diff options
author | Eric Anholt <eric@anholt.net> | 2007-07-27 12:48:08 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-07-27 14:38:49 -0700 |
commit | d7b5b595ad29ae0ac3adbd3a176be3fe7ffa6474 (patch) | |
tree | 11e1b98b44bb7fd7473a2c9bd1593c382e130c6f /src | |
parent | 2b1ec0f51479c1d7e5e62803c68feca29375519d (diff) | |
download | xorg-driver-xf86-video-intel-d7b5b595ad29ae0ac3adbd3a176be3fe7ffa6474.tar.gz |
Delay the first screen pixmap update to CreateScreenResources.
The return value of GetScreenPixmap before CreateScreenResources is not, in
fact, a pixmap.
Diffstat (limited to 'src')
-rw-r--r-- | src/i830_driver.c | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 929a5410..676b4cb9 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -712,6 +712,50 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } } +static void +i830UpdateFrontOffset(ScrnInfoPtr pScrn) +{ + ScreenPtr pScreen = pScrn->pScreen; + I830Ptr pI830 = I830PTR(pScrn); + + /* If we are still in ScreenInit, there is no screen pixmap to be updated + * yet. We'll fix it up at CreateScreenResources. + */ + if (pI830->starting) + return; + + /* Update buffer locations, which may have changed as a result of + * i830_bind_all_memory(). + */ + pScrn->fbOffset = pI830->front_buffer->offset; + if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen), + -1, -1, -1, -1, -1, + (pointer)(pI830->FbBase + + pScrn->fbOffset))) + FatalError("Couldn't adjust screen pixmap\n"); +} + +/** + * Adjust the screen pixmap for the current location of the front buffer. + * This is done at EnterVT when buffers are bound as long as the resources + * have already been created, but the first EnterVT happens before + * CreateScreenResources. + */ +static Bool +i830CreateScreenResources(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + pScreen->CreateScreenResources = pI830->CreateScreenResources; + if (!(*pScreen->CreateScreenResources)(pScreen)) + return FALSE; + + i830UpdateFrontOffset(pScrn); + + return TRUE; +} + int i830_output_clones (ScrnInfoPtr pScrn, int type_mask) { @@ -2680,6 +2724,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScreen->SaveScreen = xf86SaveScreen; pI830->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = I830CloseScreen; + pI830->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = i830CreateScreenResources; if (!xf86CrtcScreenInit (pScreen)) return FALSE; @@ -2803,7 +2849,6 @@ static Bool I830EnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - ScreenPtr pScreen = pScrn->pScreen; I830Ptr pI830 = I830PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int o; @@ -2827,15 +2872,7 @@ I830EnterVT(int scrnIndex, int flags) i830_describe_allocations(pScrn, 1, ""); - /* Update buffer locations, which may have changed as a result of - * i830_bind_all_memory(). - */ - pScrn->fbOffset = pI830->front_buffer->offset; - if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen), - -1, -1, -1, -1, -1, - (pointer)(pI830->FbBase + - pScrn->fbOffset))) - FatalError("Couldn't adjust screen pixmap\n"); + i830UpdateFrontOffset(pScrn); if (i830_check_error_state(pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, |