OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [drm-4.0/] [r128_drm.h] - Blame information for rev 1275

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*-
2
 * Created: Wed Apr  5 19:24:19 2000 by kevin@precisioninsight.com
3
 *
4
 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
5
 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
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
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
 * and/or sell copies of the Software, and to permit persons to whom the
13
 * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
22
 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
 * DEALINGS IN THE SOFTWARE.
26
 *
27
 * Authors:
28
 *    Kevin E. Martin <martin@valinux.com>
29
 *    Gareth Hughes <gareth@valinux.com>
30
 *
31
 */
32
 
33
#ifndef _R128_DRM_H_
34
#define _R128_DRM_H_
35
 
36
/* WARNING: If you change any of these defines, make sure to change the
37
 * defines in the X server file (r128_sarea.h)
38
 */
39
#ifndef __R128_SAREA_DEFINES__
40
#define __R128_SAREA_DEFINES__
41
 
42
/* What needs to be changed for the current vertex buffer?
43
 */
44
#define R128_UPLOAD_CONTEXT             0x001
45
#define R128_UPLOAD_SETUP               0x002
46
#define R128_UPLOAD_TEX0                0x004
47
#define R128_UPLOAD_TEX1                0x008
48
#define R128_UPLOAD_TEX0IMAGES          0x010
49
#define R128_UPLOAD_TEX1IMAGES          0x020
50
#define R128_UPLOAD_CORE                0x040
51
#define R128_UPLOAD_MASKS               0x080
52
#define R128_UPLOAD_WINDOW              0x100
53
#define R128_UPLOAD_CLIPRECTS           0x200   /* handled client-side */
54
#define R128_REQUIRE_QUIESCENCE         0x400
55
#define R128_UPLOAD_ALL                 0x7ff
56
 
57
#define R128_FRONT                      0x1
58
#define R128_BACK                       0x2
59
#define R128_DEPTH                      0x4
60
 
61
/* Primitive types
62
 */
63
#define R128_POINTS                     0x1
64
#define R128_LINES                      0x2
65
#define R128_LINE_STRIP                 0x3
66
#define R128_TRIANGLES                  0x4
67
#define R128_TRIANGLE_FAN               0x5
68
#define R128_TRIANGLE_STRIP             0x6
69
 
70
/* Vertex/indirect buffer size
71
 */
72
#if 1
73
#define R128_BUFFER_SIZE                16384
74
#else
75
#define R128_BUFFER_SIZE                (128 * 1024)
76
#endif
77
 
78
/* Byte offsets for indirect buffer data
79
 */
80
#define R128_INDEX_PRIM_OFFSET          20
81
#define R128_HOSTDATA_BLIT_OFFSET       32
82
 
83
/* 2048x2048 @ 32bpp texture requires this many indirect buffers
84
 */
85
#define R128_MAX_BLIT_BUFFERS           ((2048 * 2048 * 4) / R128_BUFFER_SIZE)
86
 
87
/* Keep these small for testing.
88
 */
89
#define R128_NR_SAREA_CLIPRECTS         12
90
 
91
/* There are 2 heaps (local/AGP).  Each region within a heap is a
92
 *  minimum of 64k, and there are at most 64 of them per heap.
93
 */
94
#define R128_LOCAL_TEX_HEAP             0
95
#define R128_AGP_TEX_HEAP               1
96
#define R128_NR_TEX_HEAPS               2
97
#define R128_NR_TEX_REGIONS             64
98
#define R128_LOG_TEX_GRANULARITY        16
99
 
100
#define R128_NR_CONTEXT_REGS            12
101
#define R128_TEX_MAXLEVELS              11
102
 
103
#endif /* __R128_SAREA_DEFINES__ */
104
 
105
typedef struct {
106
        /* Context state - can be written in one large chunk */
107
        unsigned int dst_pitch_offset_c;
108
        unsigned int dp_gui_master_cntl_c;
109
        unsigned int sc_top_left_c;
110
        unsigned int sc_bottom_right_c;
111
        unsigned int z_offset_c;
112
        unsigned int z_pitch_c;
113
        unsigned int z_sten_cntl_c;
114
        unsigned int tex_cntl_c;
115
        unsigned int misc_3d_state_cntl_reg;
116
        unsigned int texture_clr_cmp_clr_c;
117
        unsigned int texture_clr_cmp_msk_c;
118
        unsigned int fog_color_c;
119
 
120
        /* Texture state */
121
        unsigned int tex_size_pitch_c;
122
        unsigned int constant_color_c;
123
 
124
        /* Setup state */
125
        unsigned int pm4_vc_fpu_setup;
126
        unsigned int setup_cntl;
127
 
128
        /* Mask state */
129
        unsigned int dp_write_mask;
130
        unsigned int sten_ref_mask_c;
131
        unsigned int plane_3d_mask_c;
132
 
133
        /* Window state */
134
        unsigned int window_xy_offset;
135
 
136
        /* Core state */
137
        unsigned int scale_3d_cntl;
138
} drm_r128_context_regs_t;
139
 
