(file) Return to igsdraw.h CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / hw / tinyx / igs

File: [XFree86 CVS] / xc / programs / Xserver / hw / tinyx / igs / igsdraw.h (download)
Revision: 1.1, Wed Jun 2 21:43:01 2004 UTC (8 years, 11 months ago) by dawes
Branch: MAIN
CVS Tags: xf-4_8_0-bindist, xf-4_8_0, xf-4_8-branch, xf-4_7_99_9, xf-4_7_99_8, xf-4_7_99_7, xf-4_7_99_6, xf-4_7_99_5, xf-4_7_99_4, xf-4_7_99_31, xf-4_7_99_30, xf-4_7_99_3, xf-4_7_99_29, xf-4_7_99_28, xf-4_7_99_27, xf-4_7_99_26, xf-4_7_99_25, xf-4_7_99_24, xf-4_7_99_23, xf-4_7_99_22, xf-4_7_99_21, xf-4_7_99_20, xf-4_7_99_2, xf-4_7_99_19, xf-4_7_99_18, xf-4_7_99_17, xf-4_7_99_16, xf-4_7_99_15, xf-4_7_99_14, xf-4_7_99_13, xf-4_7_99_12, xf-4_7_99_11, xf-4_7_99_10, xf-4_7_99_1, xf-4_7_0, xf-4_7-branch, xf-4_6_99_9, xf-4_6_99_8, xf-4_6_99_7, xf-4_6_99_6, xf-4_6_99_5, xf-4_6_99_4, xf-4_6_99_3, xf-4_6_99_29, xf-4_6_99_28, xf-4_6_99_27, xf-4_6_99_26, xf-4_6_99_25, xf-4_6_99_24, xf-4_6_99_23, xf-4_6_99_22, xf-4_6_99_21, xf-4_6_99_20, xf-4_6_99_2, xf-4_6_99_19, xf-4_6_99_18, xf-4_6_99_17, xf-4_6_99_16, xf-4_6_99_15, xf-4_6_99_14, xf-4_6_99_13, xf-4_6_99_12, xf-4_6_99_11, xf-4_6_99_10, xf-4_6_99_1, xf-4_6_0, xf-4_6-branch, xf-4_5_99_904, xf-4_5_99_903, xf-4_5_99_902, xf-4_5_99_901, xf-4_5_99_9, xf-4_5_99_8, xf-4_5_99_7, xf-4_5_99_6, xf-4_5_99_5, xf-4_5_99_4, xf-4_5_99_3, xf-4_5_99_22, xf-4_5_99_21, xf-4_5_99_20, xf-4_5_99_2, xf-4_5_99_19, xf-4_5_99_18, xf-4_5_99_17, xf-4_5_99_16, xf-4_5_99_15, xf-4_5_99_14, xf-4_5_99_13, xf-4_5_99_12, xf-4_5_99_11, xf-4_5_99_10, xf-4_5_99_1, xf-4_5_0, xf-4_5-branch, xf-4_4_99_903, xf-4_4_99_902, xf-4_4_99_901, xf-4_4_99_9, xf-4_4_99_8, xf-4_4_99_7, xf-4_4_99_22, xf-4_4_99_21, xf-4_4_99_20, xf-4_4_99_19, xf-4_4_99_18, xf-4_4_99_17, xf-4_4_99_16, xf-4_4_99_15, xf-4_4_99_14, xf-4_4_99_13, xf-4_4_99_12, xf-4_4_99_11, xf-4_4_99_10, HEAD
 115. Integrate the TinyX servers into the standard XFree86 build:
       - Numerous build and warning fixes.
       - Eliminate unnecessary requirement differences at the DIX level
         for the XFree86 and TinyX servers.
       - Eliminate unnecessary wrapper-related hacks for non-XFree86 servers.
       - Fix libglx module build.
       - Support for building "tiny" sets of some device-independent modules,
         allowing control over which pervasive extensions are included in
         the TinyX servers.
       - Support for omitting extensions and font backends from TinyX.
       - Add per-server usage message support.
       - Numerous build/config cleanups.
      (X-Oz Technologies).

