Add framebuffer access wrapper infrastructure.

Create fbPrepareAccess macros to call into the driver to set up the
wfbReadMemory and wfbWriteWemory pointers.  Call these from fbGetDrawable and
fbGetStipDrawable.

Add the READ and WRITE macros, which expand to simple memory accesses for fb,
and calls through the function pointers for wfb.

Add fbFinishAccess macro to give the driver an opportunity to clean up.  Add
calls to this in the appropriate places.
This commit is contained in:
Aaron Plattner 2006-07-10 18:58:09 -07:00
parent 319efac445
commit a4005c15fb
24 changed files with 266 additions and 9 deletions

69
fb/fb.h
View File

@ -47,8 +47,12 @@
#ifdef FB_ACCESS_WRAPPER #ifdef FB_ACCESS_WRAPPER
#include "wfbrename.h" #include "wfbrename.h"
#define FBPREFIX(x) wfb##x #define FBPREFIX(x) wfb##x
#define WRITE(ptr, val) ((*wfbWriteMemory)(ptr, val))
#define READ(ptr) ((*wfbReadMemory)(ptr))
#else #else
#define FBPREFIX(x) fb##x #define FBPREFIX(x) fb##x
#define WRITE(ptr, val) (*(ptr) = (val))
#define READ(ptr) (*(ptr))
#endif #endif
/* /*
@ -595,6 +599,34 @@ extern WindowPtr *WindowTable;
#define FB_SCREEN_PRIVATE #define FB_SCREEN_PRIVATE
#endif #endif
/* Framebuffer access wrapper */
#ifdef FB_ACCESS_WRAPPER
typedef FbBits (*ReadMemoryProcPtr)(FbBits *src);
typedef void (*WriteMemoryProcPtr)(FbBits *dst, FbBits value);
typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
WriteMemoryProcPtr *pWrite,
PixmapPtr pPixmap);
typedef void (*FinishWrapProcPtr)(PixmapPtr pPixmap);
#define fbPrepareAccess(pPix) \
fbGetScreenPrivate((pPix)->drawable.pScreen)->setupWrap( \
&wfbReadMemory, \
&wfbWriteMemory, \
(pPix))
#define fbFinishAccess(pDrawable) { \
PixmapPtr _pPix; \
if ((pDrawable)->type != DRAWABLE_PIXMAP) \
_pPix = fbGetWindowPixmap(pDrawable); \
else \
_pPix = (PixmapPtr) (pDrawable); \
fbGetScreenPrivate(_pPix->drawable.pScreen)->finishWrap(_pPix); \
}
#else
#define fbPrepareAccess(pPix)
#define fbFinishAccess(pDraw)
#endif
#ifdef FB_SCREEN_PRIVATE #ifdef FB_SCREEN_PRIVATE
extern int fbScreenPrivateIndex; extern int fbScreenPrivateIndex;
extern int fbGetScreenPrivateIndex(void); extern int fbGetScreenPrivateIndex(void);
@ -603,6 +635,10 @@ extern int fbGetScreenPrivateIndex(void);
typedef struct { typedef struct {
unsigned char win32bpp; /* window bpp for 32-bpp images */ unsigned char win32bpp; /* window bpp for 32-bpp images */
unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */ unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
#ifdef FB_ACCESS_WRAPPER
SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */
FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */
#endif
} FbScreenPrivRec, *FbScreenPrivPtr; } FbScreenPrivRec, *FbScreenPrivPtr;
#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
@ -681,6 +717,7 @@ typedef struct {
(xoff) = __fbPixOffXPix(_pPix); \ (xoff) = __fbPixOffXPix(_pPix); \
(yoff) = __fbPixOffYPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \
} \ } \
fbPrepareAccess(_pPix); \
(pointer) = (FbBits *) _pPix->devPrivate.ptr; \ (pointer) = (FbBits *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \ (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
@ -697,6 +734,7 @@ typedef struct {
(xoff) = __fbPixOffXPix(_pPix); \ (xoff) = __fbPixOffXPix(_pPix); \
(yoff) = __fbPixOffYPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \
} \ } \
fbPrepareAccess(_pPix); \
(pointer) = (FbStip *) _pPix->devPrivate.ptr; \ (pointer) = (FbStip *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \ (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
@ -1745,6 +1783,31 @@ fbSetupScreen(ScreenPtr pScreen,
int width, /* pixel width of frame buffer */ int width, /* pixel width of frame buffer */
int bpp); /* bits per pixel of frame buffer */ int bpp); /* bits per pixel of frame buffer */
#ifdef FB_ACCESS_WRAPPER
Bool
wfbFinishScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap);
Bool
wfbScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap);
#else
Bool Bool
fbFinishScreenInit(ScreenPtr pScreen, fbFinishScreenInit(ScreenPtr pScreen,
pointer pbits, pointer pbits,
@ -1764,6 +1827,7 @@ fbScreenInit(ScreenPtr pScreen,
int dpiy, int dpiy,
int width, int width,
int bpp); int bpp);
#endif
void void
fbInitializeBackingStore (ScreenPtr pScreen); fbInitializeBackingStore (ScreenPtr pScreen);
@ -2001,6 +2065,11 @@ fbReplicatePixel (Pixel p, int bpp);
void void
fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp); fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
#ifdef FB_ACCESS_WRAPPER
extern ReadMemoryProcPtr wfbReadMemory;
extern WriteMemoryProcPtr wfbWriteMemory;
#endif
/* /*
* fbwindow.c * fbwindow.c
*/ */

