From 6ff369cd2602497ee11273b50f76d1a7bf25991d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 9 Jul 2010 14:00:31 +0100 Subject: drmmode: Destroy Crtc on screen shutdown Should fix: Bug 26946 - CRTC cursor BO leak in 2D https://bugs.freedesktop.org/show_bug.cgi?id=26946 Signed-off-by: Chris Wilson --- src/drmmode_display.c | 11 ++++++++++- src/intel.h | 2 ++ src/intel_driver.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 40643b0d..906cd71a 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -643,7 +643,7 @@ drmmode_crtc_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num) GTT_PAGE_SIZE); drm_intel_bo_disable_reuse(drmmode_crtc->cursor); - return; + intel->crtc = crtc; } static xf86OutputStatus @@ -1487,6 +1487,15 @@ Bool drmmode_pre_init(ScrnInfoPtr scrn, int fd, int cpp) return TRUE; } +void +drmmode_close_screen(intel_screen_private *intel) +{ + if (intel->crtc) { + xf86CrtcDestroy(intel->crtc); + intel->crtc = NULL; + } +} + int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc) { diff --git a/src/intel.h b/src/intel.h index bdd89e5f..bd24708d 100644 --- a/src/intel.h +++ b/src/intel.h @@ -278,6 +278,7 @@ typedef struct intel_screen_private { long FbMapSize; long GTTMapSize; + xf86CrtcPtr crtc; drm_intel_bo *front_buffer; dri_bufmgr *bufmgr; @@ -436,6 +437,7 @@ enum { }; extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp); +extern void drmmode_close_screen(intel_screen_private *intel); extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc); extern int drmmode_output_dpms_status(xf86OutputPtr output); extern Bool drmmode_do_pageflip(ScreenPtr screen, dri_bo *new_front, void *data); diff --git a/src/intel_driver.c b/src/intel_driver.c index a69f7c1b..2ced844f 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -1139,6 +1139,8 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen) screen->CloseScreen = intel->CloseScreen; (*screen->CloseScreen) (scrnIndex, screen); + drmmode_close_screen(intel); + if (intel->directRenderingOpen && intel->directRenderingType == DRI_DRI2) { intel->directRenderingOpen = FALSE; -- cgit v1.2.3