From 132dce7565feeea1055899f8c1627766fe84c88c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 5 Oct 2007 12:12:06 -0700 Subject: Delay SAREA and mapping setup until EnterVT when using the memory manager. Otherwise, we would use uninitialized offsets in the early setup. --- src/i830_dri.c | 19 +++++++++++++------ src/i830_driver.c | 11 +++++------ 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]); } -- cgit v1.2.3