Minor r200 vertex program cleanups. Remove disabled leftovers from r300 vertex progra...
[mesa.git] / src / mesa / drivers / dri / i965 / server / i830_common.h
1 /**************************************************************************
2
3 Copyright 2001 VA Linux Systems Inc., Fremont, California.
4 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
5
6 All Rights Reserved.
7
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the "Software"),
10 to deal in the Software without restriction, including without limitation
11 on the rights to use, copy, modify, merge, publish, distribute, sub
12 license, and/or sell copies of the Software, and to permit persons to whom
13 the Software is furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice (including the next
16 paragraph) shall be included in all copies or substantial portions of the
17 Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22 ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27 **************************************************************************/
28
29 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
30
31 #ifndef _I830_COMMON_H_
32 #define _I830_COMMON_H_
33
34
35 #define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */
36 #define I830_LOG_MIN_TEX_REGION_SIZE 14
37
38
39 /* Driver specific DRM command indices
40 * NOTE: these are not OS specific, but they are driver specific
41 */
42 #define DRM_I830_INIT 0x00
43 #define DRM_I830_FLUSH 0x01
44 #define DRM_I830_FLIP 0x02
45 #define DRM_I830_BATCHBUFFER 0x03
46 #define DRM_I830_IRQ_EMIT 0x04
47 #define DRM_I830_IRQ_WAIT 0x05
48 #define DRM_I830_GETPARAM 0x06
49 #define DRM_I830_SETPARAM 0x07
50 #define DRM_I830_ALLOC 0x08
51 #define DRM_I830_FREE 0x09
52 #define DRM_I830_INIT_HEAP 0x0a
53 #define DRM_I830_CMDBUFFER 0x0b
54 #define DRM_I830_DESTROY_HEAP 0x0c
55
56 typedef struct {
57 enum {
58 I830_INIT_DMA = 0x01,
59 I830_CLEANUP_DMA = 0x02,
60 I830_RESUME_DMA = 0x03
61 } func;
62 unsigned int mmio_offset;
63 int sarea_priv_offset;
64 unsigned int ring_start;
65 unsigned int ring_end;
66 unsigned int ring_size;
67 unsigned int front_offset;
68 unsigned int back_offset;
69 unsigned int depth_offset;
70 unsigned int w;
71 unsigned int h;
72 unsigned int pitch;
73 unsigned int pitch_bits;
74 unsigned int back_pitch;
75 unsigned int depth_pitch;
76 unsigned int cpp;
77 unsigned int chipset;
78 } drmI830Init;
79
80 typedef struct {
81 drmTextureRegion texList[I830_NR_TEX_REGIONS+1];
82 int last_upload; /* last time texture was uploaded */
83 int last_enqueue; /* last time a buffer was enqueued */
84 volatile int last_dispatch; /* age of the most recently dispatched buffer */
85 int ctxOwner; /* last context to upload state */
86 int texAge;
87 int pf_enabled; /* is pageflipping allowed? */
88 int pf_active;
89 int pf_current_page; /* which buffer is being displayed? */
90 int perf_boxes; /* performance boxes to be displayed */
91 int width, height; /* screen size in pixels */
92
93 drm_handle_t front_handle;
94 int front_offset;
95 int front_size;
96
97 drm_handle_t back_handle;
98 int back_offset;
99 int back_size;
100
101 drm_handle_t depth_handle;
102 int depth_offset;
103 int depth_size;
104
105 drm_handle_t tex_handle;
106 int tex_offset;
107 int tex_size;
108 int log_tex_granularity;
109 int pitch;
110 int rotation; /* 0, 90, 180 or 270 */
111 int rotated_offset;
112 int rotated_size;
113 int rotated_pitch;
114 int virtualX, virtualY;
115
116 unsigned int front_tiled;
117 unsigned int back_tiled;
118 unsigned int depth_tiled;
119 unsigned int rotated_tiled;
120 unsigned int rotated2_tiled;
121 } drmI830Sarea;
122
123 /* Flags for perf_boxes
124 */
125 #define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
126 #define I830_BOX_FLIP 0x2 /* populated by kernel */
127 #define I830_BOX_WAIT 0x4 /* populated by kernel & client */
128 #define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
129 #define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
130
131
132 typedef struct {
133 int start; /* agp offset */
134 int used; /* nr bytes in use */
135 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
136 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
137 int num_cliprects; /* mulitpass with multiple cliprects? */
138 drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
139 } drmI830BatchBuffer;
140
141 typedef struct {
142 char *buf; /* agp offset */
143 int sz; /* nr bytes in use */
144 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
145 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
146 int num_cliprects; /* mulitpass with multiple cliprects? */
147 drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
148 } drmI830CmdBuffer;
149
150 typedef struct {
151 int *irq_seq;
152 } drmI830IrqEmit;
153
154 typedef struct {
155 int irq_seq;
156 } drmI830IrqWait;
157
158 typedef struct {
159 int param;
160 int *value;
161 } drmI830GetParam;
162
163 #define I830_PARAM_IRQ_ACTIVE 1
164 #define I830_PARAM_ALLOW_BATCHBUFFER 2
165
166 typedef struct {
167 int param;
168 int value;
169 } drmI830SetParam;
170
171 #define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
172 #define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
173 #define I830_SETPARAM_ALLOW_BATCHBUFFER 3
174
175
176 /* A memory manager for regions of shared memory:
177 */
178 #define I830_MEM_REGION_AGP 1
179
180 typedef struct {
181 int region;
182 int alignment;
183 int size;
184 int *region_offset; /* offset from start of fb or agp */
185 } drmI830MemAlloc;
186
187 typedef struct {
188 int region;
189 int region_offset;
190 } drmI830MemFree;
191
192 typedef struct {
193 int region;
194 int size;
195 int start;
196 } drmI830MemInitHeap;
197
198 typedef struct {
199 int region;
200 } drmI830MemDestroyHeap;
201
202
203 #endif /* _I830_DRM_H_ */