summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-11-28 17:47:17 +0900
committerMichel Dänzer <michel.daenzer@amd.com>2016-11-28 17:47:17 +0900
commit82729b1f3b9d57f3002ac2689bfbf37ece0bc3f2 (patch)
tree52a16554c1b220b6e412d2612afd72c99c889d83
parent7fe2a8ed67ef82916a1eb5b241c5a602a26e10b2 (diff)
Add amdgpu_is_gpu_screen helper
This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future. (Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_drv.h3
-rw-r--r--src/amdgpu_kms.c14
-rw-r--r--src/drmmode_display.c6
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 ||