diff options
author | Eric Anholt <eric@anholt.net> | 2007-09-12 13:58:46 +0000 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-09-13 00:08:53 +0000 |
commit | e4d11e58ce349dfe6af2f73ff341317f9b39684c (patch) | |
tree | 05509150343f56d8ec6c88e8da338bf99e6ec03f /afb | |
parent | 6da39c67905500ab2db00a45cda4a9f756cdde96 (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 'afb')
-rw-r--r-- | afb/Makefile.am | 2 | ||||
-rw-r--r-- | afb/afb.h | 15 | ||||
-rw-r--r-- | afb/afbpntwin.c | 126 | ||||
-rw-r--r-- | afb/afbscrinit.c | 9 | ||||
-rw-r--r-- | afb/afbwindow.c | 163 |
5 files changed, 6 insertions, 309 deletions
diff --git a/afb/Makefile.am b/afb/Makefile.am index d6b8901a1..9fc22ca54 100644 --- a/afb/Makefile.am +++ b/afb/Makefile.am @@ -6,7 +6,7 @@ libafb_gen_sources = afbbltC.c afbbltX.c afbbltCI.c afbbltO.c afbbltG.c afbtileC DISTCLEANFILES = $(libafb_gen_sources) -libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpntwin.c afbpixmap.c \ +libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpixmap.c \ afbimage.c afbline.c afbbres.c afbhrzvert.c afbbresd.c afbpushpxl.c afbply1rct.c \ afbzerarc.c afbfillarc.c afbfillsp.c afbsetsp.c afbscrinit.c afbplygblt.c \ afbclip.c afbgetsp.c afbpolypnt.c afbbitblt.c afbcmap.c afbimggblt.c afbpntarea.c \ @@ -506,11 +506,6 @@ extern void afbCopyRotatePixmap( int /*xrot*/, int /*yrot*/ ); -extern void afbPaintWindow( - WindowPtr /*pWin*/, - RegionPtr /*pRegion*/, - int /*what*/ -); /* afbpolypnt.c */ extern void afbPolyPoint( @@ -744,16 +739,6 @@ extern int frameWindowPrivateIndex; /* index into Window private array */ #define afbGetGCPrivate(pGC) \ ((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr)) -/* private field of window */ -typedef struct { - unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */ - unsigned char fastBackground; - unsigned short unused; /* pad for alignment with Sun compiler */ - DDXPointRec oldRotate; - PixmapPtr pRotatedBackground; - PixmapPtr pRotatedBorder; -} afbPrivWin; - /* Common macros for extracting drawing information */ #define afbGetTypedWidth(pDrawable,wtype)( \ diff --git a/afb/afbpntwin.c b/afb/afbpntwin.c deleted file mode 100644 index 6082f7caa..000000000 --- a/afb/afbpntwin.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> - -#include "windowstr.h" -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "afb.h" -#include "maskbits.h" -#include "mi.h" - -void -afbPaintWindow(pWin, pRegion, what) - WindowPtr pWin; - RegionPtr pRegion; - int what; -{ - register afbPrivWin *pPrivWin; - unsigned char rrops[AFB_MAX_DEPTH]; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - - switch (what) { - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - do { - pWin = pWin->parent; - } while (pWin->backgroundState == ParentRelative); - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, - what); - return; - case BackgroundPixmap: - if (pPrivWin->fastBackground) { - afbTileAreaPPWCopy((DrawablePtr)pWin, - REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pPrivWin->pRotatedBackground, ~0); - return; - } else { - afbTileAreaCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pWin->background.pixmap, 0, 0, ~0); - return; - } - break; - case BackgroundPixel: - afbReduceRop(GXcopy, pWin->background.pixel, ~0, - pWin->drawable.depth, rrops); - afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), rrops); - return; - } - break; - case PW_BORDER: - if (pWin->borderIsPixel) { - afbReduceRop(GXcopy, pWin->border.pixel, ~0, pWin->drawable.depth, - rrops); - afbSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), rrops); - return; - } else if (pPrivWin->fastBorder) { - afbTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), - REGION_RECTS(pRegion), GXcopy, - pPrivWin->pRotatedBorder, ~0); - return; - } - break; - } - miPaintWindow(pWin, pRegion, what); -} diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c index 71e8d4c1e..f3a054268 100644 --- a/afb/afbscrinit.c +++ b/afb/afbscrinit.c @@ -71,7 +71,6 @@ SOFTWARE. #ifdef PIXMAP_PER_WINDOW int frameWindowPrivateIndex; #endif -int afbWindowPrivateIndex; int afbGCPrivateIndex; int afbScreenPrivateIndex; @@ -140,20 +139,16 @@ afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) #ifdef PIXMAP_PER_WINDOW frameWindowPrivateIndex = AllocateWindowPrivateIndex(); #endif - afbWindowPrivateIndex = AllocateWindowPrivateIndex(); afbGCPrivateIndex = AllocateGCPrivateIndex(); afbGeneration = serverGeneration; } - if (pWinIndex) - *pWinIndex = afbWindowPrivateIndex; if (pGCIndex) *pGCIndex = afbGCPrivateIndex; afbScreenPrivateIndex = AllocateScreenPrivateIndex(); pScreen->GetWindowPixmap = afbGetWindowPixmap; pScreen->SetWindowPixmap = afbSetWindowPixmap; - return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) && - AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); + return(AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ @@ -198,8 +193,6 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i pScreen->ChangeWindowAttributes = afbChangeWindowAttributes; pScreen->RealizeWindow = afbMapWindow; pScreen->UnrealizeWindow = afbUnmapWindow; - pScreen->PaintWindowBackground = afbPaintWindow; - pScreen->PaintWindowBorder = afbPaintWindow; pScreen->CopyWindow = afbCopyWindow; pScreen->CreatePixmap = afbCreatePixmap; pScreen->DestroyPixmap = afbDestroyPixmap; diff --git a/afb/afbwindow.c b/afb/afbwindow.c index a4a1602bc..5c2f18aea 100644 --- a/afb/afbwindow.c +++ b/afb/afbwindow.c @@ -62,39 +62,16 @@ SOFTWARE. #include "maskbits.h" Bool -afbCreateWindow(pWin) - register WindowPtr pWin; +afbCreateWindow(WindowPtr pWin) { - register afbPrivWin *pPrivWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - pPrivWin->pRotatedBorder = NullPixmap; - pPrivWin->pRotatedBackground = NullPixmap; - pPrivWin->fastBackground = FALSE; - pPrivWin->fastBorder = FALSE; -#ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = - pWin->pDrawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; -#endif - return (TRUE); } /* This always returns true, because Xfree can't fail. It might be possible * on some devices for Destroy to fail */ Bool -afbDestroyWindow(pWin) - WindowPtr pWin; +afbDestroyWindow(WindowPtr pWin) { - register afbPrivWin *pPrivWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - - if (pPrivWin->pRotatedBorder) - (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder); - if (pPrivWin->pRotatedBackground) - (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground); - return (TRUE); } @@ -106,46 +83,10 @@ afbMapWindow(pWindow) return (TRUE); } -/* (x, y) is the upper left corner of the window on the screen - do we really need to pass this? (is it a;ready in pWin->absCorner?) - we only do the rotation for pixmaps that are 32 bits wide (padded -or otherwise.) - afbChangeWindowAttributes() has already put a copy of the pixmap -in pPrivWin->pRotated* -*/ - /*ARGSUSED*/ Bool -afbPositionWindow(pWin, x, y) - WindowPtr pWin; - int x, y; +afbPositionWindow(WindowPtr pWin, int x, int y) { - register afbPrivWin *pPrivWin; - int reset = 0; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) { - afbXRotatePixmap(pPrivWin->pRotatedBackground, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBackground, - pWin->drawable.y - pPrivWin->oldRotate.y); - reset = 1; - } - - if (!pWin->borderIsPixel && pPrivWin->fastBorder) { - while (pWin->backgroundState == ParentRelative) - pWin = pWin->parent; - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.y - pPrivWin->oldRotate.y); - reset = 1; - } - if (reset) { - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } - /* This is the "wrong" fix to the right problem, but it doesn't really * cost very much. When the window is moved, we need to invalidate any * RotatedPixmap that exists in any GC currently validated against this @@ -215,104 +156,8 @@ afbCopyWindow(pWin, ptOldOrg, prgnSrc) REGION_DESTROY(pWin->drawable.pScreen, prgnDst); } - - -/* swap in correct PaintWindow* routine. If we can use a fast output -routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy -of it in devPrivate. -*/ Bool -afbChangeWindowAttributes(pWin, mask) - register WindowPtr pWin; - register unsigned long mask; +afbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { - register unsigned long index; - register afbPrivWin *pPrivWin; - WindowPtr pBgWin; - - pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr); - /* - * When background state changes from ParentRelative and - * we had previously rotated the fast border pixmap to match - * the parent relative origin, rerotate to match window - */ - if (mask & (CWBackPixmap | CWBackPixel) && - pWin->backgroundState != ParentRelative && pPrivWin->fastBorder && - (pPrivWin->oldRotate.x != pWin->drawable.x || - pPrivWin->oldRotate.y != pWin->drawable.y)) { - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pWin->drawable.y - pPrivWin->oldRotate.y); - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } - while(mask) { - index = lowbit (mask); - mask &= ~index; - switch(index) { - case CWBackPixmap: - if (pWin->backgroundState == None) - pPrivWin->fastBackground = FALSE; - else if (pWin->backgroundState == ParentRelative) { - pPrivWin->fastBackground = FALSE; - /* Rotate border to match parent origin */ - if (pPrivWin->pRotatedBorder) { - for (pBgWin = pWin->parent; - pBgWin->backgroundState == ParentRelative; - pBgWin = pBgWin->parent); - afbXRotatePixmap(pPrivWin->pRotatedBorder, - pBgWin->drawable.x - pPrivWin->oldRotate.x); - afbYRotatePixmap(pPrivWin->pRotatedBorder, - pBgWin->drawable.y - pPrivWin->oldRotate.y); - pPrivWin->oldRotate.x = pBgWin->drawable.x; - pPrivWin->oldRotate.y = pBgWin->drawable.y; - } - } else if ((pWin->background.pixmap->drawable.width <= PPW) && - !(pWin->background.pixmap->drawable.width & - (pWin->background.pixmap->drawable.width - 1))) { - afbCopyRotatePixmap(pWin->background.pixmap, - &pPrivWin->pRotatedBackground, - pWin->drawable.x, pWin->drawable.y); - if (pPrivWin->pRotatedBackground) { - pPrivWin->fastBackground = TRUE; - pPrivWin->oldRotate.x = pWin->drawable.x; - pPrivWin->oldRotate.y = pWin->drawable.y; - } else - pPrivWin->fastBackground = FALSE; - } else - pPrivWin->fastBackground = FALSE; - break; - - case CWBackPixel: - pPrivWin->fastBackground = FALSE; - break; - - case CWBorderPixmap: - if ((pWin->border.pixmap->drawable.width <= PPW) && - !(pWin->border.pixmap->drawable.width & - (pWin->border.pixmap->drawable.width - 1))) { - for (pBgWin = pWin; - pBgWin->backgroundState == ParentRelative; - pBgWin = pBgWin->parent); - afbCopyRotatePixmap(pWin->border.pixmap, - &pPrivWin->pRotatedBorder, - pBgWin->drawable.x, pBgWin->drawable.y); - if (pPrivWin->pRotatedBorder) { - pPrivWin->fastBorder = TRUE; - pPrivWin->oldRotate.x = pBgWin->drawable.x; - pPrivWin->oldRotate.y = pBgWin->drawable.y; - } else - pPrivWin->fastBorder = FALSE; - } else - pPrivWin->fastBorder = FALSE; - break; - case CWBorderPixel: - pPrivWin->fastBorder = FALSE; - break; - } - } - /* Again, we have no failure modes indicated by any of the routines - * we've called, so we have to assume it worked */ return (TRUE); } |