fb.h revision a3f3701cea1ba388e7c877955252bb7375eedebd
/*
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FB_H_
#define _FB_H_
#include <pixman.h>
#include "scrnintstr.h"
#include "pixmap.h"
#include "pixmapstr.h"
#include "region.h"
#include "gcstruct.h"
#include "colormap.h"
#include "miscstruct.h"
#include "servermd.h"
#include "windowstr.h"
#include "privates.h"
#include "mi.h"
#include "migc.h"
#include "mibstore.h"
#include "picturestr.h"
#ifdef FB_ACCESS_WRAPPER
#include "wfbrename.h"
} \
} while(0)
} \
} while(0)
#else
#endif
/*
* This single define controls the basic size of data manipulated
* by this software; it must be log2(sizeof (FbBits) * 8)
*/
#ifndef FB_SHIFT
#define FB_SHIFT LOG2_BITMAP_PAD
#endif
#if FB_SHIFT < LOG2_BITMAP_PAD
#endif
#if GLYPHPADBYTES != 4
#error "GLYPHPADBYTES must be 4"
#endif
/* for driver compat - intel UXA needs the second one at least */
#define FB_24BIT
#define FB_24_32BIT
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
#if FB_SHIFT == 6
#ifdef WIN32
#else
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
defined (__powerpc64__)
typedef unsigned long FbBits;
#else
typedef unsigned long long FbBits;
#endif
#endif
#endif
#if FB_SHIFT == 5
#endif
#if FB_SHIFT == 4
#endif
#if LOG2_BITMAP_PAD == FB_SHIFT
#else
#if LOG2_BITMAP_PAD == 5
#endif
#endif
typedef int FbStride;
#ifdef FB_DEBUG
#else
#define fbValidateDrawable(d)
#define fdInitializeDrawable(d)
#endif
#include "fbrop.h"
#if BITMAP_BIT_ORDER == LSBFirst
#define FbScrLeft(x,n) ((x) >> (n))
#define FbScrRight(x,n) ((x) << (n))
/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */
#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n)))
#define FbPatternOffsetBits 0
#else
#define FbScrLeft(x,n) ((x) << (n))
#define FbScrRight(x,n) ((x) >> (n))
/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
#define FbStipMoveLsb(x,s,n) (x)
#endif
#include "micoord.h"
#define FbStipLeft(x,n) FbScrLeft(x,n)
#define FbStipRight(x,n) FbScrRight(x,n)
#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \
#define FbMaskBits(x,w,l,n,r) { \
n = (w); \
r = FbRightMask((x)+n); \
l = FbLeftMask(x); \
if (l) { \
if (n < 0) { \
n = 0; \
l &= r; \
r = 0; \
} \
} \
n >>= FB_SHIFT; \
}
#define FbByteMaskInvalid 0x10
#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o)))
#ifndef FbSelectPart
#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
#endif
n = (w); \
lb = 0; \
rb = 0; \
r = FbRightMask((x)+n); \
if (r) { \
/* compute right byte length */ \
if ((copy) && (((x) + n) & 7) == 0) { \
} else { \
rb = FbByteMaskInvalid; \
} \
} \
l = FbLeftMask(x); \
if (l) { \
/* compute left byte length */ \
if ((copy) && ((x) & 7) == 0) { \
} else { \
lb = FbByteMaskInvalid; \
} \
/* subtract out the portion painted by leftMask */ \
if (n < 0) { \
if (lb != FbByteMaskInvalid) { \
if (rb == FbByteMaskInvalid) { \
lb = FbByteMaskInvalid; \
} else if (rb) { \
rb = 0; \
} \
} \
n = 0; \
l &= r; \
r = 0; \
}\
} \
n >>= FB_SHIFT; \
}
#if FB_SHIFT == 6
break; \
break; \
break; \
break; \
break; \
break; \
case (sizeof (FbBits) - 7): \
break; \
break; \
break; \
break; \
break; \
break; \
case (sizeof (FbBits) - 6): \
break; \
break; \
break; \
break; \
break; \
case (sizeof (FbBits) - 5): \
break; \
break; \
break; \
break; \
case (sizeof (FbBits) - 4): \
break;
case 4: \
break; \
case 5: \
break; \
case 6: \
break; \
case 7: \
break;
#else
#endif
switch (lb) { \
break; \
break; \
break; \
case sizeof (FbBits) - 3: \
case sizeof (FbBits) - 2: \
break; \
case sizeof (FbBits) - 1: \
break; \
default: \
break; \
} \
}
switch (rb) { \
case 1: \
break; \
case 2: \
break; \
case 3: \
break; \
default: \
} \
}
#define FbMaskStip(x,w,l,n,r) { \
n = (w); \
r = FbRightStipMask((x)+n); \
l = FbLeftStipMask(x); \
if (l) { \
n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \
if (n < 0) { \
n = 0; \
l &= r; \
r = 0; \
} \
} \
n >>= FB_STIP_SHIFT; \
}
/*
* These macros are used to transparently stipple
* in copy mode; the expected usage is with 'n' constant
* so all of the conditional parts collapse into a minimal
* sequence of partial word writes
*
* 'n' is the bytemask of which bytes to store, 'a' is the address
* of the FbBits base unit, 'o' is the offset within that unit
*
* The term "lane" comes from the hardware term "byte-lane" which
*/
#define FbLaneCase1(n,a,o) \
if ((n) == 0x01) { \
}
#define FbLaneCase2(n,a,o) \
if ((n) == 0x03) { \
} else { \
FbLaneCase1((n)&1,a,o) \
}
#define FbLaneCase4(n,a,o) \
if ((n) == 0x0f) { \
} else { \
FbLaneCase2((n)&3,a,o) \
}
#define FbLaneCase8(n,a,o) \
if ((n) == 0x0ff) { \
} else { \
FbLaneCase4((n)&15,a,o) \
}
#if FB_SHIFT == 6
#endif
#if FB_SHIFT == 5
#endif
/* Rotate a filled pixel value to the specified alignement */
#if FB_UNIT == 64
#if IMAGE_BYTE_ORDER == MSBFirst
#else
#define FbFirst24Rot(x) ((x) % 24)
#endif
#endif
#if FB_UNIT == 32
#if IMAGE_BYTE_ORDER == MSBFirst
#else
#define FbFirst24Rot(x) ((x) % 24)
#endif
#endif
/* Whether 24-bit specific code is needed for this filled pixel value */
#define FbCheck24Pix(p) ((p) == FbNext24Pix(p))
/* Macros for dealing with dashing */
#define FbDashDeclare \
\
__dash = __firstDash; \
{ \
(dashOffset) -= (dashlen); \
if (++__dash == __lastDash) \
__dash = __firstDash; \
} \
(dashlen) -= (dashOffset); \
}
#define FbDashNext(dashlen) { \
if (++__dash == __lastDash) \
__dash = __firstDash; \
}
/* as numInDashList is always even, this case can skip a test */
#define FbDashNextEven(dashlen) { \
}
if (!--(dashlen)) { \
FbDashNext(dashlen); \
} \
}
/* Framebuffer access wrapper */
#ifdef FB_ACCESS_WRAPPER
#define fbPrepareAccess(pDraw) \
&wfbReadMemory, \
&wfbWriteMemory, \
(pDraw))
#define fbFinishAccess(pDraw) \
#else
#define fbPrepareAccess(pPix)
#define fbFinishAccess(pDraw)
#endif
extern _X_EXPORT DevPrivateKey
fbGetScreenPrivateKey(void);
/* private field of a screen */
typedef struct {
unsigned char win32bpp; /* window bpp for 32-bpp images */
unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */
#ifdef FB_ACCESS_WRAPPER
#endif
/* private field of GC */
typedef struct {
unsigned int dashLength; /* total of all dash elements */
unsigned char evenStipple; /* stipple is even */
unsigned char bpp; /* current drawable bpp */
} FbGCPrivRec, *FbGCPrivPtr;
#define fbGetWinPrivateKey(pWin) (&fbGetScreenPrivate(((DrawablePtr) (pWin))->pScreen)->winPrivateKeyRec)
#ifdef ROOTLESS
#else
#define __fbPixDrawableX(pPix) 0
#define __fbPixDrawableY(pPix) 0
#endif
#ifdef COMPOSITE
#else
#endif
} else { \
} \
}
}
}
}
}
/*
* XFree86 empties the root BorderClip when the VT is inactive,
* here's a macro which uses that to disable GetImage and GetSpans
*/
#define fbWindowEnabled(pWin) \
#define fbDrawableEnabled(pDrawable) \
#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
/*
* Accelerated tiles are power of 2 width <= FB_UNIT
*/
/*
* with dstBpp a power of 2 as well
*/
/*
*/
extern _X_EXPORT void
int wMax,
extern _X_EXPORT void
char *src,
extern _X_EXPORT void
int alu,
int x,
extern _X_EXPORT void
int x,
int y,
int w,
extern _X_EXPORT void
int nbox,
int dx,
int dy,
int width,
int height,
int depth,
/*
*/
/*
* fbarc.c
*/
extern _X_EXPORT void
/*
* fbbits.c
*/
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dashOffset,
int signdx,
extern _X_EXPORT void
int dstBpp,
int npt,
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dstBpp,
int npt,
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dstBpp,
int npt,
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
extern _X_EXPORT void
int dstBpp,
int npt,
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
/*
* fbblt.c
*/
extern _X_EXPORT void
int srcX,
int dstX,
int width,
extern _X_EXPORT void
int srcX,
int dstX,
int width,
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
int srcX,
int dstX,
int dstBpp,
int width,
extern _X_EXPORT void
int srcX, /* bit position of source */
int dstX, /* bit position of dest */
int dstBpp, /* bits per destination unit */
int width, /* width in bits of destination */
int height, /* height in scanlines */
extern _X_EXPORT void
int srcX,
int srcBpp,
int dstX,
int width,
int height,
/*
*/
extern _X_EXPORT int
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
fbResolveColor(unsigned short *pred,
unsigned short *pgreen,
extern _X_EXPORT int
extern _X_EXPORT void
fbClearVisualTypes(void);
fbHasVisualTypes(int depth);
int *nvisualp,
int *ndepthp,
int *rootDepthp,
/*
* fbcopy.c
*/
/* Compatibility definition, to be removed at next ABI change. */
int nbox,
int dx,
int dy,
extern _X_EXPORT void
int nbox,
int dx,
int dy,
/* Compatibility wrapper, to be removed at next ABI change. */
extern _X_EXPORT void
int dx,
/* Compatibility wrapper, to be removed at next ABI change. */
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
extern _X_EXPORT void
int nbox,
int dx,
int dy,
extern _X_EXPORT void
int nbox,
int dx,
int dy,
int xIn,
int yIn,
int widthSrc,
/*
* fbfill.c
*/
extern _X_EXPORT void
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
#define fbPolyFillArc miPolyFillArc
#define fbFillPolygon miFillPolygon
/*
*/
extern _X_EXPORT void
/*
* fbgc.c
*/
extern _X_EXPORT void
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
int wMax,
/*
*/
extern _X_EXPORT void
int x,
int y,
extern _X_EXPORT void
int x,
int y,
/*
*/
extern _X_EXPORT void
int depth,
extern _X_EXPORT void
int alu,
int x,
extern _X_EXPORT void
int alu,
int x,
int y,
extern _X_EXPORT void
int x,
int y,
/*
* fbline.c
*/
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
#define fbPolyRectangle miPolyRectangle
/*
* fbpict.c
*/
/*
*/
unsigned usage_hint);
unsigned usage_hint);
/*
*/
extern _X_EXPORT void
int dstBpp,
int npt,
extern _X_EXPORT void
/*
* fbpush.c
*/
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
fbQueryBestSize(int class,
extern _X_EXPORT void
int xsize, /* in pixels */
int bpp); /* bits per pixel of frame buffer */
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp,
int xsize,
/*
* fbseg.c
*/
int dashOffset,
int signdx,
int signdy,
/*
*/
extern _X_EXPORT void
extern _X_EXPORT void
int dashOffset,
int signdx,
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipHeight,
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
/*
* fbtile.c
*/
extern _X_EXPORT void
int dstX,
int width,
int height,
extern _X_EXPORT void
int dstX,
int width,
int height,
int tileWidth,
extern _X_EXPORT void
int dstX,
int width,
int height,
int tileWidth,
/*
* fbutil.c
*/
extern _X_EXPORT void
#ifdef FB_ACCESS_WRAPPER
#endif
/*
*/
extern _X_EXPORT void
int nbox,
int dx,
int dy,
extern _X_EXPORT void
extern _X_EXPORT void
#endif /* _FB_H_ */