r200_context.h revision f20917de5bd2b1fc152e74304d3649a1f6042422
1bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ 2bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl/* 3adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellCopyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. 4adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 5adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellThe Weather Channel (TM) funded Tungsten Graphics to develop the 6adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellinitial release of the Radeon 8500 driver under the XFree86 license. 7adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellThis notice must be preserved. 8adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 9adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellPermission is hereby granted, free of charge, to any person obtaining 10adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwella copy of this software and associated documentation files (the 11adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell"Software"), to deal in the Software without restriction, including 12adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellwithout limitation the rights to use, copy, modify, merge, publish, 13adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelldistribute, sublicense, and/or sell copies of the Software, and to 14adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellpermit persons to whom the Software is furnished to do so, subject to 15adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellthe following conditions: 16adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 17adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellThe above copyright notice and this permission notice (including the 18adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellnext paragraph) shall be included in all copies or substantial 19adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellportions of the Software. 20adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 21adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellIN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 25adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 26adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27adbec39bbf671ad80f6c557801e274cac0d305faKeith WhitwellWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 29adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell**************************************************************************/ 30adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 31adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* 32adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * Authors: 33adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * Keith Whitwell <keith@tungstengraphics.com> 34adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 35adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 36adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#ifndef __R200_CONTEXT_H__ 37adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define __R200_CONTEXT_H__ 38adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 39e946688edac5cdf153652defae3ef732a3487416Ian Romanick#include "tnl/t_vertex.h" 40ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl#include "drm.h" 41ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl#include "radeon_drm.h" 42adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "dri_util.h" 43adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "texmem.h" 44adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 45adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "macros.h" 46adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "mtypes.h" 47adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "colormac.h" 48adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "r200_reg.h" 49adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 5095a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick#define ENABLE_HW_3D_TEXTURE 1 /* XXX this is temporary! */ 51adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 52adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_context; 53adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef struct r200_context r200ContextRec; 54adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef struct r200_context *r200ContextPtr; 55adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 56adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "r200_lock.h" 57adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "r200_screen.h" 58adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "mm.h" 59adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 60adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Flags for software fallback cases */ 61adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* See correponding strings in r200_swtcl.c */ 62ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_TEXTURE 0x01 63ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_DRAW_BUFFER 0x02 64ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_STENCIL 0x04 65ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_RENDER_MODE 0x08 66ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_DISABLE 0x10 67ef377c3c007611e57aef176cb66d8b4c18f1a6c3Eric Anholt#define R200_FALLBACK_BORDER_MODE 0x20 68adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 69adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* The blit width for texture uploads 70adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 71adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define BLIT_WIDTH_BYTES 1024 72adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 73adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Use the templated vertex format: 74adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 75adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define COLOR_IS_RGBA 76adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TAG(x) r200##x 77adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#include "tnl_dd/t_dd_vertex.h" 78adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#undef TAG 79adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 80adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef void (*r200_tri_func)( r200ContextPtr, 81adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex *, 82adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex *, 83adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex * ); 84adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 85adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef void (*r200_line_func)( r200ContextPtr, 86adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex *, 87adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex * ); 88adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 89adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef void (*r200_point_func)( r200ContextPtr, 90adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200Vertex * ); 91adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 92adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 93adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_colorbuffer_state { 94adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint clear; 95fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#if 000 96adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLint drawOffset, drawPitch; 97fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#endif 98273e52f86fa41564f573c8e84d013f995e01a8f0Alan Hourihane int roundEnable; 99adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 100adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 101adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 102adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_depthbuffer_state { 103b31b7836d6e7abf80dd4feacce333d4b1fe6e4abRoland Scheidegger GLuint clear; 104adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLfloat scale; 105adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 106adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 107fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#if 000 108adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_pixel_state { 109adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLint readOffset, readPitch; 110adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 111fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#endif 112adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 113adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_scissor_state { 114ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_clip_rect_t rect; 115adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean enabled; 116adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 117adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint numClipRects; /* Cliprects active */ 118adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint numAllocedClipRects; /* Cliprects available */ 119ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_clip_rect_t *pClipRects; 120adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 121adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 122adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_stencilbuffer_state { 123adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean hwBuffer; 124adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint clear; /* rb3d_stencilrefmask value */ 125adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 126adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 127adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_stipple_state { 128adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint mask[32]; 129adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 130adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 131adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 132adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 133adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_0 0x1 134adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_1 0x2 13548ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define TEX_2 0x4 13648ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define TEX_3 0x8 13748ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define TEX_4 0x10 13848ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define TEX_5 0x20 13948ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define TEX_ALL 0x3f 140adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 141adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwelltypedef struct r200_tex_obj r200TexObj, *r200TexObjPtr; 142adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 143adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Texture object in locally shared texture space. 144adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 145adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_tex_obj { 146adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell driTextureObject base; 147adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 148adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint bufAddr; /* Offset to start of locally 149adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell shared texture block */ 150adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 151adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint dirty_state; /* Flags (1 per texunit) for 152adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell whether or not this texobj 153adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell has dirty hardware state 154adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell (pp_*) that needs to be 155adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell brought into the 156adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell texunit. */ 157adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 158ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS]; 159adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Six, for the cube faces */ 160adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 161adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txfilter; /* hardware register values */ 162adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txformat; 163adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txformat_x; 164adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txoffset; /* Image location in texmem. 165adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell All cube faces follow. */ 166adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txsize; /* npot only */ 167adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_txpitch; /* npot only */ 168adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_border_color; 169adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ 170adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 171adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean border_fallback; 1724837ea30208d002bc36a836d2117f826d40c8bfaRoland Scheidegger 1734837ea30208d002bc36a836d2117f826d40c8bfaRoland Scheidegger GLuint tile_bits; /* hw texture tile bits used on this texture */ 174adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 175adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 176adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 177adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_texture_env_state { 178adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200TexObjPtr texobj; 17936603539ccdb1c507724d8a1c314e6c9cc9863d9Roland Scheidegger GLuint outputreg; 18036603539ccdb1c507724d8a1c314e6c9cc9863d9Roland Scheidegger GLuint unitneeded; 181adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 182adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 18348ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define R200_MAX_TEXTURE_UNITS 6 184adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 185adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_texture_state { 186adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_texture_env_state unit[R200_MAX_TEXTURE_UNITS]; 187adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 188adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 189adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 190adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_state_atom { 191adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom *next, *prev; 192adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell const char *name; /* for debug */ 193adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int cmd_size; /* size in bytes */ 194adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint idx; 195adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int *cmd; /* one or more cmd's */ 196adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int *lastcmd; /* one or more cmd's */ 197a05b1549f7b6da7d9313b9addf2d01b9c61f34d7Keith Whitwell GLboolean dirty; 198adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean (*check)( GLcontext *, int ); /* is this state active? */ 199adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 200adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 201adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 202adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 203adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Trying to keep these relatively short as the variables are becoming 204adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * extravagently long. Drop the driver name prefix off the front of 205adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * everything - I think we know which driver we're in by now, and keep the 206adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * prefix to 3 letters unless absolutely impossible. 207adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 208adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 209adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_CMD_0 0 210adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_PP_MISC 1 211adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_PP_FOG_COLOR 2 212adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RE_SOLID_COLOR 3 213adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_BLENDCNTL 4 214adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_DEPTHOFFSET 5 215adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_DEPTHPITCH 6 216adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_ZSTENCILCNTL 7 217adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_CMD_1 8 218adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_PP_CNTL 9 219adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_CNTL 10 220adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_COLOROFFSET 11 221adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_CMD_2 12 /* why */ 222adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CTX_RB3D_COLORPITCH 13 /* why */ 223033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_STATE_SIZE_OLDDRM 14 224033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_CMD_3 14 225033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_RB3D_BLENDCOLOR 15 226033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_RB3D_ABLENDCNTL 16 227033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_RB3D_CBLENDCNTL 17 228033728555cb2f39d8c77f228e1eccc45329bb40aRoland Scheidegger#define CTX_STATE_SIZE_NEWDRM 18 229adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 230adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define SET_CMD_0 0 231adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define SET_SE_CNTL 1 232adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define SET_RE_CNTL 2 /* replace se_coord_fmt */ 233adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define SET_STATE_SIZE 3 234adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 235adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTE_CMD_0 0 236adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTE_SE_VTE_CNTL 1 237adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTE_STATE_SIZE 2 238adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 239adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_CMD_0 0 240adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_RE_LINE_PATTERN 1 241adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_RE_LINE_STATE 2 242adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_CMD_1 3 243adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_SE_LINE_WIDTH 4 244adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIN_STATE_SIZE 5 245adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 246adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSK_CMD_0 0 247adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSK_RB3D_STENCILREFMASK 1 248adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSK_RB3D_ROPCNTL 2 249adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSK_RB3D_PLANEMASK 3 250adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSK_STATE_SIZE 4 251adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 252adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_CMD_0 0 253adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_XSCALE 1 254adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_XOFFSET 2 255adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_YSCALE 3 256adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_YOFFSET 4 257adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_ZSCALE 5 258adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_SE_VPORT_ZOFFSET 6 259adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VPT_STATE_SIZE 7 260adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 261adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define ZBS_CMD_0 0 262adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define ZBS_SE_ZBIAS_FACTOR 1 263adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define ZBS_SE_ZBIAS_CONSTANT 2 264adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define ZBS_STATE_SIZE 3 265adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 266adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSC_CMD_0 0 267adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSC_RE_MISC 1 268adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSC_STATE_SIZE 2 269adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 270adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TAM_CMD_0 0 271adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TAM_DEBUG3 1 272adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TAM_STATE_SIZE 2 273adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 274adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_CMD_0 0 275adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_TXFILTER 1 /*2c00*/ 276adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_TXFORMAT 2 /*2c04*/ 277adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_TXFORMAT_X 3 /*2c08*/ 278adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_TXSIZE 4 /*2c0c*/ 279adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_TXPITCH 5 /*2c10*/ 280adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TEX_PP_BORDER_COLOR 6 /*2c14*/ 281f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_CMD_1_OLDDRM 7 282f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_PP_TXOFFSET_OLDDRM 8 /*2d00 */ 283f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_STATE_SIZE_OLDDRM 9 284f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_PP_CUBIC_FACES 7 285f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_PP_TXMULTI_CTL 8 286f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_CMD_1_NEWDRM 9 287f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_PP_TXOFFSET_NEWDRM 10 288f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define TEX_STATE_SIZE_NEWDRM 11 289f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger 290f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define CUBE_CMD_0 0 /* 1 register follows */ /* this command unnecessary */ 291f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */ /* with new enough drm */ 292adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_CMD_1 2 /* 5 registers follow */ 293adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */ 294adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */ 295adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */ 296adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */ 297adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */ 298adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CUBE_STATE_SIZE 8 299adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 300adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_CMD_0 0 301adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_PP_TXCBLEND 1 302adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_PP_TXCBLEND2 2 303adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_PP_TXABLEND 3 304adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_PP_TXABLEND2 4 305adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define PIX_STATE_SIZE 5 306adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 307adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_CMD_0 0 308adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_0 1 309adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_1 2 310adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_2 3 311adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_3 4 312adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_4 5 313adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_TFACTOR_5 6 314adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TF_STATE_SIZE 7 315adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 316f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_CMD_0 0 317f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_0 1 318f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_1 2 319f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_2 3 320f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_3 4 321f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_4 5 322f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_5 6 323f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_6 7 324f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_TFACTOR_7 8 325f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define ATF_STATE_SIZE 9 326f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger 327f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger/* ATI_FRAGMENT_SHADER */ 328f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_CMD_0 0 329f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_IC0 1 /* 2f00 */ 330f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_IC1 2 /* 2f04 */ 331f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_IA0 3 /* 2f08 */ 332f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_IA1 4 /* 2f0c */ 333f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger#define AFS_STATE_SIZE 33 334f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger 335adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_CMD_0 0 336adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_LIGHT_MODEL_CTL_0 1 337adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_LIGHT_MODEL_CTL_1 2 338adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_PER_LIGHT_CTL_0 3 339adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_PER_LIGHT_CTL_1 4 340adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_PER_LIGHT_CTL_2 5 341adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_PER_LIGHT_CTL_3 6 342adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_CMD_1 7 343adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_UCP_VERT_BLEND_CTL 8 344adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCL_STATE_SIZE 9 345adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 346adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_CMD_0 0 347adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_MATRIX_SELECT_0 1 348adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_MATRIX_SELECT_1 2 349adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_MATRIX_SELECT_2 3 350adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_MATRIX_SELECT_3 4 351adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_MATRIX_SELECT_4 5 352adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MSL_STATE_SIZE 6 353adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 354adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_CMD_0 0 355adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_TEX_PROC_CTL_2 1 356adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_TEX_PROC_CTL_3 2 357adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_TEX_PROC_CTL_0 3 358adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_TEX_PROC_CTL_1 4 359adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_TEX_CYL_WRAP_CTL 5 360adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define TCG_STATE_SIZE 6 361adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 362adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_CMD_0 0 363adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_EMMISSIVE_RED 1 364adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_EMMISSIVE_GREEN 2 365adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_EMMISSIVE_BLUE 3 366adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_EMMISSIVE_ALPHA 4 367adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_AMBIENT_RED 5 368adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_AMBIENT_GREEN 6 369adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_AMBIENT_BLUE 7 370adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_AMBIENT_ALPHA 8 371adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_DIFFUSE_RED 9 372adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_DIFFUSE_GREEN 10 373adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_DIFFUSE_BLUE 11 374adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_DIFFUSE_ALPHA 12 375adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_SPECULAR_RED 13 376adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_SPECULAR_GREEN 14 377adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_SPECULAR_BLUE 15 378adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_SPECULAR_ALPHA 16 379adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_CMD_1 17 380adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_SHININESS 18 381adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MTL_STATE_SIZE 19 382adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 383adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VAP_CMD_0 0 384adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VAP_SE_VAP_CNTL 1 385adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VAP_STATE_SIZE 2 386adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 387adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Replaces a lot of packet info from radeon 388adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 389adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_CMD_0 0 390adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_VTXFMT_0 1 391adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_VTXFMT_1 2 392adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_TCL_OUTPUT_VTXFMT_0 3 393adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_TCL_OUTPUT_VTXFMT_1 4 394adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_CMD_1 5 395adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_TCL_OUTPUT_COMPSEL 6 396adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_CMD_2 7 397adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_STATE_CNTL 8 398adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_STATE_SIZE 9 399adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 400adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 401adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\ 402adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell R200_VTX_COLOR_MASK) 403adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 40495a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick/** 40595a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick * Given the \c R200_SE_VTX_FMT_1 for the current vertex state, determine 40695a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick * how many components are in texture coordinate \c n. 40795a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick */ 40895a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick#define VTX_TEXn_COUNT(v,n) (((v) >> (3 * n)) & 0x07) 40995a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick 410adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MAT_CMD_0 0 411adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MAT_ELT_0 1 412adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define MAT_STATE_SIZE 17 413adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 414adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_CMD_0 0 415adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_VERT_GUARD_CLIP_ADJ 1 416adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_VERT_GUARD_DISCARD_ADJ 2 417adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_HORZ_GUARD_CLIP_ADJ 3 418adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_HORZ_GUARD_DISCARD_ADJ 4 419adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GRD_STATE_SIZE 5 420adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 421adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* position changes frequently when lighting in modelpos - separate 422adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * out to new state item? 423adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 424adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_CMD_0 0 425adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_AMBIENT_RED 1 426adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_AMBIENT_GREEN 2 427adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_AMBIENT_BLUE 3 428adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_AMBIENT_ALPHA 4 429adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIFFUSE_RED 5 430adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIFFUSE_GREEN 6 431adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIFFUSE_BLUE 7 432adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIFFUSE_ALPHA 8 433adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPECULAR_RED 9 434adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPECULAR_GREEN 10 435adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPECULAR_BLUE 11 436adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPECULAR_ALPHA 12 437adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_POSITION_X 13 438adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_POSITION_Y 14 439adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_POSITION_Z 15 440adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_POSITION_W 16 441adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIRECTION_X 17 442adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIRECTION_Y 18 443adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIRECTION_Z 19 444adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_DIRECTION_W 20 4455d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_QUADRATIC 21 446adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_ATTEN_LINEAR 22 4475d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_CONST 23 448adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_ATTEN_XXX 24 449adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_CMD_1 25 450adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPOT_DCD 26 451adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPOT_DCM 27 452adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPOT_EXPONENT 28 453adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPOT_CUTOFF 29 454adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_SPECULAR_THRESH 30 455adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_RANGE_CUTOFF 31 /* ? */ 4565d00e131d8a264498b8d050c3eded093ee5c42f2Michel Dänzer#define LIT_ATTEN_CONST_INV 32 457adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define LIT_STATE_SIZE 33 458adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 459adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Fog 460adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 461adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_CMD_0 0 462adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_R 1 463adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_C 2 464adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_D 3 465adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_PAD 4 466adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define FOG_STATE_SIZE 5 467adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 468adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* UCP 469adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 470adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_CMD_0 0 471adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_X 1 472adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_Y 2 473adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_Z 3 474adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_W 4 475adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define UCP_STATE_SIZE 5 476adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 477adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* GLT - Global ambient 478adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 479adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_CMD_0 0 480adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_RED 1 481adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_GREEN 2 482adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_BLUE 3 483adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_ALPHA 4 484adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define GLT_STATE_SIZE 5 485adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 486adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* EYE 487adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 488adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_CMD_0 0 489adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_X 1 490adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_Y 2 491adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_Z 3 492adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_RESCALE_FACTOR 4 493adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define EYE_STATE_SIZE 5 494adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 495adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* CST - constant state 496adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 497adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_0 0 498adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_PP_CNTL_X 1 499adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_1 2 500adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_RB3D_DEPTHXY_OFFSET 3 501adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_2 4 502adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_RE_AUX_SCISSOR_CNTL 5 503adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_3 6 504adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_RE_SCISSOR_TL_0 7 505adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_RE_SCISSOR_BR_0 8 506adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_4 9 507adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_SE_VAP_CNTL_STATUS 10 508adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_5 11 509adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_RE_POINTSIZE 12 510adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_CMD_6 13 511adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_SE_TCL_INPUT_VTX_0 14 512adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_SE_TCL_INPUT_VTX_1 15 513adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_SE_TCL_INPUT_VTX_2 16 514adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_SE_TCL_INPUT_VTX_3 17 515adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define CST_STATE_SIZE 18 516adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 517fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger#define PRF_CMD_0 0 518fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger#define PRF_PP_TRI_PERF 1 519fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger#define PRF_PP_PERF_CNTL 2 520fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger#define PRF_STATE_SIZE 3 521adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 522adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 523adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_hw_state { 5240c8f8d3dc9d60ed34eeca7f3606651420a81753cEric Anholt /* Head of the linked list of state atoms. */ 5250c8f8d3dc9d60ed34eeca7f3606651420a81753cEric Anholt struct r200_state_atom atomlist; 526adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 527adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Hardware state, stored as cmdbuf commands: 528adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * -- Need to doublebuffer for 529adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * - reviving state after loss of context 530adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * - eliding noop statechange loops? (except line stipple count) 531adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 532adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom ctx; 533adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom set; 534adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom vte; 535adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom lin; 536adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom msk; 537adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom vpt; 538adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom vap; 539adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom vtx; 540adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom tcl; 541adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom msl; 542adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom tcg; 543adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom msc; 544adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom cst; 545adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom tam; 546adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom tf; 54748ccaf200940613032dfaaafe71382947f398004Roland Scheidegger struct r200_state_atom tex[6]; 54848ccaf200940613032dfaaafe71382947f398004Roland Scheidegger struct r200_state_atom cube[6]; 549adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom zbs; 550fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger struct r200_state_atom mtl[2]; 551fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger struct r200_state_atom mat[9]; 552adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom lit[8]; /* includes vec, scl commands */ 553adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom ucp[6]; 554adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom pix[6]; /* pixshader stages */ 555adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom eye; /* eye pos */ 556adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state_atom grd; /* guard band clipping */ 557fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger struct r200_state_atom fog; 558fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger struct r200_state_atom glt; 559fbe5296d1463e1052590b744f3d62ebb9e5d5dd4Roland Scheidegger struct r200_state_atom prf; 560f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger struct r200_state_atom afs[2]; 561f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger struct r200_state_atom atf; 5626f3cc6a5226fd4b5d44cca91e2f76216ecaff831Eric Anholt 5636f3cc6a5226fd4b5d44cca91e2f76216ecaff831Eric Anholt int max_state_size; /* Number of bytes necessary for a full state emit. */ 5640c8f8d3dc9d60ed34eeca7f3606651420a81753cEric Anholt GLboolean is_dirty, all_dirty; 565adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 566adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 567adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_state { 568adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Derived state for internal purposes: 569adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 570adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_colorbuffer_state color; 571adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_depthbuffer_state depth; 572fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#if 00 573adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_pixel_state pixel; 574fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8Brian Paul#endif 575adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_scissor_state scissor; 576adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_stencilbuffer_state stencil; 577adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_stipple_state stipple; 578adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_texture_state texture; 57936603539ccdb1c507724d8a1c314e6c9cc9863d9Roland Scheidegger GLuint envneeded; 580adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 581adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 582adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Need refcounting on dma buffers: 583adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 584adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_dma_buffer { 585adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int refcount; /* the number of retained regions in buf */ 586adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell drmBufPtr buf; 587adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 588adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 589bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \ 590adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell (rvb)->address - rmesa->dma.buf0_address + \ 591adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell (rvb)->start) 592adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 593adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* A retained region, eg vertices for indexed vertices. 594adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 595adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_dma_region { 596adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_buffer *buf; 597adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell char *address; /* == buf->address */ 598adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int start, end, ptr; /* offsets from start of buf */ 599adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int aos_start; 600adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int aos_stride; 601adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int aos_size; 602adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 603adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 604adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 605adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_dma { 606adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Active dma region. Allocations for vertices and retained 607adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * regions come from here. Also used for emitting random vertices, 608adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * these may be flushed by calling flush_current(); 609adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 610adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region current; 611adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 612adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell void (*flush)( r200ContextPtr ); 613adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 614adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell char *buf0_address; /* start of buf[0], for index calcs */ 615adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint nr_released_bufs; /* flush after so many buffers released */ 616adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 617adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 618adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_dri_mirror { 619adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIcontextPrivate *context; /* DRI context */ 620adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIscreenPrivate *screen; /* DRI screen */ 621adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */ 622adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 623c06b25594e5effe34a90c067e1a3da0f61cf2b13Ian Romanick drm_context_t hwContext; 624ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_hw_lock_t *hwLock; 625adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int fd; 626adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int drmMinor; 627adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 628adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 629adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 630adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define R200_CMD_BUF_SZ (8*1024) 631adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 632adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_store { 633adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint statenr; 634adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint primnr; 635adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell char cmd_buf[R200_CMD_BUF_SZ]; 636adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int cmd_used; 637adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int elts_start; 638adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 639adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 640adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 641adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* r200_tcl.c 642adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 643adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_tcl_info { 644adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vertex_format; 645adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLint last_offset; 646adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint hw_primitive; 647adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 648adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region *aos_components[8]; 649adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint nr_aos_components; 650adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 651adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint *Elts; 652adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 653adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region indexed_verts; 654adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region obj; 655adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region rgba; 656adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region spec; 657adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region fog; 658adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS]; 659adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region norm; 660adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 661adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 662adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 663adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* r200_swtcl.c 664adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 665adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_swtcl_info { 666adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint RenderIndex; 667e946688edac5cdf153652defae3ef732a3487416Ian Romanick 668e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 669e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Size of a hardware vertex. This is calculated when \c ::vertex_attrs is 670e946688edac5cdf153652defae3ef732a3487416Ian Romanick * installed in the Mesa state vector. 671e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 672adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vertex_size; 673e946688edac5cdf153652defae3ef732a3487416Ian Romanick 674e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 675e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Attributes instructing the Mesa TCL pipeline where / how to put vertex 676e946688edac5cdf153652defae3ef732a3487416Ian Romanick * data in the hardware buffer. 677e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 678e946688edac5cdf153652defae3ef732a3487416Ian Romanick struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; 679e946688edac5cdf153652defae3ef732a3487416Ian Romanick 680e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 681e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Number of elements of \c ::vertex_attrs that are actually used. 682e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 683e946688edac5cdf153652defae3ef732a3487416Ian Romanick GLuint vertex_attr_count; 684e946688edac5cdf153652defae3ef732a3487416Ian Romanick 685e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 686e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Cached pointer to the buffer where Mesa will store vertex data. 687e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 6885df82c82bd53db90eb72c5aad4dd20cf6f1116b1Brian Paul GLubyte *verts; 689adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 690adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Fallback rasterization functions 691adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 692adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200_point_func draw_point; 693adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200_line_func draw_line; 694adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200_tri_func draw_tri; 695adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 696adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint hw_primitive; 697adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLenum render_primitive; 698adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint numverts; 699adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 700e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 701e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Offset of the 4UB color data within a hardware (swtcl) vertex. 702e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 703e946688edac5cdf153652defae3ef732a3487416Ian Romanick GLuint coloroffset; 704e946688edac5cdf153652defae3ef732a3487416Ian Romanick 705e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 706e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Offset of the 3UB specular color data within a hardware (swtcl) vertex. 707e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 708e946688edac5cdf153652defae3ef732a3487416Ian Romanick GLuint specoffset; 709e946688edac5cdf153652defae3ef732a3487416Ian Romanick 710e946688edac5cdf153652defae3ef732a3487416Ian Romanick /** 711e946688edac5cdf153652defae3ef732a3487416Ian Romanick * Should Mesa project vertex data or will the hardware do it? 712e946688edac5cdf153652defae3ef732a3487416Ian Romanick */ 713e946688edac5cdf153652defae3ef732a3487416Ian Romanick GLboolean needproj; 714e946688edac5cdf153652defae3ef732a3487416Ian Romanick 715adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma_region indexed_verts; 716adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 717adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 718adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 719adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_ioctl { 720adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vertex_offset; 721adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vertex_size; 722adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 723adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 724adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 725adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 726adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define R200_MAX_PRIMS 64 727adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 728adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 729adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* Want to keep a cache of these around. Each is parameterized by 730adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * only a single value which has only a small range. Only expect a 731adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * few, so just rescan the list each time? 732adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 733adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct dynfn { 734adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *next, *prev; 735adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int key[2]; 736adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell char *code; 737adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 738adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 739adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct dfn_lists { 740adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Vertex2f; 741adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Vertex2fv; 742adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Vertex3f; 743adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Vertex3fv; 744adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color4ub; 745adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color4ubv; 746adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color3ub; 747adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color3ubv; 748adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color4f; 749adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color4fv; 750adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color3f; 751adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Color3fv; 752adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn SecondaryColor3ubEXT; 753adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn SecondaryColor3ubvEXT; 754adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn SecondaryColor3fEXT; 755adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn SecondaryColor3fvEXT; 756adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Normal3f; 757adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn Normal3fv; 75895a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn TexCoord3f; 75995a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn TexCoord3fv; 760adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn TexCoord2f; 761adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn TexCoord2fv; 762adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn TexCoord1f; 763adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn TexCoord1fv; 76495a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn MultiTexCoord3fARB; 76595a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn MultiTexCoord3fvARB; 766adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn MultiTexCoord2fARB; 767adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn MultiTexCoord2fvARB; 768adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn MultiTexCoord1fARB; 769adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn MultiTexCoord1fvARB; 770d294f79190a5b25ef0fbbbf3ac94b15c9402d009Roland Scheidegger struct dynfn FogCoordfEXT; 771d294f79190a5b25ef0fbbbf3ac94b15c9402d009Roland Scheidegger struct dynfn FogCoordfvEXT; 772adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 773adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 774adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct dfn_generators { 775adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Vertex2f)( GLcontext *, const int * ); 776adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Vertex2fv)( GLcontext *, const int * ); 777adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Vertex3f)( GLcontext *, const int * ); 778adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Vertex3fv)( GLcontext *, const int * ); 779adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color4ub)( GLcontext *, const int * ); 780adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color4ubv)( GLcontext *, const int * ); 781adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color3ub)( GLcontext *, const int * ); 782adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color3ubv)( GLcontext *, const int * ); 783adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color4f)( GLcontext *, const int * ); 784adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color4fv)( GLcontext *, const int * ); 785adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color3f)( GLcontext *, const int * ); 786adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Color3fv)( GLcontext *, const int * ); 787adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, const int * ); 788adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, const int * ); 789adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, const int * ); 790adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, const int * ); 791adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Normal3f)( GLcontext *, const int * ); 792adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*Normal3fv)( GLcontext *, const int * ); 79395a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn *(*TexCoord3f)( GLcontext *, const int * ); 79495a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn *(*TexCoord3fv)( GLcontext *, const int * ); 795adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*TexCoord2f)( GLcontext *, const int * ); 796adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*TexCoord2fv)( GLcontext *, const int * ); 797adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*TexCoord1f)( GLcontext *, const int * ); 798adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*TexCoord1fv)( GLcontext *, const int * ); 79995a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn *(*MultiTexCoord3fARB)( GLcontext *, const int * ); 80095a0bd6762737bb25bdf5c4147da9d1372f6aac3Ian Romanick struct dynfn *(*MultiTexCoord3fvARB)( GLcontext *, const int * ); 801adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, const int * ); 802adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, const int * ); 803adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, const int * ); 804adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, const int * ); 805d294f79190a5b25ef0fbbbf3ac94b15c9402d009Roland Scheidegger struct dynfn *(*FogCoordfEXT)( GLcontext *, const int * ); 806d294f79190a5b25ef0fbbbf3ac94b15c9402d009Roland Scheidegger struct dynfn *(*FogCoordfvEXT)( GLcontext *, const int * ); 807adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 808adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 809adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 810adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 811adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_prim { 812adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint start; 813adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint end; 814adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint prim; 815adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 816adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 81748ccaf200940613032dfaaafe71382947f398004Roland Scheidegger /* A maximum total of 29 elements per vertex: 3 floats for position, 3 818adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * floats for normal, 4 floats for color, 4 bytes for secondary color, 81948ccaf200940613032dfaaafe71382947f398004Roland Scheidegger * 3 floats for each texture unit (18 floats total). 820adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * 82148ccaf200940613032dfaaafe71382947f398004Roland Scheidegger * we maybe need add. 4 to prevent segfault if someone specifies 82248ccaf200940613032dfaaafe71382947f398004Roland Scheidegger * GL_TEXTURE6/GL_TEXTURE7 (esp. for the codegen-path) (FIXME: ) 823adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * 824adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * The position data is never actually stored here, so 3 elements could be 825adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * trimmed out of the buffer. 826adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 82748ccaf200940613032dfaaafe71382947f398004Roland Scheidegger 82848ccaf200940613032dfaaafe71382947f398004Roland Scheidegger#define R200_MAX_VERTEX_SIZE ((3*6)+11) 82948ccaf200940613032dfaaafe71382947f398004Roland Scheidegger 83048ccaf200940613032dfaaafe71382947f398004Roland Scheideggerstruct r200_vbinfo { 83148ccaf200940613032dfaaafe71382947f398004Roland Scheidegger GLint counter, initial_counter; 83248ccaf200940613032dfaaafe71382947f398004Roland Scheidegger GLint *dmaptr; 83348ccaf200940613032dfaaafe71382947f398004Roland Scheidegger void (*notify)( void ); 83448ccaf200940613032dfaaafe71382947f398004Roland Scheidegger GLint vertex_size; 83548ccaf200940613032dfaaafe71382947f398004Roland Scheidegger 83648ccaf200940613032dfaaafe71382947f398004Roland Scheidegger union { float f; int i; r200_color_t color; } vertex[R200_MAX_VERTEX_SIZE]; 837adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 838adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLfloat *normalptr; 839adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLfloat *floatcolorptr; 840d294f79190a5b25ef0fbbbf3ac94b15c9402d009Roland Scheidegger GLfloat *fogptr; 841adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200_color_t *colorptr; 842adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLfloat *floatspecptr; 843adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200_color_t *specptr; 84448ccaf200940613032dfaaafe71382947f398004Roland Scheidegger GLfloat *texcoordptr[8]; /* 6 (TMU) + 2 for r200_vtxfmt_c.c when GL_TEXTURE6/7 */ 845adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 846adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 847adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */ 848adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint primflags; 849adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */ 850adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean installed; 851adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean fell_back; 852adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean recheck; 853adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLint nrverts; 854adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vtxfmt_0, vtxfmt_1; 855adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 856adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint installed_vertex_format; 857adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint installed_color_3f_sz; 858adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 859adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_prim primlist[R200_MAX_PRIMS]; 860adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell int nrprims; 861adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 862adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dfn_lists dfn_cache; 863adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct dfn_generators codegen; 864adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLvertexformat vtxfmt; 865adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 866adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 867adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 868adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstruct r200_context { 869adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLcontext *glCtx; /* Mesa context */ 870adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 871adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Driver and hardware state management 872adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 873adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_hw_state hw; 874adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_state state; 875adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 876adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Texture object bookkeeping 877adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 878adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell unsigned nr_heaps; 879adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell driTexHeap * texture_heaps[ R200_NR_TEX_HEAPS ]; 880adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell driTextureObject swapped; 881d907a75498360fb96ec2314bb0abb105be74d500Alan Hourihane int texture_depth; 882d3fd7ba8af15bead2f770d68a893449adeb11397Brian Paul float initialMaxAnisotropy; 883adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 884adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Rasterization and vertex state: 885adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 886adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint TclFallback; 887adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint Fallback; 888adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint NewGLState; 889b1ebd306bf4fdc4076d3d3daa410b08f477cb4c4Eric Anholt GLuint tnl_index; /* index of bits for last tnl_install_attrs */ 890adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 891adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Vertex buffers 892adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 893adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_ioctl ioctl; 894adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dma dma; 895adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_store store; 8967a086dc05e665a78f7e9d069aa4fc70e844b8988Eric Anholt /* A full state emit as of the first state emit in the main store, in case 8977a086dc05e665a78f7e9d069aa4fc70e844b8988Eric Anholt * the context is lost. 8987a086dc05e665a78f7e9d069aa4fc70e844b8988Eric Anholt */ 8997a086dc05e665a78f7e9d069aa4fc70e844b8988Eric Anholt struct r200_store backup_store; 900adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 901adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Page flipping 902adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 903adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint doPageFlip; 904adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 905adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Busy waiting 906adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 907adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint do_usleeps; 908adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint do_irqs; 909adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint irqsEmitted; 910ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_radeon_irq_wait_t iw; 911adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 912adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Clientdata textures; 913adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 914bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl GLuint prefer_gart_client_texturing; 915adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 916adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Drawable, cliprect and scissor information 917adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 918adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint numClipRects; /* Cliprects for the draw buffer */ 919ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_clip_rect_t *pClipRects; 920adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell unsigned int lastStamp; 921adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean lost_context; 9227a086dc05e665a78f7e9d069aa4fc70e844b8988Eric Anholt GLboolean save_on_next_emit; 923adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell r200ScreenPtr r200Screen; /* Screen private DRI data */ 924ae4a1cc0666860bf5cc37a5cb549afc9aa5448b0Jon Smirl drm_radeon_sarea_t *sarea; /* Private SAREA data */ 925adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 926adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* TCL stuff 927adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 928adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS]; 929adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS]; 930adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS]; 931adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint TexMatEnabled; 932adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint TexMatCompSel; 933adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint TexGenEnabled; 934adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint TexGenCompSel; 935adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLmatrix tmpmat; 936adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 937adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* VBI / buffer swap 938adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 939adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vbl_seq; 940adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint vblank_flags; 941adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 942afa446db83ecf5dcb38ce46648fb12911628de32Ian Romanick int64_t swap_ust; 943afa446db83ecf5dcb38ce46648fb12911628de32Ian Romanick int64_t swap_missed_ust; 944adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 945adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint swap_count; 946adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLuint swap_missed_count; 947adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 948adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 949adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* r200_tcl.c 950adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 951adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_tcl_info tcl; 952adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 953adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* r200_swtcl.c 954adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 955adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_swtcl_info swtcl; 956adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 957adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* r200_vtxfmt.c 958adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 959adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_vbinfo vb; 960adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 961adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell /* Mirrors of some DRI state 962adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 963adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell struct r200_dri_mirror dri; 964bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl 965bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl /* Configuration cache 966bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl */ 967bcc6eddd335e97d49ed2ef3a1440f94d58dce12dJon Smirl driOptionCache optionCache; 968b31b7836d6e7abf80dd4feacce333d4b1fe6e4abRoland Scheidegger 969b31b7836d6e7abf80dd4feacce333d4b1fe6e4abRoland Scheidegger GLboolean using_hyperz; 9704837ea30208d002bc36a836d2117f826d40c8bfaRoland Scheidegger GLboolean texmicrotile; 971f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger 972f20917de5bd2b1fc152e74304d3649a1f6042422Roland Scheidegger struct ati_fragment_shader *afs_loaded; 973adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell}; 974adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 975adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx)) 976adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 977adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 978adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellstatic __inline GLuint r200PackColor( GLuint cpp, 979adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLubyte r, GLubyte g, 980adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell GLubyte b, GLubyte a ) 981adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell{ 982adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell switch ( cpp ) { 983adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell case 2: 984adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell return PACK_COLOR_565( r, g, b ); 985adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell case 4: 986adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell return PACK_COLOR_8888( a, r, g, b ); 987adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell default: 988adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell return 0; 989adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell } 990adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell} 991adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 992adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 993adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern void r200DestroyContext( __DRIcontextPrivate *driContextPriv ); 994adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern GLboolean r200CreateContext( const __GLcontextModes *glVisual, 995adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIcontextPrivate *driContextPriv, 996adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell void *sharedContextPrivate); 997adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern void r200SwapBuffers( __DRIdrawablePrivate *dPriv ); 998adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv, 999adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIdrawablePrivate *driDrawPriv, 1000adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell __DRIdrawablePrivate *driReadPriv ); 1001adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern GLboolean r200UnbindContext( __DRIcontextPrivate *driContextPriv ); 1002adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 1003adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell/* ================================================================ 1004adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell * Debugging: 1005adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell */ 1006adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DO_DEBUG 1 1007adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 1008adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#if DO_DEBUG 1009adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwellextern int R200_DEBUG; 1010adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#else 1011adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define R200_DEBUG 0 1012adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#endif 1013adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 1014adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_TEXTURE 0x001 1015adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_STATE 0x002 1016adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_IOCTL 0x004 1017adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_PRIMS 0x008 1018adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_VERTS 0x010 1019adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_FALLBACKS 0x020 1020adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_VFMT 0x040 1021adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_CODEGEN 0x080 1022adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_VERBOSE 0x100 1023adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_DRI 0x200 1024adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_DMA 0x400 1025adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_SANITY 0x800 1026adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_SYNC 0x1000 1027adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_PIXEL 0x2000 1028adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#define DEBUG_MEMORY 0x4000 1029adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell 1030adbec39bbf671ad80f6c557801e274cac0d305faKeith Whitwell#endif /* __R200_CONTEXT_H__ */ 1031