d46a2d20ff3cd7c65e6ed9abb4f9111e056a1c29
[mesa.git] / src / mesa / drivers / dri / r300 / radeon_context.h
1 /**************************************************************************
2
3 Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
4 VA Linux Systems Inc., Fremont, California.
5 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
6
7 The Weather Channel (TM) funded Tungsten Graphics to develop the
8 initial release of the Radeon 8500 driver under the XFree86 license.
9 This notice must be preserved.
10
11 All Rights Reserved.
12
13 Permission is hereby granted, free of charge, to any person obtaining
14 a copy of this software and associated documentation files (the
15 "Software"), to deal in the Software without restriction, including
16 without limitation the rights to use, copy, modify, merge, publish,
17 distribute, sublicense, and/or sell copies of the Software, and to
18 permit persons to whom the Software is furnished to do so, subject to
19 the following conditions:
20
21 The above copyright notice and this permission notice (including the
22 next paragraph) shall be included in all copies or substantial
23 portions of the Software.
24
25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
29 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
33 **************************************************************************/
34
35 /*
36 * Authors:
37 * Gareth Hughes <gareth@valinux.com>
38 * Keith Whitwell <keith@tungstengraphics.com>
39 * Kevin E. Martin <martin@valinux.com>
40 * Nicolai Haehnle <prefect_@gmx.net>
41 */
42
43 #ifndef __RADEON_CONTEXT_H__
44 #define __RADEON_CONTEXT_H__
45
46 #include "main/mtypes.h"
47 #include "main/colormac.h"
48 #include "radeon_screen.h"
49 #include "drm.h"
50 #include "dri_util.h"
51
52 #include "radeon_screen.h"
53 #include "common_context.h"
54 #include "common_misc.h"
55
56 #if R200_MERGED
57 extern void radeonFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
58
59 #define FALLBACK( radeon, bit, mode ) do { \
60 if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
61 __FUNCTION__, bit, mode ); \
62 radeonFallback( (radeon)->glCtx, bit, mode ); \
63 } while (0)
64 #else
65 #define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__);
66 #endif
67
68 /* TCL fallbacks */
69 extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
70
71 #define RADEON_TCL_FALLBACK_RASTER 0x0001 /* rasterization */
72 #define RADEON_TCL_FALLBACK_UNFILLED 0x0002 /* unfilled tris */
73 #define RADEON_TCL_FALLBACK_LIGHT_TWOSIDE 0x0004 /* twoside tris */
74 #define RADEON_TCL_FALLBACK_MATERIAL 0x0008 /* material in vb */
75 #define RADEON_TCL_FALLBACK_TEXGEN_0 0x0010 /* texgen, unit 0 */
76 #define RADEON_TCL_FALLBACK_TEXGEN_1 0x0020 /* texgen, unit 1 */
77 #define RADEON_TCL_FALLBACK_TEXGEN_2 0x0040 /* texgen, unit 2 */
78 #define RADEON_TCL_FALLBACK_TEXGEN_3 0x0080 /* texgen, unit 3 */
79 #define RADEON_TCL_FALLBACK_TEXGEN_4 0x0100 /* texgen, unit 4 */
80 #define RADEON_TCL_FALLBACK_TEXGEN_5 0x0200 /* texgen, unit 5 */
81 #define RADEON_TCL_FALLBACK_TCL_DISABLE 0x0400 /* user disable */
82 #define RADEON_TCL_FALLBACK_BITMAP 0x0800 /* draw bitmap with points */
83 #define RADEON_TCL_FALLBACK_VERTEX_PROGRAM 0x1000 /* vertex program active */
84
85 #if R200_MERGED
86 #define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )
87 #else
88 #define TCL_FALLBACK( ctx, bit, mode ) ;
89 #endif
90
91
92 extern void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
93 extern void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
94 int x, int y, int w, int h);
95 extern GLboolean radeonInitContext(radeonContextPtr radeon,
96 struct dd_function_table *functions,
97 const __GLcontextModes * glVisual,
98 __DRIcontextPrivate * driContextPriv,
99 void *sharedContextPrivate);
100 extern void radeonCleanupContext(radeonContextPtr radeon);
101 extern GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
102 __DRIdrawablePrivate * driDrawPriv,
103 __DRIdrawablePrivate * driReadPriv);
104 extern GLboolean radeonUnbindContext(__DRIcontextPrivate * driContextPriv);
105 void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable);
106
107 /* ================================================================
108 * Debugging:
109 */
110 #define DO_DEBUG 1
111
112 #if DO_DEBUG
113 extern int RADEON_DEBUG;
114 #else
115 #define RADEON_DEBUG 0
116 #endif
117
118 #define DEBUG_SYNC 0x1000
119 #define DEBUG_PIXEL 0x2000
120 #define DEBUG_MEMORY 0x4000
121
122 #endif /* __RADEON_CONTEXT_H__ */