From a4005c15fbb48231cb958c32b2c791a2d23a135a Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Mon, 10 Jul 2006 18:58:09 -0700 Subject: [PATCH] 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. --- fb/fb.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++ fb/fb24_32.c | 14 ++++++++++ fb/fballpriv.c | 5 ++++ fb/fbarc.c | 1 + fb/fbbits.h | 13 ++++++++- fb/fbcompose.c | 12 +++++++- fb/fbcopy.c | 10 +++++++ fb/fbfill.c | 13 +++++++-- fb/fbgc.c | 7 ++++- fb/fbgetsp.c | 2 ++ fb/fbglyph.c | 8 ++++-- fb/fbimage.c | 6 ++++ fb/fbpict.c | 39 ++++++++++++++++++++++++++ fb/fbpict.h | 1 + fb/fbpixmap.c | 6 ++++ fb/fbpoint.c | 1 + fb/fbpseudocolor.c | 4 +++ fb/fbpush.c | 1 + fb/fbscreen.c | 40 +++++++++++++++++++++++++++ fb/fbseg.c | 8 ++++++ fb/fbsetsp.c | 1 + fb/fbtrap.c | 4 +++ fb/fbwindow.c | 8 ++++++ fb/wfbrename.h | 2 -- 24 files changed, 266 insertions(+), 9 deletions(-) diff --git a/fb/fb.h b/fb/fb.h index 9c777c1a06..13783d36d8 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -47,8 +47,12 @@ #ifdef FB_ACCESS_WRAPPER #include "wfbrename.h" #define FBPREFIX(x) wfb##x +#define WRITE(ptr, val) ((*wfbWriteMemory)(ptr, val)) +#define READ(ptr) ((*wfbReadMemory)(ptr)) #else #define FBPREFIX(x) fb##x +#define WRITE(ptr, val) (*(ptr) = (val)) +#define READ(ptr) (*(ptr)) #endif /* @@ -595,6 +599,34 @@ extern WindowPtr *WindowTable; #define FB_SCREEN_PRIVATE #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 extern int fbScreenPrivateIndex; extern int fbGetScreenPrivateIndex(void); @@ -603,6 +635,10 @@ extern int fbGetScreenPrivateIndex(void); typedef struct { unsigned char win32bpp; /* window 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; #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ @@ -681,6 +717,7 @@ typedef struct { (xoff) = __fbPixOffXPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \ } \ + fbPrepareAccess(_pPix); \ (pointer) = (FbBits *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ @@ -697,6 +734,7 @@ typedef struct { (xoff) = __fbPixOffXPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \ } \ + fbPrepareAccess(_pPix); \ (pointer) = (FbStip *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ @@ -1745,6 +1783,31 @@ fbSetupScreen(ScreenPtr pScreen, int width, /* pixel width 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 fbFinishScreenInit(ScreenPtr pScreen, pointer pbits, @@ -1764,6 +1827,7 @@ fbScreenInit(ScreenPtr pScreen, int dpiy, int width, int bpp); +#endif void fbInitializeBackingStore (ScreenPtr pScreen); @@ -2001,6 +2065,11 @@ fbReplicatePixel (Pixel p, int bpp); void fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp); +#ifdef FB_ACCESS_WRAPPER +extern ReadMemoryProcPtr wfbReadMemory; +extern WriteMemoryProcPtr wfbWriteMemory; +#endif + /* * fbwindow.c */ diff --git a/fb/fb24_32.c b/fb/fb24_32.c index 572da48658..0fdd9b8214 100644 --- a/fb/fb24_32.c +++ b/fb/fb24_32.c @@ -305,6 +305,8 @@ fb24_32GetSpans(DrawablePtr pDrawable, ppt++; pwidth++; } + + fbFinishAccess (pDrawable); } void @@ -366,6 +368,8 @@ fb24_32SetSpans (DrawablePtr pDrawable, ppt++; pwidth++; } + + fbFinishAccess (pDrawable); } /* @@ -429,6 +433,8 @@ fb24_32PutZImage (DrawablePtr pDrawable, alu, pm); } + + fbFinishAccess (pDrawable); } void @@ -463,6 +469,8 @@ fb24_32GetImage (DrawablePtr pDrawable, fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff, (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm); + + fbFinishAccess (pDrawable); } void @@ -519,6 +527,9 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawable, pPriv->pm); pbox++; } + + fbFinishAccess (pSrcDrawable); + fbFinishAccess (pDstDrawable); } PixmapPtr @@ -563,6 +574,9 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) GXcopy, FB_ALLONES); + fbFinishAccess (&pOldTile->drawable); + fbFinishAccess (&pNewTile->drawable); + return pNewTile; } diff --git a/fb/fballpriv.c b/fb/fballpriv.c index 3c05ff36e2..4f807ed8d0 100644 --- a/fb/fballpriv.c +++ b/fb/fballpriv.c @@ -90,3 +90,8 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) #endif return TRUE; } + +#ifdef FB_ACCESS_WRAPPER +ReadMemoryProcPtr wfbReadMemory; +WriteMemoryProcPtr wfbWriteMemory; +#endif diff --git a/fb/fbarc.c b/fb/fbarc.c index 8f4d2960ea..d2c1a76f1c 100644 --- a/fb/fbarc.c +++ b/fb/fbarc.c @@ -109,6 +109,7 @@ fbPolyArc (DrawablePtr pDrawable, miPolyArc(pDrawable, pGC, 1, parcs); parcs++; } + fbFinishAccess (pDrawable); } else #endif diff --git a/fb/fbbits.h b/fb/fbbits.h index e5c006dbb5..e99a297b59 100644 --- a/fb/fbbits.h +++ b/fb/fbbits.h @@ -119,6 +119,8 @@ BRESSOLID (DrawablePtr pDrawable, e += e3; } } + + fbFinishAccess (pDrawable); } #endif @@ -263,6 +265,8 @@ onOffOdd: dashlen = len; } } + + fbFinishAccess (pDrawable); } #endif @@ -710,8 +714,10 @@ POLYLINE (DrawablePtr pDrawable, intToX(pt2) + xoff, intToY(pt2) + yoff, npt == 0 && pGC->capStyle != CapNotLast, &dashoffset); - if (!npt) + if (!npt) { + fbFinishAccess (pDrawable); return; + } pt1 = pt2; pt2 = *pts++; npt--; @@ -776,6 +782,7 @@ POLYLINE (DrawablePtr pDrawable, { RROP(bits,and,xor); } + fbFinishAccess (pDrawable); return; } pt1 = pt2; @@ -786,6 +793,8 @@ POLYLINE (DrawablePtr pDrawable, } } } + + fbFinishAccess (pDrawable); } #endif @@ -950,6 +959,8 @@ POLYSEGMENT (DrawablePtr pDrawable, } } } + + fbFinishAccess (pDrawable); } #endif diff --git a/fb/fbcompose.c b/fb/fbcompose.c index b1903e90b9..c7a728066e 100644 --- a/fb/fbcompose.c +++ b/fb/fbcompose.c @@ -2652,6 +2652,7 @@ static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffe end = buffer + width; while (buffer < end) *buffer++ = color; + fbFinishAccess (pict->pDrawable); } 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; fetch(bits, x, width, buffer, indexed); + fbFinishAccess (pict->pDrawable); } #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 */ if (pict->transform) { - if (!PictureTransformPoint3d (pict->transform, &v)) + if (!PictureTransformPoint3d (pict->transform, &v)) { + fbFinishAccess (pict->pDrawable); return; + } unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[1] = pict->transform->matrix[1][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]; } } + + fbFinishAccess (pict->pDrawable); } @@ -3397,6 +3403,7 @@ static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer) bits += y*stride; store(bits, buffer, x, width, indexed); + fbFinishAccess (pict->pDrawable); } 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); 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 *); diff --git a/fb/fbcopy.c b/fb/fbcopy.c index 0d1cb7fafc..164cd3d675 100644 --- a/fb/fbcopy.c +++ b/fb/fbcopy.c @@ -103,6 +103,8 @@ fbCopyNtoN (DrawablePtr pSrcDrawable, #endif pbox++; } + fbFinishAccess (pDstDrawable); + fbFinishAccess (pSrcDrawable); } void @@ -173,6 +175,9 @@ fbCopy1toN (DrawablePtr pSrcDrawable, } pbox++; } + + fbFinishAccess (pDstDrawable); + fbFinishAccess (pSrcDrawable); } void @@ -221,6 +226,8 @@ fbCopyNto1 (DrawablePtr pSrcDrawable, (FbStip) pPriv->and, (FbStip) pPriv->xor, (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, bitplane); + fbFinishAccess (pDstDrawable); + fbFinishAccess (pSrcDrawable); } else { @@ -281,6 +288,9 @@ fbCopyNto1 (DrawablePtr pSrcDrawable, pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); xfree (tmp); + + fbFinishAccess (pDstDrawable); + fbFinishAccess (pSrcDrawable); } pbox++; } diff --git a/fb/fbfill.c b/fb/fbfill.c index ad5025c843..7ef3a70f98 100644 --- a/fb/fbfill.c +++ b/fb/fbfill.c @@ -49,8 +49,10 @@ fbFill (DrawablePtr pDrawable, case FillSolid: #ifdef USE_MMX 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; + } #endif fbSolid (dst + (y + dstYoff) * dstStride, dstStride, @@ -92,6 +94,7 @@ fbFill (DrawablePtr pDrawable, (pGC->patOrg.x + pDrawable->x + dstXoff), pGC->patOrg.y + pDrawable->y - y); + fbFinishAccess (&pStip->drawable); } else { @@ -129,6 +132,7 @@ fbFill (DrawablePtr pDrawable, bgand, bgxor, pGC->patOrg.x + pDrawable->x + dstXoff, pGC->patOrg.y + pDrawable->y - y); + fbFinishAccess (&pStip->drawable); } break; } @@ -157,10 +161,12 @@ fbFill (DrawablePtr pDrawable, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, pGC->patOrg.y + pDrawable->y - y); + fbFinishAccess (&pTile->drawable); break; } } fbValidateDrawable (pDrawable); + fbFinishAccess (pDrawable); } void @@ -215,8 +221,10 @@ fbSolidBoxClipped (DrawablePtr pDrawable, if (fbSolidFillmmx (pDrawable, partX1, partY1, (partX2 - partX1), (partY2 - partY1), - xor)) + xor)) { + fbFinishAccess (pDrawable); return; + } } #endif fbSolid (dst + (partY1 + dstYoff) * dstStride, @@ -228,4 +236,5 @@ fbSolidBoxClipped (DrawablePtr pDrawable, (partY2 - partY1), and, xor); } + fbFinishAccess (pDrawable); } diff --git a/fb/fbgc.c b/fb/fbgc.c index 5b55810937..1aca17c7c3 100644 --- a/fb/fbgc.c +++ b/fb/fbgc.c @@ -116,6 +116,8 @@ fbPadPixmap (PixmapPtr pPixmap) *bits = b; bits += stride; } + + fbFinishAccess (&pPixmap->drawable); } /* @@ -183,10 +185,13 @@ fbCanEvenStipple (PixmapPtr pStipple, int bpp) /* check to see that the stipple repeats horizontally */ while (h--) { - if (!fbLineRepeat (bits, len, pStipple->drawable.width)) + if (!fbLineRepeat (bits, len, pStipple->drawable.width)) { + fbFinishAccess (&pStipple->drawable); return FALSE; + } bits += stride; } + fbFinishAccess (&pStipple->drawable); return TRUE; } diff --git a/fb/fbgetsp.c b/fb/fbgetsp.c index f77ea8c52b..ffd8a1d7df 100644 --- a/fb/fbgetsp.c +++ b/fb/fbgetsp.c @@ -84,4 +84,6 @@ fbGetSpans(DrawablePtr pDrawable, ppt++; pwidth++; } + + fbFinishAccess (pDrawable); } diff --git a/fb/fbglyph.c b/fb/fbglyph.c index 8e819401be..78e26a993c 100644 --- a/fb/fbglyph.c +++ b/fb/fbglyph.c @@ -284,7 +284,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable, glyph = 0; if (pGC->fillStyle == FillSolid && pPriv->and == 0) { - fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; @@ -312,6 +312,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable, if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, @@ -319,6 +320,7 @@ fbPolyGlyphBlt (DrawablePtr pDrawable, pPriv->xor, gx + dstXoff, gHeight); + fbFinishAccess (pDrawable); } else #endif @@ -375,7 +377,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable, glyph = 0; if (pPriv->and == 0) { - fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; @@ -443,6 +445,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable, if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, @@ -450,6 +453,7 @@ fbImageGlyphBlt (DrawablePtr pDrawable, pPriv->fg, gx + dstXoff, gHeight); + fbFinishAccess (pDrawable); } else #endif diff --git a/fb/fbimage.c b/fb/fbimage.c index bf5c06b57d..4798709917 100644 --- a/fb/fbimage.c +++ b/fb/fbimage.c @@ -170,6 +170,8 @@ fbPutZImage (DrawablePtr pDrawable, pm, dstBpp); } + + fbFinishAccess (pDrawable); } void @@ -277,6 +279,8 @@ fbPutXYImage (DrawablePtr pDrawable, fgand, fgxor, bgand, bgxor); } } + + fbFinishAccess (pDrawable); } void @@ -361,4 +365,6 @@ fbGetImage (DrawablePtr pDrawable, fbXorStip(GXcopy,0,FB_STIP_ALLONES), planeMask); } + + fbFinishAccess (pDrawable); } diff --git a/fb/fbpict.c b/fb/fbpict.c index c208643dd0..2af0278bdf 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -153,6 +153,9 @@ fbCompositeSolidMask_nx8x8888 (CARD8 op, dst++; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -226,6 +229,9 @@ fbCompositeSolidMask_nx8888x8888C (CARD8 op, dst++; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -288,6 +294,9 @@ fbCompositeSolidMask_nx8x0888 (CARD8 op, dst += 3; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -351,6 +360,9 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op, dst++; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -424,6 +436,9 @@ fbCompositeSolidMask_nx8888x0565C (CARD8 op, dst++; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -470,6 +485,9 @@ fbCompositeSrc_8888x8888 (CARD8 op, dst++; } } + + fbFinishAccess (pSrc->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -519,6 +537,9 @@ fbCompositeSrc_8888x0888 (CARD8 op, dst += 3; } } + + fbFinishAccess (pSrc->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -571,6 +592,9 @@ fbCompositeSrc_8888x0565 (CARD8 op, dst++; } } + + fbFinishAccess (pDst->pDrawable); + fbFinishAccess (pSrc->pDrawable); } void @@ -607,6 +631,9 @@ fbCompositeSrc_0565x0565 (CARD8 op, while (w--) *dst++ = *src++; } + + fbFinishAccess (pDst->pDrawable); + fbFinishAccess (pSrc->pDrawable); } void @@ -657,6 +684,9 @@ fbCompositeSrcAdd_8000x8000 (CARD8 op, dst++; } } + + fbFinishAccess (pDst->pDrawable); + fbFinishAccess (pSrc->pDrawable); } void @@ -714,6 +744,9 @@ fbCompositeSrcAdd_8888x8888 (CARD8 op, dst++; } } + + fbFinishAccess (pDst->pDrawable); + fbFinishAccess (pSrc->pDrawable); } void @@ -757,6 +790,9 @@ fbCompositeSrcAdd_1000x1000 (CARD8 op, FALSE, FALSE); + + fbFinishAccess(pDst->pDrawable); + fbFinishAccess(pSrc->pDrawable); } void @@ -821,6 +857,9 @@ fbCompositeSolidMask_nx1xn (CARD8 op, src, FB_ALLONES, 0x0); + + fbFinishAccess (pDst->pDrawable); + fbFinishAccess (pMask->pDrawable); } # define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) diff --git a/fb/fbpict.h b/fb/fbpict.h index 4ad0324713..296cfbdfbb 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -99,6 +99,7 @@ /* manage missing src alpha */ \ if ((pict)->pFormat->direct.alphaMask == 0) \ (bits) |= 0xff000000; \ + fbFinishAccess ((pict)->pDrawable); \ } #define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c index f79f7010d2..3fe38ef9fb 100644 --- a/fb/fbpixmap.c +++ b/fb/fbpixmap.c @@ -160,6 +160,8 @@ fbPixmapToRegion(PixmapPtr pPix) FirstRect = REGION_BOXPTR(pReg); rects = FirstRect; + fbPrepareAccess(pPix); + pwLine = (FbBits *) pPix->devPrivate.ptr; nWidth = pPix->devKind >> (FB_SHIFT-3); @@ -311,6 +313,8 @@ fbPixmapToRegion(PixmapPtr pPix) pReg->data = (RegDataPtr)NULL; } } + + fbFinishAccess(&pPix->drawable); #ifdef DEBUG if (!miValidRegion(pReg)) 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) || !fbValidateBits (last, stride, FB_TAIL_BITS)) fbInitializeDrawable(pDrawable); + fbFinishAccess (pDrawable); } void @@ -383,5 +388,6 @@ fbInitializeDrawable (DrawablePtr pDrawable) last = bits + stride * pDrawable->height; fbSetBits (first, stride, FB_HEAD_BITS); fbSetBits (last, stride, FB_TAIL_BITS); + fbFinishAccess (pDrawable); } #endif /* FB_DEBUG */ diff --git a/fb/fbpoint.c b/fb/fbpoint.c index 7154b53a1c..4e2ff0c645 100644 --- a/fb/fbpoint.c +++ b/fb/fbpoint.c @@ -160,4 +160,5 @@ fbPolyPoint (DrawablePtr pDrawable, nBox--; pBox++) (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); + fbFinishAccess (pDrawable); } diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c index 2233f95dc5..170fcad0e8 100644 --- a/fb/fbpseudocolor.c +++ b/fb/fbpseudocolor.c @@ -875,6 +875,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, register CARD16 *d; int w; + fbPrepareAccess((PixmapPtr)pScreen->devPrivate); + dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr; dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind / sizeof (CARD16); @@ -899,6 +901,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, } pbox++; } + + fbFinishAccess(&((PixmapPtr)pScreen->devPrivate)->drawable); } static void diff --git a/fb/fbpush.c b/fb/fbpush.c index 0632766d09..282344d854 100644 --- a/fb/fbpush.c +++ b/fb/fbpush.c @@ -165,6 +165,7 @@ fbPushFill (DrawablePtr pDrawable, fbAnd(GXnoop,(FbBits) 0,FB_ALLONES), fbXor(GXnoop,(FbBits) 0,FB_ALLONES)); } + fbFinishAccess (pDrawable); } else { diff --git a/fb/fbscreen.c b/fb/fbscreen.c index b88375810f..045ca8fd2f 100644 --- a/fb/fbscreen.c +++ b/fb/fbscreen.c @@ -155,6 +155,19 @@ fbSetupScreen(ScreenPtr pScreen, 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 fbFinishScreenInit(ScreenPtr pScreen, pointer pbits, @@ -164,6 +177,7 @@ fbFinishScreenInit(ScreenPtr pScreen, int dpiy, int width, int bpp) +#endif { VisualPtr visuals; DepthPtr depths; @@ -222,6 +236,10 @@ fbFinishScreenInit(ScreenPtr pScreen, fbGetScreenPrivate(pScreen)->win32bpp = 32; fbGetScreenPrivate(pScreen)->pix32bpp = 32; } +#ifdef FB_ACCESS_WRAPPER + fbGetScreenPrivate(pScreen)->setupWrap = setupWrap; + fbGetScreenPrivate(pScreen)->finishWrap = finishWrap; +#endif #endif rootdepth = 0; if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, @@ -256,6 +274,27 @@ fbFinishScreenInit(ScreenPtr pScreen, } /* 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 fbScreenInit(ScreenPtr pScreen, pointer pbits, @@ -273,6 +312,7 @@ fbScreenInit(ScreenPtr pScreen, return FALSE; return TRUE; } +#endif #ifdef FB_OLD_SCREEN diff --git a/fb/fbseg.c b/fb/fbseg.c index d66e42468e..a980c24f31 100644 --- a/fb/fbseg.c +++ b/fb/fbseg.c @@ -115,6 +115,8 @@ fbBresSolid (DrawablePtr pDrawable, } } } + + fbFinishAccess (pDrawable); } void @@ -199,6 +201,8 @@ fbBresDash (DrawablePtr pDrawable, } FbDashStep (dashlen, even); } + + fbFinishAccess (pDrawable); } void @@ -399,6 +403,8 @@ fbBresSolid24RRop (DrawablePtr pDrawable, } } } + + fbFinishAccess (pDrawable); } static void @@ -498,6 +504,8 @@ fbBresDash24RRop (DrawablePtr pDrawable, } FbDashStep (dashlen, even); } + + fbFinishAccess (pDrawable); } #endif diff --git a/fb/fbsetsp.c b/fb/fbsetsp.c index c59c13ceb7..06332568bd 100644 --- a/fb/fbsetsp.c +++ b/fb/fbsetsp.c @@ -99,5 +99,6 @@ fbSetSpans (DrawablePtr pDrawable, pwidth++; } fbValidateDrawable (pDrawable); + fbFinishAccess (pDrawable); } diff --git a/fb/fbtrap.c b/fb/fbtrap.c index 863969527f..4c67bcdfb7 100644 --- a/fb/fbtrap.c +++ b/fb/fbtrap.c @@ -95,6 +95,8 @@ fbAddTraps (PicturePtr pPicture, } traps++; } + + fbFinishAccess (pPicture->pDrawable); } void @@ -142,6 +144,8 @@ fbRasterizeTrapezoid (PicturePtr pPicture, fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); } + + fbFinishAccess (pPicture->pDrawable); } static int diff --git a/fb/fbwindow.c b/fb/fbwindow.c index 968b5a61dc..cac662cc76 100644 --- a/fb/fbwindow.c +++ b/fb/fbwindow.c @@ -118,6 +118,9 @@ fbCopyWindowProc (DrawablePtr pSrcDrawable, upsidedown); pbox++; } + + fbFinishAccess (pDstDrawable); + fbFinishAccess (pSrcDrawable); } void @@ -249,6 +252,8 @@ fbFillRegionSolid (DrawablePtr pDrawable, fbValidateDrawable (pDrawable); pbox++; } + + fbFinishAccess (pDrawable); } #ifdef PANORAMIX @@ -311,6 +316,9 @@ fbFillRegionTiled (DrawablePtr pDrawable, yRot - (pbox->y1 + dstYoff)); pbox++; } + + fbFinishAccess (&pTile->drawable); + fbFinishAccess (pDrawable); } void diff --git a/fb/wfbrename.h b/fb/wfbrename.h index 3c1bfdeaee..7b7d81e563 100644 --- a/fb/wfbrename.h +++ b/fb/wfbrename.h @@ -81,7 +81,6 @@ #define fbFillRegionSolid wfbFillRegionSolid #define fbFillRegionTiled wfbFillRegionTiled #define fbFillSpans wfbFillSpans -#define fbFinishScreenInit wfbFinishScreenInit #define fbFixCoordModePrevious wfbFixCoordModePrevious #define fbGCFuncs wfbGCFuncs #define fbGCOps wfbGCOps @@ -160,7 +159,6 @@ #define fbResolveColor wfbResolveColor #define fbRestoreAreas wfbRestoreAreas #define fbSaveAreas wfbSaveAreas -#define fbScreenInit wfbScreenInit #define fbScreenPrivateIndex wfbScreenPrivateIndex #define fbSegment wfbSegment #define fbSelectBres wfbSelectBres