First import
[xorg_rtime.git] / xorg-server-1.4 / hw / kdrive / smi / smidraw.h
blob4165c7406b9e86c6545e6bc7cb21caa3b5a55712
1 /*
2 * Copyright © 1999 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #ifndef _SMIDRAW_H_
24 #define _SMIDRAW_H_
26 #define SetupSmi(s) KdScreenPriv(s); \
27 smiCardInfo(pScreenPriv); \
28 Cop *cop = smic->cop
30 #define SmiAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
32 #define _smiInit(cop,smic) { \
33 if ((cop)->status == 0xffffffff) smiSetMMIO(smic); \
34 (cop)->multi = (smic)->cop_depth; \
35 (cop)->multi = (smic)->cop_stride; \
36 (cop)->multi = SmiAlpha; \
37 } \
39 #define _smiSetSolidRect(cop,pix,alu,cmd) {\
40 cop->multi = COP_MULTI_PATTERN; \
41 cop->multi = COP_MULTI_ROP | smiRop[alu]; \
42 cop->fg = (pix); \
43 cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
46 #define _smiRect(cop,x1,y1,x2,y2,cmd) { \
47 (cop)->dst_start_xy = TRI_XY (x1,y1); \
48 (cop)->dst_end_xy = TRI_XY(x2,y2); \
49 _smiWaitDone(cop); \
50 (cop)->command = (cmd); \
53 #define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
54 COP_STATUS_DPE_BUSY | \
55 COP_STATUS_MI_BUSY)
57 #define _smiWaitDone(cop) { \
58 int __q__ = 500000; \
59 while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
60 ; \
61 if (!__q__) \
62 (cop)->status = 0; \
65 #define _smiWaitIdleEmpty(cop) _smiWaitDone(cop)
67 #define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
69 #endif