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 | |
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.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | src/radeon.h | 2 | ||||
-rw-r--r-- | src/radeon_dri.c | 55 | ||||
-rw-r--r-- | src/radeon_driver.c | 9 |
4 files changed, 55 insertions, 22 deletions
@@ -1,3 +1,14 @@ +2006-03-15 Benjamin Herrenschmidt <benh@kernel.crashing.org> + + * src/radeon.h: + * src/radeon_dri.c: (RADEONDRIScreenInit), + (RADEONDRIDoCloseScreen), (RADEONDRIFinishScreenInit), + (RADEONDRIStop), (RADEONDRICloseScreen): + * src/radeon_driver.c: (RADEONCloseScreen): + 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. + 2006-03-15 Luc Verhaegen <libv@skynet.be> * configure.ac: diff --git a/src/radeon.h b/src/radeon.h index fc694c73..b6ae5479 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -502,6 +502,7 @@ typedef struct { int numVisualConfigs; __GLXvisualConfig *pVisualConfigs; RADEONConfigPrivPtr pVisualConfigsPriv; + Bool (*DRICloseScreen)(int, ScreenPtr); drm_handle_t fbHandle; @@ -787,6 +788,7 @@ extern void RADEONDRIResume(ScreenPtr pScreen); extern Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen); extern void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen); extern void RADEONDRIInitPageFlip(ScreenPtr pScreen); +extern void RADEONDRIStop(ScreenPtr pScreen); extern drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn); extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard); diff --git a/src/radeon_dri.c b/src/radeon_dri.c index f9e7c9a3..868b735a 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. * diff --git a/src/radeon_driver.c b/src/radeon_driver.c index cb86fb8c..093f6141 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ */ -/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.99 2006/03/13 00:09:44 benh Exp $ */ +/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.100 2006/03/15 00:46:33 libv Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -8906,12 +8906,7 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) info->accelOn = FALSE; #ifdef XF86DRI - /* Disable direct rendering */ - if (info->directRenderingEnabled) { - RADEONDRICloseScreen(pScreen); - info->directRenderingEnabled = FALSE; - info->directRenderingInited = FALSE; - } + RADEONDRIStop(pScreen); #endif #ifdef USE_XAA |