summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-10-05 12:12:06 -0700
committerEric Anholt <eric@anholt.net>2007-10-11 12:17:14 -0700
commit132dce7565feeea1055899f8c1627766fe84c88c (patch)
tree5e7217fa5a34ad7b6e069cdae545b1f3e4203636
parent4ca3550fb7d488741f8dc1ba3c8722393277c3b8 (diff)
Delay SAREA and mapping setup until EnterVT when using the memory manager.
Otherwise, we would use uninitialized offsets in the early setup.
-rw-r--r--src/i830_dri.c19
-rw-r--r--src/i830_driver.c11
2 files changed, 18 insertions, 12 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 0466410c..4d3458f5 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -833,12 +833,19 @@ I830DRIDoMappings(ScreenPtr pScreen)
pScrn->pScreen->width = pScrn->virtualX;
pScrn->pScreen->height = pScrn->virtualY;
- if (!i830_update_dri_buffers(pScrn)) {
- /* screen mappings probably failed */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAddMap(screen mappings) failed. Disabling DRI\n");
- DRICloseScreen(pScreen);
- return FALSE;
+ /* If we are using the kernel memory manager, we have to delay SAREA and
+ * mapping setup until our buffers are pinned at EnterVT, losing the
+ * opportunity to fail cleanly early on.
+ */
+ if (pI830->memory_manager == NULL) {
+ if (!i830_update_dri_buffers(pScrn)) {
+ /* screen mappings probably failed */
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] drmAddMap(screen mappings) failed. "
+ "Disabling DRI\n");
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
}
if (pI830->allocate_classic_textures)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index d24c408a..abe70d72 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3070,6 +3070,11 @@ I830EnterVT(int scrnIndex, int flags)
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
+ /* Update buffer offsets in sarea and mappings, since buffer offsets
+ * may have changed.
+ */
+ if (!i830_update_dri_buffers(pScrn))
+ FatalError("i830_update_dri_buffers() failed\n");
I830DRISetVBlankInterrupt (pScrn, TRUE);
@@ -3088,12 +3093,6 @@ I830EnterVT(int scrnIndex, int flags)
for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
sarea->texList[i].age = sarea->texAge;
- /* Update buffer offsets in sarea and mappings, since buffer offsets
- * may have changed.
- */
- if (!i830_update_dri_buffers(pScrn))
- FatalError("i830_update_dri_buffers() failed\n");
-
DPRINTF(PFX, "calling dri unlock\n");
DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
}