mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-22 01:20:26 +00:00
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.
This commit is contained in:
parent
6da39c6790
commit
e4d11e58ce
107 changed files with 62 additions and 4720 deletions
|
|
@ -568,10 +568,6 @@ extern void PclCopyWindow(
|
|||
extern Bool PclChangeWindowAttributes(
|
||||
register WindowPtr pWin,
|
||||
register unsigned long mask);
|
||||
extern void PclPaintWindow(
|
||||
WindowPtr pWin,
|
||||
RegionPtr pRegion,
|
||||
int what);
|
||||
|
||||
/******
|
||||
* Functions in PclFonts.c
|
||||
|
|
|
|||
|
|
@ -201,8 +201,6 @@ InitializePclDriver(
|
|||
pScreen->RealizeWindow = PclMapWindow;
|
||||
pScreen->UnrealizeWindow = PclUnmapWindow;
|
||||
*/
|
||||
pScreen->PaintWindowBackground = PclPaintWindow;
|
||||
pScreen->PaintWindowBorder = PclPaintWindow;
|
||||
pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */
|
||||
|
||||
pScreen->CreatePixmap = fbCreatePixmap;
|
||||
|
|
|
|||
|
|
@ -198,232 +198,6 @@ PclChangeWindowAttributes(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is largely ripped from miPaintWindow, but modified so
|
||||
* that the background is not painted to the root window, and so that
|
||||
* the backing store is not referenced.
|
||||
*/
|
||||
void
|
||||
PclPaintWindow(
|
||||
WindowPtr pWin,
|
||||
RegionPtr pRegion,
|
||||
int what)
|
||||
{
|
||||
|
||||
#define FUNCTION 0
|
||||
#define FOREGROUND 1
|
||||
#define TILE 2
|
||||
#define FILLSTYLE 3
|
||||
#define ABSX 4
|
||||
#define ABSY 5
|
||||
#define CLIPMASK 6
|
||||
#define SUBWINDOW 7
|
||||
#define COUNT_BITS 8
|
||||
|
||||
pointer gcval[7];
|
||||
pointer newValues [COUNT_BITS];
|
||||
|
||||
BITS32 gcmask, index, mask;
|
||||
RegionRec prgnWin;
|
||||
DDXPointRec oldCorner;
|
||||
BoxRec box;
|
||||
WindowPtr pBgWin;
|
||||
GCPtr pGC;
|
||||
register int i;
|
||||
register BoxPtr pbox;
|
||||
register ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
register xRectangle *prect;
|
||||
int numRects;
|
||||
|
||||
gcmask = 0;
|
||||
|
||||
/*
|
||||
* We don't want to paint a window that has no place to put the
|
||||
* PCL output.
|
||||
*/
|
||||
if( PclGetContextFromWindow( pWin ) == (XpContextPtr)NULL )
|
||||
return;
|
||||
|
||||
if (what == PW_BACKGROUND)
|
||||
{
|
||||
switch (pWin->backgroundState) {
|
||||
case None:
|
||||
return;
|
||||
case ParentRelative:
|
||||
(*pWin->parent->drawable.pScreen->PaintWindowBackground)
|
||||
(pWin->parent, pRegion, what);
|
||||
return;
|
||||
case BackgroundPixel:
|
||||
newValues[FOREGROUND] = (pointer)pWin->background.pixel;
|
||||
newValues[FILLSTYLE] = (pointer)FillSolid;
|
||||
gcmask |= GCForeground | GCFillStyle;
|
||||
break;
|
||||
case BackgroundPixmap:
|
||||
newValues[TILE] = (pointer)pWin->background.pixmap;
|
||||
newValues[FILLSTYLE] = (pointer)FillTiled;
|
||||
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin |
|
||||
GCTileStipYOrigin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pWin->borderIsPixel)
|
||||
{
|
||||
newValues[FOREGROUND] = (pointer)pWin->border.pixel;
|
||||
newValues[FILLSTYLE] = (pointer)FillSolid;
|
||||
gcmask |= GCForeground | GCFillStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
newValues[TILE] = (pointer)pWin->border.pixmap;
|
||||
newValues[FILLSTYLE] = (pointer)FillTiled;
|
||||
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin
|
||||
| GCTileStipYOrigin;
|
||||
}
|
||||
}
|
||||
|
||||
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(pRegion) *
|
||||
sizeof(xRectangle));
|
||||
if (!prect)
|
||||
return;
|
||||
|
||||
newValues[FUNCTION] = (pointer)GXcopy;
|
||||
gcmask |= GCFunction | GCClipMask;
|
||||
|
||||
i = pScreen->myNum;
|
||||
|
||||
pBgWin = pWin;
|
||||
if (what == PW_BORDER)
|
||||
{
|
||||
while (pBgWin->backgroundState == ParentRelative)
|
||||
pBgWin = pBgWin->parent;
|
||||
}
|
||||
|
||||
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
|
||||
if (!pGC)
|
||||
{
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* mash the clip list so we can paint the border by
|
||||
* mangling the window in place, pretending it
|
||||
* spans the entire screen
|
||||
*/
|
||||
if (what == PW_BORDER)
|
||||
{
|
||||
prgnWin = pWin->clipList;
|
||||
oldCorner.x = pWin->drawable.x;
|
||||
oldCorner.y = pWin->drawable.y;
|
||||
pWin->drawable.x = pWin->drawable.y = 0;
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = pScreen->width;
|
||||
box.y2 = pScreen->height;
|
||||
REGION_INIT(pScreen, &pWin->clipList, &box, 1);
|
||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
newValues[ABSX] = (pointer)(long)pBgWin->drawable.x;
|
||||
newValues[ABSY] = (pointer)(long)pBgWin->drawable.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
newValues[ABSX] = (pointer)0;
|
||||
newValues[ABSY] = (pointer)0;
|
||||
}
|
||||
|
||||
mask = gcmask;
|
||||
gcmask = 0;
|
||||
i = 0;
|
||||
while (mask) {
|
||||
index = lowbit (mask);
|
||||
mask &= ~index;
|
||||
switch (index) {
|
||||
case GCFunction:
|
||||
if ((pointer)(long) pGC->alu != newValues[FUNCTION]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FUNCTION];
|
||||
}
|
||||
break;
|
||||
case GCTileStipXOrigin:
|
||||
if ((pointer)(long) pGC->patOrg.x != newValues[ABSX]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[ABSX];
|
||||
}
|
||||
break;
|
||||
case GCTileStipYOrigin:
|
||||
if ((pointer)(long) pGC->patOrg.y != newValues[ABSY]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[ABSY];
|
||||
}
|
||||
break;
|
||||
case GCClipMask:
|
||||
if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = (pointer)CT_NONE;
|
||||
}
|
||||
break;
|
||||
case GCSubwindowMode:
|
||||
if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[SUBWINDOW];
|
||||
}
|
||||
break;
|
||||
case GCTile:
|
||||
if (pGC->tileIsPixel ||
|
||||
(pointer) pGC->tile.pixmap != newValues[TILE])
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[TILE];
|
||||
}
|
||||
break;
|
||||
case GCFillStyle:
|
||||
if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FILLSTYLE];
|
||||
}
|
||||
break;
|
||||
case GCForeground:
|
||||
if ((pointer) pGC->fgPixel != newValues[FOREGROUND]) {
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FOREGROUND];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gcmask)
|
||||
DoChangeGC(pGC, gcmask, (XID *)gcval, 1);
|
||||
|
||||
if (pWin->drawable.serialNumber != pGC->serialNumber)
|
||||
ValidateGC((DrawablePtr)pWin, pGC);
|
||||
|
||||
numRects = REGION_NUM_RECTS(pRegion);
|
||||
pbox = REGION_RECTS(pRegion);
|
||||
for (i= numRects; --i >= 0; pbox++, prect++)
|
||||
{
|
||||
prect->x = pbox->x1 - pWin->drawable.x;
|
||||
prect->y = pbox->y1 - pWin->drawable.y;
|
||||
prect->width = pbox->x2 - pbox->x1;
|
||||
prect->height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
prect -= numRects;
|
||||
(*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
|
||||
if (what == PW_BORDER)
|
||||
{
|
||||
REGION_UNINIT(pScreen, &pWin->clipList);
|
||||
pWin->clipList = prgnWin;
|
||||
pWin->drawable.x = oldCorner.x;
|
||||
pWin->drawable.y = oldCorner.y;
|
||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
}
|
||||
FreeScratchGC(pGC);
|
||||
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
PclDestroyWindow(
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ copyright holders.
|
|||
#define PclUnmapWindow PCLNAME(UnmapWindow)
|
||||
#define PclCopyWindow PCLNAME(CopyWindow)
|
||||
#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
|
||||
#define PclPaintWindow PCLNAME(PaintWindow)
|
||||
#define PclDestroyWindow PCLNAME(DestroyWindow)
|
||||
|
||||
/* PclGC.c */
|
||||
|
|
|
|||
|
|
@ -517,7 +517,6 @@ extern Bool PsUnmapWindow(WindowPtr pWin);
|
|||
extern void PsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
|
||||
RegionPtr prgnSrc);
|
||||
extern Bool PsChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
|
||||
extern void PsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
|
||||
extern Bool PsDestroyWindow(WindowPtr pWin);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -169,8 +169,6 @@ InitializePsDriver(ndx, pScreen, argc, argv)
|
|||
pScreen->ChangeWindowAttributes = PsChangeWindowAttributes;
|
||||
pScreen->RealizeWindow = PsMapWindow;
|
||||
pScreen->UnrealizeWindow = PsUnmapWindow;
|
||||
pScreen->PaintWindowBackground = PsPaintWindow;
|
||||
pScreen->PaintWindowBorder = PsPaintWindow;
|
||||
pScreen->CloseScreen = PsCloseScreen;
|
||||
pScreen->CopyWindow = PsCopyWindow;
|
||||
/* XXX Hard routine to write! */
|
||||
|
|
|
|||
|
|
@ -213,230 +213,6 @@ PsChangeWindowAttributes(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PsPaintWindow(
|
||||
WindowPtr pWin,
|
||||
RegionPtr pRegion,
|
||||
int what)
|
||||
{
|
||||
WindowPtr pRoot;
|
||||
|
||||
#define FUNCTION 0
|
||||
#define FOREGROUND 1
|
||||
#define TILE 2
|
||||
#define FILLSTYLE 3
|
||||
#define ABSX 4
|
||||
#define ABSY 5
|
||||
#define CLIPMASK 6
|
||||
#define SUBWINDOW 7
|
||||
#define COUNT_BITS 8
|
||||
|
||||
pointer gcval[7];
|
||||
pointer newValues [COUNT_BITS];
|
||||
|
||||
BITS32 gcmask, index, mask;
|
||||
RegionRec prgnWin;
|
||||
DDXPointRec oldCorner;
|
||||
BoxRec box;
|
||||
WindowPtr pBgWin;
|
||||
GCPtr pGC;
|
||||
register int i;
|
||||
register BoxPtr pbox;
|
||||
register ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
register xRectangle *prect;
|
||||
int numRects;
|
||||
|
||||
gcmask = 0;
|
||||
|
||||
/*
|
||||
* We don't want to paint a window that has no place to put the
|
||||
* PS output.
|
||||
*/
|
||||
if( PsGetContextFromWindow(pWin)==(XpContextPtr)NULL ) return;
|
||||
|
||||
if( what==PW_BACKGROUND )
|
||||
{
|
||||
switch(pWin->backgroundState)
|
||||
{
|
||||
case None: return;
|
||||
case ParentRelative:
|
||||
(*pWin->parent->drawable.pScreen->PaintWindowBackground)
|
||||
(pWin->parent, pRegion, what);
|
||||
return;
|
||||
case BackgroundPixel:
|
||||
newValues[FOREGROUND] = (pointer)pWin->background.pixel;
|
||||
newValues[FILLSTYLE] = (pointer)FillSolid;
|
||||
gcmask |= GCForeground | GCFillStyle;
|
||||
break;
|
||||
case BackgroundPixmap:
|
||||
newValues[TILE] = (pointer)pWin->background.pixmap;
|
||||
newValues[FILLSTYLE] = (pointer)FillTiled;
|
||||
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pWin->borderIsPixel )
|
||||
{
|
||||
newValues[FOREGROUND] = (pointer)pWin->border.pixel;
|
||||
newValues[FILLSTYLE] = (pointer)FillSolid;
|
||||
gcmask |= GCForeground | GCFillStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
newValues[TILE] = (pointer)pWin->border.pixmap;
|
||||
newValues[FILLSTYLE] = (pointer)FillTiled;
|
||||
gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin;
|
||||
}
|
||||
}
|
||||
|
||||
prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(pRegion) *
|
||||
sizeof(xRectangle));
|
||||
if( !prect ) return;
|
||||
|
||||
newValues[FUNCTION] = (pointer)GXcopy;
|
||||
gcmask |= GCFunction | GCClipMask;
|
||||
|
||||
i = pScreen->myNum;
|
||||
pRoot = WindowTable[i];
|
||||
|
||||
pBgWin = pWin;
|
||||
if (what == PW_BORDER)
|
||||
{
|
||||
while( pBgWin->backgroundState==ParentRelative ) pBgWin = pBgWin->parent;
|
||||
}
|
||||
|
||||
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
|
||||
if( !pGC )
|
||||
{
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* mash the clip list so we can paint the border by
|
||||
* mangling the window in place, pretending it
|
||||
* spans the entire screen
|
||||
*/
|
||||
if( what==PW_BORDER )
|
||||
{
|
||||
prgnWin = pWin->clipList;
|
||||
oldCorner.x = pWin->drawable.x;
|
||||
oldCorner.y = pWin->drawable.y;
|
||||
pWin->drawable.x = pWin->drawable.y = 0;
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = pScreen->width;
|
||||
box.y2 = pScreen->height;
|
||||
REGION_INIT(pScreen, &pWin->clipList, &box, 1);
|
||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
newValues[ABSX] = (pointer)(long)pBgWin->drawable.x;
|
||||
newValues[ABSY] = (pointer)(long)pBgWin->drawable.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
newValues[ABSX] = (pointer)0;
|
||||
newValues[ABSY] = (pointer)0;
|
||||
}
|
||||
|
||||
mask = gcmask;
|
||||
gcmask = 0;
|
||||
i = 0;
|
||||
while( mask )
|
||||
{
|
||||
index = lowbit (mask);
|
||||
mask &= ~index;
|
||||
switch(index)
|
||||
{
|
||||
case GCFunction:
|
||||
if( (pointer)(long)pGC->alu!=newValues[FUNCTION] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FUNCTION];
|
||||
}
|
||||
break;
|
||||
case GCTileStipXOrigin:
|
||||
if( (pointer)(long)pGC->patOrg.x!=newValues[ABSX] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[ABSX];
|
||||
}
|
||||
break;
|
||||
case GCTileStipYOrigin:
|
||||
if( (pointer)(long)pGC->patOrg.y!=newValues[ABSY] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[ABSY];
|
||||
}
|
||||
break;
|
||||
case GCClipMask:
|
||||
if( (pointer)pGC->clientClipType!=(pointer)CT_NONE )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = (pointer)CT_NONE;
|
||||
}
|
||||
break;
|
||||
case GCSubwindowMode:
|
||||
if( (pointer)pGC->subWindowMode!=newValues[SUBWINDOW] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[SUBWINDOW];
|
||||
}
|
||||
break;
|
||||
case GCTile:
|
||||
if( pGC->tileIsPixel || (pointer)pGC->tile.pixmap!=newValues[TILE] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[TILE];
|
||||
}
|
||||
break;
|
||||
case GCFillStyle:
|
||||
if( (pointer)pGC->fillStyle!=newValues[FILLSTYLE] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FILLSTYLE];
|
||||
}
|
||||
break;
|
||||
case GCForeground:
|
||||
if( (pointer)pGC->fgPixel!=newValues[FOREGROUND] )
|
||||
{
|
||||
gcmask |= index;
|
||||
gcval[i++] = newValues[FOREGROUND];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( gcmask ) DoChangeGC(pGC, gcmask, (XID *)gcval, 1);
|
||||
|
||||
if( pWin->drawable.serialNumber!=pGC->serialNumber )
|
||||
ValidateGC((DrawablePtr)pWin, pGC);
|
||||
|
||||
numRects = REGION_NUM_RECTS(pRegion);
|
||||
pbox = REGION_RECTS(pRegion);
|
||||
for( i=numRects ; --i >= 0 ; pbox++,prect++ )
|
||||
{
|
||||
prect->x = pbox->x1 - pWin->drawable.x;
|
||||
prect->y = pbox->y1 - pWin->drawable.y;
|
||||
prect->width = pbox->x2 - pbox->x1;
|
||||
prect->height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
prect -= numRects;
|
||||
(*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect);
|
||||
DEALLOCATE_LOCAL(prect);
|
||||
|
||||
if( what==PW_BORDER )
|
||||
{
|
||||
REGION_UNINIT(pScreen, &pWin->clipList);
|
||||
pWin->clipList = prgnWin;
|
||||
pWin->drawable.x = oldCorner.x;
|
||||
pWin->drawable.y = oldCorner.y;
|
||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
}
|
||||
FreeScratchGC(pGC);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
Bool
|
||||
PsDestroyWindow(WindowPtr pWin)
|
||||
|
|
|
|||
Loading…
Reference in a new issue