[PATCH xf86-video-amdgpu] Add radeon_is_gpu_screen helper

Michel Dänzer michel at daenzer.net
Mon Nov 28 08:51:39 UTC 2016


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

This will hopefully decrease the chance of accidentally breaking the
build against xserver < 1.13 in the future.

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_drv.h      |  3 +++
 src/amdgpu_kms.c      | 14 +++-----------
 src/drmmode_display.c |  6 ++----
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index ebfca8c..4eb4cf4 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -149,6 +149,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define AMDGPU_PIXMAP_SHARING 1
+#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define amdgpu_is_gpu_screen(screen) 0
 #endif
 
 #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC (in usecs) */
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 18d2abb..bc48ca6 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -237,10 +237,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (dixPrivateKeyRegistered(rrPrivKey)) {
 		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-		if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		    !pScreen->isGPU &&
-#endif
+		if (!amdgpu_is_gpu_screen(pScreen) &&
 		    !rrScrPriv->primaryOutput)
 		{
 			xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -277,10 +274,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		amdgpu_glamor_create_screen_resources(pScreen);
 
 	info->callback_event_type = -1;
-	if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		!pScreen->isGPU &&
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen) &&
 		(damage_ext = CheckExtension("DAMAGE"))) {
 		info->callback_event_type = damage_ext->eventBase + XDamageNotify;
 
@@ -1001,9 +995,7 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
 	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	if (!pScreen->isGPU)
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen))
 	{
 		for (c = 0; c < xf86_config->num_crtc; c++) {
 			if (info->tear_free)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8cedc5f..30a0f54 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -721,10 +721,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-		} else if (
-#ifdef AMDGPU_PIXMAP_SHARING
-			   !pScreen->isGPU &&
-#endif
+
+		} else if (!amdgpu_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
 			    crtc->driverIsPerformingTransform ||
-- 
2.10.2



More information about the amd-gfx mailing list