View File

@ -305,6 +305,8 @@ fb24_32GetSpans(DrawablePtr pDrawable,
ppt++; ppt++;
pwidth++; pwidth++;
} }
fbFinishAccess (pDrawable);
} }
void void
@ -366,6 +368,8 @@ fb24_32SetSpans (DrawablePtr pDrawable,
ppt++; ppt++;
pwidth++; pwidth++;
} }
fbFinishAccess (pDrawable);
} }
/* /*
@ -429,6 +433,8 @@ fb24_32PutZImage (DrawablePtr pDrawable,
alu, alu,
pm); pm);
} }
fbFinishAccess (pDrawable);
} }
void void
@ -463,6 +469,8 @@ fb24_32GetImage (DrawablePtr pDrawable,
fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff, fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
(CARD8 *) d, dstStride, 0, (CARD8 *) d, dstStride, 0,
w, h, GXcopy, pm); w, h, GXcopy, pm);
fbFinishAccess (pDrawable);
} }
void void
@ -519,6 +527,9 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawable,
pPriv->pm); pPriv->pm);
pbox++; pbox++;
} }
fbFinishAccess (pSrcDrawable);
fbFinishAccess (pDstDrawable);
} }
PixmapPtr PixmapPtr
@ -563,6 +574,9 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
GXcopy, GXcopy,
FB_ALLONES); FB_ALLONES);
fbFinishAccess (&pOldTile->drawable);
fbFinishAccess (&pNewTile->drawable);
return pNewTile; return pNewTile;
} }

View File

@ -90,3 +90,8 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
#endif #endif
return TRUE; return TRUE;
} }
#ifdef FB_ACCESS_WRAPPER
ReadMemoryProcPtr wfbReadMemory;
WriteMemoryProcPtr wfbWriteMemory;
#endif

View File

@ -109,6 +109,7 @@ fbPolyArc (DrawablePtr pDrawable,
miPolyArc(pDrawable, pGC, 1, parcs); miPolyArc(pDrawable, pGC, 1, parcs);
parcs++; parcs++;
} }
fbFinishAccess (pDrawable);
} }
else else
#endif #endif

View File

@ -119,6 +119,8 @@ BRESSOLID (DrawablePtr pDrawable,
e += e3; e += e3;
} }
} }
fbFinishAccess (pDrawable);
} }
#endif #endif
@ -263,6 +265,8 @@ onOffOdd:
dashlen = len; dashlen = len;
} }
} }
fbFinishAccess (pDrawable);
} }
#endif #endif
@ -710,8 +714,10 @@ POLYLINE (DrawablePtr pDrawable,
intToX(pt2) + xoff, intToY(pt2) + yoff, intToX(pt2) + xoff, intToY(pt2) + yoff,
npt == 0 && pGC->capStyle != CapNotLast, npt == 0 && pGC->capStyle != CapNotLast,
&dashoffset); &dashoffset);
if (!npt) if (!npt) {
fbFinishAccess (pDrawable);
return; return;
}
pt1 = pt2; pt1 = pt2;
pt2 = *pts++; pt2 = *pts++;
npt--; npt--;
@ -776,6 +782,7 @@ POLYLINE (DrawablePtr pDrawable,
{ {
RROP(bits,and,xor); RROP(bits,and,xor);
} }
fbFinishAccess (pDrawable);
return; return;
} }
pt1 = pt2; pt1 = pt2;
@ -786,6 +793,8 @@ POLYLINE (DrawablePtr pDrawable,
} }
} }
} }
fbFinishAccess (pDrawable);
} }
#endif #endif
@ -950,6 +959,8 @@ POLYSEGMENT (DrawablePtr pDrawable,
} }
} }
} }
fbFinishAccess (pDrawable);
} }
#endif #endif

View File

@ -2652,6 +2652,7 @@ static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffe
end = buffer + width; end = buffer + width;
while (buffer < end) while (buffer < end)
*buffer++ = color; *buffer++ = color;
fbFinishAccess (pict->pDrawable);
} }
static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer) static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
@ -2670,6 +2671,7 @@ static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
bits += y*stride; bits += y*stride;
fetch(bits, x, width, buffer, indexed); fetch(bits, x, width, buffer, indexed);
fbFinishAccess (pict->pDrawable);
} }
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b)) #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
@ -2921,8 +2923,10 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
/* when using convolution filters one might get here without a transform */ /* when using convolution filters one might get here without a transform */
if (pict->transform) { if (pict->transform) {
if (!PictureTransformPoint3d (pict->transform, &v)) if (!PictureTransformPoint3d (pict->transform, &v)) {
fbFinishAccess (pict->pDrawable);
return; return;
}
unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[0] = pict->transform->matrix[0][0];
unit.vector[1] = pict->transform->matrix[1][0]; unit.vector[1] = pict->transform->matrix[1][0];
unit.vector[2] = pict->transform->matrix[2][0]; unit.vector[2] = pict->transform->matrix[2][0];
@ -3352,6 +3356,8 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32
v.vector[2] += unit.vector[2]; v.vector[2] += unit.vector[2];
} }
} }
fbFinishAccess (pict->pDrawable);
} }
@ -3397,6 +3403,7 @@ static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
bits += y*stride; bits += y*stride;
store(bits, buffer, x, width, indexed); store(bits, buffer, x, width, indexed);
fbFinishAccess (pict->pDrawable);
} }
static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
@ -3436,6 +3443,9 @@ static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD3
store(bits, buffer, x, width, indexed); store(bits, buffer, x, width, indexed);
astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed); astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed);
fbFinishAccess (pict->alphaMap->pDrawable);
fbFinishAccess (pict->pDrawable);
} }
typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *); typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *);

