summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-03-31 16:05:26 +1000
committerDave Airlie <airlied@redhat.com>2011-03-31 16:05:26 +1000
commit4b002fd02b25109753661db76685d662c9af4675 (patch)
tree217a65002f9422ff89eb36180d79a9c4e2f3e649
parent05ece44af3ed0d6b5d025dfb36b65a424e519275 (diff)
[RFC] dix/mi: remove ChangeWindowAttributes from rendering path.rework-stuff
This moves ChangeWindowAttributes to mi, and calls a new hook that fb/exa can use to fixup the pixmap properly. I've looked at XAA and it seems this should work there as well, and I'm sure UXA is like EXA. pretty much same set of open questions: sane? interface good enough? naming? (again only lightly tested with emacs which hits these paths inside Xcan't spell it. Dave.
-rw-r--r--exa/exa.c31
-rw-r--r--exa/exa_priv.h2
-rw-r--r--fb/fb.h6
-rw-r--r--fb/fbscreen.c2
-rw-r--r--fb/fbwindow.c26
-rw-r--r--include/scrnintstr.h3
-rw-r--r--mi/mi.h2
-rw-r--r--mi/miscrinit.c1
-rw-r--r--mi/miwindow.c14
9 files changed, 40 insertions, 47 deletions
diff --git a/exa/exa.c b/exa/exa.c
index 604b6579b..afc89858e 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -642,31 +642,20 @@ exaCreateGC (GCPtr pGC)
return ret;
}
-static Bool
-exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+static void
+exaPixmapWindowFixup(PixmapPtr *ppPixmap, int bpp)
{
- Bool ret;
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = (*ppPixmap)->drawable.pScreen;
ExaScreenPriv(pScreen);
-
- if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
- exaPrepareAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
-
- if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
- exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
+ exaPrepareAccess(&(*ppPixmap)->drawable, EXA_PREPARE_SRC);
pExaScr->fallback_counter++;
- swap(pExaScr, pScreen, ChangeWindowAttributes);
- ret = pScreen->ChangeWindowAttributes(pWin, mask);
- swap(pExaScr, pScreen, ChangeWindowAttributes);
+ swap(pExaScr, pScreen, PixmapWindowFixup);
+ pScreen->PixmapWindowFixup(ppPixmap, bpp);
+ swap(pExaScr, pScreen, PixmapWindowFixup);
pExaScr->fallback_counter--;
- if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
- exaFinishAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
- if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
- exaFinishAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
-
- return ret;
+ exaFinishAccess(&(*ppPixmap)->drawable, EXA_PREPARE_SRC);
}
static RegionPtr
@@ -793,7 +782,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
if (pExaScr->SavedModifyPixmapHeader)
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
unwrap(pExaScr, pScreen, PixmapCopyRegion);
- unwrap(pExaScr, pScreen, ChangeWindowAttributes);
+ unwrap(pExaScr, pScreen, PixmapWindowFixup);
unwrap(pExaScr, pScreen, BitmapToRegion);
unwrap(pExaScr, pScreen, CreateScreenResources);
unwrap(pExaScr, ps, Composite);
@@ -952,7 +941,7 @@ exaDriverInit (ScreenPtr pScreen,
wrap(pExaScr, pScreen, GetImage, exaGetImage);
wrap(pExaScr, pScreen, GetSpans, ExaCheckGetSpans);
wrap(pExaScr, pScreen, PixmapCopyRegion, exaPixmapCopyRegion);
- wrap(pExaScr, pScreen, ChangeWindowAttributes, exaChangeWindowAttributes);
+ wrap(pExaScr, pScreen, PixmapWindowFixup, exaPixmapWindowFixup);
wrap(pExaScr, pScreen, BitmapToRegion, exaBitmapToRegion);
wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources);
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 37906ba2c..19b9ab1b7 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -156,7 +156,7 @@ typedef struct {
CreatePixmapProcPtr SavedCreatePixmap;
DestroyPixmapProcPtr SavedDestroyPixmap;
PixmapCopyRegionProcPtr SavedPixmapCopyRegion;
- ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
+ PixmapWindowFixupProcPtr SavedPixmapWindowFixup;
BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
diff --git a/fb/fb.h b/fb/fb.h
index dd1f53329..2c1a7ad63 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2010,9 +2010,6 @@ fbPositionWindow(WindowPtr pWin, int x, int y);
extern _X_EXPORT Bool
fbUnmapWindow(WindowPtr pWindow);
-extern _X_EXPORT Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
-
extern _X_EXPORT void
fbFillRegionSolid (DrawablePtr pDrawable,
RegionPtr pRegion,
@@ -2027,5 +2024,8 @@ image_from_pict (PicturePtr pict,
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
+void
+fbPixmapWindowFixup(PixmapPtr *ppPixmap, int bpp);
+
#endif /* _FB_H_ */
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 5b5c58327..93c02929e 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -112,10 +112,10 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->CreateWindow = fbCreateWindow;
pScreen->DestroyWindow = fbDestroyWindow;
pScreen->PositionWindow = fbPositionWindow;
- pScreen->ChangeWindowAttributes = fbChangeWindowAttributes;
pScreen->RealizeWindow = fbMapWindow;
pScreen->UnrealizeWindow = fbUnmapWindow;
pScreen->PixmapCopyRegion = fbPixmapCopyRegion;
+ pScreen->PixmapWindowFixup = fbPixmapWindowFixup;
pScreen->CreatePixmap = fbCreatePixmap;
pScreen->DestroyPixmap = fbDestroyPixmap;
pScreen->RealizeFont = fbRealizeFont;
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 8b439b1fe..041a9d750 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -72,17 +72,17 @@ fbPixmapCopyRegion(PixmapPtr pPixmap,
prgnDst, dx, dy, fbCopyNtoN, 0, 0);
}
-static void
-fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
+void
+fbPixmapWindowFixup(PixmapPtr *ppPixmap, int bpp)
{
PixmapPtr pPixmap = *ppPixmap;
- if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
+ if (pPixmap->drawable.bitsPerPixel != bpp)
{
- pPixmap = fb24_32ReformatTile (pPixmap, pDrawable->bitsPerPixel);
+ pPixmap = fb24_32ReformatTile (pPixmap, bpp);
if (!pPixmap)
return;
- (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (*ppPixmap);
*ppPixmap = pPixmap;
}
if (FbEvenTile (pPixmap->drawable.width *
@@ -90,22 +90,6 @@ fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
fbPadPixmap (pPixmap);
}
-Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
- }
- if (mask & CWBorderPixmap)
- {
- if (pWin->borderIsPixel == FALSE)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
- }
- return TRUE;
-}
-
void
fbFillRegionSolid (DrawablePtr pDrawable,
RegionPtr pRegion,
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 1c4f286ec..74eeb2951 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -201,6 +201,8 @@ typedef void (* PixmapCopyRegionProcPtr)(
RegionPtr dstregion,
int dx, int dy);
+typedef void (* PixmapWindowFixupProcPtr)(PixmapPtr *ppPixmap, int bpp);
+
/* pixmap will exist only for the duration of the current rendering operation */
#define CREATE_PIXMAP_USAGE_SCRATCH 1
/* pixmap will be the backing pixmap for a redirected window */
@@ -545,6 +547,7 @@ typedef struct _Screen {
DeviceCursorInitializeProcPtr DeviceCursorInitialize;
DeviceCursorCleanupProcPtr DeviceCursorCleanup;
+ PixmapWindowFixupProcPtr PixmapWindowFixup;
PixmapCopyRegionProcPtr PixmapCopyRegion;
/* set it in driver side if X server can copy the framebuffer content.
* Meant to be used together with '-background none' option, avoiding
diff --git a/mi/mi.h b/mi/mi.h
index 1fb9ddea8..14c3a9e19 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -597,4 +597,6 @@ extern _X_EXPORT void miPolyFillArc(
);
extern _X_EXPORT void miCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
+extern _X_EXPORT void miChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
#endif /* MI_H */
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 348309ec6..dd9aafebc 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -253,6 +253,7 @@ miScreenInit(
pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
pScreen->WindowExposures = miWindowExposures;
pScreen->CopyWindow = miCopyWindow;
+ pScreen->ChangeWindowAttributes = miChangeWindowAttributes;
/* CopyWindow */
pScreen->ClearToBackground = miClearToBackground;
pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
diff --git a/mi/miwindow.c b/mi/miwindow.c
index c74357ded..5ed1c2756 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -851,3 +851,17 @@ miCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
RegionUninit(&rgnDst);
}
+
+void
+miChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ if (mask & CWBackPixmap)
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->PixmapWindowFixup)(&pWin->background.pixmap, pWin->drawable.bitsPerPixel);
+
+ if (mask & CWBorderPixmap)
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->PixmapWindowFixup)(&pWin->border.pixmap, pWin->drawable.bitsPerPixel);
+
+}