sna: Drop master after discarding framebuffers

As Imre Deak pointed out in the previous patch, drmModeRmFB only works
when we hold the DRM master, therefore to prevent a leak of the
framebuffer across server reset we need to defer dropping master until
after we release our scanouts and modes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-09-05 11:05:28 +01:00
parent 46981d0170
commit dff25e5ec4
1 changed files with 5 additions and 9 deletions

View File

@ -701,15 +701,12 @@ static void sna_leave_vt(VT_FUNC_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
struct sna *sna = to_sna(scrn);
int ret;
DBG(("%s\n", __FUNCTION__));
xf86RotateFreeShadow(scrn);
xf86_hide_cursors(scrn);
ret = drmDropMaster(sna->kgem.fd);
if (ret)
if (drmDropMaster(sna->kgem.fd))
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(errno));
}
@ -739,16 +736,14 @@ static Bool sna_early_close_screen(CLOSE_SCREEN_ARGS_DECL)
if (sna_mode_has_pending_events(sna))
sna_mode_wakeup(sna);
if (scrn->vtSema == TRUE) {
sna_leave_vt(VT_FUNC_ARGS(0));
scrn->vtSema = FALSE;
}
if (sna->dri_open) {
sna_dri_close(sna, screen);
sna->dri_open = false;
}
xf86_hide_cursors(scrn);
scrn->vtSema = FALSE;
xf86_cursors_fini(screen);
return TRUE;
@ -769,6 +764,7 @@ static Bool sna_late_close_screen(CLOSE_SCREEN_ARGS_DECL)
}
sna_accel_close(sna);
drmDropMaster(sna->kgem.fd);
depths = screen->allowedDepths;
for (d = 0; d < screen->numDepths; d++)