1 /**************************************************************************
3 Copyright 2001 VA Linux Systems Inc., Fremont, California.
4 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
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:
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
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.
27 **************************************************************************/
29 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
31 #ifndef _I830_COMMON_H_
32 #define _I830_COMMON_H_
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
39 /* Driver specific DRM command indices
40 * NOTE: these are not OS specific, but they are driver specific
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 #define DRM_I830_MMIO 0x10
60 I830_CLEANUP_DMA = 0x02,
61 I830_RESUME_DMA = 0x03
63 unsigned int mmio_offset;
64 int sarea_priv_offset;
65 unsigned int ring_start;
66 unsigned int ring_end;
67 unsigned int ring_size;
68 unsigned int front_offset;
69 unsigned int back_offset;
70 unsigned int depth_offset;
74 unsigned int pitch_bits;
75 unsigned int back_pitch;
76 unsigned int depth_pitch;
82 drmTextureRegion texList[I830_NR_TEX_REGIONS+1];
83 int last_upload; /* last time texture was uploaded */
84 int last_enqueue; /* last time a buffer was enqueued */
85 volatile int last_dispatch; /* age of the most recently dispatched buffer */
86 int ctxOwner; /* last context to upload state */
88 int pf_enabled; /* is pageflipping allowed? */
90 int pf_current_page; /* which buffer is being displayed? */
91 int perf_boxes; /* performance boxes to be displayed */
92 int width, height; /* screen size in pixels */
94 drm_handle_t front_handle;
98 drm_handle_t back_handle;
102 drm_handle_t depth_handle;
106 drm_handle_t tex_handle;
109 int log_tex_granularity;
111 int rotation; /* 0, 90, 180 or 270 */
115 int virtualX, virtualY;
117 unsigned int front_tiled;
118 unsigned int back_tiled;
119 unsigned int depth_tiled;
120 unsigned int rotated_tiled;
121 unsigned int rotated2_tiled;
124 /* Flags for perf_boxes
126 #define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
127 #define I830_BOX_FLIP 0x2 /* populated by kernel */
128 #define I830_BOX_WAIT 0x4 /* populated by kernel & client */
129 #define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
130 #define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
134 int start; /* agp offset */
135 int used; /* nr bytes in use */
136 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
137 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
138 int num_cliprects; /* mulitpass with multiple cliprects? */
139 drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
140 } drmI830BatchBuffer;
143 char *buf; /* agp offset */
144 int sz; /* nr bytes in use */
145 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
146 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
147 int num_cliprects; /* mulitpass with multiple cliprects? */
148 drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
164 #define I830_PARAM_IRQ_ACTIVE 1
165 #define I830_PARAM_ALLOW_BATCHBUFFER 2
172 #define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
173 #define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
174 #define I830_SETPARAM_ALLOW_BATCHBUFFER 3
177 /* A memory manager for regions of shared memory:
179 #define I830_MEM_REGION_AGP 1
185 int *region_offset; /* offset from start of fb or agp */
197 } drmI830MemInitHeap;
201 } drmI830MemDestroyHeap;
206 #define MMIO_REGS_IA_PRIMATIVES_COUNT 0
207 #define MMIO_REGS_IA_VERTICES_COUNT 1
208 #define MMIO_REGS_VS_INVOCATION_COUNT 2
209 #define MMIO_REGS_GS_PRIMITIVES_COUNT 3
210 #define MMIO_REGS_GS_INVOCATION_COUNT 4
211 #define MMIO_REGS_CL_PRIMITIVES_COUNT 5
212 #define MMIO_REGS_CL_INVOCATION_COUNT 6
213 #define MMIO_REGS_PS_INVOCATION_COUNT 7
214 #define MMIO_REGS_PS_DEPTH_COUNT 8
217 unsigned int read_write:1;
222 #endif /* _I830_DRM_H_ */