View File

@ -103,6 +103,8 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
#endif #endif
pbox++; pbox++;
} }
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
} }
void void
@ -173,6 +175,9 @@ fbCopy1toN (DrawablePtr pSrcDrawable,
} }
pbox++; pbox++;
} }
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
} }
void void
@ -221,6 +226,8 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
(FbStip) pPriv->and, (FbStip) pPriv->xor, (FbStip) pPriv->and, (FbStip) pPriv->xor,
(FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor,
bitplane); bitplane);
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
} }
else else
{ {
@ -281,6 +288,9 @@ fbCopyNto1 (DrawablePtr pSrcDrawable,
pPriv->and, pPriv->xor, pPriv->and, pPriv->xor,
pPriv->bgand, pPriv->bgxor); pPriv->bgand, pPriv->bgxor);
xfree (tmp); xfree (tmp);
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
} }
pbox++; pbox++;
} }

View File

@ -49,8 +49,10 @@ fbFill (DrawablePtr pDrawable,
case FillSolid: case FillSolid:
#ifdef USE_MMX #ifdef USE_MMX
if (!pPriv->and && fbHaveMMX()) if (!pPriv->and && fbHaveMMX())
if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) {
fbFinishAccess (pDrawable);
return; return;
}
#endif #endif
fbSolid (dst + (y + dstYoff) * dstStride, fbSolid (dst + (y + dstYoff) * dstStride,
dstStride, dstStride,
@ -92,6 +94,7 @@ fbFill (DrawablePtr pDrawable,
(pGC->patOrg.x + pDrawable->x + dstXoff), (pGC->patOrg.x + pDrawable->x + dstXoff),
pGC->patOrg.y + pDrawable->y - y); pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pStip->drawable);
} }
else else
{ {
@ -129,6 +132,7 @@ fbFill (DrawablePtr pDrawable,
bgand, bgxor, bgand, bgxor,
pGC->patOrg.x + pDrawable->x + dstXoff, pGC->patOrg.x + pDrawable->x + dstXoff,
pGC->patOrg.y + pDrawable->y - y); pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pStip->drawable);
} }
break; break;
} }
@ -157,10 +161,12 @@ fbFill (DrawablePtr pDrawable,
dstBpp, dstBpp,
(pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
pGC->patOrg.y + pDrawable->y - y); pGC->patOrg.y + pDrawable->y - y);
fbFinishAccess (&pTile->drawable);
break; break;
} }
} }
fbValidateDrawable (pDrawable); fbValidateDrawable (pDrawable);
fbFinishAccess (pDrawable);
} }
void void
@ -215,8 +221,10 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
if (fbSolidFillmmx (pDrawable, if (fbSolidFillmmx (pDrawable,
partX1, partY1, partX1, partY1,
(partX2 - partX1), (partY2 - partY1), (partX2 - partX1), (partY2 - partY1),
xor)) xor)) {
fbFinishAccess (pDrawable);
return; return;
}
} }
#endif #endif
fbSolid (dst + (partY1 + dstYoff) * dstStride, fbSolid (dst + (partY1 + dstYoff) * dstStride,
@ -228,4 +236,5 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
(partY2 - partY1), (partY2 - partY1),
and, xor); and, xor);
} }
fbFinishAccess (pDrawable);
} }

