2
* Copyright 2000 Gareth Hughes
5
* Permission is hereby granted, free of charge, to any person obtaining a
6
* copy of this software and associated documentation files (the "Software"),
7
* to deal in the Software without restriction, including without limitation
8
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
* and/or sell copies of the Software, and to permit persons to whom the
10
* Software is furnished to do so, subject to the following conditions:
12
* The above copyright notice and this permission notice (including the next
13
* paragraph) shall be included in all copies or substantial portions of the
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
* GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
* Gareth Hughes <gareth@valinux.com>
27
* Leif Delgass <ldelgass@retinalburn.net>
30
#ifndef __MACH64_SAREA_H__
31
#define __MACH64_SAREA_H__ 1
35
/* WARNING: If you change any of these defines, make sure to change the
36
* defines in the kernel file (mach64_drm.h)
38
#ifndef __MACH64_SAREA_DEFINES__
39
#define __MACH64_SAREA_DEFINES__ 1
41
/* What needs to be changed for the current vertex buffer?
42
* GH: We're going to be pedantic about this. We want the card to do as
43
* little as possible, so let's avoid having it fetch a whole bunch of
44
* register values that don't change all that often, if at all.
46
#define MACH64_UPLOAD_DST_OFF_PITCH 0x0001
47
#define MACH64_UPLOAD_Z_OFF_PITCH 0x0002
48
#define MACH64_UPLOAD_Z_ALPHA_CNTL 0x0004
49
#define MACH64_UPLOAD_SCALE_3D_CNTL 0x0008
50
#define MACH64_UPLOAD_DP_FOG_CLR 0x0010
51
#define MACH64_UPLOAD_DP_WRITE_MASK 0x0020
52
#define MACH64_UPLOAD_DP_PIX_WIDTH 0x0040
53
#define MACH64_UPLOAD_SETUP_CNTL 0x0080
54
#define MACH64_UPLOAD_MISC 0x0100
55
#define MACH64_UPLOAD_TEXTURE 0x0200
56
#define MACH64_UPLOAD_TEX0IMAGE 0x0400
57
#define MACH64_UPLOAD_TEX1IMAGE 0x0800
58
#define MACH64_UPLOAD_CLIPRECTS 0x1000 /* handled client-side */
59
#define MACH64_UPLOAD_CONTEXT 0x00ff
60
#define MACH64_UPLOAD_ALL 0x1fff
64
#define MACH64_BUFFER_SIZE 16384
66
/* Max number of swaps allowed on the ring
67
* before the client must wait
69
#define MACH64_MAX_QUEUED_FRAMES 3
71
/* Byte offsets for host blit buffer data
73
#define MACH64_HOSTDATA_BLIT_OFFSET 104
75
/* Keep these small for testing.
77
#define MACH64_NR_SAREA_CLIPRECTS 8
80
#define MACH64_CARD_HEAP 0
81
#define MACH64_AGP_HEAP 1
82
#define MACH64_NR_TEX_HEAPS 2
83
#define MACH64_NR_TEX_REGIONS 64
84
#define MACH64_LOG_TEX_GRANULARITY 16
86
#define MACH64_TEX_MAXLEVELS 1
88
#define MACH64_NR_CONTEXT_REGS 15
89
#define MACH64_NR_TEXTURE_REGS 4
91
#endif /* __MACH64_SAREA_DEFINES__ */
95
unsigned int dst_off_pitch; /* 0x500 */
97
unsigned int z_off_pitch; /* 0x548 */ /* ****** */
98
unsigned int z_cntl; /* 0x54c */
99
unsigned int alpha_tst_cntl; /* 0x550 */
101
unsigned int scale_3d_cntl; /* 0x5fc */
103
unsigned int sc_left_right; /* 0x6a8 */
104
unsigned int sc_top_bottom; /* 0x6b4 */
106
unsigned int dp_fog_clr; /* 0x6c4 */
107
unsigned int dp_write_mask; /* 0x6c8 */
108
unsigned int dp_pix_width; /* 0x6d0 */
109
unsigned int dp_mix; /* 0x6d4 */ /* ****** */
110
unsigned int dp_src; /* 0x6d8 */ /* ****** */
112
unsigned int clr_cmp_cntl; /* 0x708 */ /* ****** */
113
unsigned int gui_traj_cntl; /* 0x730 */ /* ****** */
115
unsigned int setup_cntl; /* 0x304 */
118
unsigned int tex_size_pitch; /* 0x770 */
119
unsigned int tex_cntl; /* 0x774 */
120
unsigned int secondary_tex_off; /* 0x778 */
121
unsigned int tex_offset; /* 0x5c0 */
122
} mach64_context_regs_t;
125
/* The channel for communication of state information to the kernel
126
* on firing a vertex buffer.
128
mach64_context_regs_t ContextState;
130
unsigned int vertsize;
133
/* The current cliprects, or a subset thereof.
135
drm_clip_rect_t boxes[MACH64_NR_SAREA_CLIPRECTS];
138
/* Counter for throttling of rendering clients.
140
unsigned int frames_queued;
142
/* Maintain an LRU of contiguous regions of texture space. If you
143
* think you own a region of texture memory, and it has an age
144
* different to the one you set, then you are mistaken and it has
145
* been stolen by another client. If global texAge hasn't changed,
146
* there is no need to walk the list.
148
* These regions can be used as a proxy for the fine-grained texture
149
* information of other clients - by maintaining them in the same
150
* lru which is used to age their own textures, clients have an
151
* approximate lru for the whole of global texture space, and can
152
* make informed decisions as to which areas to kick out. There is
153
* no need to choose whether to kick out your own texture or someone
154
* else's - simply eject them all in LRU order.
156
drmTextureRegion texList[MACH64_NR_TEX_HEAPS][MACH64_NR_TEX_REGIONS+1];
157
unsigned int texAge[MACH64_NR_TEX_HEAPS];
159
int ctxOwner; /* last context to upload state */
160
} ATISAREAPrivRec, *ATISAREAPrivPtr;
162
#endif /* __MACH64_SAREA_H__ */