diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-03-15 04:03:37 +0000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-03-15 04:03:37 +0000 |
commit | 36799e3ea7ddde5fce528e8bc17ea942933a9111 (patch) | |
tree | ab589404874995ba4b7b73259a441ddcf59770d3 /src/radeon_dri.c | |
parent | 50923b6a9325592edc8b02b17646f96b9b8c4a01 (diff) |
Fix various issues with DRI & server recycle by putting DRICloseSreen in
the normal CloseScreen callback chain at a spot that matches the call
to DRIFinishScreenInit in order to unwrap at the right time.
Diffstat (limited to 'src/radeon_dri.c')
-rw-r--r-- | src/radeon_dri.c | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c index f9e7c9a..868b735 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -1340,6 +1340,8 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) RADEONDRIPtr pRADEONDRI; drmVersionPtr version; + info->DRICloseScreen = NULL; + switch (info->CurrentLayout.pixel_code) { case 8: case 15: @@ -1509,6 +1511,17 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) return TRUE; } +static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + RADEONDRICloseScreen(pScreen); + + pScreen->CloseScreen = info->DRICloseScreen; + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + /* Finish initializing the device-dependent DRI state, and call * DRIFinishScreenInit() to complete the device-independent DRI * initialization. @@ -1599,6 +1612,10 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) info->directRenderingInited = TRUE; + /* Wrap CloseScreen */ + info->DRICloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = RADEONDRIDoCloseScreen; + return TRUE; } @@ -1664,20 +1681,16 @@ void RADEONDRIResume(ScreenPtr pScreen) RADEONDRICPInit(pScrn); } -/* The screen is being closed, so clean up any state and free any - * resources used by the DRI. - */ -void RADEONDRICloseScreen(ScreenPtr pScreen) +void RADEONDRIStop(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); - drmRadeonInit drmInfo; RING_LOCALS; - RADEONTRACE(("RADEONDRICloseScreen\n")); - + RADEONTRACE(("RADEONDRIStop\n")); + /* Stop the CP */ - if (info->directRenderingEnabled) { + if (info->directRenderingInited) { /* If we've generated any CP commands, we must flush them to the * kernel module now. */ @@ -1690,26 +1703,39 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) } RADEONCP_STOP(pScrn, info); } + info->directRenderingInited = FALSE; +} + +/* The screen is being closed, so clean up any state and free any + * resources used by the DRI. + */ +void RADEONDRICloseScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + drmRadeonInit drmInfo; - if (info->irq) { + RADEONTRACE(("RADEONDRICloseScreen\n")); + + if (info->irq) { drmCtlUninstHandler(info->drmFD); info->irq = 0; info->ModeReg.gen_int_cntl = 0; } - /* De-allocate vertex buffers */ + /* De-allocate vertex buffers */ if (info->buffers) { drmUnmapBufs(info->buffers); info->buffers = NULL; } - /* De-allocate all kernel resources */ + /* De-allocate all kernel resources */ memset(&drmInfo, 0, sizeof(drmRadeonInit)); drmInfo.func = DRM_RADEON_CLEANUP_CP; drmCommandWrite(info->drmFD, DRM_RADEON_CP_INIT, &drmInfo, sizeof(drmRadeonInit)); - /* De-allocate all GART resources */ + /* De-allocate all GART resources */ if (info->gartTex) { drmUnmap(info->gartTex, info->gartTexMapSize); info->gartTex = NULL; @@ -1737,10 +1763,10 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) info->pciMemHandle = 0; } - /* De-allocate all DRI resources */ + /* De-allocate all DRI resources */ DRICloseScreen(pScreen); - /* De-allocate all DRI data structures */ + /* De-allocate all DRI data structures */ if (info->pDRIInfo) { if (info->pDRIInfo->devPrivate) { xfree(info->pDRIInfo->devPrivate); @@ -1759,7 +1785,6 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) } } - /* Use callbacks from dri.c to support pageflipping mode for a single * 3d context without need for any specific full-screen extension. * |