View File

@ -116,6 +116,8 @@ fbPadPixmap (PixmapPtr pPixmap)
*bits = b; *bits = b;
bits += stride; bits += stride;
} }
fbFinishAccess (&pPixmap->drawable);
} }
/* /*
@ -183,10 +185,13 @@ fbCanEvenStipple (PixmapPtr pStipple, int bpp)
/* check to see that the stipple repeats horizontally */ /* check to see that the stipple repeats horizontally */
while (h--) while (h--)
{ {
if (!fbLineRepeat (bits, len, pStipple->drawable.width)) if (!fbLineRepeat (bits, len, pStipple->drawable.width)) {
fbFinishAccess (&pStipple->drawable);
return FALSE; return FALSE;
}
bits += stride; bits += stride;
} }
fbFinishAccess (&pStipple->drawable);
return TRUE; return TRUE;
} }

View File

@ -84,4 +84,6 @@ fbGetSpans(DrawablePtr pDrawable,
ppt++; ppt++;
pwidth++; pwidth++;
} }
fbFinishAccess (pDrawable);
} }

View File

@ -284,7 +284,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
glyph = 0; glyph = 0;
if (pGC->fillStyle == FillSolid && pPriv->and == 0) if (pGC->fillStyle == FillSolid && pPriv->and == 0)
{ {
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dstBpp = pDrawable->bitsPerPixel;
switch (dstBpp) { switch (dstBpp) {
case 8: glyph = fbGlyph8; break; case 8: glyph = fbGlyph8; break;
case 16: glyph = fbGlyph16; break; case 16: glyph = fbGlyph16; break;
@ -312,6 +312,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
if (glyph && gWidth <= sizeof (FbStip) * 8 && if (glyph && gWidth <= sizeof (FbStip) * 8 &&
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
{ {
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
(*glyph) (dst + (gy + dstYoff) * dstStride, (*glyph) (dst + (gy + dstYoff) * dstStride,
dstStride, dstStride,
dstBpp, dstBpp,
@ -319,6 +320,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable,
pPriv->xor, pPriv->xor,
gx + dstXoff, gx + dstXoff,
gHeight); gHeight);
fbFinishAccess (pDrawable);
} }
else else
#endif #endif
@ -375,7 +377,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
glyph = 0; glyph = 0;
if (pPriv->and == 0) if (pPriv->and == 0)
{ {
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dstBpp = pDrawable->bitsPerPixel;
switch (dstBpp) { switch (dstBpp) {
case 8: glyph = fbGlyph8; break; case 8: glyph = fbGlyph8; break;
case 16: glyph = fbGlyph16; break; case 16: glyph = fbGlyph16; break;
@ -443,6 +445,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
if (glyph && gWidth <= sizeof (FbStip) * 8 && if (glyph && gWidth <= sizeof (FbStip) * 8 &&
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
{ {
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
(*glyph) (dst + (gy + dstYoff) * dstStride, (*glyph) (dst + (gy + dstYoff) * dstStride,
dstStride, dstStride,
dstBpp, dstBpp,
@ -450,6 +453,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable,
pPriv->fg, pPriv->fg,
gx + dstXoff, gx + dstXoff,
gHeight); gHeight);
fbFinishAccess (pDrawable);
} }
else else
#endif #endif

View File

@ -170,6 +170,8 @@ fbPutZImage (DrawablePtr pDrawable,
pm, pm,
dstBpp); dstBpp);
} }
fbFinishAccess (pDrawable);
} }
void void
@ -277,6 +279,8 @@ fbPutXYImage (DrawablePtr pDrawable,
fgand, fgxor, bgand, bgxor); fgand, fgxor, bgand, bgxor);
} }
} }
fbFinishAccess (pDrawable);
} }
void void
@ -361,4 +365,6 @@ fbGetImage (DrawablePtr pDrawable,
fbXorStip(GXcopy,0,FB_STIP_ALLONES), fbXorStip(GXcopy,0,FB_STIP_ALLONES),
planeMask); planeMask);
} }
fbFinishAccess (pDrawable);
} }

