Wrap libwfb memory access.
Use the READ and WRITE macros to wrap memory accesses that could be in video memory. Add MEMCPY_WRAPPED and MEMSET_WRAPPED macros to wrap memcpy and memset, respectively.
This commit is contained in:
22
fb/fbbits.h
22
fb/fbbits.h
@@ -42,13 +42,13 @@
|
||||
#ifdef BITSSTORE
|
||||
#define STORE(b,x) BITSSTORE(b,x)
|
||||
#else
|
||||
#define STORE(b,x) (*(b) = (x))
|
||||
#define STORE(b,x) WRITE((b), (x))
|
||||
#endif
|
||||
|
||||
#ifdef BITSRROP
|
||||
#define RROP(b,a,x) BITSRROP(b,a,x)
|
||||
#else
|
||||
#define RROP(b,a,x) (*(b) = FbDoRRop (*(b), (a), (x)))
|
||||
#define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x)))
|
||||
#endif
|
||||
|
||||
#ifdef BITSUNIT
|
||||
@@ -545,18 +545,18 @@ ARC (FbBits *dst,
|
||||
# define WRITE_ADDR4(n) ((n))
|
||||
#endif
|
||||
|
||||
#define WRITE1(d,n,fg) ((d)[WRITE_ADDR1(n)] = (BITS) (fg))
|
||||
#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
|
||||
|
||||
#ifdef BITS2
|
||||
# define WRITE2(d,n,fg) (*((BITS2 *) &((d)[WRITE_ADDR2(n)])) = (BITS2) (fg))
|
||||
# define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
|
||||
#else
|
||||
# define WRITE2(d,n,fg) WRITE1(d,(n)+1,WRITE1(d,n,fg))
|
||||
# define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
|
||||
#endif
|
||||
|
||||
#ifdef BITS4
|
||||
# define WRITE4(d,n,fg) (*((BITS4 *) &((d)[WRITE_ADDR4(n)])) = (BITS4) (fg))
|
||||
# define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
|
||||
#else
|
||||
# define WRITE4(d,n,fg) WRITE2(d,(n)+2,WRITE2(d,n,fg))
|
||||
# define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
|
||||
#endif
|
||||
|
||||
void
|
||||
@@ -892,20 +892,20 @@ POLYSEGMENT (DrawablePtr pDrawable,
|
||||
FbMaskBits (dstX, width, startmask, nmiddle, endmask);
|
||||
if (startmask)
|
||||
{
|
||||
*dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, startmask);
|
||||
WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
|
||||
dstLine++;
|
||||
}
|
||||
if (!andBits)
|
||||
while (nmiddle--)
|
||||
*dstLine++ = xorBits;
|
||||
WRITE(dstLine++, xorBits);
|
||||
else
|
||||
while (nmiddle--)
|
||||
{
|
||||
*dstLine = FbDoRRop (*dstLine, andBits, xorBits);
|
||||
WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
|
||||
dstLine++;
|
||||
}
|
||||
if (endmask)
|
||||
*dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, endmask);
|
||||
WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user