summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-06-16 09:26:18 +0000
committerEric Anholt <anholt@freebsd.org>2004-06-16 09:26:18 +0000
commitbec47f9369b6f02ce4537ab1ac547ba933609edc (patch)
tree4fc679522a0ba2737836772b91bc77aeca933bdf
parentc5b1972b50a6dbe57c67d3cc88ae010386b908a6 (diff)
-rw-r--r--src/i810.h14
-rw-r--r--src/i810_dri.c140
-rw-r--r--src/i810_dri.h13
-rw-r--r--src/i810_driver.c12
-rw-r--r--src/i810_hwmc.c6
-rw-r--r--src/i830.h4
-rw-r--r--src/i830_dri.c39
-rw-r--r--src/i830_dri.h13
8 files changed, 176 insertions, 65 deletions
diff --git a/src/i810.h b/src/i810.h
index 0dd046c9..332cd81a 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -238,11 +238,11 @@ typedef struct _I810Rec {
unsigned long xvmcHandle;
unsigned long sysmemHandle;
Bool agpAcquired;
- drmHandle buffer_map;
- drmHandle ring_map;
- drmHandle overlay_map;
- drmHandle mc_map;
- drmHandle xvmcContext;
+ drm_handle_t buffer_map;
+ drm_handle_t ring_map;
+ drm_handle_t overlay_map;
+ drm_handle_t mc_map;
+ drm_handle_t xvmcContext;
#endif
Bool agpAcquired2d;
@@ -264,9 +264,13 @@ typedef struct _I810Rec {
#define I810_SELECT_BACK 1
#define I810_SELECT_DEPTH 2
+#ifdef XF86DRI
extern Bool I810DRIScreenInit(ScreenPtr pScreen);
extern void I810DRICloseScreen(ScreenPtr pScreen);
extern Bool I810DRIFinishScreenInit(ScreenPtr pScreen);
+extern Bool I810DRILeave(ScrnInfoPtr pScrn);
+extern Bool I810DRIEnter(ScrnInfoPtr pScrn);
+#endif
extern Bool I810InitDma(ScrnInfoPtr pScrn);
extern Bool I810CleanupDma(ScrnInfoPtr pScrn);
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 06bb0f14..787eef56 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -34,9 +34,9 @@ static char I810ClientDriverName[] = "i810";
static Bool I810InitVisualConfigs(ScreenPtr pScreen);
static Bool I810CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore);
-static void I810DestroyContext(ScreenPtr pScreen, drmContext hwContext,
+static void I810DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore);
static void I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType readContextType,
@@ -343,12 +343,15 @@ I810DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->drmDriverName = I810KernelDriverName;
pDRIInfo->clientDriverName = I810ClientDriverName;
- pDRIInfo->busIdString = xalloc(64);
-
- sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
- ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum,
- ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum,
- ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum);
+ if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
+ pDRIInfo->busIdString = DRICreatePCIBusID(pI810->PciInfo);
+ } else {
+ pDRIInfo->busIdString = xalloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum);
+ }
pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION;
pDRIInfo->ddxDriverMinorVersion = I810_MINOR_VERSION;
pDRIInfo->ddxDriverPatchVersion = I810_PATCHLEVEL;
@@ -478,7 +481,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
}
pI810DRI->regsSize = I810_REG_SIZE;
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->MMIOAddr,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->MMIOAddr,
pI810DRI->regsSize, DRM_REGISTERS, 0, &pI810DRI->regs) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n");
DRICloseScreen(pScreen);
@@ -678,16 +681,19 @@ I810DRIScreenInit(ScreenPtr pScreen)
* regular framebuffer as well as texture memory.
*/
drmAgpAlloc(pI810->drmSubFD, sysmem_size, 0, NULL, &agpHandle);
-
- if (agpHandle == DRM_AGP_NO_HANDLE) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAlloc failed\n");
- DRICloseScreen(pScreen);
- return FALSE;
- }
pI810->sysmemHandle = agpHandle;
-
- if (drmAgpBind(pI810->drmSubFD, agpHandle, 0) != 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpBind failed\n");
+
+ if (agpHandle != DRM_AGP_NO_HANDLE) {
+ if (drmAgpBind(pI810->drmSubFD, agpHandle, 0) == 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[agp] Bound System Texture Memory\n");
+ } else {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Unable to bind system texture memory. Disabling DRI.\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Unable to allocate system texture memory. Disabling DRI.\n");
DRICloseScreen(pScreen);
return FALSE;
}
@@ -818,7 +824,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
pI810->SavedDcacheMem = pI810->DcacheMem;
pI810DRI->backbufferSize = pI810->BackBuffer.Size;
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->BackBuffer.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->BackBuffer.Start,
pI810->BackBuffer.Size, DRM_AGP, 0,
&pI810DRI->backbuffer) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -828,7 +834,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
}
pI810DRI->depthbufferSize = pI810->DepthBuffer.Size;
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->DepthBuffer.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->DepthBuffer.Start,
pI810->DepthBuffer.Size, DRM_AGP, 0,
&pI810DRI->depthbuffer) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -858,7 +864,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
DRICloseScreen(pScreen);
return FALSE;
}
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->BufferMem.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->BufferMem.Start,
pI810->BufferMem.Size, DRM_AGP, 0, &pI810->buffer_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n");
@@ -869,7 +875,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
pI810DRI->agp_buffers = pI810->buffer_map;
pI810DRI->agp_buf_size = pI810->BufferMem.Size;
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->LpRing.mem.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->LpRing.mem.Start,
pI810->LpRing.mem.Size, DRM_AGP, 0, &pI810->ring_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] drmAddMap(ring_map) failed. Disabling DRI.\n");
@@ -897,7 +903,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
I810AllocLow(&(pI810->TexMem), &(pI810->SysMem), pI810DRI->textureSize);
- if (drmAddMap(pI810->drmSubFD, (drmHandle) pI810->TexMem.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t) pI810->TexMem.Start,
pI810->TexMem.Size, DRM_AGP, 0, &pI810DRI->textures) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] drmAddMap(textures) failed. Disabling DRI.\n");
@@ -1037,14 +1043,14 @@ I810DRICloseScreen(ScreenPtr pScreen)
static Bool
I810CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
return TRUE;
}
static void
-I810DestroyContext(ScreenPtr pScreen, drmContext hwContext,
+I810DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore)
{
}
@@ -1418,9 +1424,93 @@ static void I810DRITransitionTo2d(ScreenPtr pScreen)
I810Ptr pI810 = I810PTR(pScrn);
I810SAREAPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
+ /* Try flipping back to the front page if necessary */
+ if (pSAREAPriv->pf_current_page == 1)
+ drmCommandNone(pI810->drmSubFD, DRM_I810_FLIP);
+
/* 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;
+}
diff --git a/src/i810_dri.h b/src/i810_dri.h
index cfca20a9..e62d3b79 100644
--- a/src/i810_dri.h
+++ b/src/i810_dri.h
@@ -3,26 +3,27 @@
#ifndef _I810_DRI_
#define _I810_DRI_
+#include "xf86dri.h"
#include "xf86drm.h"
#include "i810_common.h"
#define I810_MAX_DRAWABLES 256
typedef struct {
- drmHandle regs;
+ drm_handle_t regs;
drmSize regsSize;
drmAddress regsMap;
drmSize backbufferSize;
- drmHandle backbuffer;
+ drm_handle_t backbuffer;
drmSize depthbufferSize;
- drmHandle depthbuffer;
+ drm_handle_t depthbuffer;
- drmHandle textures;
+ drm_handle_t textures;
int textureSize;
- drmHandle agp_buffers;
+ drm_handle_t agp_buffers;
drmSize agp_buf_size;
int deviceID;
@@ -78,7 +79,7 @@ typedef struct {
unsigned int dirty;
unsigned int nbox;
- XF86DRIClipRectRec boxes[I810_NR_SAREA_CLIPRECTS];
+ drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS];
/* Maintain an LRU of contiguous regions of texture space. If
* you think you own a region of texture memory, and it has an
diff --git a/src/i810_driver.c b/src/i810_driver.c
index 25a60f9d..36dc956b 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -292,6 +292,7 @@ static const char *driSymbols[] = {
"DRIScreenInit",
"DRIUnlock",
"GlxSetVisualConfigs",
+ "DRICreatePCIBusID",
NULL
};
@@ -2273,10 +2274,13 @@ I810EnterVT(int scrnIndex, int flags)
if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("\n\nENTER VT\n");
- if (!I810BindGARTMemory(pScrn))
+ if (!I810BindGARTMemory(pScrn)) {
return FALSE;
-
+ }
#ifdef XF86DRI
+ if (!I810DRIEnter(pScrn)) {
+ return FALSE;
+ }
if (pI810->directRenderingEnabled) {
if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("calling dri unlock\n");
@@ -2319,6 +2323,10 @@ I810LeaveVT(int scrnIndex, int flags)
if (!I810UnbindGARTMemory(pScrn))
return;
+#ifdef XF86DRI
+ if (!I810DRILeave(pScrn))
+ return;
+#endif
vgaHWLock(hwp);
}
diff --git a/src/i810_hwmc.c b/src/i810_hwmc.c
index 525ad361..8c9c3050 100644
--- a/src/i810_hwmc.c
+++ b/src/i810_hwmc.c
@@ -71,7 +71,7 @@ void I810XvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSurf);
typedef struct {
- drmContext drmcontext;
+ drm_context_t drmcontext;
unsigned int fbBase;
unsigned int OverlayOffset;
unsigned int OverlaySize;
@@ -206,12 +206,12 @@ void I810InitMC(ScreenPtr pScreen)
}
/* Cursor is at a page boundary, Overlay regs are not, don't forget */
- if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->CursorStart,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t)pI810->CursorStart,
4096, DRM_AGP, 0, &pI810->overlay_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(overlay) failed\n");
return;
}
- if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MC.Start,
+ if (drmAddMap(pI810->drmSubFD, (drm_handle_t)pI810->MC.Start,
pI810->MC.Size, DRM_AGP, 0, &pI810->mc_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(MC) failed\n");
return;
diff --git a/src/i830.h b/src/i830.h
index a0d3f7a7..6942fad1 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -246,8 +246,8 @@ typedef struct _I830Rec {
int numVisualConfigs;
__GLXvisualConfig *pVisualConfigs;
I830ConfigPrivPtr pVisualConfigsPriv;
- drmHandle buffer_map;
- drmHandle ring_map;
+ drm_handle_t buffer_map;
+ drm_handle_t ring_map;
#endif
OptionInfoPtr Options;
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 4c9b1a28..9ed9bb79 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -80,9 +80,9 @@ static char I830ClientDriverName[] = "i830";
static Bool I830InitVisualConfigs(ScreenPtr pScreen);
static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore);
-static void I830DestroyContext(ScreenPtr pScreen, drmContext hwContext,
+static void I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore);
static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType readContextType,
@@ -444,12 +444,15 @@ I830DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->drmDriverName = I830KernelDriverName;
pDRIInfo->clientDriverName = I830ClientDriverName;
- pDRIInfo->busIdString = xalloc(64);
-
- sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
- ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum,
- ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum,
- ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum);
+ if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
+ pDRIInfo->busIdString = DRICreatePCIBusID(pI830->PciInfo);
+ } else {
+ pDRIInfo->busIdString = xalloc(64);
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum);
+ }
pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION;
pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION;
pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL;
@@ -585,7 +588,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
DPRINTF(PFX, "I830DRIDoMappings\n");
pI830DRI->regsSize = I830_REG_SIZE;
- if (drmAddMap(pI830->drmSubFD, (drmHandle)pI830->MMIOAddr,
+ if (drmAddMap(pI830->drmSubFD, (drm_handle_t)pI830->MMIOAddr,
pI830DRI->regsSize, DRM_REGISTERS, 0, &pI830DRI->regs) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n");
DRICloseScreen(pScreen);
@@ -604,7 +607,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
pI830DRI->backbufferSize = pI830->BackBuffer.Size;
if (drmAddMap(pI830->drmSubFD,
- (drmHandle)pI830->BackBuffer.Start + pI830->LinearAddr,
+ (drm_handle_t)pI830->BackBuffer.Start + pI830->LinearAddr,
pI830->BackBuffer.Size, DRM_AGP, 0,
&pI830DRI->backbuffer) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -617,7 +620,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
pI830DRI->depthbufferSize = pI830->DepthBuffer.Size;
if (drmAddMap(pI830->drmSubFD,
- (drmHandle)pI830->DepthBuffer.Start + pI830->LinearAddr,
+ (drm_handle_t)pI830->DepthBuffer.Start + pI830->LinearAddr,
pI830->DepthBuffer.Size, DRM_AGP, 0,
&pI830DRI->depthbuffer) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -629,7 +632,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
pI830DRI->depthbuffer);
if (drmAddMap(pI830->drmSubFD,
- (drmHandle)pI830->BufferMem.Start + pI830->LinearAddr,
+ (drm_handle_t)pI830->BufferMem.Start + pI830->LinearAddr,
pI830->BufferMem.Size, DRM_AGP, 0,
&pI830->buffer_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -644,7 +647,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
pI830DRI->agp_buf_size = pI830->BufferMem.Size;
if (drmAddMap(pI830->drmSubFD,
- (drmHandle)pI830->LpRing.mem.Start + pI830->LinearAddr,
+ (drm_handle_t)pI830->LpRing.mem.Start + pI830->LinearAddr,
pI830->LpRing.mem.Size, DRM_AGP, 0,
&pI830->ring_map) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -659,7 +662,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
pI830DRI->logTextureGranularity = pI830->TexGranularity;
if (drmAddMap(pI830->drmSubFD,
- (drmHandle)pI830->TexMem.Start + pI830->LinearAddr,
+ (drm_handle_t)pI830->TexMem.Start + pI830->LinearAddr,
pI830->TexMem.Size, DRM_AGP, 0,
&pI830DRI->textures) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -786,14 +789,14 @@ I830DRICloseScreen(ScreenPtr pScreen)
static Bool
I830CreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
return TRUE;
}
static void
-I830DestroyContext(ScreenPtr pScreen, drmContext hwContext,
+I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore)
{
}
@@ -1665,6 +1668,10 @@ I830DRITransitionTo2d(ScreenPtr pScreen)
I830Ptr pI830 = I830PTR(pScrn);
I830SAREARec *sPriv = (I830SAREARec *) DRIGetSAREAPrivate(pScreen);
+ /* Try flipping back to the front page if necessary */
+ if (sPriv->pf_current_page == 1)
+ drmCommandNone(pI830->drmSubFD, DRM_I830_FLIP);
+
/* Shut down shadowing if we've made it back to the front page:
*/
if (sPriv->pf_current_page == 0) {
diff --git a/src/i830_dri.h b/src/i830_dri.h
index 69a4f678..b427dc84 100644
--- a/src/i830_dri.h
+++ b/src/i830_dri.h
@@ -3,6 +3,7 @@
#ifndef _I830_DRI_H
#define _I830_DRI_H
+#include "xf86dri.h"
#include "xf86drm.h"
#include "i830_common.h"
@@ -15,20 +16,20 @@
#define I830_REG_SIZE 0x80000
typedef struct _I830DRIRec {
- drmHandle regs;
+ drm_handle_t regs;
drmSize regsSize;
drmAddress regsMap;
drmSize backbufferSize;
- drmHandle backbuffer;
+ drm_handle_t backbuffer;
drmSize depthbufferSize;
- drmHandle depthbuffer;
+ drm_handle_t depthbuffer;
- drmHandle textures;
+ drm_handle_t textures;
int textureSize;
- drmHandle agp_buffers;
+ drm_handle_t agp_buffers;
drmSize agp_buf_size;
int deviceID;
@@ -82,7 +83,7 @@ typedef struct _I830SAREA {
unsigned int dirty;
unsigned int nbox;
- XF86DRIClipRectRec boxes[I830_NR_SAREA_CLIPRECTS];
+ drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS];
/* Maintain an LRU of contiguous regions of texture space. If
* you think you own a region of texture memory, and it has an