summaryrefslogtreecommitdiff
path: root/src/i810_dri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i810_dri.c')
-rw-r--r--src/i810_dri.c364
1 files changed, 325 insertions, 39 deletions
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 11ecacf0..d1dc11b4 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.33 2002/12/10 01:27:04 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.42 2003/09/28 20:15:58 alanh Exp $ */
/*
* Reformatted with GNU indent (2.2.8), using the following options:
*
@@ -21,6 +21,8 @@
#include "xf86Pci.h"
#include "windowstr.h"
+#include "shadow.h"
+#include "shadowfb.h"
#include "GL/glxtokens.h"
@@ -45,6 +47,18 @@ static void I810DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
static void I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
+
+static Bool I810DRIOpenFullScreen(ScreenPtr pScreen);
+static Bool I810DRICloseFullScreen(ScreenPtr pScreen);
+static void I810EnablePageFlip(ScreenPtr pScreen);
+static void I810DisablePageFlip(ScreenPtr pScreen);
+static void I810DRITransitionSingleToMulti3d(ScreenPtr pScreen);
+static void I810DRITransitionMultiToSingle3d(ScreenPtr pScreen);
+static void I810DRITransitionTo3d(ScreenPtr pScreen);
+static void I810DRITransitionTo2d(ScreenPtr pScreen);
+
+static void I810DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+
extern void GlxSetVisualConfigs(int nconfigs,
__GLXvisualConfig * configs,
void **configprivs);
@@ -65,6 +79,8 @@ static int i810_pitch_flags[] = {
0
};
+static unsigned int i810_drm_version = 0;
+
Bool
I810CleanupDma(ScrnInfoPtr pScrn)
{
@@ -94,8 +110,6 @@ I810InitDma(ScrnInfoPtr pScrn)
memset(&info, 0, sizeof(drmI810Init));
- info.func = I810_INIT_DMA;
-
info.ring_start = ring->mem.Start;
info.ring_end = ring->mem.End;
info.ring_size = ring->mem.Size;
@@ -113,6 +127,28 @@ I810InitDma(ScrnInfoPtr pScrn)
info.pitch = pI810->auxPitch;
info.pitch_bits = pI810->auxPitchBits;
+ /* We require DRM v1.2 or greater. Since DRM v1.2 broke compatibility
+ * we created a new v1.4 that supports a new init function. Eventually the
+ * old init function will go away. If you change the drm interface, make a
+ * new init type too so that we can detect the new client.
+ */
+ switch(i810_drm_version) {
+ case ((1<<16) | 0):
+ case ((1<<16) | 1):
+ case ((1<<16) | 2):
+ case ((1<<16) | 3):
+ /* Use OLD drm < 1.4 init */
+ info.func = I810_INIT_DMA;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Init PRE v1.4 interface.\n");
+ break;
+ default:
+ case ((1<<16) | 4):
+ /* DRM version 1.3 or greater init */
+ info.func = I810_INIT_DMA_1_4;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Init v1.4 interface.\n");
+ break;
+ }
+
if (drmCommandWrite(pI810->drmSubFD, DRM_I810_INIT,
&info, sizeof(drmI810Init))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -188,7 +224,7 @@ I810InitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].accumRedSize = 16;
pConfigs[i].accumGreenSize = 16;
pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 16;
+ pConfigs[i].accumAlphaSize = 0;
} else {
pConfigs[i].accumRedSize = 0;
pConfigs[i].accumGreenSize = 0;
@@ -209,10 +245,10 @@ I810InitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].auxBuffers = 0;
pConfigs[i].level = 0;
if (stencil || accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ pConfigs[i].visualRating = GLX_SLOW_CONFIG;
else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
+ pConfigs[i].visualRating = GLX_NONE;
+ pConfigs[i].transparentPixel = GLX_NONE;
pConfigs[i].transparentRed = 0;
pConfigs[i].transparentGreen = 0;
pConfigs[i].transparentBlue = 0;
@@ -354,6 +390,12 @@ I810DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->InitBuffers = I810DRIInitBuffers;
pDRIInfo->MoveBuffers = I810DRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
+ pDRIInfo->OpenFullScreen = I810DRIOpenFullScreen;
+ pDRIInfo->CloseFullScreen = I810DRICloseFullScreen;
+ pDRIInfo->TransitionTo2d = I810DRITransitionTo2d;
+ pDRIInfo->TransitionTo3d = I810DRITransitionTo3d;
+ pDRIInfo->TransitionSingleToMulti3D = I810DRITransitionSingleToMulti3d;
+ pDRIInfo->TransitionMultiToSingle3D = I810DRITransitionMultiToSingle3d;
pDRIInfo->createDummyCtx = TRUE;
pDRIInfo->createDummyCtxPriv = FALSE;
@@ -416,6 +458,8 @@ I810DRIScreenInit(ScreenPtr pScreen)
/* Check the i810 DRM version */
version = drmGetVersion(pI810->drmSubFD);
if (version) {
+ i810_drm_version = (version->version_major<<16) |
+ version->version_minor;
if (version->version_major != 1 || version->version_minor < 2) {
/* incompatible drm version */
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -428,6 +472,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
drmFreeVersion(version);
return FALSE;
}
+ pI810->drmMinor = version->version_minor;
drmFreeVersion(version);
}
}
@@ -442,13 +487,13 @@ I810DRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
pI810DRI->regs);
- pI810->backHandle = 0;
- pI810->zHandle = 0;
- pI810->cursorHandle = 0;
- pI810->xvmcHandle = 0;
- pI810->sysmemHandle = 0;
+ pI810->backHandle = DRM_AGP_NO_HANDLE;
+ pI810->zHandle = DRM_AGP_NO_HANDLE;
+ pI810->cursorHandle = DRM_AGP_NO_HANDLE;
+ pI810->xvmcHandle = DRM_AGP_NO_HANDLE;
+ pI810->sysmemHandle = DRM_AGP_NO_HANDLE;
pI810->agpAcquired = FALSE;
- pI810->dcacheHandle = 0;
+ pI810->dcacheHandle = DRM_AGP_NO_HANDLE;
/* Agp Support - Need this just to get the framebuffer.
*/
@@ -476,7 +521,8 @@ I810DRIScreenInit(ScreenPtr pScreen)
drmAgpAlloc(pI810->drmSubFD, 4096 * 1024, 1, NULL, &dcacheHandle);
pI810->dcacheHandle = dcacheHandle;
- xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : %p\n",
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : 0x%lx\n",
dcacheHandle);
#define Elements(x) sizeof(x)/sizeof(*x)
@@ -490,18 +536,22 @@ I810DRIScreenInit(ScreenPtr pScreen)
DRICloseScreen(pScreen);
return FALSE;
} else {
- back_size = i810_pitches[pitch_idx] * (pScrn->virtualY + 4);
+ /* for tiled memory to work, the buffer needs to have the
+ * number of lines as a multiple of 16 (the tile size),
+ * - airlied */
+ int lines = (pScrn->virtualY + 15) / 16 * 16;
+ back_size = i810_pitches[pitch_idx] * lines;
back_size = ((back_size + 4096 - 1) / 4096) * 4096;
}
sysmem_size = pScrn->videoRam * 1024;
- if (dcacheHandle != 0) {
+ if (dcacheHandle != DRM_AGP_NO_HANDLE) {
if (back_size > 4 * 1024 * 1024) {
xf86DrvMsg(pScreen->myNum, X_INFO,
"[dri] Backsize is larger then 4 meg\n");
sysmem_size = sysmem_size - 2 * back_size;
drmAgpFree(pI810->drmSubFD, dcacheHandle);
- pI810->dcacheHandle = dcacheHandle = 0;
+ pI810->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
} else {
sysmem_size = sysmem_size - back_size;
}
@@ -545,7 +595,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
pI810->SavedSysMem = pI810->SysMem;
- if (dcacheHandle != 0) {
+ if (dcacheHandle != DRM_AGP_NO_HANDLE) {
if (drmAgpBind(pI810->drmSubFD, dcacheHandle, pI810->DepthOffset) == 0) {
memset(&pI810->DcacheMem, 0, sizeof(I810MemRange));
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -565,7 +615,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[agp] GART: dcache bind failed\n");
drmAgpFree(pI810->drmSubFD, dcacheHandle);
- pI810->dcacheHandle = dcacheHandle = 0;
+ pI810->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
}
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -575,7 +625,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle);
pI810->backHandle = agpHandle;
- if (agpHandle != 0) {
+ if (agpHandle != DRM_AGP_NO_HANDLE) {
if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[agp] Bound backbuffer memory\n");
@@ -597,11 +647,12 @@ I810DRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
- if (dcacheHandle == 0) {
- drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle);
+ if (dcacheHandle == DRM_AGP_NO_HANDLE) {
+ drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle);
+
pI810->zHandle = agpHandle;
- if (agpHandle != 0) {
+ if (agpHandle != DRM_AGP_NO_HANDLE) {
if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[agp] Bound depthbuffer memory\n");
@@ -627,7 +678,8 @@ I810DRIScreenInit(ScreenPtr pScreen)
* regular framebuffer as well as texture memory.
*/
drmAgpAlloc(pI810->drmSubFD, sysmem_size, 0, NULL, &agpHandle);
- if (agpHandle == 0) {
+
+ if (agpHandle == DRM_AGP_NO_HANDLE) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAlloc failed\n");
DRICloseScreen(pScreen);
return FALSE;
@@ -666,9 +718,10 @@ I810DRIScreenInit(ScreenPtr pScreen)
pI810->MC.Start = pI810->FbMapSize - 8 * 1024 * 1024;
}
drmAgpAlloc(pI810->drmSubFD, pI810->MC.Size, 0, NULL, &agpHandle);
+
pI810->xvmcHandle = agpHandle;
- if (agpHandle != 0) {
+ if (agpHandle != DRM_AGP_NO_HANDLE) {
if (drmAgpBind(pI810->drmSubFD, agpHandle, pI810->MC.Start) == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"GART: Allocated 7MB for HWMC\n");
@@ -690,9 +743,10 @@ I810DRIScreenInit(ScreenPtr pScreen)
drmAgpAlloc(pI810->drmSubFD, 4096, 2,
(unsigned long *)&pI810->CursorPhysical, &agpHandle);
+
pI810->cursorHandle = agpHandle;
- if (agpHandle != 0) {
+ if (agpHandle != DRM_AGP_NO_HANDLE) {
tom = sysmem_size;
if (drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) {
@@ -932,32 +986,38 @@ I810DRICloseScreen(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I810Ptr pI810 = I810PTR(pScrn);
+ I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate;
+
+ if (pI810DRI->irq) {
+ drmCtlUninstHandler(pI810->drmSubFD);
+ pI810DRI->irq = 0;
+ }
I810CleanupDma(pScrn);
- if (pI810->dcacheHandle)
+ if (pI810->dcacheHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->dcacheHandle);
- if (pI810->backHandle)
+ if (pI810->backHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->backHandle);
- if (pI810->zHandle)
+ if (pI810->zHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->zHandle);
- if (pI810->cursorHandle)
+ if (pI810->cursorHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->cursorHandle);
- if (pI810->xvmcHandle)
+ if (pI810->xvmcHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->xvmcHandle);
- if (pI810->sysmemHandle)
+ if (pI810->sysmemHandle!=DRM_AGP_NO_HANDLE)
drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle);
if (pI810->agpAcquired == TRUE)
drmAgpRelease(pI810->drmSubFD);
- pI810->backHandle = 0;
- pI810->zHandle = 0;
- pI810->cursorHandle = 0;
- pI810->xvmcHandle = 0;
- pI810->sysmemHandle = 0;
+ pI810->backHandle = DRM_AGP_NO_HANDLE;
+ pI810->zHandle = DRM_AGP_NO_HANDLE;
+ pI810->cursorHandle = DRM_AGP_NO_HANDLE;
+ pI810->xvmcHandle = DRM_AGP_NO_HANDLE;
+ pI810->sysmemHandle = DRM_AGP_NO_HANDLE;
pI810->agpAcquired = FALSE;
- pI810->dcacheHandle = 0;
+ pI810->dcacheHandle = DRM_AGP_NO_HANDLE;
DRICloseScreen(pScreen);
@@ -993,8 +1053,18 @@ Bool
I810DRIFinishScreenInit(ScreenPtr pScreen)
{
I810SAREARec *sPriv = (I810SAREARec *) DRIGetSAREAPrivate(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I810Ptr info = I810PTR(pScrn);
memset(sPriv, 0, sizeof(sPriv));
+
+ /* Have shadow run only while there is 3d active.
+ */
+ if (info->allowPageFlip && info->drmMinor >= 3) {
+ ShadowFBInit( pScreen, I810DRIRefreshArea );
+ }
+ else
+ info->allowPageFlip = 0;
return DRIFinishScreenInit(pScreen);
}
@@ -1198,7 +1268,7 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n",
x1, y1, w, h, dx, dy);
-
+
I810SelectBuffer(pScrn, I810_SELECT_BACK);
I810SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
I810SelectBuffer(pScrn, I810_SELECT_DEPTH);
@@ -1218,3 +1288,219 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
pI810->AccelInfoRec->NeedToSync = TRUE;
}
+
+
+/* Fullscreen hooks. The DRI fullscreen mode can probably be removed as
+ * it adds little or nothing above the mechanism below (and isn't widely
+ * used).
+ */
+static Bool I810DRIOpenFullScreen(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+static Bool I810DRICloseFullScreen(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+/* Use the miext/shadow module to maintain a list of dirty rectangles.
+ * These are blitted to the back buffer to keep both buffers clean
+ * during page-flipping when the 3d application isn't fullscreen.
+ *
+ * Unlike most use of the shadow code, both buffers are in video memory.
+ *
+ * An alternative to this would be to organize for all on-screen drawing
+ * operations to be duplicated for the two buffers. That might be
+ * faster, but seems like a lot more work...
+ */
+
+
+/* This should be done *before* XAA syncs or fires its buffer.
+ * Otherwise will have to fire it again???
+ */
+static void I810DRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ I810Ptr pI810 = I810PTR(pScrn);
+ int i;
+ I810SAREAPtr pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
+ unsigned int br13;
+ int cpp=2;
+
+
+ /* Don't want to do this when no 3d is active and pages are
+ * right-way-round
+ */
+ if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0)
+ return;
+
+ br13 = (pI810->auxPitch) | (0xcc << 16);
+
+ for (i = 0 ; i < num ; i++, pbox++) {
+ unsigned int w = min(pbox->y2, pScrn->virtualY-1) - max(pbox->y1, 0) + 1;
+ unsigned int h = min(pbox->x2, pScrn->virtualX-1) - max(pbox->x1, 0) + 1;
+ unsigned int dst = max(pbox->x1, 0)*cpp + (max(pbox->y1, 0)*pI810->auxPitch);
+
+ BEGIN_LP_RING(6);
+
+ OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4);
+ OUT_RING(br13);
+ OUT_RING( (h<<16) | (w*cpp) );
+ OUT_RING(pI810->BackBuffer.Start + dst);
+ OUT_RING(br13 & 0xffff);
+ OUT_RING(dst);
+
+ ADVANCE_LP_RING();
+ }
+
+}
+
+static void I810EnablePageFlip(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I810Ptr pI810 = I810PTR(pScrn);
+ I810SAREAPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
+ int cpp=2;
+ pSAREAPriv->pf_enabled = pI810->allowPageFlip;
+ pSAREAPriv->pf_active = 0;
+
+ if (pI810->allowPageFlip) {
+ unsigned int br13 = pI810->auxPitch | (0xcc << 16);
+
+ BEGIN_LP_RING(6);
+
+ OUT_RING(BR00_BITBLT_CLIENT | BR00_OP_SRC_COPY_BLT | 0x4);
+ OUT_RING(br13);
+ OUT_RING((pScrn->virtualY << 16) | (pScrn->virtualX*cpp));
+ OUT_RING(pI810->BackBuffer.Start);
+ OUT_RING(br13 & 0xFFFF);
+ OUT_RING(0);
+ ADVANCE_LP_RING();
+
+ pSAREAPriv->pf_active = 1;
+ }
+
+}
+
+static void I810DisablePageFlip(ScreenPtr pScreen)
+{
+ I810SAREAPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
+
+ pSAREAPriv->pf_active=0;
+}
+
+static void I810DRITransitionSingleToMulti3d(ScreenPtr pScreen)
+{
+ /* Tell the clients not to pageflip. How?
+ * -- Field in sarea, plus bumping the window counters.
+ * -- DRM needs to cope with Front-to-Back swapbuffers.
+ */
+ I810DisablePageFlip(pScreen);
+}
+
+static void I810DRITransitionMultiToSingle3d(ScreenPtr pScreen)
+{
+ /* Let the remaining 3d app start page flipping again */
+ I810EnablePageFlip(pScreen);
+}
+
+static void I810DRITransitionTo3d(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I810Ptr pI810 = I810PTR(pScrn);
+
+ I810EnablePageFlip(pScreen);
+ pI810->have3DWindows = 1;
+}
+
+static void I810DRITransitionTo2d(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I810Ptr pI810 = I810PTR(pScrn);
+ I810SAREAPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
+
+ /* Shut down shadowing if we've made it back to the front page */
+ if (pSAREAPriv->pf_current_page == 0) {
+ I810DisablePageFlip(pScreen);
+ }
+ pI810->have3DWindows = 0;
+}
+
+Bool
+I810DRILeave(ScrnInfoPtr pScrn)
+{
+ I810Ptr pI810 = I810PTR(pScrn);
+
+ if (pI810->directRenderingEnabled) {
+ if (pI810->dcacheHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->dcacheHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->backHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->backHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->zHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->zHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->sysmemHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->sysmemHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->xvmcHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->xvmcHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->cursorHandle != 0)
+ if (drmAgpUnbind(pI810->drmSubFD, pI810->cursorHandle) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"%s\n",strerror(errno));
+ return FALSE;
+ }
+ if (pI810->agpAcquired == TRUE)
+ drmAgpRelease(pI810->drmSubFD);
+ pI810->agpAcquired = FALSE;
+ }
+ return TRUE;
+}
+
+Bool
+I810DRIEnter(ScrnInfoPtr pScrn)
+{
+ I810Ptr pI810 = I810PTR(pScrn);
+
+ if (pI810->directRenderingEnabled) {
+
+ if (pI810->agpAcquired == FALSE)
+ drmAgpAcquire(pI810->drmSubFD);
+ pI810->agpAcquired = TRUE;
+ if (pI810->dcacheHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->dcacheHandle,
+ pI810->DepthOffset) != 0)
+ return FALSE;
+ if (pI810->backHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->backHandle,
+ pI810->BackOffset) != 0)
+ return FALSE;
+ if (pI810->zHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->zHandle,
+ pI810->DepthOffset) != 0)
+ return FALSE;
+ if (pI810->sysmemHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->sysmemHandle, 0) != 0)
+ return FALSE;
+ if (pI810->xvmcHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->xvmcHandle,
+ pI810->MC.Start) != 0)
+ return FALSE;
+ if (pI810->cursorHandle != 0)
+ if (drmAgpBind(pI810->drmSubFD, pI810->cursorHandle,
+ pI810->CursorStart) != 0)
+ return FALSE;
+ }
+ return TRUE;
+}