/*
*
* 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 "X.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 "mi.h"
#include "migc.h"
#include "mibstore.h"
#ifdef RENDER
#include "picturestr.h"
#else
#include "picture.h"
#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
#if GETLEFTBITS_ALIGNMENT != 1
#error "GETLEFTBITS_ALIGNMENT must be 1"
#endif
/* whether to bother to include 24bpp support */
#ifndef FBNO24BIT
#define FB_24BIT
#endif
/*
* Unless otherwise instructed, fb includes code to advertise 24bpp
* windows with 32bpp image format for application compatibility
*/
#ifdef FB_24BIT
#ifndef FBNO24_32
#define FB_24_32BIT
#endif
#endif
#if FB_SHIFT == 6
# ifdef WIN32
# else
defined(__sparc64__) || \
defined(__s390x__) || \
defined(x86_64) || defined (__x86_64__)
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
extern void fbValidateDrawable(DrawablePtr d);
extern void fbInitializeDrawable(DrawablePtr d);
#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; \
}
#ifdef FBNOPIXADDR
}
}
#else
#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: \
} \
}
#endif
#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
*/
fgxor) : 0)
fgxor) : \
((void)FbLaneCase1((n)&1,a,o), \
fgxor) : \
((void)FbLaneCase2((n)&3,a,o), \
((void)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 int fbGCPrivateIndex;
#ifndef FB_NO_WINDOW_PIXMAPS
extern int fbWinPrivateIndex;
#endif
#ifdef TEKX11
#define FB_OLD_GC
#define FB_OLD_SCREEN
#endif
#ifdef FB_OLD_SCREEN
extern WindowPtr *WindowTable;
#endif
#ifdef FB_24_32BIT
#define FB_SCREEN_PRIVATE
#endif
#ifdef FB_SCREEN_PRIVATE
extern int fbScreenPrivateIndex;
/* private field of a screen */
typedef struct {
#endif
/* private field of GC */
typedef struct {
#ifdef FB_OLD_GC
unsigned char pad1;
unsigned char pad2;
unsigned char pad3;
#endif
#ifdef FB_OLD_GC
#else
#endif
#ifdef FB_NO_WINDOW_PIXMAPS
#else
#endif
#ifdef __DARWIN__
#else
#endif
else \
}
else \
}
/*
* XFree86 empties the root BorderClip when the VT is inactive,
* here's a macro which uses that to disable GetImage and GetSpans
*/
#ifdef FB_OLD_SCREEN
#define BitsPerPixel(d) (\
#endif
/*
* Accelerated tiles are power of 2 width <= FB_UNIT
*/
/*
* with dstBpp a power of 2 as well
*/
/*
*/
void
int wMax,
int *pwidth,
int nspans,
char *pchardstStart);
void
char *src,
int *pwidth,
int nspans,
int fSorted);
void
int alu,
int x,
int y,
int width,
int height,
void
int x,
int y,
int w,
int h,
unsigned int format,
unsigned long planeMask,
char *d);
void
int nbox,
int dx,
int dy,
void *closure);
int width,
int height,
int depth,
int bitsPerPixel,
int devKind,
/*
*/
/*
* fbarc.c
*/
void
int narcs,
/*
* fbbits.c
*/
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dstBpp,
int npt,
int xoff,
int yoff,
void
int dstBpp,
int dx,
int dy,
void
int dstBpp,
int height,
int shift);
void
int mode,
int npt,
void
int nseg,
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dstBpp,
int npt,
int xoff,
int yoff,
void
int dstBpp,
int dx,
int dy,
void
int dstBpp,
int height,
int shift);
void
int mode,
int npt,
void
int nseg,
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dstBpp,
int npt,
int xoff,
int yoff,
void
int dstBpp,
int dx,
int dy,
void
int dstBpp,
int height,
int shift);
void
int mode,
int npt,
void
int nseg,
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int dstBpp,
int npt,
int xoff,
int yoff,
void
int dstBpp,
int dx,
int dy,
void
int dstBpp,
int height,
int shift);
void
int mode,
int npt,
void
int nseg,
/*
* fbblt.c
*/
void
int srcX,
int dstX,
int width,
int height,
int alu,
int bpp,
void
int srcX,
int dstX,
int width,
int height,
int alu,
void
int srcX,
int dstX,
int width,
int height,
int alu,
int bpp);
/*
*/
void
int srcX,
int dstX,
int dstBpp,
int width,
int height,
#ifdef FB_24BIT
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 */
#endif
void
int srcX,
int srcBpp,
int dstX,
int width,
int height,
/*
*/
void
int xorg,
int yorg,
void
int xorg,
int yorg,
/*
* fbcmap.c
*/
int
void
void
void
fbResolveColor(unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue,
int
int ndef,
void
fbClearVisualTypes(void);
int *nvisualp,
int *ndepthp,
int *rootDepthp,
unsigned long sizes,
int bitsPerRGB);
/*
* fbcopy.c
*/
int nbox,
int dx,
int dy,
void *closure);
void
int nbox,
int dx,
int dy,
void *closure);
void
int nbox,
int dx,
int dy,
void *closure);
void
int nbox,
int dx,
int dy,
void *closure);
void
int dx,
int dy,
void *closure);
int xIn,
int yIn,
int widthSrc,
int heightSrc,
int xOut,
int yOut,
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
*/
void
int x,
int y,
int width,
int height);
void
int xa,
int ya,
int xb,
int yb,
/*
*/
void
int nrectInit,
/*
*/
void
int nInit,
int *pwidthInit,
int fSorted);
/*
* fbgc.c
*/
void
void
/*
*/
void
int wMax,
int *pwidth,
int nspans,
char *pchardstStart);
/*
*/
int x,
int y,
int width,
int height);
void
int x,
int y,
unsigned int nglyph,
void
int x,
int y,
unsigned int nglyph,
/*
*/
void
int depth,
int x,
int y,
int w,
int h,
int leftPad,
int format,
char *pImage);
void
int alu,
int x,
int y,
int width,
int height,
void
int alu,
int x,
int y,
int width,
int height,
int srcX);
void
int x,
int y,
int w,
int h,
unsigned int format,
unsigned long planeMask,
char *d);
/*
* fbline.c
*/
void
int mode,
int npt,
void
int nseg,
void
int mode,
int npt,
void
fbFixCoordModePrevious (int npt,
void
int nseg,
/*
* fbpict.c
*/
int nformats);
/*
*/
/*
*/
void
int dstBpp,
int npt,
int xoff,
int yoff,
void
int mode,
int npt,
/*
* fbpush.c
*/
void
int srcX,
int x,
int y,
int width,
int height);
void
int srcX,
int x,
int y,
int width,
int height);
void
int nbox,
int dx,
int dy,
void *closure);
void
int srcX,
int x,
int y,
int width,
int height);
void
int dx,
int dy,
int xOrg,
int yOrg);
/*
*/
void
fbQueryBestSize (int class,
#ifndef FB_OLD_SCREEN
void
#endif
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);
void
/*
* fbseg.c
*/
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
/*
*/
void
char *src,
int *pwidth,
int nspans,
int fSorted);
FbBres *
void
int dashOffset,
int signdx,
int signdy,
int axis,
int x,
int y,
int e,
int e1,
int e3,
int len);
void
int xa,
int ya,
int xb,
int yb,
int *dashOffset);
/*
*/
void
int dstX,
int bpp,
int width,
int height,
#ifdef FB_24BIT
void
int dstX,
int width,
int height,
#endif
/*
*/
void
int n);
void
int dstX,
int dstBpp,
int width,
int height,
int stipHeight,
int xRot,
int yRot);
void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
int xRot,
int yRot);
void
int dstX,
int dstBpp,
int width,
int height,
int stipWidth,
int stipHeight,
int xRot,
int yRot);
/*
* fbtile.c
*/
void
int dstX,
int width,
int height,
int tileHeight,
int alu,
int xRot,
int yRot);
void
int dstX,
int width,
int height,
int tileWidth,
int tileHeight,
int alu,
int bpp,
int xRot,
int yRot);
void
int dstX,
int width,
int height,
int tileWidth,
int tileHeight,
int alu,
int bpp,
int xRot,
int yRot);
/*
* fbutil.c
*/
void
/*
*/
void
int nbox,
int dx,
int dy,
void *closure);
void
void
void
void
#endif /* _FB_H_ */