[PATCH xf86-video-amdgpu 1/2] Move cursor related ScreenInit calls into AMDGPUCursorInit_KMS

Michel Dänzer michel at daenzer.net
Fri Dec 22 17:39:43 UTC 2017


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

And bail if xf86_cursors_init fails.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_kms.c | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index c15711224..58531bf33 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1523,12 +1523,29 @@ static Bool AMDGPUCursorInit_KMS(ScreenPtr pScreen)
 	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 
-	return xf86_cursors_init(pScreen, info->cursor_w, info->cursor_h,
-				 (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
-				  HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
-				  HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
-				  HARDWARE_CURSOR_UPDATE_UNHIDDEN |
-				  HARDWARE_CURSOR_ARGB));
+	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
+		       "Initializing Cursor\n");
+
+	/* Set Silken Mouse */
+	xf86SetSilkenMouse(pScreen);
+
+	/* Cursor setup */
+	miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+	if (xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
+		return TRUE;
+
+	if (!xf86_cursors_init(pScreen, info->cursor_w, info->cursor_h,
+			       HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+			       HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+			       HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
+			       HARDWARE_CURSOR_UPDATE_UNHIDDEN |
+			       HARDWARE_CURSOR_ARGB)) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86_cursors_init failed\n");
+		return FALSE;
+	}
+
+	return TRUE;
 }
 
 void AMDGPUBlank(ScrnInfoPtr pScrn)
@@ -1858,19 +1875,8 @@ Bool AMDGPUScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv)
 		       "Initializing DPMS\n");
 	xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
-	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
-		       "Initializing Cursor\n");
-
-	/* Set Silken Mouse */
-	xf86SetSilkenMouse(pScreen);
-
-	/* Cursor setup */
-	miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
-
-	if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
-		if (AMDGPUCursorInit_KMS(pScreen)) {
-		}
-	}
+	if (!AMDGPUCursorInit_KMS(pScreen))
+		return FALSE;
 
 	/* DGA setup */
 #ifdef XFreeXDGA
-- 
2.15.1



More information about the amd-gfx mailing list