/*
 * $XFree86: xc/programs/Xserver/hw/tinyx/igs/igsdraw.h,v 1.2 2000/05/24 23:52:48 keithp Exp $
 *
 * Copyright © 2000 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 _IGSDRAW_H_
#define _IGSDRAW_H_

extern CARD8	igsPatRop[];

#define SetupIgs(s) KdScreenPriv(s); \
		    igsCardInfo(pScreenPriv); \
		    Cop5xxx *cop = igsc->cop; \
		    int	    cop_stride = pScreenPriv->screen->fb[0].pixelStride

#define _igsWaitLoop(cop,mask,value) { \
    int __loop = 1000000; \
    while (((cop)->control & (mask)) != (value)) { \
	if (--__loop <= 0) { \
	    FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \
	} \
    } \
}

#define _igsWaitDone(cop)   _igsWaitLoop(cop, \
					 (IGS_CONTROL_BUSY| \
					  IGS_CONTROL_MALLWBEPTZ), \
					 0)

#if 1
#define _igsWaitFull(cop)   _igsWaitLoop(cop, \
					 IGS_CONTROL_CMDFF, \
					 0)
#else
#define _igsWaitFull(cop)   _igsWaitDone(cop)
#endif

#define _igsWaitIdleEmpty(cop)	_igsWaitDone(cop)
#define _igsWaitHostBltAck(cop)	_igsWaitLoop(cop, \
					     (IGS_CONTROL_HBACKZ| \
					      IGS_CONTROL_CMDFF), \
					     0)
					      
#define _igsReset(cop)		((cop)->control = 0)

#define IgsInvertBits32(v) { \
    v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
    v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
    v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
}

#define IgsInvertBits16(v) { \
    v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \
    v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \
    v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \
}

#define IgsInvertBits8(v) { \
    v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \
    v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \
    v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \
}

#define IgsByteSwap32(x)    	((x) = (((x) >> 24) | \
					(((x) >> 8) & 0xff00) | \
					(((x) << 8) & 0xff0000) | \
					((x) << 24)))

#define IgsByteSwap16(x)    	((x) = ((x) << 8) | ((x) >> 8))

#define igsPatternDimOk(d)  ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0))

#if BITMAP_BIT_ORDER == LSBFirst
#define IgsAdjustBits32(b)	IgsInvertBits32(b)
#define IgsAdjustBits16(x)	IgsInvertBits16(x)
#else
#define IgsAdjustBits32(x)	IgsByteSwap32(x)
#define IgsAdjustBits16(x)	IgsByteSwap16(x)
#endif

#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\
    _igsWaitFull(cop); \
    (cop)->mix = IGS_MAKE_MIX(alu,alu); \
    (cop)->fg = (pix); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_FG | \
	     IGS_HBLT_DISABLE | \
	     IGS_SRC2_NORMAL | \
	     IGS_STEP_PXBLT | \
	     IGS_FGS_FG | \
	     IGS_BGS_BG); \
}

#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\
    _igsWaitFull(cop); \
    (cop)->mix = IGS_MAKE_MIX(alu,alu); \
    (cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \
    (cop)->src1_start = (base); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_TILE | \
	     IGS_HBLT_DISABLE | \
	     IGS_SRC2_NORMAL | \
	     IGS_STEP_PXBLT | \
	     IGS_FGS_SRC | \
	     IGS_BGS_BG); \
}

#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\
    _igsWaitFull(cop); \
    (cop)->mix = IGS_MAKE_MIX(alu,alu); \
    (cop)->src1_start = (base); \
    (cop)->fg = (pix); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_STIP_TRANS | \
	     IGS_HBLT_DISABLE | \
	     IGS_SRC2_NORMAL | \
	     IGS_STEP_PXBLT | \
	     IGS_FGS_FG | \
	     IGS_BGS_BG); \
}

#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\
    _igsWaitFull(cop); \
    (cop)->mix = IGS_MAKE_MIX(alu,alu); \
    (cop)->src1_start = (base); \
    (cop)->fg = (_fg); \
    (cop)->bg = (_bg); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_STIP_OPAQUE | \
	     IGS_HBLT_DISABLE | \
	     IGS_SRC2_NORMAL | \
	     IGS_STEP_PXBLT | \
	     IGS_FGS_FG | \
	     IGS_BGS_BG); \
}

#define _igsRect(cop,x,y,w,h,cmd) { \
    _igsWaitFull(cop); \
    (cop)->dst_start = (x) + (y) * (cop_stride); \
    (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
    (cop)->operation = (cmd); \
}

#define _igsPatRect(cop,x,y,w,h,cmd) { \
    _igsWaitFull(cop); \
    (cop)->dst_start = (x) + (y) * (cop_stride); \
    (cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \
    (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
    (cop)->operation = (cmd); \
}

#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \
    _igsWaitFull(cop); \
    (cop)->mix = IGS_MAKE_MIX(alu,alu); \
    (cop)->src1_stride = cop_stride - 1; \
    (cmd) = (IGS_DRAW_ALL | \
	     IGS_PIXEL_FG | \
	     IGS_HBLT_DISABLE | \
	     IGS_SRC2_NORMAL | \
	     IGS_STEP_PXBLT | \
	     IGS_FGS_SRC | \
	     IGS_BGS_BG); \
    if (backwards) (cmd) |= IGS_DRAW_R_L; \
    if (upsidedown) (cmd) |= IGS_DRAW_B_T; \
}

#if 0
#define _igsPreparePlaneBlt(cop) { \
    _igsReset(cop); \
    (cop)->dst_stride = cop_stride - 1; \
    (cop)->src1_stride = cop_stride - 1; \
    (cop)->src2_stride = cop_stride - 1; \
    (cop)->format = IGS_FORMAT_16BPP;  \
    (cop)->src1_start = 0; \
    (cop)->src2_start = 0; \
}
#else
#define _igsPreparePlaneBlt(cop)
#endif
    
#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \
    _igsWaitIdleEmpty(cop); \
    _igsPreparePlaneBlt(cop); \
    (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
    (cop)->fg = (fg_pix); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_FG | \
	     IGS_HBLT_WRITE_2 | \
	     IGS_SRC2_MONO_TRANS | \
	     IGS_STEP_TERNARY_PXBLT | \
	     IGS_FGS_FG | \
	     IGS_BGS_BG); \
}

#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \
    _igsWaitIdleEmpty(cop); \
    _igsPreparePlaneBlt(cop); \
    (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \
    (cop)->fg = (fg_pix); \
    (cop)->bg = (bg_pix); \
    (cmd) = (IGS_DRAW_T_B | \
	     IGS_DRAW_L_R | \
	     IGS_DRAW_ALL | \
	     IGS_PIXEL_FG | \
	     IGS_HBLT_WRITE_2 | \
	     IGS_SRC2_MONO_OPAQUE | \
	     IGS_STEP_TERNARY_PXBLT | \
	     IGS_FGS_FG | \
	     IGS_BGS_BG); \
}

#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \
/*    _igsWaitFull(cop); */ \
    (cop)->dst_start = (x) + (y) * (cop_stride); \
    (cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \
    (cop)->operation = (cmd); \
/*    _igsWaitHostBltAck(cop); */ \
}
    
#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \
    _igsWaitFull(cop); \
    (cop)->dst_start = (dx) + (dy) * cop_stride; \
    (cop)->src1_start = (sx) + (sy) * cop_stride; \
    (cop)->src1_stride = cop_stride - 1; \
    (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \
    (cop)->operation = (cmd); \
}

#define sourceInvarient(alu)	(((alu) & 3) == (((alu) >> 2) & 3))

#endif

Powered by
ViewCVS 0.9.2