diff options
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 64 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 2 |
7 files changed, 61 insertions, 18 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index a09cf8529b9f..c49812b80dd0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -1233,6 +1233,7 @@ static void vmw_master_drop(struct drm_device *dev, | |||
1233 | 1233 | ||
1234 | vmw_fp->locked_master = drm_master_get(file_priv->master); | 1234 | vmw_fp->locked_master = drm_master_get(file_priv->master); |
1235 | ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); | 1235 | ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); |
1236 | vmw_kms_legacy_hotspot_clear(dev_priv); | ||
1236 | if (unlikely((ret != 0))) { | 1237 | if (unlikely((ret != 0))) { |
1237 | DRM_ERROR("Unable to lock TTM at VT switch.\n"); | 1238 | DRM_ERROR("Unable to lock TTM at VT switch.\n"); |
1238 | drm_master_put(&vmw_fp->locked_master); | 1239 | drm_master_put(&vmw_fp->locked_master); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index a8ae9dfb83b7..469cdd520615 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -925,6 +925,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
925 | uint32_t num_clips); | 925 | uint32_t num_clips); |
926 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | 926 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
927 | struct drm_file *file_priv); | 927 | struct drm_file *file_priv); |
928 | void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv); | ||
928 | 929 | ||
929 | int vmw_dumb_create(struct drm_file *file_priv, | 930 | int vmw_dumb_create(struct drm_file *file_priv, |
930 | struct drm_device *dev, | 931 | struct drm_device *dev, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 9fcd7f82995c..9b4bb9e74d73 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -133,13 +133,19 @@ void vmw_cursor_update_position(struct vmw_private *dev_priv, | |||
133 | vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT); | 133 | vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT); |
134 | } | 134 | } |
135 | 135 | ||
136 | int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | 136 | |
137 | uint32_t handle, uint32_t width, uint32_t height) | 137 | /* |
138 | * vmw_du_crtc_cursor_set2 - Driver cursor_set2 callback. | ||
139 | */ | ||
140 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, | ||
141 | uint32_t handle, uint32_t width, uint32_t height, | ||
142 | int32_t hot_x, int32_t hot_y) | ||
138 | { | 143 | { |
139 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); | 144 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
140 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); | 145 | struct vmw_display_unit *du = vmw_crtc_to_du(crtc); |
141 | struct vmw_surface *surface = NULL; | 146 | struct vmw_surface *surface = NULL; |
142 | struct vmw_dma_buffer *dmabuf = NULL; | 147 | struct vmw_dma_buffer *dmabuf = NULL; |
148 | s32 hotspot_x, hotspot_y; | ||
143 | int ret; | 149 | int ret; |
144 | 150 | ||
145 | /* | 151 | /* |
@@ -151,6 +157,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
151 | */ | 157 | */ |
152 | drm_modeset_unlock_crtc(crtc); | 158 | drm_modeset_unlock_crtc(crtc); |
153 | drm_modeset_lock_all(dev_priv->dev); | 159 | drm_modeset_lock_all(dev_priv->dev); |
160 | hotspot_x = hot_x + du->hotspot_x; | ||
161 | hotspot_y = hot_y + du->hotspot_y; | ||
154 | 162 | ||
155 | /* A lot of the code assumes this */ | 163 | /* A lot of the code assumes this */ |
156 | if (handle && (width != 64 || height != 64)) { | 164 | if (handle && (width != 64 || height != 64)) { |
@@ -187,31 +195,34 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
187 | vmw_dmabuf_unreference(&du->cursor_dmabuf); | 195 | vmw_dmabuf_unreference(&du->cursor_dmabuf); |
188 | 196 | ||
189 | /* setup new image */ | 197 | /* setup new image */ |
198 | ret = 0; | ||
190 | if (surface) { | 199 | if (surface) { |
191 | /* vmw_user_surface_lookup takes one reference */ | 200 | /* vmw_user_surface_lookup takes one reference */ |
192 | du->cursor_surface = surface; | 201 | du->cursor_surface = surface; |
193 | 202 | ||
194 | du->cursor_surface->snooper.crtc = crtc; | 203 | du->cursor_surface->snooper.crtc = crtc; |
195 | du->cursor_age = du->cursor_surface->snooper.age; | 204 | du->cursor_age = du->cursor_surface->snooper.age; |
196 | vmw_cursor_update_image(dev_priv, surface->snooper.image, | 205 | ret = vmw_cursor_update_image(dev_priv, surface->snooper.image, |
197 | 64, 64, du->hotspot_x, du->hotspot_y); | 206 | 64, 64, hotspot_x, hotspot_y); |
198 | } else if (dmabuf) { | 207 | } else if (dmabuf) { |
199 | /* vmw_user_surface_lookup takes one reference */ | 208 | /* vmw_user_surface_lookup takes one reference */ |
200 | du->cursor_dmabuf = dmabuf; | 209 | du->cursor_dmabuf = dmabuf; |
201 | 210 | ||
202 | ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, | 211 | ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, |
203 | du->hotspot_x, du->hotspot_y); | 212 | hotspot_x, hotspot_y); |
204 | } else { | 213 | } else { |
205 | vmw_cursor_update_position(dev_priv, false, 0, 0); | 214 | vmw_cursor_update_position(dev_priv, false, 0, 0); |
206 | ret = 0; | ||
207 | goto out; | 215 | goto out; |
208 | } | 216 | } |
209 | 217 | ||
210 | vmw_cursor_update_position(dev_priv, true, | 218 | if (!ret) { |
211 | du->cursor_x + du->hotspot_x, | 219 | vmw_cursor_update_position(dev_priv, true, |
212 | du->cursor_y + du->hotspot_y); | 220 | du->cursor_x + hotspot_x, |
221 | du->cursor_y + hotspot_y); | ||
222 | du->core_hotspot_x = hot_x; | ||
223 | du->core_hotspot_y = hot_y; | ||
224 | } | ||
213 | 225 | ||
214 | ret = 0; | ||
215 | out: | 226 | out: |
216 | drm_modeset_unlock_all(dev_priv->dev); | 227 | drm_modeset_unlock_all(dev_priv->dev); |
217 | drm_modeset_lock_crtc(crtc, crtc->cursor); | 228 | drm_modeset_lock_crtc(crtc, crtc->cursor); |
@@ -239,8 +250,10 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
239 | drm_modeset_lock_all(dev_priv->dev); | 250 | drm_modeset_lock_all(dev_priv->dev); |
240 | 251 | ||
241 | vmw_cursor_update_position(dev_priv, shown, | 252 | vmw_cursor_update_position(dev_priv, shown, |
242 | du->cursor_x + du->hotspot_x, | 253 | du->cursor_x + du->hotspot_x + |
243 | du->cursor_y + du->hotspot_y); | 254 | du->core_hotspot_x, |
255 | du->cursor_y + du->hotspot_y + | ||
256 | du->core_hotspot_y); | ||
244 | 257 | ||
245 | drm_modeset_unlock_all(dev_priv->dev); | 258 | drm_modeset_unlock_all(dev_priv->dev); |
246 | drm_modeset_lock_crtc(crtc, crtc->cursor); | 259 | drm_modeset_lock_crtc(crtc, crtc->cursor); |
@@ -334,6 +347,29 @@ err_unreserve: | |||
334 | ttm_bo_unreserve(bo); | 347 | ttm_bo_unreserve(bo); |
335 | } | 348 | } |
336 | 349 | ||
350 | /** | ||
351 | * vmw_kms_legacy_hotspot_clear - Clear legacy hotspots | ||
352 | * | ||
353 | * @dev_priv: Pointer to the device private struct. | ||
354 | * | ||
355 | * Clears all legacy hotspots. | ||
356 | */ | ||
357 | void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv) | ||
358 | { | ||
359 | struct drm_device *dev = dev_priv->dev; | ||
360 | struct vmw_display_unit *du; | ||
361 | struct drm_crtc *crtc; | ||
362 | |||
363 | drm_modeset_lock_all(dev); | ||
364 | drm_for_each_crtc(crtc, dev) { | ||
365 | du = vmw_crtc_to_du(crtc); | ||
366 | |||
367 | du->hotspot_x = 0; | ||
368 | du->hotspot_y = 0; | ||
369 | } | ||
370 | drm_modeset_unlock_all(dev); | ||
371 | } | ||
372 | |||
337 | void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) | 373 | void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) |
338 | { | 374 | { |
339 | struct drm_device *dev = dev_priv->dev; | 375 | struct drm_device *dev = dev_priv->dev; |
@@ -351,7 +387,9 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) | |||
351 | du->cursor_age = du->cursor_surface->snooper.age; | 387 | du->cursor_age = du->cursor_surface->snooper.age; |
352 | vmw_cursor_update_image(dev_priv, | 388 | vmw_cursor_update_image(dev_priv, |
353 | du->cursor_surface->snooper.image, | 389 | du->cursor_surface->snooper.image, |
354 | 64, 64, du->hotspot_x, du->hotspot_y); | 390 | 64, 64, |
391 | du->hotspot_x + du->core_hotspot_x, | ||
392 | du->hotspot_y + du->core_hotspot_y); | ||
355 | } | 393 | } |
356 | 394 | ||
357 | mutex_unlock(&dev->mode_config.mutex); | 395 | mutex_unlock(&dev->mode_config.mutex); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index 782df7ca9794..edd81503516d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | |||
@@ -159,6 +159,8 @@ struct vmw_display_unit { | |||
159 | 159 | ||
160 | int hotspot_x; | 160 | int hotspot_x; |
161 | int hotspot_y; | 161 | int hotspot_y; |
162 | s32 core_hotspot_x; | ||
163 | s32 core_hotspot_y; | ||
162 | 164 | ||
163 | unsigned unit; | 165 | unsigned unit; |
164 | 166 | ||
@@ -193,8 +195,9 @@ void vmw_du_crtc_restore(struct drm_crtc *crtc); | |||
193 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, | 195 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
194 | u16 *r, u16 *g, u16 *b, | 196 | u16 *r, u16 *g, u16 *b, |
195 | uint32_t start, uint32_t size); | 197 | uint32_t start, uint32_t size); |
196 | int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | 198 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, |
197 | uint32_t handle, uint32_t width, uint32_t height); | 199 | uint32_t handle, uint32_t width, uint32_t height, |
200 | int32_t hot_x, int32_t hot_y); | ||
198 | int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); | 201 | int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); |
199 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode); | 202 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode); |
200 | void vmw_du_connector_save(struct drm_connector *connector); | 203 | void vmw_du_connector_save(struct drm_connector *connector); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index bb63e4d795fa..52caecb4502e 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -297,7 +297,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) | |||
297 | static struct drm_crtc_funcs vmw_legacy_crtc_funcs = { | 297 | static struct drm_crtc_funcs vmw_legacy_crtc_funcs = { |
298 | .save = vmw_du_crtc_save, | 298 | .save = vmw_du_crtc_save, |
299 | .restore = vmw_du_crtc_restore, | 299 | .restore = vmw_du_crtc_restore, |
300 | .cursor_set = vmw_du_crtc_cursor_set, | 300 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
301 | .cursor_move = vmw_du_crtc_cursor_move, | 301 | .cursor_move = vmw_du_crtc_cursor_move, |
302 | .gamma_set = vmw_du_crtc_gamma_set, | 302 | .gamma_set = vmw_du_crtc_gamma_set, |
303 | .destroy = vmw_ldu_crtc_destroy, | 303 | .destroy = vmw_ldu_crtc_destroy, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index b96d1ab610c5..13926ff192e3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
@@ -533,7 +533,7 @@ out_no_fence: | |||
533 | static struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { | 533 | static struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { |
534 | .save = vmw_du_crtc_save, | 534 | .save = vmw_du_crtc_save, |
535 | .restore = vmw_du_crtc_restore, | 535 | .restore = vmw_du_crtc_restore, |
536 | .cursor_set = vmw_du_crtc_cursor_set, | 536 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
537 | .cursor_move = vmw_du_crtc_cursor_move, | 537 | .cursor_move = vmw_du_crtc_cursor_move, |
538 | .gamma_set = vmw_du_crtc_gamma_set, | 538 | .gamma_set = vmw_du_crtc_gamma_set, |
539 | .destroy = vmw_sou_crtc_destroy, | 539 | .destroy = vmw_sou_crtc_destroy, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index b1fc1c02792d..f823fc3efed7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | |||
@@ -1043,7 +1043,7 @@ out_finish: | |||
1043 | static struct drm_crtc_funcs vmw_stdu_crtc_funcs = { | 1043 | static struct drm_crtc_funcs vmw_stdu_crtc_funcs = { |
1044 | .save = vmw_du_crtc_save, | 1044 | .save = vmw_du_crtc_save, |
1045 | .restore = vmw_du_crtc_restore, | 1045 | .restore = vmw_du_crtc_restore, |
1046 | .cursor_set = vmw_du_crtc_cursor_set, | 1046 | .cursor_set2 = vmw_du_crtc_cursor_set2, |
1047 | .cursor_move = vmw_du_crtc_cursor_move, | 1047 | .cursor_move = vmw_du_crtc_cursor_move, |
1048 | .gamma_set = vmw_du_crtc_gamma_set, | 1048 | .gamma_set = vmw_du_crtc_gamma_set, |
1049 | .destroy = vmw_stdu_crtc_destroy, | 1049 | .destroy = vmw_stdu_crtc_destroy, |