140
/* Setup registers for each texture unit */
141
typedef struct {
142
        unsigned int tex_cntl;
143
        unsigned int tex_combine_cntl;
144
        unsigned int tex_size_pitch;
145
        unsigned int tex_offset[R128_TEX_MAXLEVELS];
146
        unsigned int tex_border_color;
147
} drm_r128_texture_regs_t;
148
 
149
 
150
typedef struct drm_tex_region {
151
        unsigned char next, prev;
152
        unsigned char in_use;
153
        int age;
154
} drm_tex_region_t;
155
 
156
typedef struct drm_r128_sarea {
157
        /* The channel for communication of state information to the kernel
158
         * on firing a vertex buffer.
159
         */
160
        drm_r128_context_regs_t context_state;
161
        drm_r128_texture_regs_t tex_state[R128_NR_TEX_HEAPS];
162
        unsigned int dirty;
163
        unsigned int vertsize;
164
        unsigned int vc_format;
165
 
166
        /* The current cliprects, or a subset thereof.
167
         */
168
        drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS];
169
        unsigned int nbox;
170
 
171
        /* Counters for client-side throttling of rendering clients.
172
         */
173
        unsigned int last_frame;
174
        unsigned int last_dispatch;
175
 
176
        drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1];
177
        int tex_age[R128_NR_TEX_HEAPS];
178
        int ctx_owner;
179
} drm_r128_sarea_t;
180
 
181
 
182
/* WARNING: If you change any of these defines, make sure to change the
183
 * defines in the Xserver file (xf86drmR128.h)
184
 */
185
typedef struct drm_r128_init {
186
        enum {
187
                R128_INIT_CCE    = 0x01,
188
                R128_CLEANUP_CCE = 0x02
189
        } func;
190
        int sarea_priv_offset;
191
        int is_pci;
192
        int cce_mode;
193
        int cce_secure;
194
        int ring_size;
195
        int usec_timeout;
196
 
197
        unsigned int fb_bpp;
198
        unsigned int front_offset, front_pitch;
199
        unsigned int back_offset, back_pitch;
200
        unsigned int depth_bpp;
201
        unsigned int depth_offset, depth_pitch;
202
        unsigned int span_offset;
203
 
204
        unsigned int fb_offset;
205
        unsigned int mmio_offset;
206
        unsigned int ring_offset;
207
        unsigned int ring_rptr_offset;
208
        unsigned int buffers_offset;
209
        unsigned int agp_textures_offset;
210
} drm_r128_init_t;
211
 
212
typedef struct drm_r128_cce_stop {
213
        int flush;
214
        int idle;
215
} drm_r128_cce_stop_t;
216
 
217
typedef struct drm_r128_clear {
218
        unsigned int flags;
219
        int x, y, w, h;
220
        unsigned int clear_color;
221
        unsigned int clear_depth;
222
} drm_r128_clear_t;
223
 
224
typedef struct drm_r128_vertex {
225
        int prim;
226
        int idx;                        /* Index of vertex buffer */
227
        int count;                      /* Number of vertices in buffer */
228
        int discard;                    /* Client finished with buffer? */
229
} drm_r128_vertex_t;
230
 
231
typedef struct drm_r128_indices {
232
        int prim;
233
        int idx;
234
        int start;
235
        int end;
236
        int discard;                    /* Client finished with buffer? */
237
} drm_r128_indices_t;
238
 
239
typedef struct drm_r128_blit {
240
        int idx;
241
        int pitch;
242
        int offset;
243
        int format;
244
        unsigned short x, y;
245
        unsigned short width, height;
246
} drm_r128_blit_t;
247
 
248
typedef struct drm_r128_depth {
249
        enum {
250
                R128_WRITE_SPAN         = 0x01,
251
                R128_WRITE_PIXELS       = 0x02,
252
                R128_READ_SPAN          = 0x03,
253
                R128_READ_PIXELS        = 0x04
254
        } func;
255
        int n;
256
        int *x;
257
        int *y;
258
        unsigned int *buffer;
259
        unsigned char *mask;
260
} drm_r128_depth_t;
261
 
262
typedef struct drm_r128_stipple {
263
        unsigned int *mask;
264
} drm_r128_stipple_t;
265
 
266
typedef struct drm_r128_packet {
267
        unsigned int *buffer;
268
        int count;
269
        int flags;
270
} drm_r128_packet_t;
271
 
272
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.