~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/kdrive/smi/smi.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Id: smi.h,v 1.2 1999/11/02 08:17:24 keithp Exp $
 
3
 *
 
4
 * Copyright ļæ½ 2001 Keith Packard
 
5
 *
 
6
 * Permission to use, copy, modify, distribute, and sell this software and its
 
7
 * documentation for any purpose is hereby granted without fee, provided that
 
8
 * the above copyright notice appear in all copies and that both that
 
9
 * copyright notice and this permission notice appear in supporting
 
10
 * documentation, and that the name of Keith Packard not be used in
 
11
 * advertising or publicity pertaining to distribution of the software without
 
12
 * specific, written prior permission.  Keith Packard makes no
 
13
 * representations about the suitability of this software for any purpose.  It
 
14
 * is provided "as is" without express or implied warranty.
 
15
 *
 
16
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
17
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 
18
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
19
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 
20
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 
21
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
22
 * PERFORMANCE OF THIS SOFTWARE.
 
23
 */
 
24
/* $XFree86: xc/programs/Xserver/hw/kdrive/smi/smi.h,v 1.6 2001/07/24 19:06:03 keithp Exp $ */
 
25
 
 
26
#ifndef _SMI_H_
 
27
#define _SMI_H_
 
28
 
 
29
#define SMI_VESA 0
 
30
 
 
31
#if SMI_VESA
 
32
#include <vesa.h>
 
33
#define subGetColors vesaGetColors
 
34
#define subPutColors vesaPutColors
 
35
#define subInitialize vesaInitialize
 
36
#define subScreenInitialize vesaScreenInitialize
 
37
#define subInitScreen vesaInitScreen
 
38
#define subFinishInitScreen vesaFinishInitScreen
 
39
#define subCreateResources vesaCreateResources
 
40
#define subRandRSetConfig vesaRandRSetConfig
 
41
#define subPreserve vesaPreserve
 
42
#define subEnable vesaEnable
 
43
#define subDPMS vesaDPMS
 
44
#define subRestore vesaRestore
 
45
#define subScreenFini vesaScreenFini
 
46
#define subCardFini vesaCardFini
 
47
#define subDisable vesaDisable
 
48
#define SubCardPrivRec  VesaCardPrivRec
 
49
#define SubScreenPrivRec    VesaScreenPrivRec
 
50
#define subUseMsg() vesaUseMsg()
 
51
#define subProcessArgument(c,v,i) vesaProcessArgument(c,v,i)
 
52
#else
 
53
#include <fbdev.h>
 
54
#define subGetColors fbdevGetColors
 
55
#define subPutColors fbdevPutColors
 
56
#define subInitialize fbdevInitialize
 
57
#define subScreenInitialize fbdevScreenInitialize
 
58
#define subInitScreen fbdevInitScreen
 
59
#define subFinishInitScreen fbdevFinishInitScreen
 
60
#define subCreateResources fbdevCreateResources
 
61
#define subRandRSetConfig fbdevRandRSetConfig
 
62
#define subPreserve fbdevPreserve
 
63
#define subEnable fbdevEnable
 
64
#define subDPMS fbdevDPMS
 
65
#define subRestore fbdevRestore
 
66
#define subScreenFini fbdevScreenFini
 
67
#define subCardFini fbdevCardFini
 
68
#define subDisable fbdevDisable
 
69
#define SubCardPrivRec  FbdevPriv
 
70
#define SubScreenPrivRec    FbdevScrPriv
 
71
#define subUseMsg()
 
72
#define subProcessArgument(c,v,i) 0
 
73
#endif
 
74
 
 
75
#include "kxv.h"
 
76
 
 
77
#define SMI_DEBUG 0
 
78
#if SMI_DEBUG
 
79
#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
 
80
#else
 
81
#define DBGOUT(fmt,a...)
 
82
#endif
 
83
 
 
84
#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
 
85
#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
 
86
 
 
87
/*
 
88
 * offset from ioport beginning 
 
89
 */
 
90
 
 
91
#define SMI_IO_BASE(c)      ((c)->attr.io)
 
92
#define SMI_REG_BASE(c)     ((c)->attr.address[0])
 
93
#define SMI_REG_SIZE(c)     (4096)
 
94
 
 
95
#define SMI_DPR_OFF(c)      (0x00000)
 
96
 
 
97
typedef volatile CARD8  VOL8;
 
98
typedef volatile CARD16 VOL16;
 
99
typedef volatile CARD32 VOL32;
 
100
 
 
101
/* DPR reg */
 
102
typedef struct _DPR {
 
103
    VOL32   src_xy;                     /* 0x00 */
 
104
    VOL32   dst_xy;                     /* 0x04 */
 
105
    VOL32   dst_wh;                     /* 0x08 */
 
106
    VOL32   accel_cmd;                  /* 0x0c */
 
107
    VOL32   src_stride;                 /* 0x10 */
 
108
    VOL32   fg;                         /* 0x14 */
 
109
    VOL32   bg;                         /* 0x18 */
 
110
    VOL32   data_format;                /* 0x1c */
 
111
    VOL32   transparent;                /* 0x20 */
 
112
    VOL32   mask1;                      /* 0x24 ? */
 
113
    VOL32   mask2;                      /* 0x28 ? */
 
114
    VOL32   scissors_ul;                /* 0x2c */
 
115
    VOL32   scissors_lr;                /* 0x30 */
 
116
    VOL32   mask3;                      /* 0x34 */
 
117
    VOL32   mask4;                      /* 0x38 */
 
118
    VOL32   dst_stride;                 /* 0x3c */
 
119
    VOL32   unknown_40;                 /* 0x40 */
 
120
    VOL32   unknown_44;                 /* 0x44 */
 
121
} DPR;
 
