diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-03-23 18:16:42 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-03-24 18:01:03 +0900 |
commit | bde466e5d44cad64b4e4eceaa5de80fdbf86356e (patch) | |
tree | 5198a9dc490fda9e2bdd8fb517fc7547f33adc49 | |
parent | b2b079be0e7ef2704c3df9ee25fe46166e450e83 (diff) |
Fix build against older versions of xserver
Also slightly clean up the error handling in radeon_scanout_do_update.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94614
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 21 | ||||
-rw-r--r-- | src/radeon_kms.c | 22 | ||||
-rw-r--r-- | src/radeon_list.h | 1 |
3 files changed, 33 insertions, 11 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index cb0b0a0c..7ed8d6c4 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -39,6 +39,7 @@ #include "radeon.h" #include "radeon_bo_helper.h" #include "radeon_glamor.h" +#include "radeon_list.h" #include "radeon_reg.h" #ifdef RADEON_PIXMAP_SHARING @@ -361,6 +362,8 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode) crtc->x, crtc->y); } +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 + static PixmapPtr create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) @@ -424,8 +427,6 @@ destroy_pixmap_for_fbcon(ScrnInfoPtr pScrn) info->fbcon_pixmap = NULL; } -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 - void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -627,16 +628,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 RADEON_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; } @@ -770,8 +775,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], @@ -2570,7 +2578,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)); } diff --git a/src/radeon_kms.c b/src/radeon_kms.c index d6a9aa9c..38642819 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -393,6 +393,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id) force = info->accel_state->force; info->accel_state->force = TRUE; +#if XF86_CRTC_VERSION >= 4 if (xf86_crtc->driverIsPerformingTransform) { SourceValidateProcPtr SourceValidate = pScreen->SourceValidate; PictFormatPtr format = PictureWindowFormat(pScreen->root); @@ -415,14 +416,14 @@ radeon_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) @@ -443,9 +444,14 @@ radeon_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); @@ -459,7 +465,6 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id) radeon_cs_flush_indirect(scrn); - out: info->accel_state->force = force; return TRUE; @@ -607,8 +612,11 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL) for (c = 0; c < xf86_config->num_crtc; c++) { if (info->tear_free) radeon_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 + ) radeon_scanout_update(xf86_config->crtc[c]); } diff --git a/src/radeon_list.h b/src/radeon_list.h index 77f74aff..a0038c96 100644 --- a/src/radeon_list.h +++ b/src/radeon_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 |