[Intel-gfx] [PATCH] load_cursor_argb is supposed to return a Bool, not void

Keith Packard keithp at keithp.com
Mon Apr 14 20:22:03 CEST 2014


By mis-declaring this function, we ended up using software cursors
because the value seen by the caller was 0.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/sna/sna_display.c      | 8 ++++++--
 src/sna/sna_display_fake.c | 3 ++-
 src/uxa/intel_display.c    | 7 +++++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 6e2d118..a3441e1 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1681,11 +1681,12 @@ sna_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
 	(void)drmIoctl(to_sna(crtc->scrn)->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg);
 }
 
-static void
+static Bool
 sna_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
 {
 	struct sna *sna = to_sna(crtc->scrn);
 	struct drm_i915_gem_pwrite pwrite;
+        int ret;
 
 	__DBG(("%s: CRTC:%d\n", __FUNCTION__, to_sna_crtc(crtc)->id));
 
@@ -1694,7 +1695,10 @@ sna_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
 	pwrite.offset = 0;
 	pwrite.size = sna->mode.cursor_width*sna->mode.cursor_height*4;
 	pwrite.data_ptr = (uintptr_t)image;
-	(void)drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
+	ret = drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
+        if (ret != 0)
+                return FALSE;
+        return TRUE;
 }
 
 static void
diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c
index c709d99..3cf0042 100644
--- a/src/sna/sna_display_fake.c
+++ b/src/sna/sna_display_fake.c
@@ -115,9 +115,10 @@ sna_crtc_show_cursor(xf86CrtcPtr crtc)
 {
 }
 
-static void
+static Bool
 sna_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
 {
+        return TRUE;
 }
 
 static void
diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index 0f06793..f755cb6 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -432,16 +432,19 @@ intel_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 	drmModeMoveCursor(mode->fd, crtc_id(intel_crtc), x, y);
 }
 
-static void
+static Bool
 intel_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
 {
 	struct intel_crtc *intel_crtc = crtc->driver_private;
 	int ret;
 
 	ret = dri_bo_subdata(intel_crtc->cursor, 0, 64*64*4, image);
-	if (ret)
+	if (ret) {
 		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
 			   "failed to set cursor: %s\n", strerror(-ret));
+                return FALSE;
+        }
+        return TRUE;
 }
 
 static void
-- 
1.9.1




More information about the Intel-gfx mailing list