[PATCH xf86-video-amdgpu 5/6] Fix build against older versions of xserver
Michel Dänzer
michel at daenzer.net
Thu Mar 24 10:14:29 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
Also slightly clean up the error handling in radeon_scanout_do_update.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94614
(Ported from radeon commit bde466e5d44cad64b4e4eceaa5de80fdbf86356e)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_kms.c | 22 +++++++++++++++-------
src/amdgpu_list.h | 1 +
src/drmmode_display.c | 17 +++++++++++++++--
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 51302e2..6dcec69 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -302,6 +302,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
pDraw->height))
return FALSE;
+#if XF86_CRTC_VERSION >= 4
if (xf86_crtc->driverIsPerformingTransform) {
SourceValidateProcPtr SourceValidate = pScreen->SourceValidate;
PictFormatPtr format = PictureWindowFormat(pScreen->root);
@@ -324,13 +325,13 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
if (!dst) {
ErrorF("Failed to create destination picture for transformed scanout "
"update\n");
- goto out;
+ goto free_src;
}
error = SetPictureTransform(src, &xf86_crtc->crtc_to_framebuffer);
if (error) {
ErrorF("SetPictureTransform failed for transformed scanout "
"update\n");
- goto out;
+ goto free_dst;
}
if (xf86_crtc->filter)
@@ -351,9 +352,14 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
extents.y2 - extents.y1);
pScreen->SourceValidate = SourceValidate;
- FreePicture(src, None);
+ free_dst:
FreePicture(dst, None);
- } else {
+ free_src:
+ FreePicture(src, None);
+ } else
+ out:
+#endif /* XF86_CRTC_VERSION >= 4 */
+ {
GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
ValidateGC(pDraw, gc);
@@ -367,7 +373,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
amdgpu_glamor_flush(xf86_crtc->scrn);
-out:
return TRUE;
}
@@ -517,8 +522,11 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
for (c = 0; c < xf86_config->num_crtc; c++) {
if (info->tear_free)
amdgpu_scanout_flip(pScreen, info, xf86_config->crtc[c]);
- else if (info->shadow_primary ||
- xf86_config->crtc[c]->driverIsPerformingTransform)
+ else if (info->shadow_primary
+#if XF86_CRTC_VERSION >= 4
+ || xf86_config->crtc[c]->driverIsPerformingTransform
+#endif
+ )
amdgpu_scanout_update(xf86_config->crtc[c]);
}
diff --git a/src/amdgpu_list.h b/src/amdgpu_list.h
index c1e3516..a2b1d3c 100644
--- a/src/amdgpu_list.h
+++ b/src/amdgpu_list.h
@@ -30,6 +30,7 @@
#if !HAVE_XORG_LIST
#define xorg_list list
#define xorg_list_init list_init
+#define xorg_list_is_empty list_is_empty
#define xorg_list_add list_add
#define xorg_list_del list_del
#define xorg_list_for_each_entry list_for_each_entry
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4240a43..2aea542 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -41,6 +41,7 @@
#include "drmmode_display.h"
#include "amdgpu_bo_helper.h"
#include "amdgpu_glamor.h"
+#include "amdgpu_list.h"
#include "amdgpu_pixmap.h"
#ifdef AMDGPU_PIXMAP_SHARING
@@ -579,16 +580,20 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
if (crtc->transformPresent)
return FALSE;
+#if XF86_CRTC_VERSION >= 4
/* Xorg doesn't correctly handle cursor position transform in the
* rotation case
*/
if (crtc->driverIsPerformingTransform &&
(crtc->rotation & 0xf) != RR_Rotate_0)
return FALSE;
+#endif
+#ifdef AMDGPU_PIXMAP_SHARING
/* HW cursor not supported yet with RandR 1.4 multihead */
if (!xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
return FALSE;
+#endif
return TRUE;
}
@@ -715,8 +720,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
- } else if (info->tear_free || info->shadow_primary ||
- crtc->driverIsPerformingTransform) {
+ } else if (info->tear_free ||
+#if XF86_CRTC_VERSION >= 4
+ crtc->driverIsPerformingTransform ||
+#endif
+ info->shadow_primary) {
for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
drmmode_crtc_scanout_create(crtc,
&drmmode_crtc->scanout[i],
@@ -2410,7 +2418,12 @@ restart_destroy:
}
if (changed) {
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
RRSetChanged(xf86ScrnToScreen(scrn));
+#else
+ rrScrPrivPtr rrScrPriv = rrGetScrPriv(scrn->pScreen);
+ rrScrPriv->changed = TRUE;
+#endif
RRTellChanged(xf86ScrnToScreen(scrn));
}
--
2.8.0.rc3
More information about the xorg-driver-ati
mailing list