summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2005-07-04 14:15:57 +0000
committerZack Rusin <zack@kde.org>2005-07-04 14:15:57 +0000
commite34f31762e0454930f30547a9407cc8b941c70f2 (patch)
tree4e27ea8810e9cd1d65b75ac34a5cf567c5f7f493 /exa
parent4ef813961dc8dea8924a79e0954d5b6da12e77c0 (diff)
This fixes the close screen mess (crash reported by Thomas). Also hide the
private Exa screen definition. Properly cleanup on screen close and do not delete the private screen in the DriverFini call.
Diffstat (limited to 'exa')
-rw-r--r--exa/exa.c65
-rw-r--r--exa/exa.h4
-rw-r--r--exa/exa_accel.c65
-rw-r--r--exa/exa_migration.c65
-rw-r--r--exa/exa_priv.h34
-rw-r--r--exa/exa_unaccel.c100
6 files changed, 205 insertions, 128 deletions
diff --git a/exa/exa.c b/exa/exa.c
index e2ef7a0e5..731feed58 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -165,6 +165,8 @@ exaPixmapAllocArea (PixmapPtr pPixmap)
pitch = (w * bpp / 8 + pExaScr->info->card.offscreenPitch - 1) &
~(pExaScr->info->card.offscreenPitch - 1);
+ ErrorF("allocating pixmap with pitch = %d, bpp = %d, byteAlign = %d\n",
+ pitch, bpp, pExaScr->info->card.offscreenByteAlign);
pExaPixmap->devKind = pPixmap->devKind;
pExaPixmap->devPrivate = pPixmap->devPrivate;
pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h,
@@ -344,6 +346,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
}
}
+ ErrorF("Creating a pixmap on %d display, with %d bpp\n", depth, bpp);
pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
if (!pPixmap)
return NULL;
@@ -1084,6 +1087,35 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
ExaCheckPaintWindow (pWin, pRegion, what);
}
+
+static Bool
+exaCloseScreen(int i, ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ pScreen->CreateGC = pExaScr->SavedCreateGC;
+ pScreen->CloseScreen = pExaScr->SavedCloseScreen;
+ pScreen->GetImage = pExaScr->SavedGetImage;
+ pScreen->GetSpans = pExaScr->SavedGetSpans;
+ pScreen->PaintWindowBackground = pExaScr->SavedPaintWindowBackground;
+ pScreen->PaintWindowBorder = pExaScr->SavedPaintWindowBorder;
+ pScreen->CreatePixmap = pExaScr->SavedCreatePixmap;
+ pScreen->DestroyPixmap = pExaScr->SavedDestroyPixmap;
+ pScreen->CopyWindow = pExaScr->SavedCopyWindow;
+#ifdef RENDER
+ if (ps) {
+ ps->Composite = pExaScr->SavedComposite;
+ }
+#endif
+
+ xfree (pExaScr);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
Bool
exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo)
@@ -1111,18 +1143,34 @@ exaDriverInit (ScreenPtr pScreen,
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
/*
- * Hook up asynchronous drawing
- */
- ExaScreenInitAsync (pScreen);
- /*
* Replace various fb screen functions
*/
+ pExaScr->SavedCloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = exaCloseScreen;
+
+ pExaScr->SavedCreateGC = pScreen->CreateGC;
pScreen->CreateGC = exaCreateGC;
+
+ pExaScr->SavedGetImage = pScreen->GetImage;
+ pScreen->GetImage = ExaCheckGetImage;
+
+ pExaScr->SavedGetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = ExaCheckGetSpans;
+
+ pExaScr->SavedCopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = exaCopyWindow;
+
+ pExaScr->SavedPaintWindowBackground = pScreen->PaintWindowBackground;
pScreen->PaintWindowBackground = exaPaintWindow;
+
+ pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder;
pScreen->PaintWindowBorder = exaPaintWindow;
+
+ pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
+ pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
#ifdef RENDER
if (ps) {
+ pExaScr->SavedComposite = ps->Composite;
ps->Composite = exaComposite;
}
#endif
@@ -1136,7 +1184,10 @@ exaDriverInit (ScreenPtr pScreen,
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
sizeof (ExaPixmapPrivRec)))
return FALSE;
+ pExaScr->SavedCreatePixmap = pScreen->CreatePixmap;
pScreen->CreatePixmap = exaCreatePixmap;
+
+ pExaScr->SavedDestroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = exaDestroyPixmap;
}
else
@@ -1158,13 +1209,9 @@ exaDriverInit (ScreenPtr pScreen,
void
exaDriverFini (ScreenPtr pScreen)
{
- ExaScreenPriv(pScreen);
-
- STRACE;
- xfree (pExaScr);
+ /*right now does nothing*/
}
-
void exaMarkSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
diff --git a/exa/exa.h b/exa/exa.h
index f5279328e..3464b94d2 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -182,10 +182,6 @@ typedef struct _ExaDriver {
ExaAccelInfoRec accel;
} ExaDriverRec, *ExaDriverPtr;
-typedef struct {
- ExaDriverPtr info;
-} ExaScreenPrivRec, *ExaScreenPrivPtr;
-
#define EXA_OFFSCREEN_PIXMAPS (1 << 0)
#define EXA_OFFSCREEN_ALIGN_POT (1 << 1)
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index e2ef7a0e5..731feed58 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -165,6 +165,8 @@ exaPixmapAllocArea (PixmapPtr pPixmap)
pitch = (w * bpp / 8 + pExaScr->info->card.offscreenPitch - 1) &
~(pExaScr->info->card.offscreenPitch - 1);
+ ErrorF("allocating pixmap with pitch = %d, bpp = %d, byteAlign = %d\n",
+ pitch, bpp, pExaScr->info->card.offscreenByteAlign);
pExaPixmap->devKind = pPixmap->devKind;
pExaPixmap->devPrivate = pPixmap->devPrivate;
pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h,
@@ -344,6 +346,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
}
}
+ ErrorF("Creating a pixmap on %d display, with %d bpp\n", depth, bpp);
pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
if (!pPixmap)
return NULL;
@@ -1084,6 +1087,35 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
ExaCheckPaintWindow (pWin, pRegion, what);
}
+
+static Bool
+exaCloseScreen(int i, ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ pScreen->CreateGC = pExaScr->SavedCreateGC;
+ pScreen->CloseScreen = pExaScr->SavedCloseScreen;
+ pScreen->GetImage = pExaScr->SavedGetImage;
+ pScreen->GetSpans = pExaScr->SavedGetSpans;
+ pScreen->PaintWindowBackground = pExaScr->SavedPaintWindowBackground;
+ pScreen->PaintWindowBorder = pExaScr->SavedPaintWindowBorder;
+ pScreen->CreatePixmap = pExaScr->SavedCreatePixmap;
+ pScreen->DestroyPixmap = pExaScr->SavedDestroyPixmap;
+ pScreen->CopyWindow = pExaScr->SavedCopyWindow;
+#ifdef RENDER
+ if (ps) {
+ ps->Composite = pExaScr->SavedComposite;
+ }
+#endif
+
+ xfree (pExaScr);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
Bool
exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo)
@@ -1111,18 +1143,34 @@ exaDriverInit (ScreenPtr pScreen,
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
/*
- * Hook up asynchronous drawing
- */
- ExaScreenInitAsync (pScreen);
- /*
* Replace various fb screen functions
*/
+ pExaScr->SavedCloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = exaCloseScreen;
+
+ pExaScr->SavedCreateGC = pScreen->CreateGC;
pScreen->CreateGC = exaCreateGC;
+
+ pExaScr->SavedGetImage = pScreen->GetImage;
+ pScreen->GetImage = ExaCheckGetImage;
+
+ pExaScr->SavedGetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = ExaCheckGetSpans;
+
+ pExaScr->SavedCopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = exaCopyWindow;
+
+ pExaScr->SavedPaintWindowBackground = pScreen->PaintWindowBackground;
pScreen->PaintWindowBackground = exaPaintWindow;
+
+ pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder;
pScreen->PaintWindowBorder = exaPaintWindow;
+
+ pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
+ pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
#ifdef RENDER
if (ps) {
+ pExaScr->SavedComposite = ps->Composite;
ps->Composite = exaComposite;
}
#endif
@@ -1136,7 +1184,10 @@ exaDriverInit (ScreenPtr pScreen,
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
sizeof (ExaPixmapPrivRec)))
return FALSE;
+ pExaScr->SavedCreatePixmap = pScreen->CreatePixmap;
pScreen->CreatePixmap = exaCreatePixmap;
+
+ pExaScr->SavedDestroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = exaDestroyPixmap;
}
else
@@ -1158,13 +1209,9 @@ exaDriverInit (ScreenPtr pScreen,
void
exaDriverFini (ScreenPtr pScreen)
{
- ExaScreenPriv(pScreen);
-
- STRACE;
- xfree (pExaScr);
+ /*right now does nothing*/
}
-
void exaMarkSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index e2ef7a0e5..731feed58 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -165,6 +165,8 @@ exaPixmapAllocArea (PixmapPtr pPixmap)
pitch = (w * bpp / 8 + pExaScr->info->card.offscreenPitch - 1) &
~(pExaScr->info->card.offscreenPitch - 1);
+ ErrorF("allocating pixmap with pitch = %d, bpp = %d, byteAlign = %d\n",
+ pitch, bpp, pExaScr->info->card.offscreenByteAlign);
pExaPixmap->devKind = pPixmap->devKind;
pExaPixmap->devPrivate = pPixmap->devPrivate;
pExaPixmap->area = exaOffscreenAlloc (pScreen, pitch * h,
@@ -344,6 +346,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
}
}
+ ErrorF("Creating a pixmap on %d display, with %d bpp\n", depth, bpp);
pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);
if (!pPixmap)
return NULL;
@@ -1084,6 +1087,35 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
ExaCheckPaintWindow (pWin, pRegion, what);
}
+
+static Bool
+exaCloseScreen(int i, ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ pScreen->CreateGC = pExaScr->SavedCreateGC;
+ pScreen->CloseScreen = pExaScr->SavedCloseScreen;
+ pScreen->GetImage = pExaScr->SavedGetImage;
+ pScreen->GetSpans = pExaScr->SavedGetSpans;
+ pScreen->PaintWindowBackground = pExaScr->SavedPaintWindowBackground;
+ pScreen->PaintWindowBorder = pExaScr->SavedPaintWindowBorder;
+ pScreen->CreatePixmap = pExaScr->SavedCreatePixmap;
+ pScreen->DestroyPixmap = pExaScr->SavedDestroyPixmap;
+ pScreen->CopyWindow = pExaScr->SavedCopyWindow;
+#ifdef RENDER
+ if (ps) {
+ ps->Composite = pExaScr->SavedComposite;
+ }
+#endif
+
+ xfree (pExaScr);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
Bool
exaDriverInit (ScreenPtr pScreen,
ExaDriverPtr pScreenInfo)
@@ -1111,18 +1143,34 @@ exaDriverInit (ScreenPtr pScreen,
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
/*
- * Hook up asynchronous drawing
- */
- ExaScreenInitAsync (pScreen);
- /*
* Replace various fb screen functions
*/
+ pExaScr->SavedCloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = exaCloseScreen;
+
+ pExaScr->SavedCreateGC = pScreen->CreateGC;
pScreen->CreateGC = exaCreateGC;
+
+ pExaScr->SavedGetImage = pScreen->GetImage;
+ pScreen->GetImage = ExaCheckGetImage;
+
+ pExaScr->SavedGetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = ExaCheckGetSpans;
+
+ pExaScr->SavedCopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = exaCopyWindow;
+
+ pExaScr->SavedPaintWindowBackground = pScreen->PaintWindowBackground;
pScreen->PaintWindowBackground = exaPaintWindow;
+
+ pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder;
pScreen->PaintWindowBorder = exaPaintWindow;
+
+ pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
+ pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
#ifdef RENDER
if (ps) {
+ pExaScr->SavedComposite = ps->Composite;
ps->Composite = exaComposite;
}
#endif
@@ -1136,7 +1184,10 @@ exaDriverInit (ScreenPtr pScreen,
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
sizeof (ExaPixmapPrivRec)))
return FALSE;
+ pExaScr->SavedCreatePixmap = pScreen->CreatePixmap;
pScreen->CreatePixmap = exaCreatePixmap;
+
+ pExaScr->SavedDestroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = exaDestroyPixmap;
}
else
@@ -1158,13 +1209,9 @@ exaDriverInit (ScreenPtr pScreen,
void
exaDriverFini (ScreenPtr pScreen)
{
- ExaScreenPriv(pScreen);
-
- STRACE;
- xfree (pExaScr);
+ /*right now does nothing*/
}
-
void exaMarkSync(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 546a538cc..66d0b2faa 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -49,6 +49,21 @@
#define EXA_MAX_FB FB_OVERLAY_MAX
#endif
+typedef struct {
+ ExaDriverPtr info;
+ CreateGCProcPtr SavedCreateGC;
+ CloseScreenProcPtr SavedCloseScreen;
+ GetImageProcPtr SavedGetImage;
+ GetSpansProcPtr SavedGetSpans;
+ PaintWindowBackgroundProcPtr SavedPaintWindowBackground;
+ CreatePixmapProcPtr SavedCreatePixmap;
+ DestroyPixmapProcPtr SavedDestroyPixmap;
+ PaintWindowBorderProcPtr SavedPaintWindowBorder;
+ CopyWindowProcPtr SavedCopyWindow;
+#ifdef RENDER
+ CompositeProcPtr SavedComposite;
+#endif
+} ExaScreenPrivRec, *ExaScreenPrivPtr;
/*
* This is the only completely portable way to
@@ -179,27 +194,8 @@ ExaCheckRestoreAreas (PixmapPtr pPixmap,
void
ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
-void
-ExaCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-ExaCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer);
-
-void
-ExaCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-ExaScreenInitAsync (ScreenPtr pScreen);
-
extern const GCOps exaAsyncPixmapGCOps;
-/* exapict.c */
-void
-ExaPictureInitAsync (ScreenPtr pScreen);
-
#ifdef RENDER
void
ExaCheckComposite (CARD8 op,
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 79c407417..9925f354f 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -250,91 +250,35 @@ ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what)
}
void
-ExaCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- exaWaitSync (pWin->drawable.pScreen);
- exaDrawableDirty ((DrawablePtr)pWin);
- fbCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-
-#if EXA_MAX_FB > 1
-void
-ExaCheckPaintKey(DrawablePtr pDrawable,
- RegionPtr pRegion,
- CARD32 pixel,
- int layer)
-{
- exaWaitSync (pDrawable->pScreen);
- exaDrawableDirty (pDrawable);
- fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
-}
-
-void
-ExaCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
- exaWaitSync (pWin->drawable.pScreen);
- exaDrawableDirty ((DrawablePtr)pWin);
- fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-#endif
-
-void
-ExaScreenInitAsync (ScreenPtr pScreen)
-{
- pScreen->GetImage = ExaCheckGetImage;
- pScreen->GetSpans = ExaCheckGetSpans;
- pScreen->PaintWindowBackground = ExaCheckPaintWindow;
- pScreen->PaintWindowBorder = ExaCheckPaintWindow;
- pScreen->CopyWindow = ExaCheckCopyWindow;
- pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
- pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
-
-#ifdef RENDER
- ExaPictureInitAsync (pScreen);
-#endif
-}
-
-
-void
ExaCheckComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
{
exaWaitSync (pDst->pDrawable->pScreen);
exaDrawableDirty (pDst->pDrawable);
fbComposite (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
-}
-
-void
-ExaPictureInitAsync (ScreenPtr pScreen)
-{
- PictureScreenPtr ps;
-
- ps = GetPictureScreen(pScreen);
- ps->Composite = ExaCheckComposite;
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
}
-
/*
* Only need to stall for copyarea/copyplane
*/