summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-03-24 18:59:05 +0900
committerMichel Dänzer <michel@daenzer.net>2016-03-25 10:38:26 +0900
commit912db5fbbc6b9b1121c8a03168cb4bd870474376 (patch)
tree9f12ef456e38f5f65d5c7fea12b259ca80cf5b8b /src
parent3fb6280ab3b104b02841c7cab8ed68c1d463c834 (diff)
Fix build against older versions of xserver
Also slightly clean up the error handling in amdgpu_scanout_do_update. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94614 (Ported from radeon commit bde466e5d44cad64b4e4eceaa5de80fdbf86356e) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/amdgpu_kms.c22
-rw-r--r--src/amdgpu_list.h1
-rw-r--r--src/drmmode_display.c17
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));
}