2 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4 The Weather Channel (TM) funded Tungsten Graphics to develop the
5 initial release of the Radeon 8500 driver under the XFree86 license.
6 This notice must be preserved.
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice (including the
17 next paragraph) shall be included in all copies or substantial
18 portions of the Software.
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
33 * \author Keith Whitwell <keith@tungstengraphics.com>
34 * \author Nicolai Haehnle <prefect_@gmx.net>
37 #ifndef __R600_CONTEXT_H__
38 #define __R600_CONTEXT_H__
40 #include "tnl/t_vertex.h"
42 #include "radeon_drm.h"
45 #include "radeon_common.h"
47 #include "main/macros.h"
48 #include "main/mtypes.h"
49 #include "main/colormac.h"
51 #include "r700_chip.h"
53 #include "r700_oglprog.h"
56 typedef struct r600_context context_t
;
58 GLboolean
r700SendPSState(context_t
*context
);
59 GLboolean
r700SendVSState(context_t
*context
);
60 GLboolean
r700SendSQConfig(context_t
*context
);
64 /* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
65 I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
66 with other compilers ... GLUE!
68 #define WARN_ONCE(a, ...) { \
69 static int warn##__LINE__=1; \
71 fprintf(stderr, "*********************************WARN_ONCE*********************************\n"); \
72 fprintf(stderr, "File %s function %s line %d\n", \
73 __FILE__, __FUNCTION__, __LINE__); \
74 fprintf(stderr, a, ## __VA_ARGS__);\
75 fprintf(stderr, "***************************************************************************\n"); \
80 /************ DMA BUFFERS **************/
82 /* The blit width for texture uploads
84 #define R600_BLIT_WIDTH_BYTES 1024
85 #define R600_MAX_TEXTURE_UNITS 8
87 struct r600_texture_state
{
88 int tc_count
; /* number of incoming texture coordinates from VAP */
91 /* Perhaps more if we store programs in vmem? */
92 /* drm_r600_cmd_header_t->vpu->count is unsigned char */
93 #define VSF_MAX_FRAGMENT_LENGTH (255*4)
95 /* Can be tested with colormat currently. */
96 #define VSF_MAX_FRAGMENT_TEMPS (14)
98 #define STATE_R600_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0)
99 #define STATE_R600_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)
101 extern int hw_tcl_on
;
103 #define COLOR_IS_RGBA
104 #define TAG(x) r600##x
105 #include "tnl_dd/t_dd_vertex.h"
108 #define PFS_MAX_ALU_INST 64
109 #define PFS_MAX_TEX_INST 64
110 #define PFS_MAX_TEX_INDIRECT 4
111 #define PFS_NUM_TEMP_REGS 32
112 #define PFS_NUM_CONST_REGS 16
114 #define R600_MAX_AOS_ARRAYS 16
120 #define R600_FALLBACK_NONE 0
121 #define R600_FALLBACK_TCL 1
122 #define R600_FALLBACK_RAST 2
132 * \brief R600 context structure.
134 struct r600_context
{
135 struct radeon_context radeon
; /* parent class, must be first */
138 R700_CHIP_CONTEXT hw
;
142 GLvector4f dummy_attrib
[_TNL_ATTRIB_MAX
];
143 GLvector4f
*temp_attrib
[_TNL_ATTRIB_MAX
];
147 #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
148 #define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx))
150 extern void r600DestroyContext(__DRIcontextPrivate
* driContextPriv
);
151 extern GLboolean
r600CreateContext(const __GLcontextModes
* glVisual
,
152 __DRIcontextPrivate
* driContextPriv
,
153 void *sharedContextPrivate
);
155 #define R700_CONTEXT_STATES(context) ((R700_CHIP_CONTEXT *)(&context->hw))
157 extern GLboolean
r700InitChipObject(context_t
*context
);
158 extern GLboolean
r700SendContextStates(context_t
*context
);
159 extern GLboolean
r700SendViewportState(context_t
*context
, int id
);
160 extern GLboolean
r700SendRenderTargetState(context_t
*context
, int id
);
162 extern int r700SetupStreams(GLcontext
* ctx
);
163 extern void r700SetupVTXConstants(GLcontext
* ctx
,
164 unsigned int nStreamID
,
166 unsigned int size
, /* number of elements in vector */
168 unsigned int Count
); /* number of vectors in stream */
170 #define RADEON_D_CAPTURE 0
171 #define RADEON_D_PLAYBACK 1
172 #define RADEON_D_PLAYBACK_RAW 2
175 #define r600PackFloat32 radeonPackFloat32
176 #define r600PackFloat24 radeonPackFloat24
178 #endif /* __R600_CONTEXT_H__ */