aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c13
3 files changed, 24 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 58fa69e5ff4c..4af6a3d5c9a1 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2039,34 +2039,32 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
2039 obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); 2039 obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC);
2040 if (!obj) { 2040 if (!obj) {
2041 DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id); 2041 DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
2042 ret = -EINVAL; 2042 return -EINVAL;
2043 goto out;
2044 } 2043 }
2045 crtc = obj_to_crtc(obj); 2044 crtc = obj_to_crtc(obj);
2046 2045
2046 mutex_lock(&crtc->mutex);
2047 if (req->flags & DRM_MODE_CURSOR_BO) { 2047 if (req->flags & DRM_MODE_CURSOR_BO) {
2048 if (!crtc->funcs->cursor_set) { 2048 if (!crtc->funcs->cursor_set) {
2049 ret = -ENXIO; 2049 ret = -ENXIO;
2050 goto out; 2050 goto out;
2051 } 2051 }
2052 /* Turns off the cursor if handle is 0 */ 2052 /* Turns off the cursor if handle is 0 */
2053 mutex_lock(&crtc->mutex);
2054 ret = crtc->funcs->cursor_set(crtc, file_priv, req->handle, 2053 ret = crtc->funcs->cursor_set(crtc, file_priv, req->handle,
2055 req->width, req->height); 2054 req->width, req->height);
2056 mutex_unlock(&crtc->mutex);
2057 } 2055 }
2058 2056
2059 if (req->flags & DRM_MODE_CURSOR_MOVE) { 2057 if (req->flags & DRM_MODE_CURSOR_MOVE) {
2060 if (crtc->funcs->cursor_move) { 2058 if (crtc->funcs->cursor_move) {
2061 drm_modeset_lock_all(dev);
2062 ret = crtc->funcs->cursor_move(crtc, req->x, req->y); 2059 ret = crtc->funcs->cursor_move(crtc, req->x, req->y);
2063 drm_modeset_unlock_all(dev);
2064 } else { 2060 } else {
2065 ret = -EFAULT; 2061 ret = -EFAULT;
2066 goto out; 2062 goto out;
2067 } 2063 }
2068 } 2064 }
2069out: 2065out:
2066 mutex_unlock(&crtc->mutex);
2067
2070 return ret; 2068 return ret;
2071} 2069}
2072 2070
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index ad6df625e8b8..c1680e6d76ad 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -245,8 +245,14 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
245 int i = 0; 245 int i = 0;
246 struct drm_crtc *crtc_p; 246 struct drm_crtc *crtc_p;
247 247
248 /* avivo cursor image can't end on 128 pixel boundary or 248 /*
249 * avivo cursor image can't end on 128 pixel boundary or
249 * go past the end of the frame if both crtcs are enabled 250 * go past the end of the frame if both crtcs are enabled
251 *
252 * NOTE: It is safe to access crtc->enabled of other crtcs
253 * without holding either the mode_config lock or the other
254 * crtc's lock as long as write access to this flag _always_
255 * grabs all locks.
250 */ 256 */
251 list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) { 257 list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) {
252 if (crtc_p->enabled) 258 if (crtc_p->enabled)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 8d82e631c305..3e3c7ab33ca2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -264,10 +264,23 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
264 du->cursor_x = x + crtc->x; 264 du->cursor_x = x + crtc->x;
265 du->cursor_y = y + crtc->y; 265 du->cursor_y = y + crtc->y;
266 266
267 /*
268 * FIXME: Unclear whether there's any global state touched by the
269 * cursor_set function, especially vmw_cursor_update_position looks
270 * suspicious. For now take the easy route and reacquire all locks. We
271 * can do this since the caller in the drm core doesn't check anything
272 * which is protected by any looks.
273 */
274 mutex_unlock(&crtc->mutex);
275 drm_modeset_lock_all(dev_priv->dev);
276
267 vmw_cursor_update_position(dev_priv, shown, 277 vmw_cursor_update_position(dev_priv, shown,
268 du->cursor_x + du->hotspot_x, 278 du->cursor_x + du->hotspot_x,
269 du->cursor_y + du->hotspot_y); 279 du->cursor_y + du->hotspot_y);
270 280
281 drm_modeset_unlock_all(dev_priv->dev);
282 mutex_lock(&crtc->mutex);
283
271 return 0; 284 return 0;
272} 285}
273 286