All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm: Avoid calling the cursor_set2 callback from the drm_mode_cursor ioctl
@ 2015-11-26 18:52 Thomas Hellstrom
  2015-11-26 18:52 ` [PATCH 2/2] drm/vmwgfx: Implement the cursor_set2 callback Thomas Hellstrom
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Thomas Hellstrom @ 2015-11-26 18:52 UTC (permalink / raw)
  To: dri-devel; +Cc: airlied, Thomas Hellstrom

If the drm_mode_cursor_ioctl is called and the cursor_set2 callback is
implemented, the cursor hotspot is set to (0,0) which is incompatible
with vmwgfx where the hotspot should instead remain unchanged.

So if the driver implements both cursor_set2 and cursor_set, prefer calling
the latter from the drm_mode_cursor ioctl.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/drm_crtc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 24c5434..93f80a5 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2874,7 +2874,8 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 
 static int drm_mode_cursor_common(struct drm_device *dev,
 				  struct drm_mode_cursor2 *req,
-				  struct drm_file *file_priv)
+				  struct drm_file *file_priv,
+				  bool from_2)
 {
 	struct drm_crtc *crtc;
 	int ret = 0;
@@ -2907,7 +2908,8 @@ static int drm_mode_cursor_common(struct drm_device *dev,
 			goto out;
 		}
 		/* Turns off the cursor if handle is 0 */
-		if (crtc->funcs->cursor_set2)
+		if (crtc->funcs->cursor_set2 &&
+		    (from_2 || !crtc->funcs->cursor_set))
 			ret = crtc->funcs->cursor_set2(crtc, file_priv, req->handle,
 						      req->width, req->height, req->hot_x, req->hot_y);
 		else
@@ -2953,7 +2955,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
 	memcpy(&new_req, req, sizeof(struct drm_mode_cursor));
 	new_req.hot_x = new_req.hot_y = 0;
 
-	return drm_mode_cursor_common(dev, &new_req, file_priv);
+	return drm_mode_cursor_common(dev, &new_req, file_priv, false);
 }
 
 /**
@@ -2976,7 +2978,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
 {
 	struct drm_mode_cursor2 *req = data;
 
-	return drm_mode_cursor_common(dev, req, file_priv);
+	return drm_mode_cursor_common(dev, req, file_priv, true);
 }
 
 /**
-- 
2.4.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-11-30 19:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26 18:52 [PATCH 1/2] drm: Avoid calling the cursor_set2 callback from the drm_mode_cursor ioctl Thomas Hellstrom
2015-11-26 18:52 ` [PATCH 2/2] drm/vmwgfx: Implement the cursor_set2 callback Thomas Hellstrom
2015-11-27 10:11 ` [PATCH 1/2] drm: Avoid calling the cursor_set2 callback from the drm_mode_cursor ioctl Daniel Vetter
2015-11-27 11:42   ` Thomas Hellstrom
2015-11-27 12:02     ` Ville Syrjälä
2015-11-27 12:24       ` Thomas Hellstrom
2015-11-29  9:18         ` Daniel Vetter
2015-11-30 13:35           ` Thomas Hellstrom
2015-11-30 14:55             ` Daniel Vetter
2015-11-30 15:52               ` Thomas Hellstrom
2015-11-30 16:12                 ` Daniel Vetter
2015-11-30 19:50 ` Sinclair Yeh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.