/*
*
* 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
#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
#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 FbPatternOffsetBits 0
#else
#define FbScrLeft(x,n) ((x) << (n))
#define FbScrRight(x,n) ((x) >> (n))
/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */
#define FbStipMoveLsb(x,s,n) (x)
#endif
#include "micoord.h"
#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; \
}
#ifndef FbSelectPart
#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
#endif
#endif
#if FB_UNIT == 32
#if IMAGE_BYTE_ORDER == MSBFirst
#else
#endif
#endif
/* Whether 24-bit specific code is needed for this filled pixel value */
/* Macros for dealing with dashing */
#define FbDashDeclare \
\
__dash = __firstDash; \
{ \
(dashOffset) -= (dashlen); \
if (++__dash == __lastDash) \
__dash = __firstDash; \
} \
(dashlen) -= (dashOffset); \
}
if (++__dash == __lastDash) \
__dash = __firstDash; \
}
/* as numInDashList is always even, this case can skip a test */
}
if (!--(dashlen)) { \
FbDashNext(dashlen); \
} \
}
extern _X_EXPORT DevPrivateKey
fbGetGCPrivateKey (void);
extern _X_EXPORT DevPrivateKey
fbGetWinPrivateKey (void);
/* Framebuffer access wrapper */
#ifdef FB_ACCESS_WRAPPER
&wfbReadMemory, \
&wfbWriteMemory, \
(pDraw))
#else
#endif
extern _X_EXPORT DevPrivateKey
fbGetScreenPrivateKey(void);
/* private field of a screen */
typedef struct {
#ifdef FB_ACCESS_WRAPPER
#endif
/* private field of GC */
typedef struct {
#ifdef ROOTLESS
#else
#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
*/
/*
* Accelerated tiles are power of 2 width <= FB_UNIT
*/
/*
* with dstBpp a power of 2 as well
*/
/*
*/
extern _X_EXPORT void
int wMax,
int *pwidth,
int nspans,
char *pchardstStart);
extern _X_EXPORT void
char *src,
int *pwidth,
int nspans,
int fSorted);
extern _X_EXPORT void
int alu,
int x,
int y,
int width,
int height,
extern _X_EXPORT void
int x,
int y,
int w,
int h,
unsigned int format,
unsigned long planeMask,
char *d);
extern _X_EXPORT void
int nbox,
int dx,
int dy,
void *closure);
int width,
int height,
int depth,
int bitsPerPixel,
int devKind,
/*
*/
/*
* fbarc.c
*/
extern _X_EXPORT void
int narcs,
/*
* fbbits.c
*/
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dstBpp,
int npt,
int xorg,
int yorg,
int xoff,
int yoff,
extern _X_EXPORT void
int dstBpp,
int dx,
int dy,
extern _X_EXPORT void
int dstBpp,
int height,
int shift);
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
int nseg,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dstBpp,
int npt,
int xorg,
int yorg,
int xoff,
int yoff,
extern _X_EXPORT void
int dstBpp,
int dx,
int dy,
extern _X_EXPORT void
int dstBpp,
int height,
int shift);
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
int nseg,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dstBpp,
int npt,
int xorg,
int yorg,
int xoff,
int yoff,
extern _X_EXPORT void
int dstBpp,
int dx,
int dy,
extern _X_EXPORT void
int dstBpp,
int height,
int shift);
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
int nseg,
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int dstBpp,
int npt,
int xorg,
int yorg,
int xoff,
int yoff,
extern _X_EXPORT void
int dstBpp,
int dx,
int dy,
extern _X_EXPORT void
int dstBpp,
int height,
int shift);
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
int nseg,
/*
* fbblt.c
*/
extern _X_EXPORT void
int srcX,
int dstX,
int width,
int height,
int alu,
int bpp,
extern _X_EXPORT void
int srcX,
int dstX,
int width,
int height,
int alu,
extern _X_EXPORT void
int srcX,
int dstX,
int width,
int height,
int alu,
int bpp);
/*
*/
extern _X_EXPORT void
int srcX,
int dstX,
int dstBpp,
int width,
int height,
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,
unsigned short *pblue,
extern _X_EXPORT int
int ndef,
extern _X_EXPORT void
fbClearVisualTypes(void);
fbHasVisualTypes (int depth);
int *nvisualp,
int *ndepthp,
int *rootDepthp,
unsigned long sizes,
int bitsPerRGB);
/*
* fbcopy.c
*/
/* Compatibility definition, to be removed at next ABI change. */
int nbox,
int dx,
int dy,
void *closure);
extern _X_EXPORT void
int nbox,
int dx,
int dy,
void *closure);
/* Compatibility wrapper, to be removed at next ABI change. */
extern _X_EXPORT void
int dx,
int dy,
void *closure);
/* Compatibility wrapper, to be removed at next ABI change. */
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
int yOut,
void *closure);
extern _X_EXPORT void
int nbox,
int dx,
int dy,
void *closure);
extern _X_EXPORT void
int nbox,
int dx,
int dy,
void *closure);
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
int yOut);
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
int yOut,
unsigned long bitplane);
/*
* fbfill.c
*/
extern _X_EXPORT void
int x,
int y,
int width,
int height);
extern _X_EXPORT void
int xa,
int ya,
int xb,
int yb,
/*
*/
extern _X_EXPORT void
int nrectInit,
/*
*/
extern _X_EXPORT void
int nInit,
int *pwidthInit,
int fSorted);
/*
* fbgc.c
*/
extern _X_EXPORT void
extern _X_EXPORT void
/*
*/
extern _X_EXPORT void
int wMax,
int *pwidth,
int nspans,
char *pchardstStart);
/*
*/
int x,
int y,
int width,
int height);
extern _X_EXPORT void
int x,
int y,
unsigned int nglyph,
extern _X_EXPORT void
int x,
int y,
unsigned int nglyph,
/*
*/
extern _X_EXPORT void
int depth,
int x,
int y,
int w,
int h,
int leftPad,
int format,
char *pImage);
extern _X_EXPORT void
int alu,
int x,
int y,
int width,
int height,
extern _X_EXPORT void
int alu,
int x,
int y,
int width,
int height,
int srcX);
extern _X_EXPORT void
int x,
int y,
int w,
int h,
unsigned int format,
unsigned long planeMask,
char *d);
/*
* fbline.c
*/
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
int nseg,
extern _X_EXPORT void
int mode,
int npt,
extern _X_EXPORT void
fbFixCoordModePrevious (int npt,
extern _X_EXPORT void
int nseg,
/*
* fbpict.c
*/
int nformats);
/*
*/
unsigned usage_hint);
unsigned usage_hint);
/*
*/
extern _X_EXPORT void
int dstBpp,
int npt,
int xorg,
int yorg,
int xoff,
int yoff,
extern _X_EXPORT void
int mode,
int npt,
/*
* fbpush.c
*/
extern _X_EXPORT void
int srcX,
int x,
int y,
int width,
int height);
extern _X_EXPORT void
int srcX,
int x,
int y,
int width,
int height);
extern _X_EXPORT void
int srcX,
int x,
int y,
int width,
int height);
extern _X_EXPORT void
int dx,
int dy,
int xOrg,
int yOrg);
/*
*/
extern _X_EXPORT void
fbQueryBestSize (int class,
extern _X_EXPORT void
int xsize, /* in pixels */
int ysize,
int dpix, /* dots per inch */
int dpiy,
int width, /* pixel width of frame buffer */
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,
int ysize,
int dpix,
int dpiy,
int width,
int bpp);
int xsize,
int ysize,
int dpix,
int dpiy,
int width,
int bpp);
/*
* fbseg.c
*/
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
/*
*/
extern _X_EXPORT void
char *src,
int *pwidth,
int nspans,
int fSorted);
extern _X_EXPORT void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
extern _X_EXPORT void
int xa,
int ya,
int xb,
int yb,
int *dashOffset);
/*
*/
extern _X_EXPORT void
int dstX,
int bpp,
int width,
int height,
extern _X_EXPORT void
int dstX,
int width,
int height,
/*
*/
extern _X_EXPORT void
int n);
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipHeight,
int xRot,
int yRot);
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
int xRot,
int yRot);
extern _X_EXPORT void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
int xRot,
int yRot);
/*
* fbtile.c
*/
extern _X_EXPORT void
int dstX,
int width,
int height,
int tileHeight,
int alu,
int xRot,
int yRot);
extern _X_EXPORT void
int dstX,
int width,
int height,
int tileWidth,
int tileHeight,
int alu,
int bpp,
int xRot,
int yRot);
extern _X_EXPORT void
int dstX,
int width,
int height,
int tileWidth,
int tileHeight,
int alu,
int bpp,
int xRot,
int yRot);
/*
* fbutil.c
*/
extern _X_EXPORT void
#ifdef FB_ACCESS_WRAPPER
#endif
/*
*/
extern _X_EXPORT void
int nbox,
int dx,
int dy,
void *closure);
extern _X_EXPORT void
extern _X_EXPORT void
extern _X_EXPORT pixman_image_t *
int *xoff,
int *yoff);
#endif /* _FB_H_ */