i915_reg.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028 
00029 #ifndef I915_REG_H
00030 #define I915_REG_H
00031 
00032 
00033 #define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
00034 
00035 #define CMD_3D (0x3<<29)
00036 
00037 #define PRIM3D_INLINE           (CMD_3D | (0x1f<<24))
00038 #define PRIM3D_TRILIST          (0x0<<18)
00039 #define PRIM3D_TRISTRIP         (0x1<<18)
00040 #define PRIM3D_TRISTRIP_RVRSE   (0x2<<18)
00041 #define PRIM3D_TRIFAN           (0x3<<18)
00042 #define PRIM3D_POLY             (0x4<<18)
00043 #define PRIM3D_LINELIST         (0x5<<18)
00044 #define PRIM3D_LINESTRIP        (0x6<<18)
00045 #define PRIM3D_RECTLIST         (0x7<<18)
00046 #define PRIM3D_POINTLIST        (0x8<<18)
00047 #define PRIM3D_DIB              (0x9<<18)
00048 #define PRIM3D_CLEAR_RECT       (0xa<<18)
00049 #define PRIM3D_ZONE_INIT        (0xd<<18)
00050 #define PRIM3D_MASK             (0x1f<<18)
00051 
00052 /* p137 */
00053 #define _3DSTATE_AA_CMD                 (CMD_3D | (0x06<<24))
00054 #define AA_LINE_ECAAR_WIDTH_ENABLE      (1<<16)
00055 #define AA_LINE_ECAAR_WIDTH_0_5         0
00056 #define AA_LINE_ECAAR_WIDTH_1_0         (1<<14)
00057 #define AA_LINE_ECAAR_WIDTH_2_0         (2<<14)
00058 #define AA_LINE_ECAAR_WIDTH_4_0         (3<<14)
00059 #define AA_LINE_REGION_WIDTH_ENABLE     (1<<8)
00060 #define AA_LINE_REGION_WIDTH_0_5        0
00061 #define AA_LINE_REGION_WIDTH_1_0        (1<<6)
00062 #define AA_LINE_REGION_WIDTH_2_0        (2<<6)
00063 #define AA_LINE_REGION_WIDTH_4_0        (3<<6)
00064 
00065 /* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/
00066 #define _3DSTATE_BACKFACE_STENCIL_OPS    (CMD_3D | (0x8<<24))
00067 #define BFO_ENABLE_STENCIL_REF          (1<<23)
00068 #define BFO_STENCIL_REF_SHIFT           15
00069 #define BFO_STENCIL_REF_MASK            (0xff<<15)
00070 #define BFO_ENABLE_STENCIL_FUNCS        (1<<14)
00071 #define BFO_STENCIL_TEST_SHIFT          11
00072 #define BFO_STENCIL_TEST_MASK           (0x7<<11)
00073 #define BFO_STENCIL_FAIL_SHIFT          8
00074 #define BFO_STENCIL_FAIL_MASK           (0x7<<8)
00075 #define BFO_STENCIL_PASS_Z_FAIL_SHIFT   5
00076 #define BFO_STENCIL_PASS_Z_FAIL_MASK    (0x7<<5)
00077 #define BFO_STENCIL_PASS_Z_PASS_SHIFT   2
00078 #define BFO_STENCIL_PASS_Z_PASS_MASK    (0x7<<2)
00079 #define BFO_ENABLE_STENCIL_TWO_SIDE     (1<<1)
00080 #define BFO_STENCIL_TWO_SIDE            (1<<0)
00081 
00082 
00083 /* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */
00084 #define _3DSTATE_BACKFACE_STENCIL_MASKS    (CMD_3D | (0x9<<24))
00085 #define BFM_ENABLE_STENCIL_TEST_MASK      (1<<17)
00086 #define BFM_ENABLE_STENCIL_WRITE_MASK     (1<<16)
00087 #define BFM_STENCIL_TEST_MASK_SHIFT       8
00088 #define BFM_STENCIL_TEST_MASK_MASK        (0xff<<8)
00089 #define BFM_STENCIL_WRITE_MASK_SHIFT      0
00090 #define BFM_STENCIL_WRITE_MASK_MASK       (0xff<<0)
00091 
00092 
00093 
00094 /* 3DSTATE_BIN_CONTROL p141 */
00095 
00096 /* p143 */
00097 #define _3DSTATE_BUF_INFO_CMD   (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
00098 /* Dword 1 */
00099 #define BUF_3D_ID_COLOR_BACK    (0x3<<24)
00100 #define BUF_3D_ID_DEPTH         (0x7<<24)
00101 #define BUF_3D_USE_FENCE        (1<<23)
00102 #define BUF_3D_TILED_SURFACE    (1<<22)
00103 #define BUF_3D_TILE_WALK_X      0
00104 #define BUF_3D_TILE_WALK_Y      (1<<21)
00105 #define BUF_3D_PITCH(x)         (((x)/4)<<2)
00106 /* Dword 2 */
00107 #define BUF_3D_ADDR(x)          ((x) & ~0x3)
00108 
00109 
00110 /* 3DSTATE_CHROMA_KEY */
00111 
00112 /* 3DSTATE_CLEAR_PARAMETERS, p150 */
00113 #define _3DSTATE_CLEAR_PARAMETERS       (CMD_3D | (0x1d<<24) | (0x9c<<16) | 5)
00114 /* Dword 1 */
00115 #define CLEARPARAM_CLEAR_RECT           (1 << 16)
00116 #define CLEARPARAM_ZONE_INIT            (0 << 16)
00117 #define CLEARPARAM_WRITE_COLOR          (1 << 2)
00118 #define CLEARPARAM_WRITE_DEPTH          (1 << 1)
00119 #define CLEARPARAM_WRITE_STENCIL        (1 << 0)
00120 
00121 /* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */
00122 #define _3DSTATE_CONST_BLEND_COLOR_CMD  (CMD_3D | (0x1d<<24) | (0x88<<16))
00123 
00124 
00125 
00126 /* 3DSTATE_COORD_SET_BINDINGS, p154 */
00127 #define _3DSTATE_COORD_SET_BINDINGS      (CMD_3D | (0x16<<24))
00128 #define CSB_TCB(iunit, eunit)           ((eunit)<<(iunit*3))
00129 
00130 /* p156 */
00131 #define _3DSTATE_DFLT_DIFFUSE_CMD       (CMD_3D | (0x1d<<24) | (0x99<<16))
00132 
00133 /* p157 */
00134 #define _3DSTATE_DFLT_SPEC_CMD          (CMD_3D | (0x1d<<24) | (0x9a<<16))
00135 
00136 /* p158 */
00137 #define _3DSTATE_DFLT_Z_CMD             (CMD_3D | (0x1d<<24) | (0x98<<16))
00138 
00139 
00140 /* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */
00141 #define _3DSTATE_DEPTH_OFFSET_SCALE       (CMD_3D | (0x1d<<24) | (0x97<<16))
00142 /* scale in dword 1 */
00143 
00144 
00145 /* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
00146 #define _3DSTATE_DEPTH_SUBRECT_DISABLE    (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2)
00147 
00148 /* p161 */
00149 #define _3DSTATE_DST_BUF_VARS_CMD       (CMD_3D | (0x1d<<24) | (0x85<<16))
00150 /* Dword 1 */
00151 #define TEX_DEFAULT_COLOR_OGL           (0<<30)
00152 #define TEX_DEFAULT_COLOR_D3D           (1<<30)
00153 #define ZR_EARLY_DEPTH                  (1<<29)
00154 #define LOD_PRECLAMP_OGL                (1<<28)
00155 #define LOD_PRECLAMP_D3D                (0<<28)
00156 #define DITHER_FULL_ALWAYS              (0<<26)
00157 #define DITHER_FULL_ON_FB_BLEND         (1<<26)
00158 #define DITHER_CLAMPED_ALWAYS           (2<<26)
00159 #define LINEAR_GAMMA_BLEND_32BPP        (1<<25)
00160 #define DEBUG_DISABLE_ENH_DITHER        (1<<24)
00161 #define DSTORG_HORT_BIAS(x)             ((x)<<20)
00162 #define DSTORG_VERT_BIAS(x)             ((x)<<16)
00163 #define COLOR_4_2_2_CHNL_WRT_ALL        0
00164 #define COLOR_4_2_2_CHNL_WRT_Y          (1<<12)
00165 #define COLOR_4_2_2_CHNL_WRT_CR         (2<<12)
00166 #define COLOR_4_2_2_CHNL_WRT_CB         (3<<12)
00167 #define COLOR_4_2_2_CHNL_WRT_CRCB       (4<<12)
00168 #define COLOR_BUF_8BIT                  0
00169 #define COLOR_BUF_RGB555                (1<<8)
00170 #define COLOR_BUF_RGB565                (2<<8)
00171 #define COLOR_BUF_ARGB8888              (3<<8)
00172 #define DEPTH_FRMT_16_FIXED             0
00173 #define DEPTH_FRMT_16_FLOAT             (1<<2)
00174 #define DEPTH_FRMT_24_FIXED_8_OTHER     (2<<2)
00175 #define VERT_LINE_STRIDE_1              (1<<1)
00176 #define VERT_LINE_STRIDE_0              (0<<1)
00177 #define VERT_LINE_STRIDE_OFS_1          1
00178 #define VERT_LINE_STRIDE_OFS_0          0
00179 
00180 /* p166 */
00181 #define _3DSTATE_DRAW_RECT_CMD          (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
00182 /* Dword 1 */
00183 #define DRAW_RECT_DIS_DEPTH_OFS         (1<<30)
00184 #define DRAW_DITHER_OFS_X(x)            ((x)<<26)
00185 #define DRAW_DITHER_OFS_Y(x)            ((x)<<24)
00186 /* Dword 2 */
00187 #define DRAW_YMIN(x)                    ((x)<<16)
00188 #define DRAW_XMIN(x)                    (x)
00189 /* Dword 3 */
00190 #define DRAW_YMAX(x)                    ((x)<<16)
00191 #define DRAW_XMAX(x)                    (x)
00192 /* Dword 4 */
00193 #define DRAW_YORG(x)                    ((x)<<16)
00194 #define DRAW_XORG(x)                    (x)
00195 
00196 
00197 /* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */
00198 
00199 /* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */
00200 
00201 
00202 /* _3DSTATE_FOG_COLOR, p173 */
00203 #define _3DSTATE_FOG_COLOR_CMD          (CMD_3D|(0x15<<24))
00204 #define FOG_COLOR_RED(x)                ((x)<<16)
00205 #define FOG_COLOR_GREEN(x)              ((x)<<8)
00206 #define FOG_COLOR_BLUE(x)               (x)
00207 
00208 /* _3DSTATE_FOG_MODE, p174 */
00209 #define _3DSTATE_FOG_MODE_CMD           (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
00210 /* Dword 1 */
00211 #define FMC1_FOGFUNC_MODIFY_ENABLE      (1<<31)
00212 #define FMC1_FOGFUNC_VERTEX             (0<<28)
00213 #define FMC1_FOGFUNC_PIXEL_EXP          (1<<28)
00214 #define FMC1_FOGFUNC_PIXEL_EXP2         (2<<28)
00215 #define FMC1_FOGFUNC_PIXEL_LINEAR       (3<<28)
00216 #define FMC1_FOGFUNC_MASK               (3<<28)
00217 #define FMC1_FOGINDEX_MODIFY_ENABLE     (1<<27)
00218 #define FMC1_FOGINDEX_Z                 (0<<25)
00219 #define FMC1_FOGINDEX_W                 (1<<25)
00220 #define FMC1_C1_C2_MODIFY_ENABLE        (1<<24)
00221 #define FMC1_DENSITY_MODIFY_ENABLE      (1<<23)
00222 #define FMC1_C1_ONE                     (1<<13)
00223 #define FMC1_C1_MASK                    (0xffff<<4)
00224 /* Dword 2 */
00225 #define FMC2_C2_ONE                     (1<<16)
00226 /* Dword 3 */
00227 #define FMC3_D_ONE                      (1<<16)
00228 
00229 
00230 
00231 /* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */
00232 #define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD    (CMD_3D|(0x0b<<24))
00233 #define IAB_MODIFY_ENABLE               (1<<23)
00234 #define IAB_ENABLE                      (1<<22)
00235 #define IAB_MODIFY_FUNC                 (1<<21)
00236 #define IAB_FUNC_SHIFT                  16
00237 #define IAB_MODIFY_SRC_FACTOR           (1<<11)
00238 #define IAB_SRC_FACTOR_SHIFT            6
00239 #define IAB_SRC_FACTOR_MASK             (BLENDFACT_MASK<<6)
00240 #define IAB_MODIFY_DST_FACTOR           (1<<5)
00241 #define IAB_DST_FACTOR_SHIFT            0
00242 #define IAB_DST_FACTOR_MASK             (BLENDFACT_MASK<<0)
00243 
00244 
00245 #define BLENDFUNC_ADD                   0x0
00246 #define BLENDFUNC_SUBTRACT              0x1
00247 #define BLENDFUNC_REVERSE_SUBTRACT      0x2
00248 #define BLENDFUNC_MIN                   0x3
00249 #define BLENDFUNC_MAX                   0x4
00250 #define BLENDFUNC_MASK                  0x7
00251 
00252 /* 3DSTATE_LOAD_INDIRECT, p180 */
00253 
00254 #define _3DSTATE_LOAD_INDIRECT          (CMD_3D|(0x1d<<24)|(0x7<<16))
00255 #define LI0_STATE_STATIC_INDIRECT       (0x01<<8)
00256 #define LI0_STATE_DYNAMIC_INDIRECT      (0x02<<8)
00257 #define LI0_STATE_SAMPLER               (0x04<<8)
00258 #define LI0_STATE_MAP                   (0x08<<8)
00259 #define LI0_STATE_PROGRAM               (0x10<<8)
00260 #define LI0_STATE_CONSTANTS             (0x20<<8)
00261 
00262 #define SIS0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00263 #define SIS0_FORCE_LOAD                 (1<<1)
00264 #define SIS0_BUFFER_VALID               (1<<0)
00265 #define SIS1_BUFFER_LENGTH(x)           ((x)&0xff)
00266 
00267 #define DIS0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00268 #define DIS0_BUFFER_RESET               (1<<1)
00269 #define DIS0_BUFFER_VALID               (1<<0)
00270 
00271 #define SSB0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00272 #define SSB0_FORCE_LOAD                 (1<<1)
00273 #define SSB0_BUFFER_VALID               (1<<0)
00274 #define SSB1_BUFFER_LENGTH(x)           ((x)&0xff)
00275 
00276 #define MSB0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00277 #define MSB0_FORCE_LOAD                 (1<<1)
00278 #define MSB0_BUFFER_VALID               (1<<0)
00279 #define MSB1_BUFFER_LENGTH(x)           ((x)&0xff)
00280 
00281 #define PSP0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00282 #define PSP0_FORCE_LOAD                 (1<<1)
00283 #define PSP0_BUFFER_VALID               (1<<0)
00284 #define PSP1_BUFFER_LENGTH(x)           ((x)&0xff)
00285 
00286 #define PSC0_BUFFER_ADDRESS(x)          ((x)&~0x3)
00287 #define PSC0_FORCE_LOAD                 (1<<1)
00288 #define PSC0_BUFFER_VALID               (1<<0)
00289 #define PSC1_BUFFER_LENGTH(x)           ((x)&0xff)
00290 
00291 
00292 
00293 
00294 
00295 /* _3DSTATE_RASTERIZATION_RULES */
00296 #define _3DSTATE_RASTER_RULES_CMD       (CMD_3D|(0x07<<24))
00297 #define ENABLE_POINT_RASTER_RULE        (1<<15)
00298 #define OGL_POINT_RASTER_RULE           (1<<13)
00299 #define ENABLE_TEXKILL_3D_4D            (1<<10)
00300 #define TEXKILL_3D                      (0<<9)
00301 #define TEXKILL_4D                      (1<<9)
00302 #define ENABLE_LINE_STRIP_PROVOKE_VRTX  (1<<8)
00303 #define ENABLE_TRI_FAN_PROVOKE_VRTX     (1<<5)
00304 #define LINE_STRIP_PROVOKE_VRTX(x)      ((x)<<6)
00305 #define TRI_FAN_PROVOKE_VRTX(x)         ((x)<<3)
00306 
00307 /* _3DSTATE_SCISSOR_ENABLE, p256 */
00308 #define _3DSTATE_SCISSOR_ENABLE_CMD     (CMD_3D|(0x1c<<24)|(0x10<<19))
00309 #define ENABLE_SCISSOR_RECT             ((1<<1) | 1)
00310 #define DISABLE_SCISSOR_RECT            (1<<1)
00311 
00312 /* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */
00313 #define _3DSTATE_SCISSOR_RECT_0_CMD     (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
00314 /* Dword 1 */
00315 #define SCISSOR_RECT_0_YMIN(x)          ((x)<<16)
00316 #define SCISSOR_RECT_0_XMIN(x)          (x)
00317 /* Dword 2 */
00318 #define SCISSOR_RECT_0_YMAX(x)          ((x)<<16)
00319 #define SCISSOR_RECT_0_XMAX(x)          (x)
00320 
00321 /* p189 */
00322 #define _3DSTATE_LOAD_STATE_IMMEDIATE_1   ((0x3<<29)|(0x1d<<24)|(0x04<<16))
00323 #define I1_LOAD_S(n)                      (1<<(4+n))
00324 
00325 #define S0_VB_OFFSET_MASK              0xffffffc
00326 #define S0_AUTO_CACHE_INV_DISABLE      (1<<0)
00327 
00328 #define S1_VERTEX_WIDTH_SHIFT          24
00329 #define S1_VERTEX_WIDTH_MASK           (0x3f<<24)
00330 #define S1_VERTEX_PITCH_SHIFT          16
00331 #define S1_VERTEX_PITCH_MASK           (0x3f<<16)
00332 
00333 #define TEXCOORDFMT_2D                 0x0
00334 #define TEXCOORDFMT_3D                 0x1
00335 #define TEXCOORDFMT_4D                 0x2
00336 #define TEXCOORDFMT_1D                 0x3
00337 #define TEXCOORDFMT_2D_16              0x4
00338 #define TEXCOORDFMT_4D_16              0x5
00339 #define TEXCOORDFMT_NOT_PRESENT        0xf
00340 #define S2_TEXCOORD_FMT0_MASK            0xf
00341 #define S2_TEXCOORD_FMT1_SHIFT           4
00342 #define S2_TEXCOORD_FMT(unit, type)    ((type)<<(unit*4))
00343 #define S2_TEXCOORD_NONE               (~0)
00344 
00345 /* S3 not interesting */
00346 
00347 #define S4_POINT_WIDTH_SHIFT           23
00348 #define S4_POINT_WIDTH_MASK            (0x1ff<<23)
00349 #define S4_LINE_WIDTH_SHIFT            19
00350 #define S4_LINE_WIDTH_ONE              (0x2<<19)
00351 #define S4_LINE_WIDTH_MASK             (0xf<<19)
00352 #define S4_FLATSHADE_ALPHA             (1<<18)
00353 #define S4_FLATSHADE_FOG               (1<<17)
00354 #define S4_FLATSHADE_SPECULAR          (1<<16)
00355 #define S4_FLATSHADE_COLOR             (1<<15)
00356 #define S4_CULLMODE_BOTH               (0<<13)
00357 #define S4_CULLMODE_NONE               (1<<13)
00358 #define S4_CULLMODE_CW                 (2<<13)
00359 #define S4_CULLMODE_CCW                (3<<13)
00360 #define S4_CULLMODE_MASK               (3<<13)
00361 #define S4_VFMT_POINT_WIDTH            (1<<12)
00362 #define S4_VFMT_SPEC_FOG               (1<<11)
00363 #define S4_VFMT_COLOR                  (1<<10)
00364 #define S4_VFMT_DEPTH_OFFSET           (1<<9)
00365 #define S4_VFMT_XYZ                    (1<<6)
00366 #define S4_VFMT_XYZW                   (2<<6)
00367 #define S4_VFMT_XY                     (3<<6)
00368 #define S4_VFMT_XYW                    (4<<6)
00369 #define S4_VFMT_XYZW_MASK              (7<<6)
00370 #define S4_FORCE_DEFAULT_DIFFUSE       (1<<5)
00371 #define S4_FORCE_DEFAULT_SPECULAR      (1<<4)
00372 #define S4_LOCAL_DEPTH_OFFSET_ENABLE   (1<<3)
00373 #define S4_VFMT_FOG_PARAM              (1<<2)
00374 #define S4_SPRITE_POINT_ENABLE         (1<<1)
00375 #define S4_LINE_ANTIALIAS_ENABLE       (1<<0)
00376 
00377 #define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH   |   \
00378                       S4_VFMT_SPEC_FOG      |   \
00379                       S4_VFMT_COLOR         |   \
00380                       S4_VFMT_DEPTH_OFFSET  |   \
00381                       S4_VFMT_XYZW_MASK     |   \
00382                       S4_VFMT_FOG_PARAM)
00383 
00384 
00385 #define S5_WRITEDISABLE_ALPHA          (1<<31)
00386 #define S5_WRITEDISABLE_RED            (1<<30)
00387 #define S5_WRITEDISABLE_GREEN          (1<<29)
00388 #define S5_WRITEDISABLE_BLUE           (1<<28)
00389 #define S5_WRITEDISABLE_MASK           (0xf<<28)
00390 #define S5_FORCE_DEFAULT_POINT_SIZE    (1<<27)
00391 #define S5_LAST_PIXEL_ENABLE           (1<<26)
00392 #define S5_GLOBAL_DEPTH_OFFSET_ENABLE  (1<<25)
00393 #define S5_FOG_ENABLE                  (1<<24)
00394 #define S5_STENCIL_REF_SHIFT           16
00395 #define S5_STENCIL_REF_MASK            (0xff<<16)
00396 #define S5_STENCIL_TEST_FUNC_SHIFT     13
00397 #define S5_STENCIL_TEST_FUNC_MASK      (0x7<<13)
00398 #define S5_STENCIL_FAIL_SHIFT          10
00399 #define S5_STENCIL_FAIL_MASK           (0x7<<10)
00400 #define S5_STENCIL_PASS_Z_FAIL_SHIFT   7
00401 #define S5_STENCIL_PASS_Z_FAIL_MASK    (0x7<<7)
00402 #define S5_STENCIL_PASS_Z_PASS_SHIFT   4
00403 #define S5_STENCIL_PASS_Z_PASS_MASK    (0x7<<4)
00404 #define S5_STENCIL_WRITE_ENABLE        (1<<3)
00405 #define S5_STENCIL_TEST_ENABLE         (1<<2)
00406 #define S5_COLOR_DITHER_ENABLE         (1<<1)
00407 #define S5_LOGICOP_ENABLE              (1<<0)
00408 
00409 
00410 #define S6_ALPHA_TEST_ENABLE           (1<<31)
00411 #define S6_ALPHA_TEST_FUNC_SHIFT       28
00412 #define S6_ALPHA_TEST_FUNC_MASK        (0x7<<28)
00413 #define S6_ALPHA_REF_SHIFT             20
00414 #define S6_ALPHA_REF_MASK              (0xff<<20)
00415 #define S6_DEPTH_TEST_ENABLE           (1<<19)
00416 #define S6_DEPTH_TEST_FUNC_SHIFT       16
00417 #define S6_DEPTH_TEST_FUNC_MASK        (0x7<<16)
00418 #define S6_CBUF_BLEND_ENABLE           (1<<15)
00419 #define S6_CBUF_BLEND_FUNC_SHIFT       12
00420 #define S6_CBUF_BLEND_FUNC_MASK        (0x7<<12)
00421 #define S6_CBUF_SRC_BLEND_FACT_SHIFT   8
00422 #define S6_CBUF_SRC_BLEND_FACT_MASK    (0xf<<8)
00423 #define S6_CBUF_DST_BLEND_FACT_SHIFT   4
00424 #define S6_CBUF_DST_BLEND_FACT_MASK    (0xf<<4)
00425 #define S6_DEPTH_WRITE_ENABLE          (1<<3)
00426 #define S6_COLOR_WRITE_ENABLE          (1<<2)
00427 #define S6_TRISTRIP_PV_SHIFT           0
00428 #define S6_TRISTRIP_PV_MASK            (0x3<<0)
00429 
00430 #define S7_DEPTH_OFFSET_CONST_MASK     ~0
00431 
00432 
00433 
00434 #define DST_BLND_FACT(f) ((f)<<S6_CBUF_DST_BLEND_FACT_SHIFT)
00435 #define SRC_BLND_FACT(f) ((f)<<S6_CBUF_SRC_BLEND_FACT_SHIFT)
00436 #define DST_ABLND_FACT(f) ((f)<<IAB_DST_FACTOR_SHIFT)
00437 #define SRC_ABLND_FACT(f) ((f)<<IAB_SRC_FACTOR_SHIFT)
00438 
00439 
00440 
00441 
00442 /* 3DSTATE_MAP_DEINTERLACER_PARAMETERS */
00443 
00444 /* 3DSTATE_MAP_PALETTE_LOAD_32, p206 */
00445 #define _3DSTATE_MAP_PALETTE_LOAD_32    (CMD_3D|(0x1d<<24)|(0x8f<<16))
00446 /* subsequent dwords up to length (max 16) are ARGB8888 color values */
00447 
00448 /* _3DSTATE_MODES_4, p218 */
00449 #define _3DSTATE_MODES_4_CMD            (CMD_3D|(0x0d<<24))
00450 #define ENABLE_LOGIC_OP_FUNC            (1<<23)
00451 #define LOGIC_OP_FUNC(x)                ((x)<<18)
00452 #define LOGICOP_MASK                    (0xf<<18)
00453 #define MODE4_ENABLE_STENCIL_TEST_MASK  ((1<<17)|(0xff00))
00454 #define ENABLE_STENCIL_TEST_MASK        (1<<17)
00455 #define STENCIL_TEST_MASK(x)            (((x)&0xff)<<8)
00456 #define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
00457 #define ENABLE_STENCIL_WRITE_MASK       (1<<16)
00458 #define STENCIL_WRITE_MASK(x)           ((x)&0xff)
00459 
00460 /* _3DSTATE_MODES_5, p220 */
00461 #define _3DSTATE_MODES_5_CMD            (CMD_3D|(0x0c<<24))
00462 #define PIPELINE_FLUSH_RENDER_CACHE     (1<<18)
00463 #define PIPELINE_FLUSH_TEXTURE_CACHE    (1<<16)
00464 
00465 
00466 /* p221 */
00467 #define _3DSTATE_PIXEL_SHADER_CONSTANTS  (CMD_3D|(0x1d<<24)|(0x6<<16))
00468 #define PS1_REG(n)                      (1<<(n))
00469 #define PS2_CONST_X(n)                  (n)
00470 #define PS3_CONST_Y(n)                  (n)
00471 #define PS4_CONST_Z(n)                  (n)
00472 #define PS5_CONST_W(n)                  (n)
00473 
00474 /* p222 */
00475 
00476 
00477 #define I915_MAX_TEX_INDIRECT 4
00478 #define I915_MAX_TEX_INSN     32
00479 #define I915_MAX_ALU_INSN     64
00480 #define I915_MAX_DECL_INSN    27
00481 #define I915_MAX_TEMPORARY    16
00482 
00483 
00484 /* Each instruction is 3 dwords long, though most don't require all
00485  * this space.  Maximum of 123 instructions.  Smaller maxes per insn
00486  * type.
00487  */
00488 #define _3DSTATE_PIXEL_SHADER_PROGRAM    (CMD_3D|(0x1d<<24)|(0x5<<16))
00489 
00490 #define REG_TYPE_R                 0    /* temporary regs, no need to
00491                                          * dcl, must be written before
00492                                          * read -- Preserved between
00493                                          * phases. 
00494                                          */
00495 #define REG_TYPE_T                 1    /* Interpolated values, must be
00496                                          * dcl'ed before use.
00497                                          *
00498                                          * 0..7: texture coord,
00499                                          * 8: diffuse spec,
00500                                          * 9: specular color,
00501                                          * 10: fog parameter in w.
00502                                          */
00503 #define REG_TYPE_CONST             2    /* Restriction: only one const
00504                                          * can be referenced per
00505                                          * instruction, though it may be
00506                                          * selected for multiple inputs.
00507                                          * Constants not initialized
00508                                          * default to zero.
00509                                          */
00510 #define REG_TYPE_S                 3    /* sampler */
00511 #define REG_TYPE_OC                4    /* output color (rgba) */
00512 #define REG_TYPE_OD                5    /* output depth (w), xyz are
00513                                          * temporaries.  If not written,
00514                                          * interpolated depth is used?
00515                                          */
00516 #define REG_TYPE_U                 6    /* unpreserved temporaries */
00517 #define REG_TYPE_MASK              0x7
00518 #define REG_NR_MASK                0xf
00519 
00520 
00521 /* REG_TYPE_T:
00522  */
00523 #define T_TEX0     0
00524 #define T_TEX1     1
00525 #define T_TEX2     2
00526 #define T_TEX3     3
00527 #define T_TEX4     4
00528 #define T_TEX5     5
00529 #define T_TEX6     6
00530 #define T_TEX7     7
00531 #define T_DIFFUSE  8
00532 #define T_SPECULAR 9
00533 #define T_FOG_W    10           /* interpolated fog is in W coord */
00534 
00535 /* Arithmetic instructions */
00536 
00537 /* .replicate_swizzle == selection and replication of a particular
00538  * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww 
00539  */
00540 #define A0_NOP    (0x0<<24)     /* no operation */
00541 #define A0_ADD    (0x1<<24)     /* dst = src0 + src1 */
00542 #define A0_MOV    (0x2<<24)     /* dst = src0 */
00543 #define A0_MUL    (0x3<<24)     /* dst = src0 * src1 */
00544 #define A0_MAD    (0x4<<24)     /* dst = src0 * src1 + src2 */
00545 #define A0_DP2ADD (0x5<<24)     /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
00546 #define A0_DP3    (0x6<<24)     /* dst.xyzw = src0.xyz dot src1.xyz */
00547 #define A0_DP4    (0x7<<24)     /* dst.xyzw = src0.xyzw dot src1.xyzw */
00548 #define A0_FRC    (0x8<<24)     /* dst = src0 - floor(src0) */
00549 #define A0_RCP    (0x9<<24)     /* dst.xyzw = 1/(src0.replicate_swizzle) */
00550 #define A0_RSQ    (0xa<<24)     /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
00551 #define A0_EXP    (0xb<<24)     /* dst.xyzw = exp2(src0.replicate_swizzle) */
00552 #define A0_LOG    (0xc<<24)     /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
00553 #define A0_CMP    (0xd<<24)     /* dst = (src0 >= 0.0) ? src1 : src2 */
00554 #define A0_MIN    (0xe<<24)     /* dst = (src0 < src1) ? src0 : src1 */
00555 #define A0_MAX    (0xf<<24)     /* dst = (src0 >= src1) ? src0 : src1 */
00556 #define A0_FLR    (0x10<<24)    /* dst = floor(src0) */
00557 #define A0_MOD    (0x11<<24)    /* dst = src0 fmod 1.0 */
00558 #define A0_TRC    (0x12<<24)    /* dst = int(src0) */
00559 #define A0_SGE    (0x13<<24)    /* dst = src0 >= src1 ? 1.0 : 0.0 */
00560 #define A0_SLT    (0x14<<24)    /* dst = src0 < src1 ? 1.0 : 0.0 */
00561 #define A0_DEST_SATURATE                 (1<<22)
00562 #define A0_DEST_TYPE_SHIFT                19
00563 /* Allow: R, OC, OD, U */
00564 #define A0_DEST_NR_SHIFT                 14
00565 /* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
00566 #define A0_DEST_CHANNEL_X                (1<<10)
00567 #define A0_DEST_CHANNEL_Y                (2<<10)
00568 #define A0_DEST_CHANNEL_Z                (4<<10)
00569 #define A0_DEST_CHANNEL_W                (8<<10)
00570 #define A0_DEST_CHANNEL_ALL              (0xf<<10)
00571 #define A0_DEST_CHANNEL_SHIFT            10
00572 #define A0_SRC0_TYPE_SHIFT               7
00573 #define A0_SRC0_NR_SHIFT                 2
00574 
00575 #define A0_DEST_CHANNEL_XY              (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y)
00576 #define A0_DEST_CHANNEL_XYZ             (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z)
00577 
00578 
00579 #define SRC_X        0
00580 #define SRC_Y        1
00581 #define SRC_Z        2
00582 #define SRC_W        3
00583 #define SRC_ZERO     4
00584 #define SRC_ONE      5
00585 
00586 #define A1_SRC0_CHANNEL_X_NEGATE         (1<<31)
00587 #define A1_SRC0_CHANNEL_X_SHIFT          28
00588 #define A1_SRC0_CHANNEL_Y_NEGATE         (1<<27)
00589 #define A1_SRC0_CHANNEL_Y_SHIFT          24
00590 #define A1_SRC0_CHANNEL_Z_NEGATE         (1<<23)
00591 #define A1_SRC0_CHANNEL_Z_SHIFT          20
00592 #define A1_SRC0_CHANNEL_W_NEGATE         (1<<19)
00593 #define A1_SRC0_CHANNEL_W_SHIFT          16
00594 #define A1_SRC1_TYPE_SHIFT               13
00595 #define A1_SRC1_NR_SHIFT                 8
00596 #define A1_SRC1_CHANNEL_X_NEGATE         (1<<7)
00597 #define A1_SRC1_CHANNEL_X_SHIFT          4
00598 #define A1_SRC1_CHANNEL_Y_NEGATE         (1<<3)
00599 #define A1_SRC1_CHANNEL_Y_SHIFT          0
00600 
00601 #define A2_SRC1_CHANNEL_Z_NEGATE         (1<<31)
00602 #define A2_SRC1_CHANNEL_Z_SHIFT          28
00603 #define A2_SRC1_CHANNEL_W_NEGATE         (1<<27)
00604 #define A2_SRC1_CHANNEL_W_SHIFT          24
00605 #define A2_SRC2_TYPE_SHIFT               21
00606 #define A2_SRC2_NR_SHIFT                 16
00607 #define A2_SRC2_CHANNEL_X_NEGATE         (1<<15)
00608 #define A2_SRC2_CHANNEL_X_SHIFT          12
00609 #define A2_SRC2_CHANNEL_Y_NEGATE         (1<<11)
00610 #define A2_SRC2_CHANNEL_Y_SHIFT          8
00611 #define A2_SRC2_CHANNEL_Z_NEGATE         (1<<7)
00612 #define A2_SRC2_CHANNEL_Z_SHIFT          4
00613 #define A2_SRC2_CHANNEL_W_NEGATE         (1<<3)
00614 #define A2_SRC2_CHANNEL_W_SHIFT          0
00615 
00616 
00617 
00618 /* Texture instructions */
00619 #define T0_TEXLD     (0x15<<24) /* Sample texture using predeclared
00620                                  * sampler and address, and output
00621                                  * filtered texel data to destination
00622                                  * register */
00623 #define T0_TEXLDP    (0x16<<24) /* Same as texld but performs a
00624                                  * perspective divide of the texture
00625                                  * coordinate .xyz values by .w before
00626                                  * sampling. */
00627 #define T0_TEXLDB    (0x17<<24) /* Same as texld but biases the
00628                                  * computed LOD by w.  Only S4.6 two's
00629                                  * comp is used.  This implies that a
00630                                  * float to fixed conversion is
00631                                  * done. */
00632 #define T0_TEXKILL   (0x18<<24) /* Does not perform a sampling
00633                                  * operation.  Simply kills the pixel
00634                                  * if any channel of the address
00635                                  * register is < 0.0. */
00636 #define T0_DEST_TYPE_SHIFT                19
00637 /* Allow: R, OC, OD, U */
00638 /* Note: U (unpreserved) regs do not retain their values between
00639  * phases (cannot be used for feedback) 
00640  *
00641  * Note: oC and OD registers can only be used as the destination of a
00642  * texture instruction once per phase (this is an implementation
00643  * restriction). 
00644  */
00645 #define T0_DEST_NR_SHIFT                 14
00646 /* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
00647 #define T0_SAMPLER_NR_SHIFT              0      /* This field ignored for TEXKILL */
00648 #define T0_SAMPLER_NR_MASK               (0xf<<0)
00649 
00650 #define T1_ADDRESS_REG_TYPE_SHIFT        24     /* Reg to use as texture coord */
00651 /* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
00652 #define T1_ADDRESS_REG_NR_SHIFT          17
00653 #define T2_MBZ                           0
00654 
00655 /* Declaration instructions */
00656 #define D0_DCL       (0x19<<24) /* Declare a t (interpolated attrib)
00657                                  * register or an s (sampler)
00658                                  * register. */
00659 #define D0_SAMPLE_TYPE_SHIFT              22
00660 #define D0_SAMPLE_TYPE_2D                 (0x0<<22)
00661 #define D0_SAMPLE_TYPE_CUBE               (0x1<<22)
00662 #define D0_SAMPLE_TYPE_VOLUME             (0x2<<22)
00663 #define D0_SAMPLE_TYPE_MASK               (0x3<<22)
00664 
00665 #define D0_TYPE_SHIFT                19
00666 /* Allow: T, S */
00667 #define D0_NR_SHIFT                  14
00668 /* Allow T: 0..10, S: 0..15 */
00669 #define D0_CHANNEL_X                (1<<10)
00670 #define D0_CHANNEL_Y                (2<<10)
00671 #define D0_CHANNEL_Z                (4<<10)
00672 #define D0_CHANNEL_W                (8<<10)
00673 #define D0_CHANNEL_ALL              (0xf<<10)
00674 #define D0_CHANNEL_NONE             (0<<10)
00675 
00676 #define D0_CHANNEL_XY               (D0_CHANNEL_X|D0_CHANNEL_Y)
00677 #define D0_CHANNEL_XYZ              (D0_CHANNEL_XY|D0_CHANNEL_Z)
00678 
00679 /* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
00680  * or specular declarations. 
00681  *
00682  * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw) 
00683  *
00684  * Must be zero for S (sampler) dcls
00685  */
00686 #define D1_MBZ                          0
00687 #define D2_MBZ                          0
00688 
00689 
00690 
00691 /* p207 */
00692 #define _3DSTATE_MAP_STATE               (CMD_3D|(0x1d<<24)|(0x0<<16))
00693 
00694 #define MS1_MAPMASK_SHIFT               0
00695 #define MS1_MAPMASK_MASK                (0x8fff<<0)
00696 
00697 #define MS2_UNTRUSTED_SURFACE           (1<<31)
00698 #define MS2_ADDRESS_MASK                0xfffffffc
00699 #define MS2_VERTICAL_LINE_STRIDE        (1<<1)
00700 #define MS2_VERTICAL_OFFSET             (1<<1)
00701 
00702 #define MS3_HEIGHT_SHIFT              21
00703 #define MS3_WIDTH_SHIFT               10
00704 #define MS3_PALETTE_SELECT            (1<<9)
00705 #define MS3_MAPSURF_FORMAT_SHIFT      7
00706 #define MS3_MAPSURF_FORMAT_MASK       (0x7<<7)
00707 #define    MAPSURF_8BIT                    (1<<7)
00708 #define    MAPSURF_16BIT                   (2<<7)
00709 #define    MAPSURF_32BIT                   (3<<7)
00710 #define    MAPSURF_422                     (5<<7)
00711 #define    MAPSURF_COMPRESSED              (6<<7)
00712 #define    MAPSURF_4BIT_INDEXED            (7<<7)
00713 #define MS3_MT_FORMAT_MASK         (0x7 << 3)
00714 #define MS3_MT_FORMAT_SHIFT        3
00715 #define    MT_4BIT_IDX_ARGB8888            (7<<3)       /* SURFACE_4BIT_INDEXED */
00716 #define    MT_8BIT_I8                      (0<<3)       /* SURFACE_8BIT */
00717 #define    MT_8BIT_L8                      (1<<3)
00718 #define    MT_8BIT_A8                      (4<<3)
00719 #define    MT_8BIT_MONO8                   (5<<3)
00720 #define    MT_16BIT_RGB565                 (0<<3)       /* SURFACE_16BIT */
00721 #define    MT_16BIT_ARGB1555               (1<<3)
00722 #define    MT_16BIT_ARGB4444               (2<<3)
00723 #define    MT_16BIT_AY88                   (3<<3)
00724 #define    MT_16BIT_88DVDU                 (5<<3)
00725 #define    MT_16BIT_BUMP_655LDVDU          (6<<3)
00726 #define    MT_16BIT_I16                    (7<<3)
00727 #define    MT_16BIT_L16                    (8<<3)
00728 #define    MT_16BIT_A16                    (9<<3)
00729 #define    MT_32BIT_ARGB8888               (0<<3)       /* SURFACE_32BIT */
00730 #define    MT_32BIT_ABGR8888               (1<<3)
00731 #define    MT_32BIT_XRGB8888               (2<<3)
00732 #define    MT_32BIT_XBGR8888               (3<<3)
00733 #define    MT_32BIT_QWVU8888               (4<<3)
00734 #define    MT_32BIT_AXVU8888               (5<<3)
00735 #define    MT_32BIT_LXVU8888               (6<<3)
00736 #define    MT_32BIT_XLVU8888               (7<<3)
00737 #define    MT_32BIT_ARGB2101010            (8<<3)
00738 #define    MT_32BIT_ABGR2101010            (9<<3)
00739 #define    MT_32BIT_AWVU2101010            (0xA<<3)
00740 #define    MT_32BIT_GR1616                 (0xB<<3)
00741 #define    MT_32BIT_VU1616                 (0xC<<3)
00742 #define    MT_32BIT_xI824                  (0xD<<3)
00743 #define    MT_32BIT_xA824                  (0xE<<3)
00744 #define    MT_32BIT_xL824                  (0xF<<3)
00745 #define    MT_422_YCRCB_SWAPY              (0<<3)       /* SURFACE_422 */
00746 #define    MT_422_YCRCB_NORMAL             (1<<3)
00747 #define    MT_422_YCRCB_SWAPUV             (2<<3)
00748 #define    MT_422_YCRCB_SWAPUVY            (3<<3)
00749 #define    MT_COMPRESS_DXT1                (0<<3)       /* SURFACE_COMPRESSED */
00750 #define    MT_COMPRESS_DXT2_3              (1<<3)
00751 #define    MT_COMPRESS_DXT4_5              (2<<3)
00752 #define    MT_COMPRESS_FXT1                (3<<3)
00753 #define    MT_COMPRESS_DXT1_RGB            (4<<3)
00754 #define MS3_USE_FENCE_REGS              (1<<2)
00755 #define MS3_TILED_SURFACE             (1<<1)
00756 #define MS3_TILE_WALK                 (1<<0)
00757 
00758 #define MS4_PITCH_SHIFT                 21
00759 #define MS4_CUBE_FACE_ENA_NEGX          (1<<20)
00760 #define MS4_CUBE_FACE_ENA_POSX          (1<<19)
00761 #define MS4_CUBE_FACE_ENA_NEGY          (1<<18)
00762 #define MS4_CUBE_FACE_ENA_POSY          (1<<17)
00763 #define MS4_CUBE_FACE_ENA_NEGZ          (1<<16)
00764 #define MS4_CUBE_FACE_ENA_POSZ          (1<<15)
00765 #define MS4_CUBE_FACE_ENA_MASK          (0x3f<<15)
00766 #define MS4_MAX_LOD_SHIFT               9
00767 #define MS4_MAX_LOD_MASK                (0x3f<<9)
00768 #define MS4_MIP_LAYOUT_LEGACY           (0<<8)
00769 #define MS4_MIP_LAYOUT_BELOW_LPT        (0<<8)
00770 #define MS4_MIP_LAYOUT_RIGHT_LPT        (1<<8)
00771 #define MS4_VOLUME_DEPTH_SHIFT          0
00772 #define MS4_VOLUME_DEPTH_MASK           (0xff<<0)
00773 
00774 /* p244 */
00775 #define _3DSTATE_SAMPLER_STATE         (CMD_3D|(0x1d<<24)|(0x1<<16))
00776 
00777 #define SS1_MAPMASK_SHIFT               0
00778 #define SS1_MAPMASK_MASK                (0x8fff<<0)
00779 
00780 #define SS2_REVERSE_GAMMA_ENABLE        (1<<31)
00781 #define SS2_PACKED_TO_PLANAR_ENABLE     (1<<30)
00782 #define SS2_COLORSPACE_CONVERSION       (1<<29)
00783 #define SS2_CHROMAKEY_SHIFT             27
00784 #define SS2_BASE_MIP_LEVEL_SHIFT        22
00785 #define SS2_BASE_MIP_LEVEL_MASK         (0x1f<<22)
00786 #define SS2_MIP_FILTER_SHIFT            20
00787 #define SS2_MIP_FILTER_MASK             (0x3<<20)
00788 #define   MIPFILTER_NONE        0
00789 #define   MIPFILTER_NEAREST     1
00790 #define   MIPFILTER_LINEAR      3
00791 #define SS2_MAG_FILTER_SHIFT          17
00792 #define SS2_MAG_FILTER_MASK           (0x7<<17)
00793 #define   FILTER_NEAREST        0
00794 #define   FILTER_LINEAR         1
00795 #define   FILTER_ANISOTROPIC    2
00796 #define   FILTER_4X4_1          3
00797 #define   FILTER_4X4_2          4
00798 #define   FILTER_4X4_FLAT       5
00799 #define   FILTER_6X5_MONO       6       /* XXX - check */
00800 #define SS2_MIN_FILTER_SHIFT          14
00801 #define SS2_MIN_FILTER_MASK           (0x7<<14)
00802 #define SS2_LOD_BIAS_SHIFT            5
00803 #define SS2_LOD_BIAS_ONE              (0x10<<5)
00804 #define SS2_LOD_BIAS_MASK             (0x1ff<<5)
00805 /* Shadow requires:
00806  *  MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
00807  *  FILTER_4X4_x  MIN and MAG filters
00808  */
00809 #define SS2_SHADOW_ENABLE             (1<<4)
00810 #define SS2_MAX_ANISO_MASK            (1<<3)
00811 #define SS2_MAX_ANISO_2               (0<<3)
00812 #define SS2_MAX_ANISO_4               (1<<3)
00813 #define SS2_SHADOW_FUNC_SHIFT         0
00814 #define SS2_SHADOW_FUNC_MASK          (0x7<<0)
00815 /* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
00816 
00817 #define SS3_MIN_LOD_SHIFT            24
00818 #define SS3_MIN_LOD_ONE              (0x10<<24)
00819 #define SS3_MIN_LOD_MASK             (0xff<<24)
00820 #define SS3_KILL_PIXEL_ENABLE        (1<<17)
00821 #define SS3_TCX_ADDR_MODE_SHIFT      12
00822 #define SS3_TCX_ADDR_MODE_MASK       (0x7<<12)
00823 #define   TEXCOORDMODE_WRAP             0
00824 #define   TEXCOORDMODE_MIRROR           1
00825 #define   TEXCOORDMODE_CLAMP_EDGE       2
00826 #define   TEXCOORDMODE_CUBE             3
00827 #define   TEXCOORDMODE_CLAMP_BORDER     4
00828 #define   TEXCOORDMODE_MIRROR_ONCE      5
00829 #define SS3_TCY_ADDR_MODE_SHIFT      9
00830 #define SS3_TCY_ADDR_MODE_MASK       (0x7<<9)
00831 #define SS3_TCZ_ADDR_MODE_SHIFT      6
00832 #define SS3_TCZ_ADDR_MODE_MASK       (0x7<<6)
00833 #define SS3_NORMALIZED_COORDS        (1<<5)
00834 #define SS3_TEXTUREMAP_INDEX_SHIFT   1
00835 #define SS3_TEXTUREMAP_INDEX_MASK    (0xf<<1)
00836 #define SS3_DEINTERLACER_ENABLE      (1<<0)
00837 
00838 #define SS4_BORDER_COLOR_MASK        (~0)
00839 
00840 /* 3DSTATE_SPAN_STIPPLE, p258
00841  */
00842 #define _3DSTATE_STIPPLE           ((0x3<<29)|(0x1d<<24)|(0x83<<16))
00843 #define ST1_ENABLE               (1<<16)
00844 #define ST1_MASK                 (0xffff)
00845 
00846 #define _3DSTATE_DEFAULT_Z          ((0x3<<29)|(0x1d<<24)|(0x98<<16))
00847 #define _3DSTATE_DEFAULT_DIFFUSE    ((0x3<<29)|(0x1d<<24)|(0x99<<16))
00848 #define _3DSTATE_DEFAULT_SPECULAR   ((0x3<<29)|(0x1d<<24)|(0x9a<<16))
00849 
00850 
00851 #define MI_FLUSH                   ((0<<29)|(4<<23))
00852 #define FLUSH_MAP_CACHE            (1<<0)
00853 #define INHIBIT_FLUSH_RENDER_CACHE (1<<2)
00854 
00855 
00856 #define CMD_3D (0x3<<29)
00857 
00858 
00859 #define _3DPRIMITIVE         ((0x3<<29)|(0x1f<<24))
00860 #define PRIM_INDIRECT            (1<<23)
00861 #define PRIM_INLINE              (0<<23)
00862 #define PRIM_INDIRECT_SEQUENTIAL (0<<17)
00863 #define PRIM_INDIRECT_ELTS       (1<<17)
00864 
00865 #define PRIM3D_TRILIST          (0x0<<18)
00866 #define PRIM3D_TRISTRIP         (0x1<<18)
00867 #define PRIM3D_TRISTRIP_RVRSE   (0x2<<18)
00868 #define PRIM3D_TRIFAN           (0x3<<18)
00869 #define PRIM3D_POLY             (0x4<<18)
00870 #define PRIM3D_LINELIST         (0x5<<18)
00871 #define PRIM3D_LINESTRIP        (0x6<<18)
00872 #define PRIM3D_RECTLIST         (0x7<<18)
00873 #define PRIM3D_POINTLIST        (0x8<<18)
00874 #define PRIM3D_DIB              (0x9<<18)
00875 #define PRIM3D_MASK             (0x1f<<18)
00876 
00877 #define I915PACKCOLOR4444(r,g,b,a) \
00878   ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
00879 
00880 #define I915PACKCOLOR1555(r,g,b,a) \
00881   ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
00882     ((a) ? 0x8000 : 0))
00883 
00884 #define I915PACKCOLOR565(r,g,b) \
00885   ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
00886 
00887 #define I915PACKCOLOR8888(r,g,b,a) \
00888   ((a<<24) | (r<<16) | (g<<8) | b)
00889 
00890 
00891 
00892 
00893 #define BR00_BITBLT_CLIENT   0x40000000
00894 #define BR00_OP_COLOR_BLT    0x10000000
00895 #define BR00_OP_SRC_COPY_BLT 0x10C00000
00896 #define BR13_SOLID_PATTERN   0x80000000
00897 
00898 #define XY_COLOR_BLT_CMD                ((2<<29)|(0x50<<22)|0x4)
00899 #define XY_COLOR_BLT_WRITE_ALPHA        (1<<21)
00900 #define XY_COLOR_BLT_WRITE_RGB          (1<<20)
00901 
00902 #define XY_SRC_COPY_BLT_CMD             ((2<<29)|(0x53<<22)|6)
00903 #define XY_SRC_COPY_BLT_WRITE_ALPHA     (1<<21)
00904 #define XY_SRC_COPY_BLT_WRITE_RGB       (1<<20)
00905 
00906 #define MI_WAIT_FOR_EVENT               ((0x3<<23))
00907 #define MI_WAIT_FOR_PLANE_B_FLIP        (1<<6)
00908 #define MI_WAIT_FOR_PLANE_A_FLIP        (1<<2)
00909 
00910 #define MI_BATCH_BUFFER                 (0x30<<23)
00911 #define MI_BATCH_BUFFER_START           (0x31<<23)
00912 #define MI_BATCH_BUFFER_END             (0xa<<23)
00913 
00914 
00915 
00916 #define COMPAREFUNC_ALWAYS              0
00917 #define COMPAREFUNC_NEVER               0x1
00918 #define COMPAREFUNC_LESS                0x2
00919 #define COMPAREFUNC_EQUAL               0x3
00920 #define COMPAREFUNC_LEQUAL              0x4
00921 #define COMPAREFUNC_GREATER             0x5
00922 #define COMPAREFUNC_NOTEQUAL            0x6
00923 #define COMPAREFUNC_GEQUAL              0x7
00924 
00925 #define STENCILOP_KEEP                  0
00926 #define STENCILOP_ZERO                  0x1
00927 #define STENCILOP_REPLACE               0x2
00928 #define STENCILOP_INCRSAT               0x3
00929 #define STENCILOP_DECRSAT               0x4
00930 #define STENCILOP_INCR                  0x5
00931 #define STENCILOP_DECR                  0x6
00932 #define STENCILOP_INVERT                0x7
00933 
00934 #define LOGICOP_CLEAR                   0
00935 #define LOGICOP_NOR                     0x1
00936 #define LOGICOP_AND_INV                 0x2
00937 #define LOGICOP_COPY_INV                0x3
00938 #define LOGICOP_AND_RVRSE               0x4
00939 #define LOGICOP_INV                     0x5
00940 #define LOGICOP_XOR                     0x6
00941 #define LOGICOP_NAND                    0x7
00942 #define LOGICOP_AND                     0x8
00943 #define LOGICOP_EQUIV                   0x9
00944 #define LOGICOP_NOOP                    0xa
00945 #define LOGICOP_OR_INV                  0xb
00946 #define LOGICOP_COPY                    0xc
00947 #define LOGICOP_OR_RVRSE                0xd
00948 #define LOGICOP_OR                      0xe
00949 #define LOGICOP_SET                     0xf
00950 
00951 #define BLENDFACT_ZERO                  0x01
00952 #define BLENDFACT_ONE                   0x02
00953 #define BLENDFACT_SRC_COLR              0x03
00954 #define BLENDFACT_INV_SRC_COLR          0x04
00955 #define BLENDFACT_SRC_ALPHA             0x05
00956 #define BLENDFACT_INV_SRC_ALPHA         0x06
00957 #define BLENDFACT_DST_ALPHA             0x07
00958 #define BLENDFACT_INV_DST_ALPHA         0x08
00959 #define BLENDFACT_DST_COLR              0x09
00960 #define BLENDFACT_INV_DST_COLR          0x0a
00961 #define BLENDFACT_SRC_ALPHA_SATURATE    0x0b
00962 #define BLENDFACT_CONST_COLOR           0x0c
00963 #define BLENDFACT_INV_CONST_COLOR       0x0d
00964 #define BLENDFACT_CONST_ALPHA           0x0e
00965 #define BLENDFACT_INV_CONST_ALPHA       0x0f
00966 #define BLENDFACT_MASK                  0x0f
00967 
00968 #define PCI_CHIP_I915_G                 0x2582
00969 #define PCI_CHIP_I915_GM                0x2592
00970 #define PCI_CHIP_I945_G                 0x2772
00971 #define PCI_CHIP_I945_GM                0x27A2
00972 #define PCI_CHIP_I945_GME               0x27AE
00973 #define PCI_CHIP_G33_G                  0x29C2
00974 #define PCI_CHIP_Q35_G                  0x29B2
00975 #define PCI_CHIP_Q33_G                  0x29D2
00976 
00977 
00978 #endif

Generated on Tue Sep 29 06:25:16 2009 for Gallium3D by  doxygen 1.5.4