Fix various cw issues, including a couple reported by deronj:

- Fix wrapping of GC ops/funcs according to policy described in bug #1045.
- Remove ValidateGC/ValidatePictures on the redirected drawables/pictures
    -- it's not needed, and DDXs shouldn't be seeing redirected drawables
    in render or GC ops/funcs when cw is running.
- Mark all GC/Picture state as dirty when moving from redirected to
    non-redirected, since it hadn't been passed down in Change* or
    Validate* while redirected.
- Remove CreatePicture wrapper that didn't do anything.
- Comment on why AddTraps wrapper isn't needed.
This commit is contained in:
Eric Anholt 2004-08-12 08:11:59 +00:00
parent 789cf3ed84
commit 6e0228722c
4 changed files with 41 additions and 48 deletions

View File

@ -163,19 +163,28 @@ cwDestroyGCPrivate(GCPtr pGC)
FreeGC(pPriv->pBackingGC, (XID)0); FreeGC(pPriv->pBackingGC, (XID)0);
setCwGC (pGC, pPriv->wrapFuncs); setCwGC (pGC, pPriv->wrapFuncs);
xfree((pointer)pPriv); xfree((pointer)pPriv);
/* The ChangeGC and ValidateGCs on the window haven't been passed down the
* stack, so report all state being changed.
*/
pGC->stateChanges |= (1 << (GCLastBit + 1)) - 1;
(*pGC->funcs->ChangeGC)(pGC, (1 << (GCLastBit + 1)) - 1);
} }
/* GCFuncs wrappers. These only get used when the drawable is a window with a /* GCFuncs wrappers. These only get used when the drawable is a window with a
* backing pixmap, to avoid the overhead in the non-window-backing-pixmap case. * backing pixmap, to avoid the overhead in the non-window-backing-pixmap case.
*/ */
#define FUNC_PROLOGUE(pGC, pPriv) \ #define FUNC_PROLOGUE(pGC, pPriv) do { \
((pGC)->funcs = pPriv->wrapFuncs), \ (pGC)->funcs = (pPriv)->wrapFuncs; \
((pGC)->ops = pPriv->wrapOps) (pGC)->ops = (pPriv)->wrapOps; \
} while (0)
#define FUNC_EPILOGUE(pGC, pPriv) \ #define FUNC_EPILOGUE(pGC, pPriv) do { \
((pGC)->funcs = &cwGCFuncs), \ (pPriv)->wrapFuncs = (pGC)->funcs; \
((pGC)->ops = &cwGCOps) (pPriv)->wrapOps = (pGC)->ops; \
(pGC)->funcs = &cwGCFuncs; \
(pGC)->ops = &cwGCOps; \
} while (0)
static void static void
cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
@ -199,13 +208,6 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
(*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable); (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
return; return;
} }
(*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
/*
* rewrap funcs and ops as Validate may have changed them
*/
pPriv->wrapFuncs = pGC->funcs;
pPriv->wrapOps = pGC->ops;
pBackingGC = pPriv->pBackingGC; pBackingGC = pPriv->pBackingGC;
pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off); pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
@ -332,8 +334,10 @@ cwDestroyClip(GCPtr pGC)
#define CHEAP_FUNC_PROLOGUE(pGC) \ #define CHEAP_FUNC_PROLOGUE(pGC) \
((pGC)->funcs = (GCFuncs *)(pGC)->devPrivates[cwGCIndex].ptr) ((pGC)->funcs = (GCFuncs *)(pGC)->devPrivates[cwGCIndex].ptr)
#define CHEAP_FUNC_EPILOGUE(pGC) \ #define CHEAP_FUNC_EPILOGUE(pGC) do { \
((pGC)->funcs = &cwCheapGCFuncs) (pGC)->devPrivates[cwGCIndex].ptr = (pointer)(pGC)->funcs; \
(pGC)->funcs = &cwCheapGCFuncs; \
} while (0)
static void static void
cwCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) cwCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
@ -425,12 +429,13 @@ cwCheapDestroyClip(GCPtr pGC)
* GC validation on BackingStore windows. * GC validation on BackingStore windows.
*/ */
#define SCREEN_PROLOGUE(pScreen, field)\ #define SCREEN_PROLOGUE(pScreen, field) \
((pScreen)->field = getCwScreen(pScreen)->field) ((pScreen)->field = getCwScreen(pScreen)->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\ #define SCREEN_EPILOGUE(pScreen, field, wrapper) do { \
((getCwScreen(pScreen)->field = (pScreen)->field), \ getCwScreen(pScreen)->field = (pScreen)->field; \
((pScreen)->field = (wrapper))) (pScreen)->field = (wrapper); \
} while (0)
static Bool static Bool
cwCreateGC(GCPtr pGC) cwCreateGC(GCPtr pGC)

