summaryrefslogtreecommitdiff
path: root/src/glint_dripriv.h
blob: 76dfd2be4d11208adec9976f8c6f261dada49429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dripriv.h,v 1.5 2000/06/17 10:00:13 alanh Exp $ */
/**************************************************************************

Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,

TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/

/*
 * Author:
 *   Jens Owen <jens@tungstengraphics.com>
 *
 */

extern void GlxSetVisualConfigs(
    int nconfigs,
    __GLXvisualConfig *configs,
    void **configprivs
);

extern Bool GLINTCreateContext(ScreenPtr pScreen,
                               VisualPtr visual,
                               drm_context_t hwContext,
                               void* pVisualConfigPriv,
			       DRIContextType contextStore);

extern void GLINTDRISwapContext( ScreenPtr pScreen,
				 DRISyncType syncType,
				 DRIContextType readContextType,
				 void* readContextStore,
				 DRIContextType writeContextType,
				 void* writeContextStore);

/* Macros to Setup Generic Kernel Device Driver to Handle DMA for gamma */

/* WARNING!!! MAGIC NUMBER!!!  The number of regions already added to the
   kernel must be specified here.  Currently, the number is 2. */
#define DRM_REG(reg)                                               \
        (2                                                         \
	 + ((reg < 0x1000)                                         \
	    ? 0                                                    \
	    : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3))))

#define DRM_OFF(reg)                                               \
        ((reg < 0x1000)                                            \
	 ? reg                                                     \
	 : ((reg < 0x10000)                                        \
	    ? (reg - 0x1000)                                       \
	    : ((reg < 0x11000)                                     \
	       ? (reg - 0x10000)                                   \
	       : (reg - 0x11000))))


#define DRM_I_WRITE_R(reg,a,b,c,d) \
        DRM_I_WRITE(DRM_REG(reg), DRM_OFF(reg), a, b, c, d)

#define DRM_I_WRITE_IMM_R(reg,a) \
        DRM_I_WRITE_IMM(DRM_REG(reg), DRM_OFF(reg), a)

#define DRM_I_READ_R(reg) \
        DRM_I_READ(DRM_REG(reg), DRM_OFF(reg))

#define DRM_I_WHILE_IMM_R(reg,a,b) \
        DRM_I_WHILE_IMM(DRM_REG(reg), DRM_OFF(reg), a, b)

#define DRM_I_IF_IMM_R(reg,a,b,c) \
        DRM_I_IF_IMM(DRM_REG(reg), DRM_OFF(reg), a, b, c)

#define GLINTSync    GlintSync
#define GLINTSyncTag 0x188

#define GLINT_MAX_DRAWABLES 		15
#define GLINT_GAMMA_CONTEXT_SIZE	964
#define GLINT_GAMMA_CONTEXT_MASK	0x7ff

typedef struct {
    int		index;
} GLINTConfigPrivRec, *GLINTConfigPrivPtr;