View File

@ -153,6 +153,9 @@ fbCompositeSolidMask_nx8x8888 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pMask->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -226,6 +229,9 @@ fbCompositeSolidMask_nx8888x8888C (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pMask->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -288,6 +294,9 @@ fbCompositeSolidMask_nx8x0888 (CARD8 op,
dst += 3; dst += 3;
} }
} }
fbFinishAccess (pMask->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -351,6 +360,9 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pMask->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -424,6 +436,9 @@ fbCompositeSolidMask_nx8888x0565C (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pMask->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -470,6 +485,9 @@ fbCompositeSrc_8888x8888 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pSrc->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -519,6 +537,9 @@ fbCompositeSrc_8888x0888 (CARD8 op,
dst += 3; dst += 3;
} }
} }
fbFinishAccess (pSrc->pDrawable);
fbFinishAccess (pDst->pDrawable);
} }
void void
@ -571,6 +592,9 @@ fbCompositeSrc_8888x0565 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pDst->pDrawable);
fbFinishAccess (pSrc->pDrawable);
} }
void void
@ -607,6 +631,9 @@ fbCompositeSrc_0565x0565 (CARD8 op,
while (w--) while (w--)
*dst++ = *src++; *dst++ = *src++;
} }
fbFinishAccess (pDst->pDrawable);
fbFinishAccess (pSrc->pDrawable);
} }
void void
@ -657,6 +684,9 @@ fbCompositeSrcAdd_8000x8000 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pDst->pDrawable);
fbFinishAccess (pSrc->pDrawable);
} }
void void
@ -714,6 +744,9 @@ fbCompositeSrcAdd_8888x8888 (CARD8 op,
dst++; dst++;
} }
} }
fbFinishAccess (pDst->pDrawable);
fbFinishAccess (pSrc->pDrawable);
} }
void void
@ -757,6 +790,9 @@ fbCompositeSrcAdd_1000x1000 (CARD8 op,
FALSE, FALSE,
FALSE); FALSE);
fbFinishAccess(pDst->pDrawable);
fbFinishAccess(pSrc->pDrawable);
} }
void void
@ -821,6 +857,9 @@ fbCompositeSolidMask_nx1xn (CARD8 op,
src, src,
FB_ALLONES, FB_ALLONES,
0x0); 0x0);
fbFinishAccess (pDst->pDrawable);
fbFinishAccess (pMask->pDrawable);
} }
# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) # define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))

View File

@ -99,6 +99,7 @@
/* manage missing src alpha */ \ /* manage missing src alpha */ \
if ((pict)->pFormat->direct.alphaMask == 0) \ if ((pict)->pFormat->direct.alphaMask == 0) \
(bits) |= 0xff000000; \ (bits) |= 0xff000000; \
fbFinishAccess ((pict)->pDrawable); \
} }
#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ #define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\

View File

