15df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/**************************************************************************
25df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
35df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulCopyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
45df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul                     VA Linux Systems Inc., Fremont, California.
54d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFaddenCopyright (C) The Weather Channel, Inc.  2002.  All Rights Reserved.
64d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
74d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFaddenThe Weather Channel (TM) funded Tungsten Graphics to develop the
84d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFaddeninitial release of the Radeon 8500 driver under the XFree86 license.
94d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFaddenThis notice must be preserved.
105df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
115df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulAll Rights Reserved.
125df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
135df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulPermission is hereby granted, free of charge, to any person obtaining
145df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paula copy of this software and associated documentation files (the
155df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul"Software"), to deal in the Software without restriction, including
165df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulwithout limitation the rights to use, copy, modify, merge, publish,
175df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Pauldistribute, sublicense, and/or sell copies of the Software, and to
185df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulpermit persons to whom the Software is furnished to do so, subject to
195df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulthe following conditions:
205df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
215df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulThe above copyright notice and this permission notice (including the
225df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulnext paragraph) shall be included in all copies or substantial
235df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulportions of the Software.
245df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
255df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
265df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
275df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
285df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulIN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
295df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
305df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
315df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian PaulWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
325df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
335df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul**************************************************************************/
345df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
355df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/*
365df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul * Authors:
375df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul *   Gareth Hughes <gareth@valinux.com>
385df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul *   Keith Whitwell <keith@tungstengraphics.com>
394d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden *   Kevin E. Martin <martin@valinux.com>
404d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden *   Nicolai Haehnle <prefect_@gmx.net>
415df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
425df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
435df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#ifndef __RADEON_CONTEXT_H__
445df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define __RADEON_CONTEXT_H__
455df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
468a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt#include "tnl/t_vertex.h"
475df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#include "dri_util.h"
486ddfdff659196cf4eeb0e5fed70ddd1ced0d16fcJon Smirl#include "drm.h"
496ddfdff659196cf4eeb0e5fed70ddd1ced0d16fcJon Smirl#include "radeon_drm.h"
50ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/macros.h"
51ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/mtypes.h"
52ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/colormac.h"
535df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#include "radeon_screen.h"
545df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
5523d3559bd4ece1fcab5513ebdaa38600d6654374Dave Airlie#include "radeon_common.h"
56692ca82116485a9c6191e5265c5b369d5b4f82f3Dave Airlie
575df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
584637235183b80963536f2364e4d50fcb894886ddDave Airliestruct r100_context;
594637235183b80963536f2364e4d50fcb894886ddDave Airlietypedef struct r100_context r100ContextRec;
604637235183b80963536f2364e4d50fcb894886ddDave Airlietypedef struct r100_context *r100ContextPtr;
615df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
625df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
635df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
644637235183b80963536f2364e4d50fcb894886ddDave Airlie#define R100_TEX_ALL 0x7
655df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
6630daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger/* used for both tcl_vtx and vc_frmt tex bits (they are identical) */
6730daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger#define RADEON_ST_BIT(unit) \
6830daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger(unit == 0 ? RADEON_CP_VC_FRMT_ST0 : (RADEON_CP_VC_FRMT_ST1 >> 2) << (2 * unit))
695df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
7030daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger#define RADEON_Q_BIT(unit) \
7130daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger(unit == 0 ? RADEON_CP_VC_FRMT_Q0 : (RADEON_CP_VC_FRMT_Q1 >> 2) << (2 * unit))
725df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
735df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulstruct radeon_texture_env_state {
744d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	radeonTexObjPtr texobj;
754d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLenum format;
764d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLenum envMode;
775df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
785df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
795df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paulstruct radeon_texture_state {
804d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_texture_env_state unit[RADEON_MAX_TEXTURE_UNITS];
815df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
825df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
835df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* Trying to keep these relatively short as the variables are becoming
845df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul * extravagently long.  Drop the driver name prefix off the front of
855df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul * everything - I think we know which driver we're in by now, and keep the
865df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul * prefix to 3 letters unless absolutely impossible.
875df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
885df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
895df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_CMD_0             0
905df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_PP_MISC           1
915df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_PP_FOG_COLOR      2
925df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RE_SOLID_COLOR    3
935df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_BLENDCNTL    4
945df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_DEPTHOFFSET  5
955df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_DEPTHPITCH   6
965df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_ZSTENCILCNTL 7
975df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_CMD_1             8
985df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_PP_CNTL           9
995df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_CNTL         10
1005df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_COLOROFFSET  11
1015df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_CMD_2             12
1025df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_RB3D_COLORPITCH   13
1035df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define CTX_STATE_SIZE        14
1045df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1055df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_CMD_0               0
1065df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_SE_CNTL             1
1075df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_SE_COORDFMT         2
1085df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_CMD_1               3
1095df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_SE_CNTL_STATUS      4
1105df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SET_STATE_SIZE          5
1115df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1125df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_CMD_0               0
1135df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_RE_LINE_PATTERN     1
1145df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_RE_LINE_STATE       2
1155df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_CMD_1               3
1165df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_SE_LINE_WIDTH       4
1175df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIN_STATE_SIZE          5
1185df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1195df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSK_CMD_0               0
1205df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSK_RB3D_STENCILREFMASK 1
1215df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSK_RB3D_ROPCNTL        2
1225df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSK_RB3D_PLANEMASK      3
1235df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSK_STATE_SIZE          4
1245df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1255df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_CMD_0           0
1265df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_XSCALE          1
1275df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_XOFFSET         2
1285df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_YSCALE          3
1295df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_YOFFSET         4
1305df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_ZSCALE          5
1315df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_SE_VPORT_ZOFFSET         6
1325df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VPT_STATE_SIZE      7
1335df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1345df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSC_CMD_0               0
1355df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSC_RE_MISC             1
1365df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MSC_STATE_SIZE          2
1375df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1385df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_CMD_0                   0
1395df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TXFILTER             1
1405df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TXFORMAT             2
1415df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TXOFFSET             3
1425df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TXCBLEND             4
1435df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TXABLEND             5
1445df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_TFACTOR              6
1455df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_CMD_1                   7
1465df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_PP_BORDER_COLOR         8
1475df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TEX_STATE_SIZE              9
1485df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1494d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define TXR_CMD_0                   0	/* rectangle textures */
1504d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define TXR_PP_TEX_SIZE             1	/* 0x1d04, 0x1d0c for NPOT! */
1514d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define TXR_PP_TEX_PITCH            2	/* 0x1d08, 0x1d10 for NPOT! */
1525df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TXR_STATE_SIZE              3
1535df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
154247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_CMD_0                  0
155247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_FACES         1
156247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_CMD_1                  2
157247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_OFFSET_0      3
158247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_OFFSET_1      4
159247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_OFFSET_2      5
160247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_OFFSET_3      6
161247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_PP_CUBIC_OFFSET_4      7
162247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger#define CUBE_STATE_SIZE             8
163247f3b3e81fffa86c50531070fab573e26ffb452Roland Scheidegger
1645df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define ZBS_CMD_0              0
1655df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define ZBS_SE_ZBIAS_FACTOR             1
1665df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define ZBS_SE_ZBIAS_CONSTANT           2
1675df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define ZBS_STATE_SIZE         3
1685df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1695df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_CMD_0                        0
1705df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_OUTPUT_VTXFMT         1
1715df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_OUTPUT_VTXSEL         2
1725df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_MATRIX_SELECT_0       3
1735df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_MATRIX_SELECT_1       4
1745df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_UCP_VERT_BLEND_CTL    5
1755df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_TEXTURE_PROC_CTL      6
1765df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_LIGHT_MODEL_CTL       7
1775df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_PER_LIGHT_CTL_0       8
1785df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_PER_LIGHT_CTL_1       9
1795df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_PER_LIGHT_CTL_2       10
1805df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_PER_LIGHT_CTL_3       11
1815df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define TCL_STATE_SIZE                   12
1825df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
1834d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define MTL_CMD_0            0
1844d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define MTL_EMMISSIVE_RED    1
1854d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define MTL_EMMISSIVE_GREEN  2
1864d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define MTL_EMMISSIVE_BLUE   3
1874d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define MTL_EMMISSIVE_ALPHA  4
1885df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_AMBIENT_RED      5
1895df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_AMBIENT_GREEN    6
1905df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_AMBIENT_BLUE     7
1915df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_AMBIENT_ALPHA    8
1925df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_DIFFUSE_RED      9
1935df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_DIFFUSE_GREEN    10
1945df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_DIFFUSE_BLUE     11
1955df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_DIFFUSE_ALPHA    12
1965df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_SPECULAR_RED     13
1975df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_SPECULAR_GREEN   14
1985df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_SPECULAR_BLUE    15
1995df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_SPECULAR_ALPHA   16
2005df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_SHININESS        17
2015df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MTL_STATE_SIZE       18
2025df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2035df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VTX_CMD_0              0
2045df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VTX_SE_COORD_FMT       1
2055df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define VTX_STATE_SIZE         2
2065df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2075df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MAT_CMD_0              0
2085df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MAT_ELT_0              1
2095df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define MAT_STATE_SIZE         17
2105df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2115df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_CMD_0                  0
2125df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_VERT_GUARD_CLIP_ADJ    1
2135df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_VERT_GUARD_DISCARD_ADJ 2
2145df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_HORZ_GUARD_CLIP_ADJ    3
2155df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_HORZ_GUARD_DISCARD_ADJ 4
2165df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GRD_STATE_SIZE             5
2175df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2185df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* position changes frequently when lighting in modelpos - separate
2195df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul * out to new state item?
2205df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
2215df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_CMD_0                  0
2225df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_AMBIENT_RED            1
2235df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_AMBIENT_GREEN          2
2245df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_AMBIENT_BLUE           3
2255df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_AMBIENT_ALPHA          4
2265df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIFFUSE_RED            5
2275df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIFFUSE_GREEN          6
2285df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIFFUSE_BLUE           7
2295df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIFFUSE_ALPHA          8
2305df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPECULAR_RED           9
2315df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPECULAR_GREEN         10
2325df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPECULAR_BLUE          11
2335df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPECULAR_ALPHA         12
2345df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_POSITION_X             13
2355df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_POSITION_Y             14
2365df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_POSITION_Z             15
2375df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_POSITION_W             16
2385df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIRECTION_X            17
2395df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIRECTION_Y            18
2405df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIRECTION_Z            19
2415df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_DIRECTION_W            20
2425d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_QUADRATIC        21
2435df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_ATTEN_LINEAR           22
2445d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_CONST            23
2455df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_ATTEN_XXX              24
2465df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_CMD_1                  25
2475df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPOT_DCD               26
2485df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPOT_EXPONENT          27
2495df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPOT_CUTOFF            28
2505df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_SPECULAR_THRESH        29
2514d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define LIT_RANGE_CUTOFF           30	/* ? */
2525d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_CONST_INV        31
2535df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define LIT_STATE_SIZE             32
2545df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2555df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* Fog
2565df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
2575df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_CMD_0      0
2585df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_R          1
2595df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_C          2
2605df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_D          3
2615df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_PAD        4
2625df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define FOG_STATE_SIZE 5
2635df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2645df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* UCP
2655df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
2665df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_CMD_0      0
2675df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_X          1
2685df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_Y          2
2695df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_Z          3
2705df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_W          4
2715df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define UCP_STATE_SIZE 5
2725df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2735df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* GLT - Global ambient
2745df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
2755df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_CMD_0      0
2765df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_RED        1
2775df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_GREEN      2
2785df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_BLUE       3
2795df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_ALPHA      4
2805df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define GLT_STATE_SIZE 5
2815df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2825df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* EYE
2835df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
2845df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_CMD_0          0
2855df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_X              1
2865df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_Y              2
2875df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_Z              3
2885df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_RESCALE_FACTOR 4
2895df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define EYE_STATE_SIZE     5
2905df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2915df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SHN_CMD_0          0
2925df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SHN_SHININESS      1
2935df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define SHN_STATE_SIZE     2
2945df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
2955484428d7267388fde868e64531dcdf98b55fafcDave Airlie#define R100_QUERYOBJ_CMD_0  0
2965484428d7267388fde868e64531dcdf98b55fafcDave Airlie#define R100_QUERYOBJ_DATA_0 1
2975484428d7267388fde868e64531dcdf98b55fafcDave Airlie#define R100_QUERYOBJ_CMDSIZE  2
2985484428d7267388fde868e64531dcdf98b55fafcDave Airlie
2997d361537661b93a501c9533271458a41b965ea79Dave Airlie#define STP_CMD_0 0
3007d361537661b93a501c9533271458a41b965ea79Dave Airlie#define STP_DATA_0 1
3017d361537661b93a501c9533271458a41b965ea79Dave Airlie#define STP_CMD_1 2
3027d361537661b93a501c9533271458a41b965ea79Dave Airlie#define STP_STATE_SIZE 35
3037d361537661b93a501c9533271458a41b965ea79Dave Airlie
3041090d206de011a67d236d8c4ae32d2d42b2f6337Dave Airliestruct r100_hw_state {
3054d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Hardware state, stored as cmdbuf commands:
3064d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 *   -- Need to doublebuffer for
3074d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 *           - eliding noop statechange loops? (except line stipple count)
3084d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
3094d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom ctx;
3104d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom set;
3114d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom lin;
3124d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom msk;
3134d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom vpt;
3144d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom tcl;
3154d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom msc;
3164d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom tex[3];
3174d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom cube[3];
3184d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom zbs;
3194d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom mtl;
3204d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom mat[6];
3214d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom lit[8];	/* includes vec, scl commands */
3224d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom ucp[6];
3234d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom eye;	/* eye pos */
3244d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom grd;	/* guard band clipping */
3254d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom fog;
3264d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom glt;
3274d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_state_atom txr[3];	/* for NPOT */
3287d361537661b93a501c9533271458a41b965ea79Dave Airlie	struct radeon_state_atom stp;
3295df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
3305df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3318d8fd9776e23a34e0d22e489ce1f85eb5e383121Alex Deucherstruct radeon_stipple_state {
3328d8fd9776e23a34e0d22e489ce1f85eb5e383121Alex Deucher	GLuint mask[32];
3338d8fd9776e23a34e0d22e489ce1f85eb5e383121Alex Deucher};
3344637235183b80963536f2364e4d50fcb894886ddDave Airlie
335d29e96bf33e91d071770b86d87ffc4ef4dfc2f70Dave Airliestruct r100_state {
3368d8fd9776e23a34e0d22e489ce1f85eb5e383121Alex Deucher	struct radeon_stipple_state stipple;
3374d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_texture_state texture;
3385df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
3395df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3404d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#define RADEON_CMD_BUF_SZ  (8*1024)
341b584b0728d3a001a142f76dde22f9e8ed7d2dd16Dave Airlie#define R200_ELT_BUF_SZ  (8*1024)
3425df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* radeon_tcl.c
3435df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
344e00ef43d796f0ae0247b1072bf0aa8cdd8e3034dDave Airliestruct r100_tcl_info {
3454d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint vertex_format;
3464d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint hw_primitive;
3474d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
3484d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Temporary for cases where incoming vertex data is incompatible
3494d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 * with maos code.
3504d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
3514d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLvector4f ObjClean;
3524d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
3534d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint *Elts;
3544d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
355e00ef43d796f0ae0247b1072bf0aa8cdd8e3034dDave Airlie        int elt_cmd_offset;
3563fafaf8959681cc41c988607bb6e387bab4fe1b5Dave Airlie	int elt_cmd_start;
357b584b0728d3a001a142f76dde22f9e8ed7d2dd16Dave Airlie        int elt_used;
3585df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
3595df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3605df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul/* radeon_swtcl.c
3615df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul */
362b584b0728d3a001a142f76dde22f9e8ed7d2dd16Dave Airliestruct r100_swtcl_info {
3634d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint vertex_format;
3648a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt
3654d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLubyte *verts;
3665df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3674d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Fallback rasterization functions
3684d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
3694d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	radeon_point_func draw_point;
3704d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	radeon_line_func draw_line;
3714d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	radeon_tri_func draw_tri;
3725df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3738a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt   /**
3748a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt    * Offset of the 4UB color data within a hardware (swtcl) vertex.
3758a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt    */
3764d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint coloroffset;
3778a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt
3788a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt   /**
3798a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt    * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
3808a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt    */
3814d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint specoffset;
3828a1df968627de01d04f3d692fd81108ba6492c18Eric Anholt
3834d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLboolean needproj;
3845df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
3855df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3865df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
3875df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
38830daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger/* A maximum total of 20 elements per vertex:  3 floats for position, 3
38930daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger * floats for normal, 4 floats for color, 4 bytes for secondary color,
39030daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger * 3 floats for each texture unit (9 floats total).
39130daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger *
39230daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger * The position data is never actually stored here, so 3 elements could be
39330daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger * trimmed out of the buffer. This number is only valid for vtxfmt!
39430daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger */
39530daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger#define RADEON_MAX_VERTEX_SIZE 20
39630daa7529331057ecb470efb500152e9c4aa1ae5Roland Scheidegger
3974637235183b80963536f2364e4d50fcb894886ddDave Airliestruct r100_context {
3984637235183b80963536f2364e4d50fcb894886ddDave Airlie        struct radeon_context radeon;
3994d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4004d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Driver and hardware state management
4014d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
4021090d206de011a67d236d8c4ae32d2d42b2f6337Dave Airlie	struct r100_hw_state hw;
403d29e96bf33e91d071770b86d87ffc4ef4dfc2f70Dave Airlie	struct r100_state state;
4044d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4054d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Vertex buffers
4064d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
4074d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_ioctl ioctl;
4084d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	struct radeon_store store;
4094d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4104d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* TCL stuff
4114d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
4124d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLmatrix TexGenMatrix[RADEON_MAX_TEXTURE_UNITS];
4134d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLboolean recheck_texgen[RADEON_MAX_TEXTURE_UNITS];
4144d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLboolean TexGenNeedNormals[RADEON_MAX_TEXTURE_UNITS];
4154d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint TexGenEnabled;
4164d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint NeedTexMatrix;
4174d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint TexMatColSwap;
4184d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLmatrix tmpmat[RADEON_MAX_TEXTURE_UNITS];
4194d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint last_ReallyEnabled;
4204d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4214d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* radeon_tcl.c
4224d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
423e00ef43d796f0ae0247b1072bf0aa8cdd8e3034dDave Airlie	struct r100_tcl_info tcl;
4244d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4254d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* radeon_swtcl.c
4264d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
427b584b0728d3a001a142f76dde22f9e8ed7d2dd16Dave Airlie	struct r100_swtcl_info swtcl;
4284d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4294d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLboolean using_hyperz;
4304d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLboolean texmicrotile;
4314d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden
4324d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	/* Performance counters
4334d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	 */
4344d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint boxes;		/* Draw performance boxes */
4354d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint hardwareWentIdle;
4364d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint c_clears;
4374d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint c_drawWaits;
4384d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint c_textureSwaps;
4394d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint c_textureBytes;
4404d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden	GLuint c_vertexBuffers;
4414637235183b80963536f2364e4d50fcb894886ddDave Airlie
4425df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul};
4435df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
444c6ac53bc40508ab2f0b9e023eee7ec3793fdf917Dave Airlie
4454637235183b80963536f2364e4d50fcb894886ddDave Airlie#define R100_CONTEXT(ctx)		((r100ContextPtr)(ctx->DriverCtx))
4465df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
4475df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
4485df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul#define RADEON_OLD_PACKETS 1
4495df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
450a7a9a91d7b28e5b5faed509d00f0f951e3136b1bKristian Høgsbergextern GLboolean r100CreateContext( gl_api api,
451d3491e775fb07f891463b2185d74bbad62f3ed24Kristian Høgsberg				    const struct gl_config *glVisual,
452d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg				    __DRIcontext *driContextPriv,
453e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick				    unsigned major_version,
454e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick				    unsigned minor_version,
455e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick				    uint32_t flags,
456e532b6288f01b63d8d8ba8c8dc08292967e65490Ian Romanick				    unsigned *error,
457e00ef43d796f0ae0247b1072bf0aa8cdd8e3034dDave Airlie				    void *sharedContextPrivate);
4585df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
4595df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul
4604d5d4e1f97bf8d5c55ef817f7a28f920accc151bOliver McFadden#endif				/* __RADEON_CONTEXT_H__ */
461