[PATCH xf86-video-ati 1/4] Destroy all dedicated scanout buffers during CloseScreen

Michel Dänzer michel at daenzer.net
Wed Sep 14 08:14:44 UTC 2016


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

Fixes leaking active scanout buffers across a server reset, which also
fixes server reset with glamor and active scanout buffers.

(Ported from amdgpu commit d96dabc71b1b32dc4b422a9633cdd4e0e95da052)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 34f7735..3aae69a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2386,8 +2386,10 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 	RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
 	RADEONInfoPtr info = RADEONPTR(pScrn);
+	int c;
 
 	if (info->dri2.pKernelDRMVersion->version_minor < 4 || !info->drmmode_inited)
 		return;
@@ -2402,6 +2404,14 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 				drm_wakeup_handler, drmmode);
 #endif
 	}
+
+	for (c = 0; c < config->num_crtc; c++) {
+		xf86CrtcPtr crtc = config->crtc[c];
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+		drmmode_crtc_scanout_destroy(&info->drmmode, &drmmode_crtc->scanout[0]);
+		drmmode_crtc_scanout_destroy(&info->drmmode, &drmmode_crtc->scanout[1]);
+	}
 }
 
 
-- 
2.9.3



More information about the amd-gfx mailing list