122
 
 
123
#define SMI_XY(x,y)         (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
 
124
 
 
125
/* 2D Engine commands */
 
126
#define SMI_TRANSPARENT_SRC             0x00000100
 
127
#define SMI_TRANSPARENT_DEST            0x00000300
 
128
 
 
129
#define SMI_OPAQUE_PXL                  0x00000000
 
130
#define SMI_TRANSPARENT_PXL             0x00000400
 
131
 
 
132
#define SMI_MONO_PACK_8                 0x00001000
 
133
#define SMI_MONO_PACK_16                0x00002000
 
134
#define SMI_MONO_PACK_32                0x00003000
 
135
 
 
136
#define SMI_ROP2_SRC                    0x00008000
 
137
#define SMI_ROP2_PAT                    0x0000C000
 
138
#define SMI_ROP3                        0x00000000
 
139
 
 
140
#define SMI_BITBLT                      0x00000000
 
141
#define SMI_RECT_FILL                   0x00010000
 
142
#define SMI_TRAPEZOID_FILL              0x00030000
 
143
#define SMI_SHORT_STROKE                0x00060000
 
144
#define SMI_BRESENHAM_LINE              0x00070000
 
145
#define SMI_HOSTBLT_WRITE               0x00080000
 
146
#define SMI_HOSTBLT_READ                0x00090000
 
147
#define SMI_ROTATE_BLT                  0x000B0000
 
148
 
 
149
#define SMI_SRC_COLOR                   0x00000000
 
150
#define SMI_SRC_MONOCHROME              0x00400000
 
151
 
 
152
#define SMI_GRAPHICS_STRETCH            0x00800000
 
153
 
 
154
#define SMI_ROTATE_CW                   0x01000000
 
155
#define SMI_ROTATE_CCW                  0x02000000
 
156
 
 
157
#define SMI_MAJOR_X                     0x00000000
 
158
#define SMI_MAJOR_Y                     0x04000000
 
159
 
 
160
#define SMI_LEFT_TO_RIGHT               0x00000000
 
161
#define SMI_RIGHT_TO_LEFT               0x08000000
 
162
 
 
163
#define SMI_COLOR_PATTERN               0x40000000
 
164
#define SMI_MONO_PATTERN                0x00000000
 
165
 
 
166
#define SMI_QUICK_START                 0x10000000
 
167
#define SMI_START_ENGINE                0x80000000
 
168
 
 
169
#define VGA_SEQ_INDEX           0x3C4
 
170
#define VGA_SEQ_DATA            0x3C5
 
171
 
 
172
typedef struct _smiCardInfo {
 
173
    SubCardPrivRec      sub;
 
174
    CARD16              io_base;
 
175
    CARD8               *reg_base;
 
176
    DPR                 *dpr;
 
177
    int                 avail;
 
178
} SmiCardInfo;
 
179
    
 
180
#define getSmiCardInfo(kd)      ((SmiCardInfo *) ((kd)->card->driver))
 
181
#define smiCardInfo(kd) SmiCardInfo     *smic = getSmiCardInfo(kd)
 
182
 
 
183
typedef struct _smiScreenInfo {
 
184
    SubScreenPrivRec    sub;
 
185
    CARD8               *screen;
 
186
    CARD32              stride;
 
187
    CARD32              data_format;
 
188
    CARD8               dpr_vpr_enable;
 
189
    KaaScreenInfoRec kaa;
 
190
} SmiScreenInfo;
 
191
 
 
192
#define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver))
 
193
#define smiScreenInfo(kd)    SmiScreenInfo *smis = getSmiScreenInfo(kd)
 
194
    
 
195
void
 
196
smiPreserve (KdCardInfo *card);
 
197
 
 
198
Bool
 
199
smiMapReg (KdCardInfo *card, SmiCardInfo *smic);
 
200
 
 
201
void
 
202
smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic);
 
203
 
 
204
void
 
205
smiOutb (CARD16 port, CARD8 val);
 
206
 
 
207
CARD8
 
208
smiInb (CARD16 port);
 
209
 
 
210
CARD8
 
211
smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id);
 
212
 
 
213
void
 
214
smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val);
 
215
 
 
216
void
 
217
smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic);
 
218
 
 
219
void
 
220
smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic);
 
221
 
 
222
Bool
 
223
smiEnable (ScreenPtr pScreen);
 
224
 
 
225
void
 
226
smiDisable (ScreenPtr pScreen);
 
227
 
 
228
void
 
229
smiWaitAvail(SmiCardInfo *smic, int n);
 
230
 
 
231
void
 
232
smiWaitIdle (SmiCardInfo *smic);
 
233
    
 
234
Bool
 
235
smiDrawSetup (ScreenPtr pScreen);
 
236
 
 
237
Bool
 
238
smiDrawInit (ScreenPtr pScreen);
 
239
 
 
240
void
 
241
smiDrawReinit (ScreenPtr pScreen);
 
242
 
 
243
void
 
244
smiDrawEnable (ScreenPtr pScreen);
 
245
 
 
246
void
 
247
smiDrawDisable (ScreenPtr pScreen);
 
248
 
 
249
void
 
250
smiDrawFini (ScreenPtr pScreen);
 
251
 
 
252
CARD8
 
253
smiReadIndex (SmiCardInfo *smic, CARD16 port, CARD8 index);
 
254
 
 
255
void
 
256
smiWriteIndex (SmiCardInfo *smic, CARD16 port, CARD8 index, CARD8 value);
 
257
 
 
258
extern KdCardFuncs  smiFuncs;
 
259
 
 
260
#endif /* _SMI_H_ */