View File

@ -64,7 +64,6 @@ typedef struct {
PaintWindowBorderProcPtr PaintWindowBorder; PaintWindowBorderProcPtr PaintWindowBorder;
#ifdef RENDER #ifdef RENDER
CreatePictureProcPtr CreatePicture;
DestroyPictureProcPtr DestroyPicture; DestroyPictureProcPtr DestroyPicture;
ChangePictureClipProcPtr ChangePictureClip; ChangePictureClipProcPtr ChangePictureClip;
DestroyPictureClipProcPtr DestroyPictureClip; DestroyPictureClipProcPtr DestroyPictureClip;
@ -82,9 +81,6 @@ typedef struct {
TriFanProcPtr TriFan; TriFanProcPtr TriFan;
RasterizeTrapezoidProcPtr RasterizeTrapezoid; RasterizeTrapezoidProcPtr RasterizeTrapezoid;
#if 0
AddTrapsProcPtr AddTraps;
#endif
#endif #endif
} cwScreenRec, *cwScreenPtr; } cwScreenRec, *cwScreenPtr;

View File

@ -26,7 +26,6 @@
#define SETUP_BACKING_DST(_pDst, _pGC) \ #define SETUP_BACKING_DST(_pDst, _pGC) \
cwGCPtr pGCPrivate = getCwGC (_pGC); \ cwGCPtr pGCPrivate = getCwGC (_pGC); \
GCFuncs *oldFuncs = (_pGC)->funcs; \
GCPtr pBackingGC = pGCPrivate->pBackingGC; \ GCPtr pBackingGC = pGCPrivate->pBackingGC; \
int dst_off_x, dst_off_y; \ int dst_off_x, dst_off_y; \
DrawablePtr pBackingDst = cwGetBackingDrawable(pDst, &dst_off_x, \ DrawablePtr pBackingDst = cwGetBackingDrawable(pDst, &dst_off_x, \
@ -39,13 +38,11 @@
#define PROLOGUE(pGC) do { \ #define PROLOGUE(pGC) do { \
pGC->ops = pGCPrivate->wrapOps;\ pGC->ops = pGCPrivate->wrapOps;\
pGC->funcs = pGCPrivate->wrapFuncs; \
} while (0) } while (0)
#define EPILOGUE(pGC) do { \ #define EPILOGUE(pGC) do { \
pGCPrivate->wrapOps = (pGC)->ops; \ pGCPrivate->wrapOps = (pGC)->ops; \
(pGC)->ops = &cwGCOps; \ (pGC)->ops = &cwGCOps; \
(pGC)->funcs = oldFuncs; \
} while (0) } while (0)
/* /*

View File

@ -74,6 +74,8 @@ cwCreateBackingPicture (PicturePtr pPicture)
pBackingPicture = CreatePicture (0, &pPixmap->drawable, pPicture->pFormat, pBackingPicture = CreatePicture (0, &pPixmap->drawable, pPicture->pFormat,
0, 0, serverClient, &error); 0, 0, serverClient, &error);
if (!pBackingPicture)
return NULL;
pPicture->devPrivates[cwPictureIndex].ptr = pBackingPicture; pPicture->devPrivates[cwPictureIndex].ptr = pBackingPicture;
@ -118,19 +120,6 @@ cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off)
} }
} }
static int
cwCreatePicture (PicturePtr pPicture)
{
int ret;
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
cwPsDecl(pScreen);
cwPsUnwrap (CreatePicture);
ret = (*ps->CreatePicture) (pPicture);
cwPsWrap (CreatePicture, cwCreatePicture);
return ret;
}
static void static void
cwDestroyPicture (PicturePtr pPicture) cwDestroyPicture (PicturePtr pPicture)
{ {
@ -141,6 +130,11 @@ cwDestroyPicture (PicturePtr pPicture)
cwDestroyBackingPicture (pPicture); cwDestroyBackingPicture (pPicture);
(*ps->DestroyPicture) (pPicture); (*ps->DestroyPicture) (pPicture);
cwPsWrap(DestroyPicture, cwDestroyPicture); cwPsWrap(DestroyPicture, cwDestroyPicture);
/* The ChangePicture and ValidatePictures on the window haven't been passed
* down the stack, so report all state being changed.
*/
pPicture->stateChanges |= (1 << (CPLastBit + 1)) - 1;
(*ps->ChangePicture) (pPicture, (1 << (CPLastBit + 1)) - 1);
} }
static void static void
@ -173,21 +167,21 @@ cwValidatePicture (PicturePtr pPicture,
cwPictureDecl; cwPictureDecl;
cwPsUnwrap(ValidatePicture); cwPsUnwrap(ValidatePicture);
(*ps->ValidatePicture) (pPicture, mask);
if (!cwDrawableIsRedirWindow (pPicture->pDrawable)) if (!cwDrawableIsRedirWindow (pPicture->pDrawable))
{ {
if (pBackingPicture) if (pBackingPicture)
cwDestroyBackingPicture (pPicture); cwDestroyBackingPicture (pPicture);
(*ps->ValidatePicture) (pPicture, mask);
} }
else else
{ {
DrawablePtr pDrawable = pPicture->pDrawable;
WindowPtr pWin = (WindowPtr) (pDrawable);
DrawablePtr pBackingDrawable; DrawablePtr pBackingDrawable;
int x_off, y_off; int x_off, y_off;
if (pBackingPicture && pBackingPicture->pDrawable != pBackingDrawable = cwGetBackingDrawable(pPicture->pDrawable, &x_off,
&(*pScreen->GetWindowPixmap) ((WindowPtr) pPicture->pDrawable)->drawable) &y_off);
if (pBackingPicture && pBackingPicture->pDrawable != pBackingDrawable)
{ {
cwDestroyBackingPicture (pPicture); cwDestroyBackingPicture (pPicture);
pBackingPicture = 0; pBackingPicture = 0;
@ -198,13 +192,12 @@ cwValidatePicture (PicturePtr pPicture,
pBackingPicture = cwCreateBackingPicture (pPicture); pBackingPicture = cwCreateBackingPicture (pPicture);
if (!pBackingPicture) if (!pBackingPicture)
{ {
(*ps->ValidatePicture) (pPicture, mask);
cwPsWrap(ValidatePicture, cwValidatePicture); cwPsWrap(ValidatePicture, cwValidatePicture);
return; return;
} }
} }
pBackingDrawable = cwGetBackingDrawable (&pWin->drawable, &x_off,&y_off);
SetPictureTransform(pBackingPicture, pPicture->transform); SetPictureTransform(pBackingPicture, pPicture->transform);
/* XXX Set filters */ /* XXX Set filters */
@ -442,7 +435,6 @@ cwInitializeRender (ScreenPtr pScreen)
{ {
cwPsDecl (pScreen); cwPsDecl (pScreen);
cwPsWrap(CreatePicture, cwCreatePicture);
cwPsWrap(DestroyPicture, cwDestroyPicture); cwPsWrap(DestroyPicture, cwDestroyPicture);
cwPsWrap(ChangePicture, cwChangePicture); cwPsWrap(ChangePicture, cwChangePicture);
cwPsWrap(ValidatePicture, cwValidatePicture); cwPsWrap(ValidatePicture, cwValidatePicture);
@ -453,6 +445,10 @@ cwInitializeRender (ScreenPtr pScreen)
cwPsWrap(Triangles, cwTriangles); cwPsWrap(Triangles, cwTriangles);
cwPsWrap(TriStrip, cwTriStrip); cwPsWrap(TriStrip, cwTriStrip);
cwPsWrap(TriFan, cwTriFan); cwPsWrap(TriFan, cwTriFan);
/* There is no need to wrap AddTraps as far as we can tell. AddTraps can
* only be done on alpha-only pictures, and we won't be getting
* alpha-only window pictures, so there's no need to translate.
*/
} }
void void
@ -460,7 +456,6 @@ cwFiniRender (ScreenPtr pScreen)
{ {
cwPsDecl (pScreen); cwPsDecl (pScreen);
cwPsUnwrap(CreatePicture);
cwPsUnwrap(DestroyPicture); cwPsUnwrap(DestroyPicture);
cwPsUnwrap(ChangePicture); cwPsUnwrap(ChangePicture);
cwPsUnwrap(ValidatePicture); cwPsUnwrap(ValidatePicture);