drm/vmwgfx: Add connector properties to switch between explicit and implicit placement
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 12 Feb 2016 08:55:45 +0000 (09:55 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Mon, 14 Mar 2016 13:58:58 +0000 (14:58 +0100)
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

index 13970fe6bb8690302ca7ef1548744d2493941708..98cf4ff455cae143c1401a69ba28d78ab69ffb50 100644 (file)
@@ -409,6 +409,7 @@ struct vmw_private {
        struct vmw_legacy_display *ldu_priv;
        struct vmw_overlay *overlay_priv;
        struct drm_property *hotplug_mode_update_property;
+       struct drm_property *implicit_placement_property;
        unsigned num_implicit;
        struct vmw_framebuffer *implicit_fb;
 
index 6726294dfccb96683cc408debaf302184bdf5831..0e2340fbed1768e4c16acc7bacc203e5a5f9b277 100644 (file)
@@ -1622,6 +1622,12 @@ int vmw_du_connector_set_property(struct drm_connector *connector,
                                  struct drm_property *property,
                                  uint64_t val)
 {
+       struct vmw_display_unit *du = vmw_connector_to_du(connector);
+       struct vmw_private *dev_priv = vmw_priv(connector->dev);
+
+       if (property == dev_priv->implicit_placement_property)
+               du->is_implicit = val;
+
        return 0;
 }
 
@@ -2219,3 +2225,27 @@ void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv,
 
        dev_priv->implicit_fb = vfb;
 }
+
+/**
+ * vmw_kms_create_implicit_placement_proparty - Set up the implicit placement
+ * property.
+ *
+ * @dev_priv: Pointer to a device private struct.
+ * @immutable: Whether the property is immutable.
+ *
+ * Sets up the implicit placement property unless it's already set up.
+ */
+void
+vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv,
+                                          bool immutable)
+{
+       if (dev_priv->implicit_placement_property)
+               return;
+
+       dev_priv->implicit_placement_property =
+               drm_property_create_range(dev_priv->dev,
+                                         immutable ?
+                                         DRM_MODE_PROP_IMMUTABLE : 0,
+                                         "implicit_placement", 0, 1);
+
+}
index 0b5c9ab4a2f8bb513c8f670aa7c40d5d970c8c14..aa21aff9870dca0a8b876cbe62074fdd41a5784e 100644 (file)
@@ -264,7 +264,8 @@ bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv,
                            struct drm_crtc *crtc);
 void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv,
                                struct drm_crtc *crtc);
-
+void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv,
+                                               bool immutable);
 
 
 /*
index 8fb17b8f6a8c41ac564d9f2d4f8aa9183f847765..13b104709912ed92f2c637d5bbb27e4cfcb29b9d 100644 (file)
@@ -383,6 +383,11 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
                                   dev->mode_config.suggested_x_property, 0);
        drm_object_attach_property(&connector->base,
                                   dev->mode_config.suggested_y_property, 0);
+       if (dev_priv->implicit_placement_property)
+               drm_object_attach_property
+                       (&connector->base,
+                        dev_priv->implicit_placement_property,
+                        1);
 
        return 0;
 }
@@ -418,6 +423,8 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv)
        if (ret != 0)
                goto err_vblank_cleanup;
 
+       vmw_kms_create_implicit_placement_property(dev_priv, true);
+
        if (dev_priv->capabilities & SVGA_CAP_MULTIMON)
                for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i)
                        vmw_ldu_init(dev_priv, i);
index 1390cfface25f6486e9dc6603918be57177df3f1..7ca13ec1291e8465633415bd435f3284c0bb7acf 100644 (file)
@@ -541,6 +541,11 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
                                   dev->mode_config.suggested_x_property, 0);
        drm_object_attach_property(&connector->base,
                                   dev->mode_config.suggested_y_property, 0);
+       if (dev_priv->implicit_placement_property)
+               drm_object_attach_property
+                       (&connector->base,
+                        dev_priv->implicit_placement_property,
+                        sou->base.is_implicit);
 
        return 0;
 }
@@ -568,6 +573,8 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
        if (unlikely(ret != 0))
                goto err_vblank_cleanup;
 
+       vmw_kms_create_implicit_placement_property(dev_priv, false);
+
        for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i)
                vmw_sou_init(dev_priv, i);
 
index f02bb702c2826ef77ca84a8ad3c42f2bf534aebb..1cd88d197840732eb6ec963b70723b722de9b066 100644 (file)
@@ -1134,7 +1134,11 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
                                   dev->mode_config.suggested_x_property, 0);
        drm_object_attach_property(&connector->base,
                                   dev->mode_config.suggested_y_property, 0);
-
+       if (dev_priv->implicit_placement_property)
+               drm_object_attach_property
+                       (&connector->base,
+                        dev_priv->implicit_placement_property,
+                        stdu->base.is_implicit);
        return 0;
 }
 
@@ -1199,6 +1203,8 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
 
        dev_priv->active_display_unit = vmw_du_screen_target;
 
+       vmw_kms_create_implicit_placement_property(dev_priv, false);
+
        for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) {
                ret = vmw_stdu_init(dev_priv, i);