diff options
author | Dave Airlie <airlied@redhat.com> | 2013-07-01 00:14:38 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-07-04 20:43:19 -0400 |
commit | 5b8788c1740fae8416e7e045301d99676d20bd64 (patch) | |
tree | ec8a2ece2837643b5abe5646ffd4f7fa51ac4acf | |
parent | 69163ea82732894e8c1e17df4010372ed078efdd (diff) |
drm/qxl: make dynamic resizing work properly.
qxl has a feature to allow the userspace driver do arbitrary resizes
when the viewer resizes, this fixes it by removing unnecessary code
from the kernel side.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_display.c | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 686a937675cb..df5ca7e72e67 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c | |||
@@ -30,55 +30,6 @@ | |||
30 | #include "qxl_object.h" | 30 | #include "qxl_object.h" |
31 | #include "drm_crtc_helper.h" | 31 | #include "drm_crtc_helper.h" |
32 | 32 | ||
33 | static void qxl_crtc_set_to_mode(struct qxl_device *qdev, | ||
34 | struct drm_connector *connector, | ||
35 | struct qxl_head *head) | ||
36 | { | ||
37 | struct drm_device *dev = connector->dev; | ||
38 | struct drm_display_mode *mode, *t; | ||
39 | int width = head->width; | ||
40 | int height = head->height; | ||
41 | |||
42 | if (width < 320 || height < 240) { | ||
43 | qxl_io_log(qdev, "%s: bad head: %dx%d", width, height); | ||
44 | width = 1024; | ||
45 | height = 768; | ||
46 | } | ||
47 | if (width * height * 4 > 16*1024*1024) { | ||
48 | width = 1024; | ||
49 | height = 768; | ||
50 | } | ||
51 | /* TODO: go over regular modes and removed preferred? */ | ||
52 | list_for_each_entry_safe(mode, t, &connector->probed_modes, head) | ||
53 | drm_mode_remove(connector, mode); | ||
54 | mode = drm_cvt_mode(dev, width, height, 60, false, false, false); | ||
55 | mode->type |= DRM_MODE_TYPE_PREFERRED; | ||
56 | mode->status = MODE_OK; | ||
57 | drm_mode_probed_add(connector, mode); | ||
58 | qxl_io_log(qdev, "%s: %d x %d\n", __func__, width, height); | ||
59 | } | ||
60 | |||
61 | void qxl_crtc_set_from_monitors_config(struct qxl_device *qdev) | ||
62 | { | ||
63 | struct drm_connector *connector; | ||
64 | int i; | ||
65 | struct drm_device *dev = qdev->ddev; | ||
66 | |||
67 | i = 0; | ||
68 | qxl_io_log(qdev, "%s: %d, %d\n", __func__, | ||
69 | dev->mode_config.num_connector, | ||
70 | qdev->monitors_config->count); | ||
71 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
72 | if (i > qdev->monitors_config->count) { | ||
73 | /* crtc will be reported as disabled */ | ||
74 | continue; | ||
75 | } | ||
76 | qxl_crtc_set_to_mode(qdev, connector, | ||
77 | &qdev->monitors_config->heads[i]); | ||
78 | ++i; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count) | 33 | void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count) |
83 | { | 34 | { |
84 | if (qdev->client_monitors_config && | 35 | if (qdev->client_monitors_config && |
@@ -117,8 +68,8 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | |||
117 | return 1; | 68 | return 1; |
118 | } | 69 | } |
119 | if (num_monitors > qdev->monitors_config->max_allowed) { | 70 | if (num_monitors > qdev->monitors_config->max_allowed) { |
120 | DRM_INFO("client monitors list will be truncated: %d < %d\n", | 71 | DRM_DEBUG_KMS("client monitors list will be truncated: %d < %d\n", |
121 | qdev->monitors_config->max_allowed, num_monitors); | 72 | qdev->monitors_config->max_allowed, num_monitors); |
122 | num_monitors = qdev->monitors_config->max_allowed; | 73 | num_monitors = qdev->monitors_config->max_allowed; |
123 | } else { | 74 | } else { |
124 | num_monitors = qdev->rom->client_monitors_config.count; | 75 | num_monitors = qdev->rom->client_monitors_config.count; |
@@ -142,7 +93,7 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev) | |||
142 | client_head->surface_id = head->surface_id = 0; | 93 | client_head->surface_id = head->surface_id = 0; |
143 | client_head->id = head->id = i; | 94 | client_head->id = head->id = i; |
144 | client_head->flags = head->flags = 0; | 95 | client_head->flags = head->flags = 0; |
145 | QXL_DEBUG(qdev, "read %dx%d+%d+%d\n", head->width, head->height, | 96 | DRM_DEBUG_KMS("read %dx%d+%d+%d\n", head->width, head->height, |
146 | head->x, head->y); | 97 | head->x, head->y); |
147 | } | 98 | } |
148 | return 0; | 99 | return 0; |
@@ -155,9 +106,6 @@ void qxl_display_read_client_monitors_config(struct qxl_device *qdev) | |||
155 | qxl_io_log(qdev, "failed crc check for client_monitors_config," | 106 | qxl_io_log(qdev, "failed crc check for client_monitors_config," |
156 | " retrying\n"); | 107 | " retrying\n"); |
157 | } | 108 | } |
158 | qxl_crtc_set_from_monitors_config(qdev); | ||
159 | /* fire off a uevent and let userspace tell us what to do */ | ||
160 | qxl_io_log(qdev, "calling drm_sysfs_hotplug_event\n"); | ||
161 | drm_sysfs_hotplug_event(qdev->ddev); | 109 | drm_sysfs_hotplug_event(qdev->ddev); |
162 | } | 110 | } |
163 | 111 | ||