summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-09-12 13:58:46 +0000
committerEric Anholt <eric@anholt.net>2007-09-13 00:08:53 +0000
commite4d11e58ce349dfe6af2f73ff341317f9b39684c (patch)
tree05509150343f56d8ec6c88e8da338bf99e6ec03f /mi
parent6da39c67905500ab2db00a45cda4a9f756cdde96 (diff)
Remove the PaintWindow optimization.
This was an attempt to avoid scratch gc creation and validation for paintwin because that was expensive. This is not the case in current servers, and the danger of failure to implement it correctly (as seen in all previous implementations) is high enough to justify removing it. No performance difference detected with x11perf -create -move -resize -circulate on Xvfb. Leave the screen hooks for PaintWindow* in for now to avoid ABI change.
Diffstat (limited to 'mi')
-rw-r--r--mi/mibank.c71
-rw-r--r--mi/miexpose.c60
-rw-r--r--mi/mioverlay.c20
-rw-r--r--mi/miscrinit.c2
-rw-r--r--mi/miwindow.c6
5 files changed, 20 insertions, 139 deletions
diff --git a/mi/mibank.c b/mi/mibank.c
index 00638a4c2..3492f1e0e 100644
--- a/mi/mibank.c
+++ b/mi/mibank.c
@@ -121,8 +121,6 @@ typedef struct _miBankScreen
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
CreateGCProcPtr CreateGC;
- PaintWindowBackgroundProcPtr PaintWindowBackground;
- PaintWindowBorderProcPtr PaintWindowBorder;
CopyWindowProcPtr CopyWindow;
} miBankScreenRec, *miBankScreenPtr;
@@ -1712,8 +1710,6 @@ miBankCloseScreen(
SCREEN_UNWRAP(GetImage);
SCREEN_UNWRAP(GetSpans);
SCREEN_UNWRAP(CreateGC);
- SCREEN_UNWRAP(PaintWindowBackground);
- SCREEN_UNWRAP(PaintWindowBorder);
SCREEN_UNWRAP(CopyWindow);
Xfree(pScreenPriv);
@@ -1878,71 +1874,6 @@ miBankCreateGC(
}
static void
-miBankPaintWindow(
- WindowPtr pWin,
- RegionPtr pRegion,
- int what
-)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RegionRec tmpReg;
- int i;
- PaintWindowProcPtr PaintWindow;
-
- SCREEN_INIT;
- SCREEN_SAVE;
-
- if (what == PW_BORDER)
- {
- SCREEN_UNWRAP(PaintWindowBorder);
- PaintWindow = pScreen->PaintWindowBorder;
- }
- else
- {
- SCREEN_UNWRAP(PaintWindowBackground);
- PaintWindow = pScreen->PaintWindowBackground;
- }
-
- if (!IS_BANKED(pWin))
- {
- (*PaintWindow)(pWin, pRegion, what);
- }
- else
- {
- REGION_NULL(pScreen, &tmpReg);
-
- for (i = 0; i < pScreenPriv->nBanks; i++)
- {
- if (!pScreenPriv->pBanks[i])
- continue;
-
- REGION_INTERSECT(pScreen, &tmpReg, pRegion,
- pScreenPriv->pBanks[i]);
-
- if (REGION_NIL(&tmpReg))
- continue;
-
- SET_SINGLE_BANK(pScreenPriv->pScreenPixmap, -1, -1, i);
-
- (*PaintWindow)(pWin, &tmpReg, what);
- }
-
- REGION_UNINIT(pScreen, &tmpReg);
- }
-
- if (what == PW_BORDER)
- {
- SCREEN_WRAP(PaintWindowBorder, miBankPaintWindow);
- }
- else
- {
- SCREEN_WRAP(PaintWindowBackground, miBankPaintWindow);
- }
-
- SCREEN_RESTORE;
-}
-
-static void
miBankCopyWindow(
WindowPtr pWindow,
DDXPointRec ptOldOrg,
@@ -2269,8 +2200,6 @@ miInitializeBanking(
SCREEN_WRAP(GetImage, miBankGetImage);
SCREEN_WRAP(GetSpans, miBankGetSpans);
SCREEN_WRAP(CreateGC, miBankCreateGC);
- SCREEN_WRAP(PaintWindowBackground, miBankPaintWindow);
- SCREEN_WRAP(PaintWindowBorder, miBankPaintWindow);
SCREEN_WRAP(CopyWindow, miBankCopyWindow);
BANK_SCRPRIVLVAL = (pointer)pScreenPriv;
diff --git a/mi/miexpose.c b/mi/miexpose.c
index e82a0b573..03d4c27e0 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -307,8 +307,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
/* PaintWindowBackground doesn't clip, so we have to */
REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList);
}
- (*pWin->drawable.pScreen->PaintWindowBackground)(
- (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
+ miPaintWindow((WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
if (extents)
{
@@ -517,7 +516,7 @@ miWindowExposures(pWin, prgn, other_exposed)
REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList);
}
if (prgn && !REGION_NIL(prgn))
- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND);
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
if (clientInterested && exposures && !REGION_NIL(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
@@ -534,60 +533,13 @@ miWindowExposures(pWin, prgn, other_exposed)
REGION_DESTROY( pWin->drawable.pScreen, exposures);
}
-
-/*
- this code is highly unlikely. it is not haile selassie.
-
- there is some hair here. we can't just use the window's
-clip region as it is, because if we are painting the border,
-the border is not in the client area and so we will be excluded
-when we validate the GC, and if we are painting a parent-relative
-background, the area we want to paint is in some other window.
-since we trust the code calling us to tell us to paint only areas
-that are really ours, we will temporarily give the window a
-clipList the size of the whole screen and an origin at (0,0).
-this more or less assumes that ddX code will do translation
-based on the window's absolute position, and that ValidateGC will
-look at clipList, and that no other fields from the
-window will be used. it's not possible to just draw
-in the root because it may be a different depth.
-
-to get the tile to align correctly we set the GC's tile origin to
-be the (x,y) of the window's upper left corner, after which we
-get the right bits when drawing into the root.
-
-because the clip_mask is being set to None, we may call DoChangeGC with
-fPointer set true, thus we no longer need to install the background or
-border tile in the resource table.
-*/
-
-static RESTYPE ResType = 0;
-static int numGCs = 0;
-static GCPtr screenContext[MAXSCREENS];
-
-/*ARGSUSED*/
-static int
-tossGC (
- pointer value,
- XID id)
-{
- GCPtr pGC = (GCPtr)value;
- screenContext[pGC->pScreen->myNum] = (GCPtr)NULL;
- FreeGC (pGC, id);
- numGCs--;
- if (!numGCs)
- ResType = 0;
-
- return 0;
-}
-
_X_EXPORT void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
ChangeGCVal gcval[5];
BITS32 gcmask;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pPixmap;
GCPtr pGC;
int i;
BoxPtr pbox;
@@ -595,8 +547,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
int numRects;
int xoff, yoff;
- while (pWin->backgroundState == ParentRelative)
- pWin = pWin->parent;
+ pPixmap = (*pScreen->GetWindowPixmap) (pWin);
#ifdef COMPOSITE
xoff = -pPixmap->screen_x;
@@ -610,6 +561,9 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
if (what == PW_BACKGROUND)
{
+ while (pWin->backgroundState == ParentRelative)
+ pWin = pWin->parent;
+
switch (pWin->backgroundState) {
case None:
return;
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index 1dbb85da5..1dd28b85b 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -865,9 +865,10 @@ miOverlayHandleExposures(WindowPtr pWin)
while (1) {
if((mival = pTree->valdata)) {
if(!((*pPriv->InOverlay)(pTree->pWin))) {
- if (REGION_NOTEMPTY(pScreen, &mival->borderExposed))
- (*pWin->drawable.pScreen->PaintWindowBorder)(
- pTree->pWin, &mival->borderExposed, PW_BORDER);
+ if (REGION_NOTEMPTY(pScreen, &mival->borderExposed)) {
+ miPaintWindow(pTree->pWin, &mival->borderExposed,
+ PW_BORDER);
+ }
REGION_UNINIT(pScreen, &mival->borderExposed);
(*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
@@ -903,10 +904,10 @@ miOverlayHandleExposures(WindowPtr pWin)
REGION_RECTS(&val->after.exposed));
}
} else {
- if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed))
- (*pChild->drawable.pScreen->PaintWindowBorder)(pChild,
- &val->after.borderExposed,
- PW_BORDER);
+ if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) {
+ miPaintWindow(pChild, &val->after.borderExposed,
+ PW_BORDER);
+ }
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
}
REGION_UNINIT(pScreen, &val->after.borderExposed);
@@ -1066,8 +1067,7 @@ miOverlayWindowExposures(
REGION_INTERSECT(pScreen, prgn, prgn, &pWin->clipList);
}
if (prgn && !REGION_NIL(prgn))
- (*pScreen->PaintWindowBackground)(
- pWin, prgn, PW_BACKGROUND);
+ miPaintWindow(pWin, prgn, PW_BACKGROUND);
if (clientInterested && exposures && !REGION_NIL(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
@@ -1738,7 +1738,7 @@ miOverlayClearToBackground(
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
- (*pScreen->PaintWindowBackground)(pWin, &reg, PW_BACKGROUND);
+ miPaintWindow(pWin, &reg, PW_BACKGROUND);
REGION_UNINIT(pScreen, &reg);
if (pBSReg)
REGION_DESTROY(pScreen, pBSReg);
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index cc40cbede..d88eb7118 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -251,7 +251,7 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->ValidateTree = miValidateTree;
pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
pScreen->WindowExposures = miWindowExposures;
- /* PaintWindowBackground, PaintWindowBorder, CopyWindow */
+ /* CopyWindow */
pScreen->ClearToBackground = miClearToBackground;
pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
pScreen->RestackWindow = (RestackWindowProcPtr) 0;
diff --git a/mi/miwindow.c b/mi/miwindow.c
index cab67ea07..77cb75009 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -118,7 +118,7 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
- (*pScreen->PaintWindowBackground)(pWin, &reg, PW_BACKGROUND);
+ miPaintWindow(pWin, &reg, PW_BACKGROUND);
REGION_UNINIT(pScreen, &reg);
if (pBSReg)
REGION_DESTROY(pScreen, pBSReg);
@@ -451,9 +451,7 @@ miHandleValidateExposures(pWin)
if ( (val = pChild->valdata) )
{
if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed))
- (*pChild->drawable.pScreen->PaintWindowBorder)(pChild,
- &val->after.borderExposed,
- PW_BORDER);
+ miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
REGION_UNINIT(pScreen, &val->after.borderExposed);
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
REGION_UNINIT(pScreen, &val->after.exposed);