From: Michel Dänzer <michel.daenzer@xxxxxxx> Otherwise, we may leak screen->pixmap_dirty_list entries if drmmode_set_scanout_pixmap is called repatedly with ppix != NULL, which can happen from RRReplaceScanoutPixmap. (Inspired by xserver commit b773a9c8126222e5fed2904d012fbf917a9f22fd) (Ported from radeon commit 6c940446ddadf418ee4959e46fa552b6c1cf6704) Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- src/drmmode_display.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 5f0fdb0..9dfef40 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1103,23 +1103,21 @@ static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn); + ScreenPtr screen = crtc->scrn->pScreen; + PixmapDirtyUpdatePtr dirty; - if (!ppix) { - 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; + 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; - } + PixmapStopDirtyTracking(dirty->src, dirty->slave_dst); + drmmode_crtc_scanout_free(drmmode_crtc); + break; + } + if (!ppix) return TRUE; - } if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0], ppix->drawable.width, -- 2.10.1