Use DrawablePtrs instead of PixmapPtrs for Prepare/Finish access.
Also, define some wfb functions even if FB_ACCESS_WRAPPER is not defined. This allows a client to use libfb and libwfb at the same time.
This commit is contained in:
parent
ee02e64788
commit
1c72290cdf
34
fb/fb.h
34
fb/fb.h
|
@ -622,30 +622,28 @@ extern WindowPtr *WindowTable;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Framebuffer access wrapper */
|
/* Framebuffer access wrapper */
|
||||||
#ifdef FB_ACCESS_WRAPPER
|
|
||||||
typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
|
typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
|
||||||
typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
|
typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
|
||||||
typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
|
typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr *pRead,
|
||||||
WriteMemoryProcPtr *pWrite,
|
WriteMemoryProcPtr *pWrite,
|
||||||
PixmapPtr pPixmap);
|
DrawablePtr pDraw);
|
||||||
typedef void (*FinishWrapProcPtr)(PixmapPtr pPixmap);
|
typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
|
||||||
#define fbPrepareAccess(pPix) \
|
|
||||||
fbGetScreenPrivate((pPix)->drawable.pScreen)->setupWrap( \
|
#ifdef FB_ACCESS_WRAPPER
|
||||||
|
|
||||||
|
#define fbPrepareAccess(pDraw) \
|
||||||
|
fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \
|
||||||
&wfbReadMemory, \
|
&wfbReadMemory, \
|
||||||
&wfbWriteMemory, \
|
&wfbWriteMemory, \
|
||||||
(pPix))
|
(pDraw))
|
||||||
#define fbFinishAccess(pDrawable) { \
|
#define fbFinishAccess(pDraw) \
|
||||||
PixmapPtr _pPix; \
|
fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw)
|
||||||
if ((pDrawable)->type != DRAWABLE_PIXMAP) \
|
|
||||||
_pPix = fbGetWindowPixmap(pDrawable); \
|
|
||||||
else \
|
|
||||||
_pPix = (PixmapPtr) (pDrawable); \
|
|
||||||
fbGetScreenPrivate(_pPix->drawable.pScreen)->finishWrap(_pPix); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define fbPrepareAccess(pPix)
|
#define fbPrepareAccess(pPix)
|
||||||
#define fbFinishAccess(pDraw)
|
#define fbFinishAccess(pDraw)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -739,7 +737,7 @@ typedef struct {
|
||||||
(xoff) = __fbPixOffXPix(_pPix); \
|
(xoff) = __fbPixOffXPix(_pPix); \
|
||||||
(yoff) = __fbPixOffYPix(_pPix); \
|
(yoff) = __fbPixOffYPix(_pPix); \
|
||||||
} \
|
} \
|
||||||
fbPrepareAccess(_pPix); \
|
fbPrepareAccess(pDrawable); \
|
||||||
(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); \
|
||||||
|
@ -756,7 +754,7 @@ typedef struct {
|
||||||
(xoff) = __fbPixOffXPix(_pPix); \
|
(xoff) = __fbPixOffXPix(_pPix); \
|
||||||
(yoff) = __fbPixOffYPix(_pPix); \
|
(yoff) = __fbPixOffYPix(_pPix); \
|
||||||
} \
|
} \
|
||||||
fbPrepareAccess(_pPix); \
|
fbPrepareAccess(pDrawable); \
|
||||||
(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); \
|
||||||
|
@ -1805,7 +1803,6 @@ 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
|
Bool
|
||||||
wfbFinishScreenInit(ScreenPtr pScreen,
|
wfbFinishScreenInit(ScreenPtr pScreen,
|
||||||
pointer pbits,
|
pointer pbits,
|
||||||
|
@ -1829,7 +1826,7 @@ wfbScreenInit(ScreenPtr pScreen,
|
||||||
int bpp,
|
int bpp,
|
||||||
SetupWrapProcPtr setupWrap,
|
SetupWrapProcPtr setupWrap,
|
||||||
FinishWrapProcPtr finishWrap);
|
FinishWrapProcPtr finishWrap);
|
||||||
#else
|
|
||||||
Bool
|
Bool
|
||||||
fbFinishScreenInit(ScreenPtr pScreen,
|
fbFinishScreenInit(ScreenPtr pScreen,
|
||||||
pointer pbits,
|
pointer pbits,
|
||||||
|
@ -1849,7 +1846,6 @@ fbScreenInit(ScreenPtr pScreen,
|
||||||
int dpiy,
|
int dpiy,
|
||||||
int width,
|
int width,
|
||||||
int bpp);
|
int bpp);
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fbInitializeBackingStore (ScreenPtr pScreen);
|
fbInitializeBackingStore (ScreenPtr pScreen);
|
||||||
|
|
|
@ -160,7 +160,7 @@ fbPixmapToRegion(PixmapPtr pPix)
|
||||||
FirstRect = REGION_BOXPTR(pReg);
|
FirstRect = REGION_BOXPTR(pReg);
|
||||||
rects = FirstRect;
|
rects = FirstRect;
|
||||||
|
|
||||||
fbPrepareAccess(pPix);
|
fbPrepareAccess(&pPix->drawable);
|
||||||
|
|
||||||
pwLine = (FbBits *) pPix->devPrivate.ptr;
|
pwLine = (FbBits *) pPix->devPrivate.ptr;
|
||||||
nWidth = pPix->devKind >> (FB_SHIFT-3);
|
nWidth = pPix->devKind >> (FB_SHIFT-3);
|
||||||
|
|
|
@ -875,7 +875,7 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
|
||||||
register CARD16 *d;
|
register CARD16 *d;
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
fbPrepareAccess((PixmapPtr)pScreen->devPrivate);
|
fbPrepareAccess((DrawablePtr)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
|
||||||
|
|
Loading…
Reference in New Issue