[PATCH xf86-video-ati 2/4] Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap

Michel Dänzer michel at daenzer.net
Tue Oct 25 08:41:26 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

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)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 00a484b..a5a34fd 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1142,22 +1142,22 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	RADEONInfoPtr info = RADEONPTR(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);
-			return TRUE;
-		}
+		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,
 					 ppix->drawable.height))
-- 
2.10.1



More information about the amd-gfx mailing list