From 0a91f11c03400e3f92a2b048505f39e7de7e87fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 26 Oct 2016 16:14:45 +0900 Subject: [PATCH] Don't rely on randr_crtc->scanout_pixmap in drmmode_set_scanout_pixmap RRReplaceScanoutPixmap may set randr_crtc->scanout_pixmap = NULL before we get here. (Inspired by xserver commit f4c37eeee7953df1fe0e3196eda452acf0078e61) v2: Always return TRUE in the if (!ppix) block. (Cherry picked from radeon commit 61df12e2377cbb19a19ca9d5624df8959822da9f) Reviewed-by: Alex Deucher --- src/drmmode_display.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index f291f6d..5f0fdb0 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1105,10 +1105,19 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn); if (!ppix) { - if (crtc->randr_crtc->scanout_pixmap) - PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, - drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap); - drmmode_crtc_scanout_free(drmmode_crtc); + ScreenPtr screen = crtc->scrn->pScreen; + PixmapDirtyUpdatePtr dirty; + + xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) { + if (dirty->slave_dst != + drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap) + continue; + + PixmapStopDirtyTracking(dirty->src, dirty->slave_dst); + drmmode_crtc_scanout_free(drmmode_crtc); + break; + } + return TRUE; }