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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2010-07-09 14:00:31 +01:00
parent 6fba8c449f
commit 6ff369cd26
3 changed files with 14 additions and 1 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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;