typedef struct {

    /* 2D components */
    CARD32	CStartXDom;
    CARD32	CdXDom;
    CARD32	CStartXSub;
    CARD32	CdXSub;
    CARD32	CStartY;
    CARD32	CdY;
    CARD32	CGLINTCount;
    CARD32	CPointTable0;
    CARD32	CPointTable1;
    CARD32	CPointTable2;
    CARD32	CPointTable3;
    CARD32	CRasterizerMode;
    CARD32	CYLimits;
    CARD32	CScanLineOwnership;
    CARD32	CPixelSize;
    CARD32	CScissorMode;
    CARD32	CScissorMinXY;
    CARD32	CScissorMaxXY;
    CARD32	CScreenSize;
    CARD32	CAreaStippleMode;
    CARD32	CLineStippleMode;
    CARD32	CLoadLineStippleCounters;
    CARD32	CWindowOrigin;
    CARD32	CRouterMode;
    CARD32	CTextureAddressMode;
    CARD32	CTextureReadMode;
    CARD32	CTextureColorMode;
    CARD32	CFogMode;
    CARD32	CColorDDAMode;
    CARD32	CGLINTColor;
    CARD32	CAlphaTestMode;
    CARD32	CAntialiasMode;
    CARD32	CAlphaBlendMode;
    CARD32	CDitherMode;
    CARD32	CFBSoftwareWriteMask;
    CARD32	CLogicalOpMode;
    CARD32	CFBWriteData;
    CARD32	CLBReadMode;
    CARD32	CLBSourceOffset;
    CARD32	CLBWindowBase;
    CARD32	CLBWriteMode;
    CARD32	CTextureDownloadOffset;
    CARD32	CLBWindowOffset;
    CARD32	CGLINTWindow;
    CARD32	CStencilMode;
    CARD32	CDepthMode;
    CARD32	CGLINTDepth;
    CARD32	CFBReadMode;
    CARD32	CFBSourceOffset;
    CARD32	CFBPixelOffset;
    CARD32	CFBWindowBase;
    CARD32	CFBWriteMode;
    CARD32	CFBHardwareWriteMask;
    CARD32	CFBBlockColor;
    CARD32	CPatternRamMode;
    CARD32	CFBBlockColorU;
    CARD32	CFBBlockColorL;
    CARD32	CFilterMode;
    CARD32	CStatisticMode;
    CARD32	CBroadcastMask;

    /* 3D components */
    CARD32	CSStart;
    CARD32	CdSdx;
    CARD32	CdSdyDom;
    CARD32	CTStart;
    CARD32	CdTdx;
    CARD32	CdTdyDom;
    CARD32	CQStart;
    CARD32	CdQdx;
    CARD32	CdQdyDom;
    CARD32	CLOD;
    CARD32	CdSdy;
    CARD32	CdTdy;
    CARD32	CdQdy;
    CARD32	CTex;
    CARD32	CTextureFormat;
    CARD32	CTextureCacheControl;
    CARD32	CGLINTBorderColor;
    CARD32	CTexelLUTIndex;
    CARD32	CTexelLUTData;
    CARD32	CTexelLUTAddress;
    CARD32	CTexelLUTTransfer;
    CARD32	CTextureFilterMode;
    CARD32	CTextureChromaUpper;
    CARD32	CTextureChromaLower;
    CARD32	CTxBaseAddr0;
    CARD32	CTxBaseAddr1;
    CARD32	CTxBaseAddr2;
    CARD32	CTxBaseAddr3;
    CARD32	CTxBaseAddr4;
    CARD32	CTxBaseAddr5;
    CARD32	CTxBaseAddr6;
    CARD32	CTxBaseAddr7;
    CARD32	CTxBaseAddr8;
    CARD32	CTxBaseAddr9;
    CARD32	CTxBaseAddr10;
    CARD32	CTxBaseAddr11;
    CARD32	CTxBaseAddr12;
    CARD32	CTexelLUT0;
    CARD32	CTexelLUT1;
    CARD32	CTexelLUT2;
    CARD32	CTexelLUT3;
    CARD32	CTexelLUT4;
    CARD32	CTexelLUT5;
    CARD32	CTexelLUT6;
    CARD32	CTexelLUT7;
    CARD32	CTexelLUT8;
    CARD32	CTexelLUT9;
    CARD32	CTexelLUT10;
    CARD32	CTexelLUT11;
    CARD32	CTexelLUT12;
    CARD32	CTexelLUT13;
    CARD32	CTexelLUT14;
    CARD32	CTexelLUT15;
    CARD32	CTexel0;
    CARD32	CTexel1;
    CARD32	CTexel2;
    CARD32	CTexel3;
    CARD32	CTexel4;
    CARD32	CTexel5;
    CARD32	CTexel6;
    CARD32	CTexel7;
    CARD32	CInterp0;
    CARD32	CInterp1;
    CARD32	CInterp2;
    CARD32	CInterp3;
    CARD32	CInterp4;
    CARD32	CTextureFilter;
    CARD32	CTextureEnvColor;
    CARD32	CFogColor;
    CARD32	CFStart;
    CARD32	CdFdx;
    CARD32	CdFdyDom;
    CARD32	CKsStart;
    CARD32	CdKsdx;
    CARD32	CdKsdyDom;
    CARD32	CKdStart;
    CARD32	CdKdStart;
    CARD32	CdKddyDom;
    CARD32	CRStart;
    CARD32	CdRdx;
    CARD32	CdRdyDom;
    CARD32	CGStart;
    CARD32	CdGdx;
    CARD32	CdGdyDom;
    CARD32	CBStart;
    CARD32	CdBdx;
    CARD32	CdBdyDom;
    CARD32	CAStart;
    CARD32	CdAdx;
    CARD32	CdAdyDom;
    CARD32	CConstantColor;
    CARD32	CChromaUpper;
    CARD32	CChromaLower;
    CARD32	CChromaTestMode;
    CARD32	CStencilData;
    CARD32	CGLINTStencil;
    CARD32	CZStartU;
    CARD32	CZStartL;
    CARD32	CdZdxU;
    CARD32	CdZdxL;
    CARD32	CdZdyDomU;
    CARD32	CdZdyDomL;
    CARD32	CFastClearDepth;
    CARD32	CMinRegion;
    CARD32	CMaxRegion;
    CARD32	CKsRStart;
    CARD32	CdKsRdx;
    CARD32	CdKsRdyDom;
    CARD32	CKsGStart;
    CARD32	CdKsGdx;
    CARD32	CdKsGdyDom;
    CARD32	CKsBStart;
    CARD32	CdKsBdx;
    CARD32	CdKsBdyDom;
    CARD32	CKdRStart;
    CARD32	CdKdRdx;
    CARD32	CdKdRdyDom;
    CARD32	CKdGStart;
    CARD32	CdKdGdx;
    CARD32	CdKdGdyDom;
    CARD32	CKdBStart;
    CARD32	CdKdBdx;
    CARD32	CdKdBdyDom;

} GLINTMXRec;

typedef struct {
    GLINTMXRec	MX1;
    GLINTMXRec	MX2;
    CARD32      Gamma[GLINT_GAMMA_CONTEXT_SIZE];
} GLINTDRIContextRec, *GLINTDRIContextPtr;