提交 4695b039 编写于 作者: D Dave Airlie

qxl: add a connector property to denote hotplug should rescan modes.

So GNOME userspace has an issue with when it rescans for modes on hotplug
events, if the monitor has no EDID it assumes that nothing has changed on
EDID as with real hw we'd never have new modes without a new EDID, and they
kind off rely on the behaviour now, however with virtual GPUs we would
like to rescan the modes and get a new preferred mode on hotplug events
to handle dynamic guest resizing (where you resize the host window and the
guest resizes with it).

This is a simple property we can make userspace watch for to trigger new
behaviour based on it, and can be used to replaced EDID hacks in virtual
drivers.

Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com> (on irc)
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 8f6599da
...@@ -848,8 +848,21 @@ static const struct drm_encoder_funcs qxl_enc_funcs = { ...@@ -848,8 +848,21 @@ static const struct drm_encoder_funcs qxl_enc_funcs = {
.destroy = qxl_enc_destroy, .destroy = qxl_enc_destroy,
}; };
static int qxl_mode_create_hotplug_mode_update_property(struct qxl_device *qdev)
{
if (qdev->hotplug_mode_update_property)
return 0;
qdev->hotplug_mode_update_property =
drm_property_create_range(qdev->ddev, DRM_MODE_PROP_IMMUTABLE,
"hotplug_mode_update", 0, 1);
return 0;
}
static int qdev_output_init(struct drm_device *dev, int num_output) static int qdev_output_init(struct drm_device *dev, int num_output)
{ {
struct qxl_device *qdev = dev->dev_private;
struct qxl_output *qxl_output; struct qxl_output *qxl_output;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -876,6 +889,8 @@ static int qdev_output_init(struct drm_device *dev, int num_output) ...@@ -876,6 +889,8 @@ static int qdev_output_init(struct drm_device *dev, int num_output)
drm_encoder_helper_add(encoder, &qxl_enc_helper_funcs); drm_encoder_helper_add(encoder, &qxl_enc_helper_funcs);
drm_connector_helper_add(connector, &qxl_connector_helper_funcs); drm_connector_helper_add(connector, &qxl_connector_helper_funcs);
drm_object_attach_property(&connector->base,
qdev->hotplug_mode_update_property, 0);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return 0; return 0;
} }
...@@ -988,6 +1003,9 @@ int qxl_modeset_init(struct qxl_device *qdev) ...@@ -988,6 +1003,9 @@ int qxl_modeset_init(struct qxl_device *qdev)
qdev->ddev->mode_config.max_height = 8192; qdev->ddev->mode_config.max_height = 8192;
qdev->ddev->mode_config.fb_base = qdev->vram_base; qdev->ddev->mode_config.fb_base = qdev->vram_base;
qxl_mode_create_hotplug_mode_update_property(qdev);
for (i = 0 ; i < qxl_num_crtc; ++i) { for (i = 0 ; i < qxl_num_crtc; ++i) {
qdev_crtc_init(qdev->ddev, i); qdev_crtc_init(qdev->ddev, i);
qdev_output_init(qdev->ddev, i); qdev_output_init(qdev->ddev, i);
......
...@@ -323,6 +323,8 @@ struct qxl_device { ...@@ -323,6 +323,8 @@ struct qxl_device {
struct work_struct gc_work; struct work_struct gc_work;
struct work_struct fb_work; struct work_struct fb_work;
struct drm_property *hotplug_mode_update_property;
}; };
/* forward declaration for QXL_INFO_IO */ /* forward declaration for QXL_INFO_IO */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册