[PATCH xf86-video-amdgpu 2/2] Destroy all dedicated scanout buffers during CloseScreen

Michel Dänzer michel at daenzer.net
Thu Jun 23 07:51:18 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.

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 de1c34b..5bddfd0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2156,8 +2156,10 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
 void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+	int c;
 
 	if (!info->drmmode_inited)
 		return;
@@ -2168,6 +2170,14 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 		RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr) NoopDDA,
 					     drm_wakeup_handler, drmmode);
 	}
+
+	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]);
+	}
 }
 
 void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id,
-- 
2.8.1



More information about the amd-gfx mailing list