[Spice-devel] [PATCH 2/3] qxl: fix broken cursor hotspot on KMS driver

Dave Airlie airlied at gmail.com
Thu Jul 4 21:49:23 PDT 2013


From: Dave Airlie <airlied at redhat.com>

bugzilla: http://bugzilla.redhat.com/974662

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 configure.ac      |  3 ++-
 src/qxl_drmmode.c | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8b2d450..81b7ad7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,8 @@ CFLAGS="$save_CFLAGS"
 
 # Checks for libraries.
 if test "x$QXL_DRM" = xyes; then
-	PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.42])
+	# require support for kms cursor hotspot
+	PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.46])
 
 	AC_ARG_ENABLE(kms,
 		      AS_HELP_STRING([--disable-kms],
diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
index 03b4124..5fe056c 100644
--- a/src/qxl_drmmode.c
+++ b/src/qxl_drmmode.c
@@ -43,6 +43,7 @@
 #define DPMS_SERVER
 #include <X11/extensions/dpms.h>
 #endif
+#include <cursorstr.h>
 
 #include "qxl.h"
 #include "qxl_surface.h"
@@ -271,7 +272,18 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	uint32_t handle = qxl_kms_bo_get_handle(drmmode_crtc->cursor_bo);
-
+	static Bool use_set_cursor2 = TRUE;
+
+	if (use_set_cursor2) {
+		xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+		CursorPtr cursor = xf86_config->cursor;
+		int ret;
+		ret = drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, 64, 64, cursor->bits->xhot, cursor->bits->yhot);
+		if (ret == -ENOSYS)
+			use_set_cursor2 = FALSE;
+		else
+			return;
+	}
 	drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, 64, 64);
 }
 
-- 
1.8.3.1



More information about the Spice-devel mailing list