[PATCH xserver 1/4] xfree86/modes: Assign xf86_config->cursor in xf86_load_cursor_image v2

Keith Packard keithp at keithp.com
Sun Jun 5 03:27:35 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Fixes a crash on startup in the radeon driver's drmmode_show_cursor()
due to xf86_config->cursor == NULL, because no CRTC was enabled yet, so
xf86_crtc_load_cursor_image was never called.

(Also use scrn->pScreen instead of xf86ScrnToScreen(scrn))

v2: Set xf86_config->cursor at the beginning of xf86_load_cursor_image
    instead of at the end.

Reviewed-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/modes/xf86Cursors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index b737268..351777b 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -456,7 +456,6 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
     CARD8 *cursor_image;
     const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
 
-    xf86_config->cursor = xf86CurrentCursor(xf86ScrnToScreen(scrn));
     crtc->cursor_argb = FALSE;
 
     if (rotation == RR_Rotate_0)
@@ -493,6 +492,7 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     int c;
 
+    xf86_config->cursor = xf86CurrentCursor(scrn->pScreen);
     for (c = 0; c < xf86_config->num_crtc; c++) {
         xf86CrtcPtr crtc = xf86_config->crtc[c];
 
-- 
2.8.1



More information about the xorg-devel mailing list