@ -160,6 +160,8 @@ fbPixmapToRegion(PixmapPtr pPix)
FirstRect = REGION_BOXPTR(pReg); FirstRect = REGION_BOXPTR(pReg);
rects = FirstRect; rects = FirstRect;
fbPrepareAccess(pPix);
pwLine = (FbBits *) pPix->devPrivate.ptr; pwLine = (FbBits *) pPix->devPrivate.ptr;
nWidth = pPix->devKind >> (FB_SHIFT-3); nWidth = pPix->devKind >> (FB_SHIFT-3);
@ -311,6 +313,8 @@ fbPixmapToRegion(PixmapPtr pPix)
pReg->data = (RegDataPtr)NULL; pReg->data = (RegDataPtr)NULL;
} }
} }
fbFinishAccess(&pPix->drawable);
#ifdef DEBUG #ifdef DEBUG
if (!miValidRegion(pReg)) if (!miValidRegion(pReg))
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
@ -362,6 +366,7 @@ fbValidateDrawable (DrawablePtr pDrawable)
if (!fbValidateBits (first, stride, FB_HEAD_BITS) || if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
!fbValidateBits (last, stride, FB_TAIL_BITS)) !fbValidateBits (last, stride, FB_TAIL_BITS))
fbInitializeDrawable(pDrawable); fbInitializeDrawable(pDrawable);
fbFinishAccess (pDrawable);
} }
void void
@ -383,5 +388,6 @@ fbInitializeDrawable (DrawablePtr pDrawable)
last = bits + stride * pDrawable->height; last = bits + stride * pDrawable->height;
fbSetBits (first, stride, FB_HEAD_BITS); fbSetBits (first, stride, FB_HEAD_BITS);
fbSetBits (last, stride, FB_TAIL_BITS); fbSetBits (last, stride, FB_TAIL_BITS);
fbFinishAccess (pDrawable);
} }
#endif /* FB_DEBUG */ #endif /* FB_DEBUG */

View File

@ -160,4 +160,5 @@ fbPolyPoint (DrawablePtr pDrawable,
nBox--; pBox++) nBox--; pBox++)
(*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit,
pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
fbFinishAccess (pDrawable);
} }

View File

@ -875,6 +875,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
register CARD16 *d; register CARD16 *d;
int w; int w;
fbPrepareAccess((PixmapPtr)pScreen->devPrivate);
dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr; dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr;
dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind
/ sizeof (CARD16); / sizeof (CARD16);
@ -899,6 +901,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
} }
pbox++; pbox++;
} }
fbFinishAccess(&((PixmapPtr)pScreen->devPrivate)->drawable);
} }
static void static void

View File

@ -165,6 +165,7 @@ fbPushFill (DrawablePtr pDrawable,
fbAnd(GXnoop,(FbBits) 0,FB_ALLONES), fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
fbXor(GXnoop,(FbBits) 0,FB_ALLONES)); fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
} }
fbFinishAccess (pDrawable);
} }
else else
{ {

View File

@ -155,6 +155,19 @@ fbSetupScreen(ScreenPtr pScreen,
return TRUE; return TRUE;
} }
#ifdef FB_ACCESS_WRAPPER
Bool
wfbFinishScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap)
#else
Bool Bool
fbFinishScreenInit(ScreenPtr pScreen, fbFinishScreenInit(ScreenPtr pScreen,
pointer pbits, pointer pbits,
@ -164,6 +177,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
int dpiy, int dpiy,
int width, int width,
int bpp) int bpp)
#endif
{ {
VisualPtr visuals; VisualPtr visuals;
DepthPtr depths; DepthPtr depths;
@ -222,6 +236,10 @@ fbFinishScreenInit(ScreenPtr pScreen,
fbGetScreenPrivate(pScreen)->win32bpp = 32; fbGetScreenPrivate(pScreen)->win32bpp = 32;
fbGetScreenPrivate(pScreen)->pix32bpp = 32; fbGetScreenPrivate(pScreen)->pix32bpp = 32;
} }
#ifdef FB_ACCESS_WRAPPER
fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
#endif
#endif #endif
rootdepth = 0; rootdepth = 0;
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
@ -256,6 +274,27 @@ fbFinishScreenInit(ScreenPtr pScreen,
} }
/* dts * (inch/dot) * (25.4 mm / inch) = mm */ /* dts * (inch/dot) * (25.4 mm / inch) = mm */
#ifdef FB_ACCESS_WRAPPER
Bool
wfbScreenInit(ScreenPtr pScreen,
pointer pbits,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
SetupWrapProcPtr setupWrap,
FinishWrapProcPtr finishWrap)
{
if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
return FALSE;
if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
width, bpp, setupWrap, finishWrap))
return FALSE;
return TRUE;
}
#else
Bool Bool
fbScreenInit(ScreenPtr pScreen, fbScreenInit(ScreenPtr pScreen,
pointer pbits, pointer pbits,
@ -273,6 +312,7 @@ fbScreenInit(ScreenPtr pScreen,
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
#endif
#ifdef FB_OLD_SCREEN #ifdef FB_OLD_SCREEN

View File

@ -115,6 +115,8 @@ fbBresSolid (DrawablePtr pDrawable,
} }
} }
} }
fbFinishAccess (pDrawable);
} }
void void
@ -199,6 +201,8 @@ fbBresDash (DrawablePtr pDrawable,
} }
FbDashStep (dashlen, even); FbDashStep (dashlen, even);
} }
fbFinishAccess (pDrawable);
} }
void void
@ -399,6 +403,8 @@ fbBresSolid24RRop (DrawablePtr pDrawable,
} }
} }
} }
fbFinishAccess (pDrawable);
} }
static void static void
@ -498,6 +504,8 @@ fbBresDash24RRop (DrawablePtr pDrawable,
} }
FbDashStep (dashlen, even); FbDashStep (dashlen, even);
} }
fbFinishAccess (pDrawable);
} }
#endif #endif

