mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-07 21:28:03 +02:00
fb: Removed some bounds checking debugging that we threw into fb a while back
(cherry picked from commit f5f3121f3c)
This commit is contained in:
parent
e36c7d425c
commit
983198128e
2 changed files with 4 additions and 33 deletions
7
fb/fb.h
7
fb/fb.h
|
|
@ -168,11 +168,6 @@ typedef CARD32 FbStip;
|
||||||
|
|
||||||
typedef int FbStride;
|
typedef int FbStride;
|
||||||
|
|
||||||
#define CHECK_NULL(ptr) \
|
|
||||||
if ((ptr) == NULL) {\
|
|
||||||
ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FB_DEBUG
|
#ifdef FB_DEBUG
|
||||||
extern void fbValidateDrawable(DrawablePtr d);
|
extern void fbValidateDrawable(DrawablePtr d);
|
||||||
|
|
@ -722,7 +717,6 @@ typedef struct {
|
||||||
(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); \
|
||||||
CHECK_NULL(pointer); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
||||||
|
|
@ -740,7 +734,6 @@ typedef struct {
|
||||||
(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); \
|
||||||
CHECK_NULL(pointer); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,6 @@
|
||||||
} else \
|
} else \
|
||||||
bits = (src < srcEnd ? READ(src++) : 0); \
|
bits = (src < srcEnd ? READ(src++) : 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_BOUNDS(pointer, limit) \
|
|
||||||
if (dst > dstEnd) { \
|
|
||||||
ErrorF("WARNING: fbbltone tried to write over end of buffer (dst=%p dstEnd=%p)\n", \
|
|
||||||
dst, dstEnd); \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef FBNOPIXADDR
|
#ifndef FBNOPIXADDR
|
||||||
|
|
||||||
|
|
@ -155,7 +148,7 @@ fbBltOne (FbStip *src,
|
||||||
FbBits bgxor)
|
FbBits bgxor)
|
||||||
{
|
{
|
||||||
const FbBits *fbBits;
|
const FbBits *fbBits;
|
||||||
FbBits *srcEnd, *dstEnd;
|
FbBits *srcEnd;
|
||||||
int pixelsPerDst; /* dst pixels per FbBits */
|
int pixelsPerDst; /* dst pixels per FbBits */
|
||||||
int unitsPerSrc; /* src patterns per FbStip */
|
int unitsPerSrc; /* src patterns per FbStip */
|
||||||
int leftShift, rightShift; /* align source with dest */
|
int leftShift, rightShift; /* align source with dest */
|
||||||
|
|
@ -188,10 +181,9 @@ fbBltOne (FbStip *src,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not read or write past the end of the buffer!
|
* Do not read past the end of the buffer!
|
||||||
*/
|
*/
|
||||||
srcEnd = src + height * srcStride;
|
srcEnd = src + height * srcStride;
|
||||||
dstEnd = dst + dstX + height * dstStride;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of destination units in FbBits == number of stipple pixels
|
* Number of destination units in FbBits == number of stipple pixels
|
||||||
|
|
@ -304,7 +296,6 @@ fbBltOne (FbStip *src,
|
||||||
*/
|
*/
|
||||||
if (startmask)
|
if (startmask)
|
||||||
{
|
{
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
#if FB_UNIT > 32
|
#if FB_UNIT > 32
|
||||||
if (pixelsPerDst == 16)
|
if (pixelsPerDst == 16)
|
||||||
mask = FbStipple16Bits(FbLeftStipBits(bits,16));
|
mask = FbStipple16Bits(FbLeftStipBits(bits,16));
|
||||||
|
|
@ -345,7 +336,6 @@ fbBltOne (FbStip *src,
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
|
mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
|
WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
|
||||||
dst++;
|
dst++;
|
||||||
bits = FbStipLeft(bits, pixelsPerDst);
|
bits = FbStipLeft(bits, pixelsPerDst);
|
||||||
|
|
@ -356,7 +346,6 @@ fbBltOne (FbStip *src,
|
||||||
#ifndef FBNOPIXADDR
|
#ifndef FBNOPIXADDR
|
||||||
if (fbLane)
|
if (fbLane)
|
||||||
{
|
{
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
while (bits && n)
|
while (bits && n)
|
||||||
{
|
{
|
||||||
switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) {
|
switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) {
|
||||||
|
|
@ -377,7 +366,6 @@ fbBltOne (FbStip *src,
|
||||||
if (left || !transparent)
|
if (left || !transparent)
|
||||||
{
|
{
|
||||||
mask = fbBits[left];
|
mask = fbBits[left];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbStippleRRop (READ(dst), mask,
|
WRITE(dst, FbStippleRRop (READ(dst), mask,
|
||||||
fgand, fgxor, bgand, bgxor));
|
fgand, fgxor, bgand, bgxor));
|
||||||
}
|
}
|
||||||
|
|
@ -598,7 +586,7 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
FbBits bgand,
|
FbBits bgand,
|
||||||
FbBits bgxor)
|
FbBits bgxor)
|
||||||
{
|
{
|
||||||
FbStip *src, *srcEnd, *dstEnd;
|
FbStip *src, *srcEnd;
|
||||||
FbBits leftMask, rightMask, mask;
|
FbBits leftMask, rightMask, mask;
|
||||||
int nlMiddle, nl;
|
int nlMiddle, nl;
|
||||||
FbStip stip, bits;
|
FbStip stip, bits;
|
||||||
|
|
@ -609,10 +597,9 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
int nDst;
|
int nDst;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not read or write past the end of the buffer!
|
* Do not read past the end of the buffer!
|
||||||
*/
|
*/
|
||||||
srcEnd = srcLine + height * srcStride;
|
srcEnd = srcLine + height * srcStride;
|
||||||
dstEnd = dst + dstX + height * dstStride;
|
|
||||||
|
|
||||||
srcLine += srcX >> FB_STIP_SHIFT;
|
srcLine += srcX >> FB_STIP_SHIFT;
|
||||||
dst += dstX >> FB_SHIFT;
|
dst += dstX >> FB_SHIFT;
|
||||||
|
|
@ -642,7 +629,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (leftMask)
|
if (leftMask)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip];
|
mask = fbStipple24Bits[rot >> 3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, (READ(dst) & ~leftMask) |
|
WRITE(dst, (READ(dst) & ~leftMask) |
|
||||||
(FbOpaqueStipple (mask,
|
(FbOpaqueStipple (mask,
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
|
|
@ -655,7 +641,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
while (nl--)
|
while (nl--)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot>>3][stip];
|
mask = fbStipple24Bits[rot>>3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbOpaqueStipple (mask,
|
WRITE(dst, FbOpaqueStipple (mask,
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
FbRot24(bgxor, rot)));
|
FbRot24(bgxor, rot)));
|
||||||
|
|
@ -665,7 +650,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (rightMask)
|
if (rightMask)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip];
|
mask = fbStipple24Bits[rot >> 3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, (READ(dst) & ~rightMask) |
|
WRITE(dst, (READ(dst) & ~rightMask) |
|
||||||
(FbOpaqueStipple (mask,
|
(FbOpaqueStipple (mask,
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
|
|
@ -690,7 +674,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (stip)
|
if (stip)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
|
mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
||||||
}
|
}
|
||||||
dst++;
|
dst++;
|
||||||
|
|
@ -702,7 +685,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (stip)
|
if (stip)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot>>3][stip];
|
mask = fbStipple24Bits[rot>>3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
|
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
|
||||||
}
|
}
|
||||||
dst++;
|
dst++;
|
||||||
|
|
@ -713,7 +695,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (stip)
|
if (stip)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
|
mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -731,7 +712,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (leftMask)
|
if (leftMask)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip];
|
mask = fbStipple24Bits[rot >> 3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
|
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
|
||||||
FbRot24(fgand, rot),
|
FbRot24(fgand, rot),
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
|
|
@ -745,7 +725,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
while (nl--)
|
while (nl--)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip];
|
mask = fbStipple24Bits[rot >> 3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbStippleRRop (READ(dst), mask,
|
WRITE(dst, FbStippleRRop (READ(dst), mask,
|
||||||
FbRot24(fgand, rot),
|
FbRot24(fgand, rot),
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
|
|
@ -757,7 +736,6 @@ fbBltOne24 (FbStip *srcLine,
|
||||||
if (rightMask)
|
if (rightMask)
|
||||||
{
|
{
|
||||||
mask = fbStipple24Bits[rot >> 3][stip];
|
mask = fbStipple24Bits[rot >> 3][stip];
|
||||||
CHECK_BOUNDS(dst, dstEnd);
|
|
||||||
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
|
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
|
||||||
FbRot24(fgand, rot),
|
FbRot24(fgand, rot),
|
||||||
FbRot24(fgxor, rot),
|
FbRot24(fgxor, rot),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue