OSDN Git Service

02e548be0ed2283686b4449e819874c8c9b55357
[android-x86/external-mesa.git] / src / mesa / drivers / dri / i810 / server / i810_common.h
1 /* i810_common.h -- common header definitions for I810 2D/3D/DRM suite
2  *
3  * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the next
14  * paragraph) shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  * Converted to common header format:
26  *   Jens Owen <jens@tungstengraphics.com>
27  *
28  * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h,v 1.1 2002/09/11 00:29:31 dawes Exp $
29  *
30  */
31
32 /* WARNING: If you change any of these defines, make sure to change
33  * the kernel include file as well (i810_drm.h)
34  */
35
36 #ifndef _I810_COMMON_H_
37 #define _I810_COMMON_H_
38
39 #ifndef _I810_DEFINES_
40 #define _I810_DEFINES_
41 #define I810_USE_BATCH 1
42
43 #define I810_DMA_BUF_ORDER     12
44 #define I810_DMA_BUF_SZ        (1<<I810_DMA_BUF_ORDER)
45 #define I810_DMA_BUF_NR        256
46
47 #define I810_NR_SAREA_CLIPRECTS 8
48
49 /* Each region is a minimum of 64k, and there are at most 64 of them.
50  */
51 #define I810_NR_TEX_REGIONS 64
52 #define I810_LOG_MIN_TEX_REGION_SIZE 16
53
54 /* Destbuffer state
55  *    - backbuffer linear offset and pitch -- invarient in the current dri
56  *    - zbuffer linear offset and pitch -- also invarient
57  *    - drawing origin in back and depth buffers.
58  *
59  * Keep the depth/back buffer state here to acommodate private buffers
60  * in the future.
61  */
62 #define I810_DESTREG_DI0  0             /* CMD_OP_DESTBUFFER_INFO (2 dwords) */
63 #define I810_DESTREG_DI1  1
64 #define I810_DESTREG_DV0  2             /* GFX_OP_DESTBUFFER_VARS (2 dwords) */
65 #define I810_DESTREG_DV1  3
66 #define I810_DESTREG_DR0  4             /* GFX_OP_DRAWRECT_INFO (4 dwords) */
67 #define I810_DESTREG_DR1  5
68 #define I810_DESTREG_DR2  6
69 #define I810_DESTREG_DR3  7
70 #define I810_DESTREG_DR4  8
71 #define I810_DEST_SETUP_SIZE 10
72
73 /* Context state
74  */
75 #define I810_CTXREG_CF0   0             /* GFX_OP_COLOR_FACTOR */
76 #define I810_CTXREG_CF1   1
77 #define I810_CTXREG_ST0   2             /* GFX_OP_STIPPLE */
78 #define I810_CTXREG_ST1   3
79 #define I810_CTXREG_VF    4             /* GFX_OP_VERTEX_FMT */
80 #define I810_CTXREG_MT    5             /* GFX_OP_MAP_TEXELS */
81 #define I810_CTXREG_MC0   6             /* GFX_OP_MAP_COLOR_STAGES - stage 0 */
82 #define I810_CTXREG_MC1   7             /* GFX_OP_MAP_COLOR_STAGES - stage 1 */
83 #define I810_CTXREG_MC2   8             /* GFX_OP_MAP_COLOR_STAGES - stage 2 */
84 #define I810_CTXREG_MA0   9             /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */
85 #define I810_CTXREG_MA1   10            /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */
86 #define I810_CTXREG_MA2   11            /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */
87 #define I810_CTXREG_SDM   12            /* GFX_OP_SRC_DEST_MONO */
88 #define I810_CTXREG_FOG   13            /* GFX_OP_FOG_COLOR */
89 #define I810_CTXREG_B1    14            /* GFX_OP_BOOL_1 */
90 #define I810_CTXREG_B2    15            /* GFX_OP_BOOL_2 */
91 #define I810_CTXREG_LCS   16            /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */
92 #define I810_CTXREG_PV    17            /* GFX_OP_PV_RULE -- Invarient! */
93 #define I810_CTXREG_ZA    18            /* GFX_OP_ZBIAS_ALPHAFUNC */
94 #define I810_CTXREG_AA    19            /* GFX_OP_ANTIALIAS */
95 #define I810_CTX_SETUP_SIZE 20
96
97 /* Texture state (per tex unit)
98  */
99 #define I810_TEXREG_MI0  0              /* GFX_OP_MAP_INFO (4 dwords) */
100 #define I810_TEXREG_MI1  1
101 #define I810_TEXREG_MI2  2
102 #define I810_TEXREG_MI3  3
103 #define I810_TEXREG_MF   4              /* GFX_OP_MAP_FILTER */
104 #define I810_TEXREG_MLC  5              /* GFX_OP_MAP_LOD_CTL */
105 #define I810_TEXREG_MLL  6              /* GFX_OP_MAP_LOD_LIMITS */
106 #define I810_TEXREG_MCS  7              /* GFX_OP_MAP_COORD_SETS ??? */
107 #define I810_TEX_SETUP_SIZE 8
108
109 /* Driver specific DRM command indices
110  * NOTE: these are not OS specific, but they are driver specific
111  */
112 #define DRM_I810_INIT                     0x00
113 #define DRM_I810_VERTEX                   0x01
114 #define DRM_I810_CLEAR                    0x02
115 #define DRM_I810_FLUSH                    0x03
116 #define DRM_I810_GETAGE                   0x04
117 #define DRM_I810_GETBUF                   0x05
118 #define DRM_I810_SWAP                     0x06
119 #define DRM_I810_COPY                     0x07
120 #define DRM_I810_DOCOPY                   0x08
121 #define DRM_I810_OV0INFO                  0x09
122 #define DRM_I810_FSTATUS                  0x0a
123 #define DRM_I810_OV0FLIP                  0x0b
124 #define DRM_I810_MC                       0x0c
125 #define DRM_I810_RSTATUS                  0x0d
126 #define DRM_I810_FLIP                     0x0e
127
128 #endif
129
130 typedef enum _drmI810Initfunc {
131         I810_INIT_DMA = 0x01,
132         I810_CLEANUP_DMA = 0x02,
133         I810_INIT_DMA_1_4 = 0x03
134 } drmI810Initfunc;
135
136 typedef struct {
137    drmI810Initfunc func;
138    unsigned int mmio_offset;
139    unsigned int buffers_offset;
140    int sarea_priv_offset;
141    unsigned int ring_start;
142    unsigned int ring_end;
143    unsigned int ring_size;
144    unsigned int front_offset;
145    unsigned int back_offset;
146    unsigned int depth_offset;
147    unsigned int overlay_offset;
148    unsigned int overlay_physical;
149    unsigned int w;
150    unsigned int h;
151    unsigned int pitch;
152    unsigned int pitch_bits;
153 } drmI810Init;
154
155 typedef struct {
156    void *virtual;
157    int request_idx;
158    int request_size;
159    int granted;
160 } drmI810DMA;
161
162 /* Flags for clear ioctl
163  */
164 #define I810_FRONT   0x1
165 #define I810_BACK    0x2
166 #define I810_DEPTH   0x4
167
168 typedef struct {
169    int clear_color;
170    int clear_depth;
171    int flags;
172 } drmI810Clear;
173
174 typedef struct {
175    int idx;                             /* buffer index */
176    int used;                            /* nr bytes in use */
177    int discard;                         /* client is finished with the buffer? */
178 } drmI810Vertex;
179
180 /* Flags for vertex ioctl
181  */
182 #define PR_TRIANGLES         (0x0<<18)
183 #define PR_TRISTRIP_0        (0x1<<18)
184 #define PR_TRISTRIP_1        (0x2<<18)
185 #define PR_TRIFAN            (0x3<<18)
186 #define PR_POLYGON           (0x4<<18)
187 #define PR_LINES             (0x5<<18)
188 #define PR_LINESTRIP         (0x6<<18)
189 #define PR_RECTS             (0x7<<18)
190 #define PR_MASK              (0x7<<18)
191
192 #endif