summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-03-15 04:12:43 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-03-15 04:12:43 +0000
commit6a7111d0b4408cc6862be2c4f39e731e081ffea4 (patch)
tree12f77c080e5be275d17d9abd592724806a28e5a1 /src
parent391a8ff7cced1dcb015a0c0762497df6aadbc14e (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')
-rw-r--r--src/radeon.h2
-rw-r--r--src/radeon_dri.c55
-rw-r--r--src/radeon_driver.c9
3 files changed, 44 insertions, 22 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 86a52dad..bdee01db 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 d6a635e6..6a004cf6 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.92.2.5 2006/03/12 06:57:12 benh Exp $ */
+/* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.92.2.6 2006/03/13 00:14:15 benh Exp $ */
/*
* Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
* VA Linux Systems Inc., Fremont, California.
@@ -8903,12 +8903,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