Use drmSetMaster() and drmDropMaster() in enter/leave VT

This allows multiple X server to use DRI and makes it possible to run
multiple X servers under KMS.  This requires a 2.6.29 kernel to work.
On older kernels it will just log a warning and DRI will fail to
initialize for the second X server.
This commit is contained in:
Kristian Høgsberg 2009-03-04 17:10:24 -05:00
parent 14bb61e0c2
commit 095a001f75
1 changed files with 16 additions and 0 deletions

View File

@ -3536,6 +3536,7 @@ I830LeaveVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
int ret;
#ifndef HAVE_FREE_SHADOW
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int o;
@ -3629,6 +3630,13 @@ I830LeaveVT(int scrnIndex, int flags)
if (pI830->AccelInfoRec)
pI830->AccelInfoRec->NeedToSync = FALSE;
#ifdef XF86DRI
ret = drmDropMaster(pI830->drmSubFD);
if (ret)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(ret));
#endif
}
/*
@ -3639,9 +3647,17 @@ I830EnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
int ret;
DPRINTF(PFX, "Enter VT\n");
#ifdef XF86DRI
ret = drmSetMaster(pI830->drmSubFD);
if (ret)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(ret));
#endif
/*
* Only save state once per server generation since that's what most
* drivers do. Could change this to save state at each VT enter.