fb6ceaa52d43ff8b2d4f845dedf3abc038dc733e
[mesa.git] / src / mesa / drivers / dri / i915 / 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 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
122 int pipeA_x;
123 int pipeA_y;
124 int pipeA_w;
125 int pipeA_h;
126 int pipeB_x;
127 int pipeB_y;
128 int pipeB_w;
129 int pipeB_h;
130 } drmI830Sarea;
131
132 /* Flags for perf_boxes
133 */
134 #define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
135 #define I830_BOX_FLIP 0x2 /* populated by kernel */
136 #define I830_BOX_WAIT 0x4 /* populated by kernel & client */
137 #define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
138 #define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
139
140
141 typedef struct {
142 int start; /* agp offset */
143 int used; /* 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 } drmI830BatchBuffer;
149
150 typedef struct {
151 char *buf; /* agp offset */
152 int sz; /* nr bytes in use */
153 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
154 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
155 int num_cliprects; /* mulitpass with multiple cliprects? */
156 drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
157 } drmI830CmdBuffer;
158
159 typedef struct {
160 int *irq_seq;
161 } drmI830IrqEmit;
162
163 typedef struct {
164 int irq_seq;
165 } drmI830IrqWait;
166
167 typedef struct {
168 int param;
169 int *value;
170 } drmI830GetParam;
171
172 #define I830_PARAM_IRQ_ACTIVE 1
173 #define I830_PARAM_ALLOW_BATCHBUFFER 2
174
175 typedef struct {
176 int param;
177 int value;
178 } drmI830SetParam;
179
180 #define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
181 #define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
182 #define I830_SETPARAM_ALLOW_BATCHBUFFER 3
183
184
185 /* A memory manager for regions of shared memory:
186 */
187 #define I830_MEM_REGION_AGP 1
188
189 typedef struct {
190 int region;
191 int alignment;
192 int size;
193 int *region_offset; /* offset from start of fb or agp */
194 } drmI830MemAlloc;
195
196 typedef struct {
197 int region;
198 int region_offset;
199 } drmI830MemFree;
200
201 typedef struct {
202 int region;
203 int size;
204 int start;
205 } drmI830MemInitHeap;
206
207 typedef struct {
208 int region;
209 } drmI830MemDestroyHeap;
210
211
212 #endif /* _I830_DRM_H_ */