diff options
author | Eric Anholt <eric@anholt.net> | 2009-04-27 14:50:54 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-04-27 16:32:25 -0700 |
commit | 3187c7698b93f1d0e07798e9c42ca2877d55e055 (patch) | |
tree | 1cd7fae155983e96dad898ecf1c965baff271cc3 | |
parent | fbaf13c93511547c563129527797fbef8628652e (diff) |
Fix assert at startup with DRI initialiation failure.
In this path, we'd make it to allocator_init -> init_bufmgr without
GEM and without FbBase being initialized, leading to assertion failure
to catch this mistake.
Comedy ensued when trying to move just the MapMem up, leading to the rest
of the commit. Some day (like tomorrow after I rebase intel-cleanup) I'll
clean this path up.
Tested with 2 X Servers on 2.6.28 (one gets DRI2, one fails successfully),
2 UMS X Servers on 2.6.30rc2 (each gets DRI2), and 2 KMS X Servers on
2.6.30rc2 (success all around).
-rw-r--r-- | src/i830_driver.c | 21 | ||||
-rw-r--r-- | src/i830_memory.c | 1 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index cc0f76d5..e0dbe77c 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -670,9 +670,6 @@ I830MapMem(ScrnInfoPtr pScrn) for (i = 2; i < pI830->FbMapSize; i <<= 1) ; pI830->FbMapSize = i; - if (!I830MapMMIO(pScrn)) - return FALSE; - #if XSERVER_LIBPCIACCESS err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize, PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, @@ -3071,14 +3068,21 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!pI830->use_drm_mode) I830MapMMIO(pScrn); + /* Need FB mapped to set up the fake bufmgr if we end up doing that + * in i830_memory_init() -> i830_allocator_init(). + */ + if (!pI830->use_drm_mode) { + if (!I830MapMem(pScrn)) + return FALSE; + pScrn->memPhysBase = (unsigned long)pI830->FbBase; + } + if (!i830_memory_init(pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Couldn't allocate video memory\n"); return FALSE; } - I830UnmapMMIO(pScrn); - i830_fixup_mtrrs(pScrn); pI830->starting = TRUE; @@ -3109,13 +3113,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->accel = ACCEL_NONE; } } - - if (!pI830->use_drm_mode) { - DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n"); - if (!I830MapMem(pScrn)) - return FALSE; - pScrn->memPhysBase = (unsigned long)pI830->FbBase; - } i830_init_bufmgr(pScrn); #ifdef XF86DRI diff --git a/src/i830_memory.c b/src/i830_memory.c index 54cee563..760e07cd 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -1065,6 +1065,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn) } pI830->ring.tail_mask = pI830->ring.mem->size - 1; + pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset; return TRUE; } |