Skip to contentSkip to conversation

Add radeon_is_gpu_screen helper

PATCH In review Michel Dänzer 2 participants 2 messages Nov 25, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add radeon_is_gpu_screen helper

From: Michel Dänzer <[email protected]>

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

---
 src/drmmode_display.c |  5 +----
 src/radeon.h          |  3 +++
 src/radeon_kms.c      | 14 +++-----------
 3 files changed, 7 insertions(+), 15 deletions(-)
src/drmmode_display.c +1 -4
index f856f67..95e3acd 100644
@@ -779,10 +779,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
 
-		} else if (
-#ifdef RADEON_PIXMAP_SHARING
-			!pScreen->isGPU &&
-#endif
+		} else if (!radeon_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
 			    crtc->driverIsPerformingTransform ||
src/radeon.h +3 -0
index ad7e69c..8ca8d31 100644
@@ -182,6 +182,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define RADEON_PIXMAP_SHARING 1
+#define radeon_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define radeon_is_gpu_screen(screen) 0
 #endif
 
 #define RADEON_VSYNC_TIMEOUT	20000 /* Maximum wait for VSYNC (in usecs) */
src/radeon_kms.c +3 -11
index d0a474e..6281fa5 100644
@@ -317,10 +317,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
     if (dixPrivateKeyRegistered(rrPrivKey)) {
 	rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-	if (
-#ifdef RADEON_PIXMAP_SHARING
-	    !pScreen->isGPU &&
-#endif
+	if (!radeon_is_gpu_screen(pScreen) &&
 	    !rrScrPriv->primaryOutput)
 	{
 	    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -360,10 +357,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
 	radeon_glamor_create_screen_resources(pScreen);
 
     info->callback_event_type = -1;
-    if (
-#ifdef RADEON_PIXMAP_SHARING
-	!pScreen->isGPU &&
-#endif
+    if (!radeon_is_gpu_screen(pScreen) &&
 	(damage_ext = CheckExtension("DAMAGE"))) {
 	info->callback_event_type = damage_ext->eventBase + XDamageNotify;
 
@@ -1099,9 +1093,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
     (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
     pScreen->BlockHandler = RADEONBlockHandler_KMS;
 
-#ifdef RADEON_PIXMAP_SHARING
-    if (!pScreen->isGPU)
-#endif
+    if (!radeon_is_gpu_screen(pScreen))
     {
 	for (c = 0; c < xf86_config->num_crtc; c++) {
 	    if (info->tear_free)
Signature · 6 lines
2.10.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161125091501.24408-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 6 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

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

Quoted 78 lines
---
 src/drmmode_display.c |  5 +----
 src/radeon.h          |  3 +++
 src/radeon_kms.c      | 14 +++-----------
 3 files changed, 7 insertions(+), 15 deletions(-)
src/drmmode_display.c +1 -4
index f856f67..95e3acd 100644
@@ -779,10 +779,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
                        fb_id = drmmode_crtc->rotate.fb_id;
                        x = y = 0;
 
-               } else if (
-#ifdef RADEON_PIXMAP_SHARING
-                       !pScreen->isGPU &&
-#endif
+               } else if (!radeon_is_gpu_screen(pScreen) &&
                           (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
                            crtc->driverIsPerformingTransform ||
src/radeon.h +3 -0
index ad7e69c..8ca8d31 100644
@@ -182,6 +182,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define RADEON_PIXMAP_SHARING 1
+#define radeon_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define radeon_is_gpu_screen(screen) 0
 #endif
 
 #define RADEON_VSYNC_TIMEOUT   20000 /* Maximum wait for VSYNC (in usecs) */
src/radeon_kms.c +3 -12
index d0a474e..6281fa5 100644
@@ -317,10 +317,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
     if (dixPrivateKeyRegistered(rrPrivKey)) {
        rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-       if (
-#ifdef RADEON_PIXMAP_SHARING
-           !pScreen->isGPU &&
-#endif
+       if (!radeon_is_gpu_screen(pScreen) &&
            !rrScrPriv->primaryOutput)
        {
            xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -360,10 +357,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
        radeon_glamor_create_screen_resources(pScreen);
 
     info->callback_event_type = -1;
-    if (
-#ifdef RADEON_PIXMAP_SHARING
-       !pScreen->isGPU &&
-#endif
+    if (!radeon_is_gpu_screen(pScreen) &&
        (damage_ext = CheckExtension("DAMAGE"))) {
        info->callback_event_type = damage_ext->eventBase + XDamageNotify;
 
@@ -1099,9 +1093,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
     (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
     pScreen->BlockHandler = RADEONBlockHandler_KMS;
 
-#ifdef RADEON_PIXMAP_SHARING
-    if (!pScreen->isGPU)
-#endif
+    if (!radeon_is_gpu_screen(pScreen))
     {
        for (c = 0; c < xf86_config->num_crtc; c++) {
            if (info->tear_free)
--

2.10.2

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx