drm/vmwgfx: Add suggested screen x and y connector properties
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 12 Feb 2016 08:45:42 +0000 (09:45 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Mon, 14 Mar 2016 13:58:46 +0000 (14:58 +0100)
Introduced by qxl, add these properties as a generic way to tell a
display manager about the GUI layout.

Also add the hotplug_mode_update_property which advises display managers to
reread the mode list on a hotplug event.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

index b92521d..13970fe 100644 (file)
@@ -408,6 +408,7 @@ struct vmw_private {
        enum vmw_display_unit_type active_display_unit;
        struct vmw_legacy_display *ldu_priv;
        struct vmw_overlay *overlay_priv;
+       struct drm_property *hotplug_mode_update_property;
        unsigned num_implicit;
        struct vmw_framebuffer *implicit_fb;
 
index 26c2e9e..6726294 100644 (file)
@@ -1108,6 +1108,22 @@ int vmw_kms_present(struct vmw_private *dev_priv,
        return 0;
 }
 
+static void
+vmw_kms_create_hotplug_mode_update_property(struct vmw_private *dev_priv)
+{
+       if (dev_priv->hotplug_mode_update_property)
+               return;
+
+       dev_priv->hotplug_mode_update_property =
+               drm_property_create_range(dev_priv->dev,
+                                         DRM_MODE_PROP_IMMUTABLE,
+                                         "hotplug_mode_update", 0, 1);
+
+       if (!dev_priv->hotplug_mode_update_property)
+               return;
+
+}
+
 int vmw_kms_init(struct vmw_private *dev_priv)
 {
        struct drm_device *dev = dev_priv->dev;
@@ -1120,6 +1136,9 @@ int vmw_kms_init(struct vmw_private *dev_priv)
        dev->mode_config.max_width = dev_priv->texture_max_width;
        dev->mode_config.max_height = dev_priv->texture_max_height;
 
+       drm_mode_create_suggested_offset_properties(dev);
+       vmw_kms_create_hotplug_mode_update_property(dev_priv);
+
        ret = vmw_kms_stdu_init_display(dev_priv);
        if (ret) {
                ret = vmw_kms_sou_init_display(dev_priv);
@@ -1359,15 +1378,28 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
                        du->pref_active = true;
                        du->gui_x = rects[du->unit].x;
                        du->gui_y = rects[du->unit].y;
+                       drm_object_property_set_value
+                         (&con->base, dev->mode_config.suggested_x_property,
+                          du->gui_x);
+                       drm_object_property_set_value
+                         (&con->base, dev->mode_config.suggested_y_property,
+                          du->gui_y);
                } else {
                        du->pref_width = 800;
                        du->pref_height = 600;
                        du->pref_active = false;
+                       drm_object_property_set_value
+                         (&con->base, dev->mode_config.suggested_x_property,
+                          0);
+                       drm_object_property_set_value
+                         (&con->base, dev->mode_config.suggested_y_property,
+                          0);
                }
                con->status = vmw_du_connector_detect(con, true);
        }
 
        mutex_unlock(&dev->mode_config.mutex);
+       drm_sysfs_hotplug_event(dev);
 
        return 0;
 }
index b6fa44f..8fb17b8 100644 (file)
@@ -375,8 +375,14 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
        drm_mode_crtc_set_gamma_size(crtc, 256);
 
        drm_object_attach_property(&connector->base,
-                                     dev->mode_config.dirty_info_property,
-                                     1);
+                                  dev->mode_config.dirty_info_property,
+                                  1);
+       drm_object_attach_property(&connector->base,
+                                  dev_priv->hotplug_mode_update_property, 1);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_x_property, 0);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_y_property, 0);
 
        return 0;
 }
index c11b196..1390cff 100644 (file)
@@ -533,8 +533,14 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
        drm_mode_crtc_set_gamma_size(crtc, 256);
 
        drm_object_attach_property(&connector->base,
-                                     dev->mode_config.dirty_info_property,
-                                     1);
+                                  dev->mode_config.dirty_info_property,
+                                  1);
+       drm_object_attach_property(&connector->base,
+                                  dev_priv->hotplug_mode_update_property, 1);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_x_property, 0);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_y_property, 0);
 
        return 0;
 }
index a5ab826..f02bb70 100644 (file)
@@ -1128,6 +1128,12 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit)
        drm_object_attach_property(&connector->base,
                                   dev->mode_config.dirty_info_property,
                                   1);
+       drm_object_attach_property(&connector->base,
+                                  dev_priv->hotplug_mode_update_property, 1);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_x_property, 0);
+       drm_object_attach_property(&connector->base,
+                                  dev->mode_config.suggested_y_property, 0);
 
        return 0;
 }