View File

@ -99,5 +99,6 @@ fbSetSpans (DrawablePtr pDrawable,
pwidth++; pwidth++;
} }
fbValidateDrawable (pDrawable); fbValidateDrawable (pDrawable);
fbFinishAccess (pDrawable);
} }

View File

@ -95,6 +95,8 @@ fbAddTraps (PicturePtr pPicture,
} }
traps++; traps++;
} }
fbFinishAccess (pPicture->pDrawable);
} }
void void
@ -142,6 +144,8 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
} }
fbFinishAccess (pPicture->pDrawable);
} }
static int static int

View File

@ -118,6 +118,9 @@ fbCopyWindowProc (DrawablePtr pSrcDrawable,
upsidedown); upsidedown);
pbox++; pbox++;
} }
fbFinishAccess (pDstDrawable);
fbFinishAccess (pSrcDrawable);
} }
void void
@ -249,6 +252,8 @@ fbFillRegionSolid (DrawablePtr pDrawable,
fbValidateDrawable (pDrawable); fbValidateDrawable (pDrawable);
pbox++; pbox++;
} }
fbFinishAccess (pDrawable);
} }
#ifdef PANORAMIX #ifdef PANORAMIX
@ -311,6 +316,9 @@ fbFillRegionTiled (DrawablePtr pDrawable,
yRot - (pbox->y1 + dstYoff)); yRot - (pbox->y1 + dstYoff));
pbox++; pbox++;
} }
fbFinishAccess (&pTile->drawable);
fbFinishAccess (pDrawable);
} }
void void

View File

@ -81,7 +81,6 @@
#define fbFillRegionSolid wfbFillRegionSolid #define fbFillRegionSolid wfbFillRegionSolid
#define fbFillRegionTiled wfbFillRegionTiled #define fbFillRegionTiled wfbFillRegionTiled
#define fbFillSpans wfbFillSpans #define fbFillSpans wfbFillSpans
#define fbFinishScreenInit wfbFinishScreenInit
#define fbFixCoordModePrevious wfbFixCoordModePrevious #define fbFixCoordModePrevious wfbFixCoordModePrevious
#define fbGCFuncs wfbGCFuncs #define fbGCFuncs wfbGCFuncs
#define fbGCOps wfbGCOps #define fbGCOps wfbGCOps
@ -160,7 +159,6 @@
#define fbResolveColor wfbResolveColor #define fbResolveColor wfbResolveColor
#define fbRestoreAreas wfbRestoreAreas #define fbRestoreAreas wfbRestoreAreas
#define fbSaveAreas wfbSaveAreas #define fbSaveAreas wfbSaveAreas
#define fbScreenInit wfbScreenInit
#define fbScreenPrivateIndex wfbScreenPrivateIndex #define fbScreenPrivateIndex wfbScreenPrivateIndex
#define fbSegment wfbSegment #define fbSegment wfbSegment
#define fbSelectBres wfbSelectBres #define fbSelectBres wfbSelectBres