Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap

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)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2016-10-26 16:15:42 +09:00
committed by Michel Dänzer
parent 0a91f11c03
commit 9c4416422f

View File

@@ -1103,24 +1103,22 @@ 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;
}
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))