public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: support hotspot for universal plane cursors
@ 2015-11-17 12:10 John Keeping
  2015-11-17 13:13 ` kbuild test robot
  2015-11-17 15:05 ` [PATCH v2] " John Keeping
  0 siblings, 2 replies; 19+ messages in thread
From: John Keeping @ 2015-11-17 12:10 UTC (permalink / raw)
  To: David Airlie; +Cc: dri-devel, linux-kernel, John Keeping

The request's hot_x and hot_y are set correctly for both
DRM_IOCTL_MODE_CURSOR and DRM_IOCTL_MODE_CURSOR2 so we just need to save
the values and then apply the offset to the cursor plane when the cursor
moves.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/gpu/drm/drm_crtc.c | 11 +++++++----
 include/drm/drm_crtc.h     |  4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 720a153..40f5b84 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2831,6 +2831,9 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 				DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
 				return PTR_ERR(fb);
 			}
+
+			crtc->hot_x = req->hot_x;
+			crtc->hot_y = req->hot_y;
 		} else {
 			fb = NULL;
 		}
@@ -2841,11 +2844,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
 	}
 
 	if (req->flags & DRM_MODE_CURSOR_MOVE) {
-		crtc_x = req->x;
-		crtc_y = req->y;
+		crtc_x = req->x - crtc->hot_x;
+		crtc_y = req->y - crtc->hot_y;
 	} else {
-		crtc_x = crtc->cursor_x;
-		crtc_y = crtc->cursor_y;
+		crtc_x = crtc->cursor_x - crtc->hot_x;
+		crtc_y = crtc->cursor_y - crtc->hot_y;
 	}
 
 	if (fb) {
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3f0c690..1420145 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -445,6 +445,10 @@ struct drm_crtc {
 	int cursor_x;
 	int cursor_y;
 
+	/* hotspot of cursor */
+	int hot_x;
+	int hot_y;
+
 	bool enabled;
 
 	/* Requested mode from modesetting. */
-- 
2.6.2.400.gcb098da


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

end of thread, other threads:[~2015-11-18 11:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 12:10 [PATCH] drm: support hotspot for universal plane cursors John Keeping
2015-11-17 13:13 ` kbuild test robot
2015-11-17 15:05 ` [PATCH v2] " John Keeping
2015-11-17 15:39   ` Ville Syrjälä
2015-11-17 15:59     ` John Keeping
2015-11-17 16:09       ` Ville Syrjälä
2015-11-17 16:29       ` Daniel Vetter
2015-11-17 16:58         ` John Keeping
2015-11-17 18:40           ` Daniel Vetter
2015-11-17 19:11             ` Alex Deucher
2015-11-17 17:07         ` Alex Deucher
2015-11-17 18:31           ` Daniel Vetter
2015-11-17 18:47             ` John Keeping
2015-11-17 19:11               ` Daniel Vetter
2015-11-18 10:12                 ` John Keeping
2015-11-18 11:08                   ` Daniel Vetter
2015-11-18  8:39         ` Michel Dänzer
2015-11-18  8:51           ` Daniel Vetter
2015-11-18  8:59             ` Michel Dänzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox