14a49301eSmrg/**************************************************************************
27ec681f3Smrg *
3af69d88dSmrg * Copyright 2003 VMware, Inc.
44a49301eSmrg * All Rights Reserved.
57ec681f3Smrg *
64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
74a49301eSmrg * copy of this software and associated documentation files (the
84a49301eSmrg * "Software"), to deal in the Software without restriction, including
94a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
104a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
114a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
124a49301eSmrg * the following conditions:
137ec681f3Smrg *
144a49301eSmrg * The above copyright notice and this permission notice (including the
154a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
164a49301eSmrg * of the Software.
177ec681f3Smrg *
184a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
194a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
224a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
244a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257ec681f3Smrg *
264a49301eSmrg **************************************************************************/
274a49301eSmrg
284a49301eSmrg#ifndef I915_REG_H
294a49301eSmrg#define I915_REG_H
304a49301eSmrg
317ec681f3Smrg#define I915_SET_FIELD(var, mask, value) (var &= ~(mask), var |= value)
327ec681f3Smrg
337ec681f3Smrg#define CMD_3D (0x3 << 29)
347ec681f3Smrg
357ec681f3Smrg#define PRIM3D_INLINE         (CMD_3D | (0x1f << 24))
367ec681f3Smrg#define PRIM3D_TRILIST        (0x0 << 18)
377ec681f3Smrg#define PRIM3D_TRISTRIP       (0x1 << 18)
387ec681f3Smrg#define PRIM3D_TRISTRIP_RVRSE (0x2 << 18)
397ec681f3Smrg#define PRIM3D_TRIFAN         (0x3 << 18)
407ec681f3Smrg#define PRIM3D_POLY           (0x4 << 18)
417ec681f3Smrg#define PRIM3D_LINELIST       (0x5 << 18)
427ec681f3Smrg#define PRIM3D_LINESTRIP      (0x6 << 18)
437ec681f3Smrg#define PRIM3D_RECTLIST       (0x7 << 18)
447ec681f3Smrg#define PRIM3D_POINTLIST      (0x8 << 18)
457ec681f3Smrg#define PRIM3D_DIB            (0x9 << 18)
467ec681f3Smrg#define PRIM3D_CLEAR_RECT     (0xa << 18)
477ec681f3Smrg#define PRIM3D_ZONE_INIT      (0xd << 18)
487ec681f3Smrg#define PRIM3D_MASK           (0x1f << 18)
494a49301eSmrg
504a49301eSmrg/* p137 */
517ec681f3Smrg#define _3DSTATE_AA_CMD             (CMD_3D | (0x06 << 24))
527ec681f3Smrg#define AA_LINE_ECAAR_WIDTH_ENABLE  (1 << 16)
537ec681f3Smrg#define AA_LINE_ECAAR_WIDTH_0_5     0
547ec681f3Smrg#define AA_LINE_ECAAR_WIDTH_1_0     (1 << 14)
557ec681f3Smrg#define AA_LINE_ECAAR_WIDTH_2_0     (2 << 14)
567ec681f3Smrg#define AA_LINE_ECAAR_WIDTH_4_0     (3 << 14)
577ec681f3Smrg#define AA_LINE_REGION_WIDTH_ENABLE (1 << 8)
587ec681f3Smrg#define AA_LINE_REGION_WIDTH_0_5    0
597ec681f3Smrg#define AA_LINE_REGION_WIDTH_1_0    (1 << 6)
607ec681f3Smrg#define AA_LINE_REGION_WIDTH_2_0    (2 << 6)
617ec681f3Smrg#define AA_LINE_REGION_WIDTH_4_0    (3 << 6)
624a49301eSmrg
634a49301eSmrg/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/
647ec681f3Smrg#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8 << 24))
657ec681f3Smrg#define BFO_ENABLE_STENCIL_REF        (1 << 23)
667ec681f3Smrg#define BFO_STENCIL_REF_SHIFT         15
677ec681f3Smrg#define BFO_STENCIL_REF_MASK          (0xff << 15)
687ec681f3Smrg#define BFO_ENABLE_STENCIL_FUNCS      (1 << 14)
697ec681f3Smrg#define BFO_STENCIL_TEST_SHIFT        11
707ec681f3Smrg#define BFO_STENCIL_TEST_MASK         (0x7 << 11)
717ec681f3Smrg#define BFO_STENCIL_FAIL_SHIFT        8
727ec681f3Smrg#define BFO_STENCIL_FAIL_MASK         (0x7 << 8)
737ec681f3Smrg#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5
747ec681f3Smrg#define BFO_STENCIL_PASS_Z_FAIL_MASK  (0x7 << 5)
757ec681f3Smrg#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2
767ec681f3Smrg#define BFO_STENCIL_PASS_Z_PASS_MASK  (0x7 << 2)
777ec681f3Smrg#define BFO_ENABLE_STENCIL_TWO_SIDE   (1 << 1)
787ec681f3Smrg#define BFO_STENCIL_TWO_SIDE          (1 << 0)
794a49301eSmrg
804a49301eSmrg/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */
817ec681f3Smrg#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9 << 24))
827ec681f3Smrg#define BFM_ENABLE_STENCIL_TEST_MASK    (1 << 17)
837ec681f3Smrg#define BFM_ENABLE_STENCIL_WRITE_MASK   (1 << 16)
847ec681f3Smrg#define BFM_STENCIL_TEST_MASK_SHIFT     8
857ec681f3Smrg#define BFM_STENCIL_TEST_MASK_MASK      (0xff << 8)
867ec681f3Smrg#define BFM_STENCIL_WRITE_MASK_SHIFT    0
877ec681f3Smrg#define BFM_STENCIL_WRITE_MASK_MASK     (0xff << 0)
884a49301eSmrg
894a49301eSmrg/* 3DSTATE_BIN_CONTROL p141 */
904a49301eSmrg
914a49301eSmrg/* p143 */
927ec681f3Smrg#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d << 24) | (0x8e << 16) | 1)
934a49301eSmrg/* Dword 1 */
947ec681f3Smrg#define BUF_3D_ID_COLOR_BACK (0x3 << 24)
957ec681f3Smrg#define BUF_3D_ID_DEPTH      (0x7 << 24)
967ec681f3Smrg#define BUF_3D_USE_FENCE     (1 << 23)
977ec681f3Smrg#define BUF_3D_TILED_SURFACE (1 << 22)
987ec681f3Smrg#define BUF_3D_TILE_WALK_X   0
997ec681f3Smrg#define BUF_3D_TILE_WALK_Y   (1 << 21)
1007ec681f3Smrg#define BUF_3D_PITCH(x)      (((x) / 4) << 2)
1014a49301eSmrg/* Dword 2 */
1027ec681f3Smrg#define BUF_3D_ADDR(x) ((x) & ~0x3)
1034a49301eSmrg
1044a49301eSmrg/* 3DSTATE_CHROMA_KEY */
1054a49301eSmrg
1064a49301eSmrg/* 3DSTATE_CLEAR_PARAMETERS, p150 */
1077ec681f3Smrg#define _3DSTATE_CLEAR_PARAMETERS (CMD_3D | (0x1d << 24) | (0x9c << 16) | 5)
1084a49301eSmrg/* Dword 1 */
1097ec681f3Smrg#define CLEARPARAM_CLEAR_RECT    (1 << 16)
1107ec681f3Smrg#define CLEARPARAM_ZONE_INIT     (0 << 16)
1117ec681f3Smrg#define CLEARPARAM_WRITE_COLOR   (1 << 2)
1127ec681f3Smrg#define CLEARPARAM_WRITE_DEPTH   (1 << 1)
1137ec681f3Smrg#define CLEARPARAM_WRITE_STENCIL (1 << 0)
1144a49301eSmrg
1154a49301eSmrg/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */
1167ec681f3Smrg#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d << 24) | (0x88 << 16))
1174a49301eSmrg
1184a49301eSmrg/* 3DSTATE_COORD_SET_BINDINGS, p154 */
1197ec681f3Smrg#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16 << 24))
1207ec681f3Smrg#define CSB_TCB(iunit, eunit)       ((eunit) << (iunit * 3))
1214a49301eSmrg
1224a49301eSmrg/* p156 */
1237ec681f3Smrg#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d << 24) | (0x99 << 16))
1244a49301eSmrg
1254a49301eSmrg/* p157 */
1267ec681f3Smrg#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d << 24) | (0x9a << 16))
1274a49301eSmrg
1284a49301eSmrg/* p158 */
1297ec681f3Smrg#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d << 24) | (0x98 << 16))
1304a49301eSmrg
1314a49301eSmrg/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */
1327ec681f3Smrg#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d << 24) | (0x97 << 16))
1334a49301eSmrg/* scale in dword 1 */
1344a49301eSmrg
1354a49301eSmrg/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
1367ec681f3Smrg#define _3DSTATE_DEPTH_SUBRECT_DISABLE                                         \
1377ec681f3Smrg   (CMD_3D | (0x1c << 24) | (0x11 << 19) | 0x2)
1384a49301eSmrg
1394a49301eSmrg/* p161 */
1407ec681f3Smrg#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d << 24) | (0x85 << 16))
1414a49301eSmrg/* Dword 1 */
1427ec681f3Smrg#define CLASSIC_EARLY_DEPTH         (1 << 31)
1437ec681f3Smrg#define TEX_DEFAULT_COLOR_OGL       (0 << 30)
1447ec681f3Smrg#define TEX_DEFAULT_COLOR_D3D       (1 << 30)
1457ec681f3Smrg#define ZR_EARLY_DEPTH              (1 << 29)
1467ec681f3Smrg#define LOD_PRECLAMP_OGL            (1 << 28)
1477ec681f3Smrg#define LOD_PRECLAMP_D3D            (0 << 28)
1487ec681f3Smrg#define DITHER_FULL_ALWAYS          (0 << 26)
1497ec681f3Smrg#define DITHER_FULL_ON_FB_BLEND     (1 << 26)
1507ec681f3Smrg#define DITHER_CLAMPED_ALWAYS       (2 << 26)
1517ec681f3Smrg#define LINEAR_GAMMA_BLEND_32BPP    (1 << 25)
1527ec681f3Smrg#define DEBUG_DISABLE_ENH_DITHER    (1 << 24)
1537ec681f3Smrg#define DSTORG_HORT_BIAS(x)         ((x) << 20)
1547ec681f3Smrg#define DSTORG_VERT_BIAS(x)         ((x) << 16)
1557ec681f3Smrg#define COLOR_4_2_2_CHNL_WRT_ALL    0
1567ec681f3Smrg#define COLOR_4_2_2_CHNL_WRT_Y      (1 << 12)
1577ec681f3Smrg#define COLOR_4_2_2_CHNL_WRT_CR     (2 << 12)
1587ec681f3Smrg#define COLOR_4_2_2_CHNL_WRT_CB     (3 << 12)
1597ec681f3Smrg#define COLOR_4_2_2_CHNL_WRT_CRCB   (4 << 12)
1607ec681f3Smrg#define COLOR_BUF_8BIT              0
1617ec681f3Smrg#define COLOR_BUF_RGB555            (1 << 8)
1627ec681f3Smrg#define COLOR_BUF_RGB565            (2 << 8)
1637ec681f3Smrg#define COLOR_BUF_ARGB8888          (3 << 8)
1647ec681f3Smrg#define COLOR_BUF_YCRCB_SWAP        (4 << 8)
1657ec681f3Smrg#define COLOR_BUF_YCRCB_NORMAL      (5 << 8)
1667ec681f3Smrg#define COLOR_BUF_YCRCB_SWAPUV      (6 << 8)
1677ec681f3Smrg#define COLOR_BUF_YCRCB_SWAPUVY     (7 << 8)
1687ec681f3Smrg#define COLOR_BUF_ARGB4444          (8 << 8)
1697ec681f3Smrg#define COLOR_BUF_ARGB1555          (9 << 8)
1707ec681f3Smrg#define COLOR_BUF_ARGB2101010       (10 << 8)
1717ec681f3Smrg#define DEPTH_FRMT_16_FIXED         0
1727ec681f3Smrg#define DEPTH_FRMT_16_FLOAT         (1 << 2)
1737ec681f3Smrg#define DEPTH_FRMT_24_FIXED_8_OTHER (2 << 2)
1747ec681f3Smrg#define VERT_LINE_STRIDE_1          (1 << 1)
1757ec681f3Smrg#define VERT_LINE_STRIDE_0          (0 << 1)
1767ec681f3Smrg#define VERT_LINE_STRIDE_OFS_1      1
1777ec681f3Smrg#define VERT_LINE_STRIDE_OFS_0      0
1784a49301eSmrg
1794a49301eSmrg/* p166 */
1807ec681f3Smrg#define _3DSTATE_DRAW_RECT_CMD (CMD_3D | (0x1d << 24) | (0x80 << 16) | 3)
1814a49301eSmrg/* Dword 1 */
1827ec681f3Smrg#define DRAW_RECT_DIS_DEPTH_OFS (1 << 30)
1837ec681f3Smrg#define DRAW_DITHER_OFS_X(x)    ((x) << 26)
1847ec681f3Smrg#define DRAW_DITHER_OFS_Y(x)    ((x) << 24)
1854a49301eSmrg/* Dword 2 */
1867ec681f3Smrg#define DRAW_YMIN(x) ((x) << 16)
1877ec681f3Smrg#define DRAW_XMIN(x) (x)
1884a49301eSmrg/* Dword 3 */
1897ec681f3Smrg#define DRAW_YMAX(x) ((x) << 16)
1907ec681f3Smrg#define DRAW_XMAX(x) (x)
1914a49301eSmrg/* Dword 4 */
1927ec681f3Smrg#define DRAW_YORG(x) ((x) << 16)
1937ec681f3Smrg#define DRAW_XORG(x) (x)
1944a49301eSmrg
1954a49301eSmrg/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */
1964a49301eSmrg
1974a49301eSmrg/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */
1984a49301eSmrg
1994a49301eSmrg/* _3DSTATE_FOG_COLOR, p173 */
2007ec681f3Smrg#define _3DSTATE_FOG_COLOR_CMD (CMD_3D | (0x15 << 24))
2017ec681f3Smrg#define FOG_COLOR_RED(x)       ((x) << 16)
2027ec681f3Smrg#define FOG_COLOR_GREEN(x)     ((x) << 8)
2037ec681f3Smrg#define FOG_COLOR_BLUE(x)      (x)
2044a49301eSmrg
2054a49301eSmrg/* _3DSTATE_FOG_MODE, p174 */
2067ec681f3Smrg#define _3DSTATE_FOG_MODE_CMD (CMD_3D | (0x1d << 24) | (0x89 << 16) | 2)
2074a49301eSmrg/* Dword 1 */
2087ec681f3Smrg#define FMC1_FOGFUNC_MODIFY_ENABLE  (1 << 31)
2097ec681f3Smrg#define FMC1_FOGFUNC_VERTEX         (0 << 28)
2107ec681f3Smrg#define FMC1_FOGFUNC_PIXEL_EXP      (1 << 28)
2117ec681f3Smrg#define FMC1_FOGFUNC_PIXEL_EXP2     (2 << 28)
2127ec681f3Smrg#define FMC1_FOGFUNC_PIXEL_LINEAR   (3 << 28)
2137ec681f3Smrg#define FMC1_FOGFUNC_MASK           (3 << 28)
2147ec681f3Smrg#define FMC1_FOGINDEX_MODIFY_ENABLE (1 << 27)
2157ec681f3Smrg#define FMC1_FOGINDEX_Z             (0 << 25)
2167ec681f3Smrg#define FMC1_FOGINDEX_W             (1 << 25)
2177ec681f3Smrg#define FMC1_C1_C2_MODIFY_ENABLE    (1 << 24)
2187ec681f3Smrg#define FMC1_DENSITY_MODIFY_ENABLE  (1 << 23)
2197ec681f3Smrg#define FMC1_C1_ONE                 (1 << 13)
2207ec681f3Smrg#define FMC1_C1_MASK                (0xffff << 4)
2214a49301eSmrg/* Dword 2 */
2227ec681f3Smrg#define FMC2_C2_ONE (1 << 16)
2234a49301eSmrg/* Dword 3 */
2247ec681f3Smrg#define FMC3_D_ONE (1 << 16)
2254a49301eSmrg
2264a49301eSmrg/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */
2277ec681f3Smrg#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D | (0x0b << 24))
2287ec681f3Smrg#define IAB_MODIFY_ENABLE                    (1 << 23)
2297ec681f3Smrg#define IAB_ENABLE                           (1 << 22)
2307ec681f3Smrg#define IAB_MODIFY_FUNC                      (1 << 21)
2317ec681f3Smrg#define IAB_FUNC_SHIFT                       16
2327ec681f3Smrg#define IAB_MODIFY_SRC_FACTOR                (1 << 11)
2337ec681f3Smrg#define IAB_SRC_FACTOR_SHIFT                 6
2347ec681f3Smrg#define IAB_SRC_FACTOR_MASK                  (BLENDFACT_MASK << 6)
2357ec681f3Smrg#define IAB_MODIFY_DST_FACTOR                (1 << 5)
2367ec681f3Smrg#define IAB_DST_FACTOR_SHIFT                 0
2377ec681f3Smrg#define IAB_DST_FACTOR_MASK                  (BLENDFACT_MASK << 0)
2387ec681f3Smrg
2397ec681f3Smrg#define BLENDFUNC_ADD              0x0
2407ec681f3Smrg#define BLENDFUNC_SUBTRACT         0x1
2417ec681f3Smrg#define BLENDFUNC_REVERSE_SUBTRACT 0x2
2427ec681f3Smrg#define BLENDFUNC_MIN              0x3
2437ec681f3Smrg#define BLENDFUNC_MAX              0x4
2447ec681f3Smrg#define BLENDFUNC_MASK             0x7
2454a49301eSmrg
2464a49301eSmrg/* 3DSTATE_LOAD_INDIRECT, p180 */
2474a49301eSmrg
2487ec681f3Smrg#define _3DSTATE_LOAD_INDIRECT     (CMD_3D | (0x1d << 24) | (0x7 << 16))
2497ec681f3Smrg#define LI0_STATE_STATIC_INDIRECT  (0x01 << 8)
2507ec681f3Smrg#define LI0_STATE_DYNAMIC_INDIRECT (0x02 << 8)
2517ec681f3Smrg#define LI0_STATE_SAMPLER          (0x04 << 8)
2527ec681f3Smrg#define LI0_STATE_MAP              (0x08 << 8)
2537ec681f3Smrg#define LI0_STATE_PROGRAM          (0x10 << 8)
2547ec681f3Smrg#define LI0_STATE_CONSTANTS        (0x20 << 8)
2557ec681f3Smrg
2567ec681f3Smrg#define SIS0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2577ec681f3Smrg#define SIS0_FORCE_LOAD        (1 << 1)
2587ec681f3Smrg#define SIS0_BUFFER_VALID      (1 << 0)
2597ec681f3Smrg#define SIS1_BUFFER_LENGTH(x)  ((x)&0xff)
2607ec681f3Smrg
2617ec681f3Smrg#define DIS0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2627ec681f3Smrg#define DIS0_BUFFER_RESET      (1 << 1)
2637ec681f3Smrg#define DIS0_BUFFER_VALID      (1 << 0)
2647ec681f3Smrg
2657ec681f3Smrg#define SSB0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2667ec681f3Smrg#define SSB0_FORCE_LOAD        (1 << 1)
2677ec681f3Smrg#define SSB0_BUFFER_VALID      (1 << 0)
2687ec681f3Smrg#define SSB1_BUFFER_LENGTH(x)  ((x)&0xff)
2697ec681f3Smrg
2707ec681f3Smrg#define MSB0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2717ec681f3Smrg#define MSB0_FORCE_LOAD        (1 << 1)
2727ec681f3Smrg#define MSB0_BUFFER_VALID      (1 << 0)
2737ec681f3Smrg#define MSB1_BUFFER_LENGTH(x)  ((x)&0xff)
2747ec681f3Smrg
2757ec681f3Smrg#define PSP0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2767ec681f3Smrg#define PSP0_FORCE_LOAD        (1 << 1)
2777ec681f3Smrg#define PSP0_BUFFER_VALID      (1 << 0)
2787ec681f3Smrg#define PSP1_BUFFER_LENGTH(x)  ((x)&0xff)
2797ec681f3Smrg
2807ec681f3Smrg#define PSC0_BUFFER_ADDRESS(x) ((x) & ~0x3)
2817ec681f3Smrg#define PSC0_FORCE_LOAD        (1 << 1)
2827ec681f3Smrg#define PSC0_BUFFER_VALID      (1 << 0)
2837ec681f3Smrg#define PSC1_BUFFER_LENGTH(x)  ((x)&0xff)
2844a49301eSmrg
2854a49301eSmrg/* _3DSTATE_RASTERIZATION_RULES */
2867ec681f3Smrg#define _3DSTATE_RASTER_RULES_CMD      (CMD_3D | (0x07 << 24))
2877ec681f3Smrg#define ENABLE_POINT_RASTER_RULE       (1 << 15)
2887ec681f3Smrg#define OGL_POINT_RASTER_RULE          (1 << 13)
2897ec681f3Smrg#define ENABLE_TEXKILL_3D_4D           (1 << 10)
2907ec681f3Smrg#define TEXKILL_3D                     (0 << 9)
2917ec681f3Smrg#define TEXKILL_4D                     (1 << 9)
2927ec681f3Smrg#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1 << 8)
2937ec681f3Smrg#define ENABLE_TRI_FAN_PROVOKE_VRTX    (1 << 5)
2947ec681f3Smrg#define LINE_STRIP_PROVOKE_VRTX(x)     ((x) << 6)
2957ec681f3Smrg#define TRI_FAN_PROVOKE_VRTX(x)        ((x) << 3)
2964a49301eSmrg
2974a49301eSmrg/* _3DSTATE_SCISSOR_ENABLE, p256 */
2987ec681f3Smrg#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D | (0x1c << 24) | (0x10 << 19))
2997ec681f3Smrg#define ENABLE_SCISSOR_RECT         ((1 << 1) | 1)
3007ec681f3Smrg#define DISABLE_SCISSOR_RECT        (1 << 1)
3014a49301eSmrg
3024a49301eSmrg/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */
3037ec681f3Smrg#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D | (0x1d << 24) | (0x81 << 16) | 1)
3044a49301eSmrg/* Dword 1 */
3057ec681f3Smrg#define SCISSOR_RECT_0_YMIN(x) ((x) << 16)
3067ec681f3Smrg#define SCISSOR_RECT_0_XMIN(x) (x)
3074a49301eSmrg/* Dword 2 */
3087ec681f3Smrg#define SCISSOR_RECT_0_YMAX(x) ((x) << 16)
3097ec681f3Smrg#define SCISSOR_RECT_0_XMAX(x) (x)
3104a49301eSmrg
3114a49301eSmrg/* p189 */
3127ec681f3Smrg#define _3DSTATE_LOAD_STATE_IMMEDIATE_1                                        \
3137ec681f3Smrg   ((0x3 << 29) | (0x1d << 24) | (0x04 << 16))
3147ec681f3Smrg#define I1_LOAD_S(n) (1 << (4 + n))
3157ec681f3Smrg
3167ec681f3Smrg#define S0_VB_OFFSET_MASK         0xffffffc
3177ec681f3Smrg#define S0_AUTO_CACHE_INV_DISABLE (1 << 0)
3187ec681f3Smrg
3197ec681f3Smrg#define S1_VERTEX_WIDTH_SHIFT 24
3207ec681f3Smrg#define S1_VERTEX_WIDTH_MASK  (0x3f << 24)
3217ec681f3Smrg#define S1_VERTEX_PITCH_SHIFT 16
3227ec681f3Smrg#define S1_VERTEX_PITCH_MASK  (0x3f << 16)
3237ec681f3Smrg
3247ec681f3Smrg#define TEXCOORDFMT_2D              0x0
3257ec681f3Smrg#define TEXCOORDFMT_3D              0x1
3267ec681f3Smrg#define TEXCOORDFMT_4D              0x2
3277ec681f3Smrg#define TEXCOORDFMT_1D              0x3
3287ec681f3Smrg#define TEXCOORDFMT_2D_16           0x4
3297ec681f3Smrg#define TEXCOORDFMT_4D_16           0x5
3307ec681f3Smrg#define TEXCOORDFMT_NOT_PRESENT     0xf
3317ec681f3Smrg#define S2_TEXCOORD_FMT0_MASK       0xf
3327ec681f3Smrg#define S2_TEXCOORD_FMT1_SHIFT      4
3337ec681f3Smrg#define S2_TEXCOORD_FMT(unit, type) ((type) << (unit * 4))
3347ec681f3Smrg#define S2_TEXCOORD_NONE            (~0)
3354a49301eSmrg
3364a49301eSmrg/* S3 not interesting */
3374a49301eSmrg
3387ec681f3Smrg#define S4_POINT_WIDTH_SHIFT         23
3397ec681f3Smrg#define S4_POINT_WIDTH_MASK          (0x1ff << 23)
3407ec681f3Smrg#define S4_LINE_WIDTH_SHIFT          19
3417ec681f3Smrg#define S4_LINE_WIDTH_ONE            (0x2 << 19)
3427ec681f3Smrg#define S4_LINE_WIDTH_MASK           (0xf << 19)
3437ec681f3Smrg#define S4_FLATSHADE_ALPHA           (1 << 18)
3447ec681f3Smrg#define S4_FLATSHADE_FOG             (1 << 17)
3457ec681f3Smrg#define S4_FLATSHADE_SPECULAR        (1 << 16)
3467ec681f3Smrg#define S4_FLATSHADE_COLOR           (1 << 15)
3477ec681f3Smrg#define S4_CULLMODE_BOTH             (0 << 13)
3487ec681f3Smrg#define S4_CULLMODE_NONE             (1 << 13)
3497ec681f3Smrg#define S4_CULLMODE_CW               (2 << 13)
3507ec681f3Smrg#define S4_CULLMODE_CCW              (3 << 13)
3517ec681f3Smrg#define S4_CULLMODE_MASK             (3 << 13)
3527ec681f3Smrg#define S4_VFMT_POINT_WIDTH          (1 << 12)
3537ec681f3Smrg#define S4_VFMT_SPEC_FOG             (1 << 11)
3547ec681f3Smrg#define S4_VFMT_COLOR                (1 << 10)
3557ec681f3Smrg#define S4_VFMT_DEPTH_OFFSET         (1 << 9)
3567ec681f3Smrg#define S4_VFMT_XYZ                  (1 << 6)
3577ec681f3Smrg#define S4_VFMT_XYZW                 (2 << 6)
3587ec681f3Smrg#define S4_VFMT_XY                   (3 << 6)
3597ec681f3Smrg#define S4_VFMT_XYW                  (4 << 6)
3607ec681f3Smrg#define S4_VFMT_XYZW_MASK            (7 << 6)
3617ec681f3Smrg#define S4_FORCE_DEFAULT_DIFFUSE     (1 << 5)
3627ec681f3Smrg#define S4_FORCE_DEFAULT_SPECULAR    (1 << 4)
3637ec681f3Smrg#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1 << 3)
3647ec681f3Smrg#define S4_VFMT_FOG_PARAM            (1 << 2)
3657ec681f3Smrg#define S4_SPRITE_POINT_ENABLE       (1 << 1)
3667ec681f3Smrg#define S4_LINE_ANTIALIAS_ENABLE     (1 << 0)
3677ec681f3Smrg
3687ec681f3Smrg#define S4_VFMT_MASK                                                           \
3697ec681f3Smrg   (S4_VFMT_POINT_WIDTH | S4_VFMT_SPEC_FOG | S4_VFMT_COLOR |                   \
3707ec681f3Smrg    S4_VFMT_DEPTH_OFFSET | S4_VFMT_XYZW_MASK | S4_VFMT_FOG_PARAM)
3717ec681f3Smrg
3727ec681f3Smrg#define S5_WRITEDISABLE_ALPHA         (1 << 31)
3737ec681f3Smrg#define S5_WRITEDISABLE_RED           (1 << 30)
3747ec681f3Smrg#define S5_WRITEDISABLE_GREEN         (1 << 29)
3757ec681f3Smrg#define S5_WRITEDISABLE_BLUE          (1 << 28)
3767ec681f3Smrg#define S5_WRITEDISABLE_MASK          (0xf << 28)
3777ec681f3Smrg#define S5_FORCE_DEFAULT_POINT_SIZE   (1 << 27)
3787ec681f3Smrg#define S5_LAST_PIXEL_ENABLE          (1 << 26)
3797ec681f3Smrg#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1 << 25)
3807ec681f3Smrg#define S5_FOG_ENABLE                 (1 << 24)
3817ec681f3Smrg#define S5_STENCIL_REF_SHIFT          16
3827ec681f3Smrg#define S5_STENCIL_REF_MASK           (0xff << 16)
3837ec681f3Smrg#define S5_STENCIL_TEST_FUNC_SHIFT    13
3847ec681f3Smrg#define S5_STENCIL_TEST_FUNC_MASK     (0x7 << 13)
3857ec681f3Smrg#define S5_STENCIL_FAIL_SHIFT         10
3867ec681f3Smrg#define S5_STENCIL_FAIL_MASK          (0x7 << 10)
3877ec681f3Smrg#define S5_STENCIL_PASS_Z_FAIL_SHIFT  7
3887ec681f3Smrg#define S5_STENCIL_PASS_Z_FAIL_MASK   (0x7 << 7)
3897ec681f3Smrg#define S5_STENCIL_PASS_Z_PASS_SHIFT  4
3907ec681f3Smrg#define S5_STENCIL_PASS_Z_PASS_MASK   (0x7 << 4)
3917ec681f3Smrg#define S5_STENCIL_WRITE_ENABLE       (1 << 3)
3927ec681f3Smrg#define S5_STENCIL_TEST_ENABLE        (1 << 2)
3937ec681f3Smrg#define S5_COLOR_DITHER_ENABLE        (1 << 1)
3947ec681f3Smrg#define S5_LOGICOP_ENABLE             (1 << 0)
3957ec681f3Smrg
3967ec681f3Smrg#define S6_ALPHA_TEST_ENABLE         (1 << 31)
3977ec681f3Smrg#define S6_ALPHA_TEST_FUNC_SHIFT     28
3987ec681f3Smrg#define S6_ALPHA_TEST_FUNC_MASK      (0x7 << 28)
3997ec681f3Smrg#define S6_ALPHA_REF_SHIFT           20
4007ec681f3Smrg#define S6_ALPHA_REF_MASK            (0xff << 20)
4017ec681f3Smrg#define S6_DEPTH_TEST_ENABLE         (1 << 19)
4027ec681f3Smrg#define S6_DEPTH_TEST_FUNC_SHIFT     16
4037ec681f3Smrg#define S6_DEPTH_TEST_FUNC_MASK      (0x7 << 16)
4047ec681f3Smrg#define S6_CBUF_BLEND_ENABLE         (1 << 15)
4057ec681f3Smrg#define S6_CBUF_BLEND_FUNC_SHIFT     12
4067ec681f3Smrg#define S6_CBUF_BLEND_FUNC_MASK      (0x7 << 12)
4077ec681f3Smrg#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8
4087ec681f3Smrg#define S6_CBUF_SRC_BLEND_FACT_MASK  (0xf << 8)
4097ec681f3Smrg#define S6_CBUF_DST_BLEND_FACT_SHIFT 4
4107ec681f3Smrg#define S6_CBUF_DST_BLEND_FACT_MASK  (0xf << 4)
4117ec681f3Smrg#define S6_DEPTH_WRITE_ENABLE        (1 << 3)
4127ec681f3Smrg#define S6_COLOR_WRITE_ENABLE        (1 << 2)
4137ec681f3Smrg#define S6_TRISTRIP_PV_SHIFT         0
4147ec681f3Smrg#define S6_TRISTRIP_PV_MASK          (0x3 << 0)
4157ec681f3Smrg
4167ec681f3Smrg#define S7_DEPTH_OFFSET_CONST_MASK ~0
4177ec681f3Smrg
4187ec681f3Smrg#define DST_BLND_FACT(f)  ((f) << S6_CBUF_DST_BLEND_FACT_SHIFT)
4197ec681f3Smrg#define SRC_BLND_FACT(f)  ((f) << S6_CBUF_SRC_BLEND_FACT_SHIFT)
4207ec681f3Smrg#define DST_ABLND_FACT(f) ((f) << IAB_DST_FACTOR_SHIFT)
4217ec681f3Smrg#define SRC_ABLND_FACT(f) ((f) << IAB_SRC_FACTOR_SHIFT)
4224a49301eSmrg
4234a49301eSmrg/* 3DSTATE_MAP_DEINTERLACER_PARAMETERS */
4244a49301eSmrg
4254a49301eSmrg/* 3DSTATE_MAP_PALETTE_LOAD_32, p206 */
4267ec681f3Smrg#define _3DSTATE_MAP_PALETTE_LOAD_32 (CMD_3D | (0x1d << 24) | (0x8f << 16))
4274a49301eSmrg/* subsequent dwords up to length (max 16) are ARGB8888 color values */
4284a49301eSmrg
4294a49301eSmrg/* _3DSTATE_MODES_4, p218 */
4307ec681f3Smrg#define _3DSTATE_MODES_4_CMD            (CMD_3D | (0x0d << 24))
4317ec681f3Smrg#define ENABLE_LOGIC_OP_FUNC            (1 << 23)
4327ec681f3Smrg#define LOGIC_OP_FUNC(x)                ((x) << 18)
4337ec681f3Smrg#define LOGICOP_MASK                    (0xf << 18)
4347ec681f3Smrg#define MODE4_ENABLE_STENCIL_TEST_MASK  ((1 << 17) | (0xff00))
4357ec681f3Smrg#define ENABLE_STENCIL_TEST_MASK        (1 << 17)
4367ec681f3Smrg#define STENCIL_TEST_MASK(x)            (((x)&0xff) << 8)
4377ec681f3Smrg#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1 << 16) | (0x00ff))
4387ec681f3Smrg#define ENABLE_STENCIL_WRITE_MASK       (1 << 16)
4397ec681f3Smrg#define STENCIL_WRITE_MASK(x)           ((x)&0xff)
4404a49301eSmrg
4414a49301eSmrg/* _3DSTATE_MODES_5, p220 */
4427ec681f3Smrg#define _3DSTATE_MODES_5_CMD         (CMD_3D | (0x0c << 24))
4437ec681f3Smrg#define PIPELINE_FLUSH_RENDER_CACHE  (1 << 18)
4447ec681f3Smrg#define PIPELINE_FLUSH_TEXTURE_CACHE (1 << 16)
4454a49301eSmrg
4464a49301eSmrg/* p221 */
4477ec681f3Smrg#define _3DSTATE_PIXEL_SHADER_CONSTANTS (CMD_3D | (0x1d << 24) | (0x6 << 16))
4487ec681f3Smrg#define PS1_REG(n)                      (1 << (n))
4494a49301eSmrg#define PS2_CONST_X(n)                  (n)
4504a49301eSmrg#define PS3_CONST_Y(n)                  (n)
4514a49301eSmrg#define PS4_CONST_Z(n)                  (n)
4524a49301eSmrg#define PS5_CONST_W(n)                  (n)
4534a49301eSmrg
4544a49301eSmrg/* p222 */
4554a49301eSmrg
4564a49301eSmrg#define I915_MAX_TEX_INDIRECT 4
4574a49301eSmrg#define I915_MAX_TEX_INSN     32
4584a49301eSmrg#define I915_MAX_ALU_INSN     64
4594a49301eSmrg#define I915_MAX_DECL_INSN    27
4604a49301eSmrg#define I915_MAX_TEMPORARY    16
4614a49301eSmrg
4624a49301eSmrg/* Each instruction is 3 dwords long, though most don't require all
4634a49301eSmrg * this space.  Maximum of 123 instructions.  Smaller maxes per insn
4644a49301eSmrg * type.
4654a49301eSmrg */
4667ec681f3Smrg#define _3DSTATE_PIXEL_SHADER_PROGRAM (CMD_3D | (0x1d << 24) | (0x5 << 16))
4677ec681f3Smrg
4687ec681f3Smrg#define REG_TYPE_R                                                             \
4697ec681f3Smrg   0 /* temporary regs, no need to                                             \
4707ec681f3Smrg      * dcl, must be written before                                            \
4717ec681f3Smrg      * read -- Preserved between                                              \
4727ec681f3Smrg      * phases.                                                                \
4737ec681f3Smrg      */
4747ec681f3Smrg#define REG_TYPE_T                                                             \
4757ec681f3Smrg   1 /* Interpolated values, must be                                           \
4767ec681f3Smrg      * dcl'ed before use.                                                     \
4777ec681f3Smrg      *                                                                        \
4787ec681f3Smrg      * 0..7: texture coord,                                                   \
4797ec681f3Smrg      * 8: diffuse spec,                                                       \
4807ec681f3Smrg      * 9: specular color,                                                     \
4817ec681f3Smrg      * 10: fog parameter in w.                                                \
4827ec681f3Smrg      */
4837ec681f3Smrg#define REG_TYPE_CONST                                                         \
4847ec681f3Smrg   2                  /* Restriction: only one const                           \
4857ec681f3Smrg                       * can be referenced per                                 \
4867ec681f3Smrg                       * instruction, though it may be                         \
4877ec681f3Smrg                       * selected for multiple inputs.                         \
4887ec681f3Smrg                       * Constants not initialized                             \
4897ec681f3Smrg                       * default to zero.                                      \
4907ec681f3Smrg                       */
4917ec681f3Smrg#define REG_TYPE_S  3 /* sampler */
4927ec681f3Smrg#define REG_TYPE_OC 4 /* output color (rgba) */
4937ec681f3Smrg#define REG_TYPE_OD                                                            \
4947ec681f3Smrg   5                    /* output depth (w), xyz are                           \
4957ec681f3Smrg                         * temporaries.  If not written,                       \
4967ec681f3Smrg                         * interpolated depth is used?                         \
4977ec681f3Smrg                         */
4987ec681f3Smrg#define REG_TYPE_U    6 /* unpreserved temporaries */
4997ec681f3Smrg#define REG_TYPE_MASK 0x7
5007ec681f3Smrg#define REG_NR_MASK   0xf
5014a49301eSmrg
5024a49301eSmrg/* REG_TYPE_T:
5034a49301eSmrg */
5044a49301eSmrg#define T_TEX0     0
5054a49301eSmrg#define T_TEX1     1
5064a49301eSmrg#define T_TEX2     2
5074a49301eSmrg#define T_TEX3     3
5084a49301eSmrg#define T_TEX4     4
5094a49301eSmrg#define T_TEX5     5
5104a49301eSmrg#define T_TEX6     6
5114a49301eSmrg#define T_TEX7     7
5124a49301eSmrg#define T_DIFFUSE  8
5134a49301eSmrg#define T_SPECULAR 9
5147ec681f3Smrg#define T_FOG_W    10 /* interpolated fog is in W coord */
5154a49301eSmrg
5164a49301eSmrg/* Arithmetic instructions */
5174a49301eSmrg
5184a49301eSmrg/* .replicate_swizzle == selection and replication of a particular
5197ec681f3Smrg * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww
5204a49301eSmrg */
5217ec681f3Smrg#define A0_NOP (0x0 << 24) /* no operation */
5227ec681f3Smrg#define A0_ADD (0x1 << 24) /* dst = src0 + src1 */
5237ec681f3Smrg#define A0_MOV (0x2 << 24) /* dst = src0 */
5247ec681f3Smrg#define A0_MUL (0x3 << 24) /* dst = src0 * src1 */
5257ec681f3Smrg#define A0_MAD (0x4 << 24) /* dst = src0 * src1 + src2 */
5267ec681f3Smrg#define A0_DP2ADD                                                              \
5277ec681f3Smrg   (0x5 << 24) /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
5287ec681f3Smrg#define A0_DP3 (0x6 << 24) /* dst.xyzw = src0.xyz dot src1.xyz */
5297ec681f3Smrg#define A0_DP4 (0x7 << 24) /* dst.xyzw = src0.xyzw dot src1.xyzw */
5307ec681f3Smrg#define A0_FRC (0x8 << 24) /* dst = src0 - floor(src0) */
5317ec681f3Smrg#define A0_RCP (0x9 << 24) /* dst.xyzw = 1/(src0.replicate_swizzle) */
5327ec681f3Smrg#define A0_RSQ                                                                 \
5337ec681f3Smrg   (0xa << 24) /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
5347ec681f3Smrg#define A0_EXP             (0xb << 24) /* dst.xyzw = exp2(src0.replicate_swizzle) */
5357ec681f3Smrg#define A0_LOG             (0xc << 24) /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
5367ec681f3Smrg#define A0_CMP             (0xd << 24)  /* dst = (src0 >= 0.0) ? src1 : src2 */
5377ec681f3Smrg#define A0_MIN             (0xe << 24)  /* dst = (src0 < src1) ? src0 : src1 */
5387ec681f3Smrg#define A0_MAX             (0xf << 24)  /* dst = (src0 >= src1) ? src0 : src1 */
5397ec681f3Smrg#define A0_FLR             (0x10 << 24) /* dst = floor(src0) */
5407ec681f3Smrg#define A0_MOD             (0x11 << 24) /* dst = src0 fmod 1.0 */
5417ec681f3Smrg#define A0_TRC             (0x12 << 24) /* dst = int(src0) */
5427ec681f3Smrg#define A0_SGE             (0x13 << 24) /* dst = src0 >= src1 ? 1.0 : 0.0 */
5437ec681f3Smrg#define A0_SLT             (0x14 << 24) /* dst = src0 < src1 ? 1.0 : 0.0 */
5447ec681f3Smrg#define A0_DEST_SATURATE   (1 << 22)
5457ec681f3Smrg#define A0_DEST_TYPE_SHIFT 19
5464a49301eSmrg/* Allow: R, OC, OD, U */
5477ec681f3Smrg#define A0_DEST_NR_SHIFT 14
5484a49301eSmrg/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
5497ec681f3Smrg#define A0_DEST_CHANNEL_X     (1 << 10)
5507ec681f3Smrg#define A0_DEST_CHANNEL_Y     (2 << 10)
5517ec681f3Smrg#define A0_DEST_CHANNEL_Z     (4 << 10)
5527ec681f3Smrg#define A0_DEST_CHANNEL_W     (8 << 10)
5537ec681f3Smrg#define A0_DEST_CHANNEL_ALL   (0xf << 10)
5547ec681f3Smrg#define A0_DEST_CHANNEL_SHIFT 10
5557ec681f3Smrg#define A0_SRC0_TYPE_SHIFT    7
5567ec681f3Smrg#define A0_SRC0_NR_SHIFT      2
5577ec681f3Smrg
5587ec681f3Smrg#define A0_DEST_CHANNEL_XY  (A0_DEST_CHANNEL_X | A0_DEST_CHANNEL_Y)
5597ec681f3Smrg#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY | A0_DEST_CHANNEL_Z)
5607ec681f3Smrg
5617ec681f3Smrg#define SRC_X    0
5627ec681f3Smrg#define SRC_Y    1
5637ec681f3Smrg#define SRC_Z    2
5647ec681f3Smrg#define SRC_W    3
5657ec681f3Smrg#define SRC_ZERO 4
5667ec681f3Smrg#define SRC_ONE  5
5677ec681f3Smrg
5687ec681f3Smrg#define A1_SRC0_CHANNEL_X_NEGATE (1 << 31)
5697ec681f3Smrg#define A1_SRC0_CHANNEL_X_SHIFT  28
5707ec681f3Smrg#define A1_SRC0_CHANNEL_Y_NEGATE (1 << 27)
5717ec681f3Smrg#define A1_SRC0_CHANNEL_Y_SHIFT  24
5727ec681f3Smrg#define A1_SRC0_CHANNEL_Z_NEGATE (1 << 23)
5737ec681f3Smrg#define A1_SRC0_CHANNEL_Z_SHIFT  20
5747ec681f3Smrg#define A1_SRC0_CHANNEL_W_NEGATE (1 << 19)
5757ec681f3Smrg#define A1_SRC0_CHANNEL_W_SHIFT  16
5767ec681f3Smrg#define A1_SRC1_TYPE_SHIFT       13
5777ec681f3Smrg#define A1_SRC1_NR_SHIFT         8
5787ec681f3Smrg#define A1_SRC1_CHANNEL_X_NEGATE (1 << 7)
5797ec681f3Smrg#define A1_SRC1_CHANNEL_X_SHIFT  4
5807ec681f3Smrg#define A1_SRC1_CHANNEL_Y_NEGATE (1 << 3)
5817ec681f3Smrg#define A1_SRC1_CHANNEL_Y_SHIFT  0
5827ec681f3Smrg
5837ec681f3Smrg#define A2_SRC1_CHANNEL_Z_NEGATE (1 << 31)
5847ec681f3Smrg#define A2_SRC1_CHANNEL_Z_SHIFT  28
5857ec681f3Smrg#define A2_SRC1_CHANNEL_W_NEGATE (1 << 27)
5867ec681f3Smrg#define A2_SRC1_CHANNEL_W_SHIFT  24
5877ec681f3Smrg#define A2_SRC2_TYPE_SHIFT       21
5887ec681f3Smrg#define A2_SRC2_NR_SHIFT         16
5897ec681f3Smrg#define A2_SRC2_CHANNEL_X_NEGATE (1 << 15)
5907ec681f3Smrg#define A2_SRC2_CHANNEL_X_SHIFT  12
5917ec681f3Smrg#define A2_SRC2_CHANNEL_Y_NEGATE (1 << 11)
5927ec681f3Smrg#define A2_SRC2_CHANNEL_Y_SHIFT  8
5937ec681f3Smrg#define A2_SRC2_CHANNEL_Z_NEGATE (1 << 7)
5947ec681f3Smrg#define A2_SRC2_CHANNEL_Z_SHIFT  4
5957ec681f3Smrg#define A2_SRC2_CHANNEL_W_NEGATE (1 << 3)
5967ec681f3Smrg#define A2_SRC2_CHANNEL_W_SHIFT  0
5974a49301eSmrg
5984a49301eSmrg/* Texture instructions */
5997ec681f3Smrg#define T0_TEXLD                                                               \
6007ec681f3Smrg   (0x15 << 24) /* Sample texture using predeclared                            \
6017ec681f3Smrg                 * sampler and address, and output                             \
6027ec681f3Smrg                 * filtered texel data to destination                          \
6037ec681f3Smrg                 * register */
6047ec681f3Smrg#define T0_TEXLDP                                                              \
6057ec681f3Smrg   (0x16 << 24) /* Same as texld but performs a                                \
6067ec681f3Smrg                 * perspective divide of the texture                           \
6077ec681f3Smrg                 * coordinate .xyz values by .w before                         \
6087ec681f3Smrg                 * sampling. */
6097ec681f3Smrg#define T0_TEXLDB                                                              \
6107ec681f3Smrg   (0x17 << 24) /* Same as texld but biases the                                \
6117ec681f3Smrg                 * computed LOD by w.  Only S4.6 two's                         \
6127ec681f3Smrg                 * comp is used.  This implies that a                          \
6137ec681f3Smrg                 * float to fixed conversion is                                \
6147ec681f3Smrg                 * done. */
6157ec681f3Smrg#define T0_TEXKILL                                                             \
6167ec681f3Smrg   (0x18 << 24) /* Does not perform a sampling                                 \
6177ec681f3Smrg                 * operation.  Simply kills the pixel                          \
6187ec681f3Smrg                 * if any channel of the address                               \
6197ec681f3Smrg                 * register is < 0.0. */
6207ec681f3Smrg#define T0_DEST_TYPE_SHIFT 19
6214a49301eSmrg/* Allow: R, OC, OD, U */
6224a49301eSmrg/* Note: U (unpreserved) regs do not retain their values between
6237ec681f3Smrg * phases (cannot be used for feedback)
6244a49301eSmrg *
6254a49301eSmrg * Note: oC and OD registers can only be used as the destination of a
6264a49301eSmrg * texture instruction once per phase (this is an implementation
6277ec681f3Smrg * restriction).
6284a49301eSmrg */
6297ec681f3Smrg#define T0_DEST_NR_SHIFT 14
6304a49301eSmrg/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
6317ec681f3Smrg#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */
6327ec681f3Smrg#define T0_SAMPLER_NR_MASK  (0xf << 0)
6334a49301eSmrg
6347ec681f3Smrg#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */
6354a49301eSmrg/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
6367ec681f3Smrg#define T1_ADDRESS_REG_NR_SHIFT 17
6377ec681f3Smrg#define T2_MBZ                  0
6384a49301eSmrg
6394a49301eSmrg/* Declaration instructions */
6407ec681f3Smrg#define D0_DCL                                                                 \
6417ec681f3Smrg   (0x19 << 24) /* Declare a t (interpolated attrib)                           \
6427ec681f3Smrg                 * register or an s (sampler)                                  \
6437ec681f3Smrg                 * register. */
6447ec681f3Smrg#define D0_SAMPLE_TYPE_SHIFT  22
6457ec681f3Smrg#define D0_SAMPLE_TYPE_2D     (0x0 << 22)
6467ec681f3Smrg#define D0_SAMPLE_TYPE_CUBE   (0x1 << 22)
6477ec681f3Smrg#define D0_SAMPLE_TYPE_VOLUME (0x2 << 22)
6487ec681f3Smrg#define D0_SAMPLE_TYPE_MASK   (0x3 << 22)
6497ec681f3Smrg
6507ec681f3Smrg#define D0_TYPE_SHIFT 19
6514a49301eSmrg/* Allow: T, S */
6527ec681f3Smrg#define D0_NR_SHIFT 14
6534a49301eSmrg/* Allow T: 0..10, S: 0..15 */
6547ec681f3Smrg#define D0_CHANNEL_X    (1 << 10)
6557ec681f3Smrg#define D0_CHANNEL_Y    (2 << 10)
6567ec681f3Smrg#define D0_CHANNEL_Z    (4 << 10)
6577ec681f3Smrg#define D0_CHANNEL_W    (8 << 10)
6587ec681f3Smrg#define D0_CHANNEL_ALL  (0xf << 10)
6597ec681f3Smrg#define D0_CHANNEL_NONE (0 << 10)
6604a49301eSmrg
6617ec681f3Smrg#define D0_CHANNEL_XY  (D0_CHANNEL_X | D0_CHANNEL_Y)
6627ec681f3Smrg#define D0_CHANNEL_XYZ (D0_CHANNEL_XY | D0_CHANNEL_Z)
6634a49301eSmrg
6644a49301eSmrg/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
6657ec681f3Smrg * or specular declarations.
6664a49301eSmrg *
6677ec681f3Smrg * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw)
6684a49301eSmrg *
6694a49301eSmrg * Must be zero for S (sampler) dcls
6704a49301eSmrg */
6717ec681f3Smrg#define D1_MBZ 0
6727ec681f3Smrg#define D2_MBZ 0
6734a49301eSmrg
6744a49301eSmrg/* p207 */
6757ec681f3Smrg#define _3DSTATE_MAP_STATE (CMD_3D | (0x1d << 24) | (0x0 << 16))
6767ec681f3Smrg
6777ec681f3Smrg#define MS1_MAPMASK_SHIFT 0
6787ec681f3Smrg#define MS1_MAPMASK_MASK  (0x8fff << 0)
6797ec681f3Smrg
6807ec681f3Smrg#define MS2_UNTRUSTED_SURFACE    (1 << 31)
6817ec681f3Smrg#define MS2_ADDRESS_MASK         0xfffffffc
6827ec681f3Smrg#define MS2_VERTICAL_LINE_STRIDE (1 << 1)
6837ec681f3Smrg#define MS2_VERTICAL_OFFSET      (1 << 1)
6847ec681f3Smrg
6857ec681f3Smrg#define MS3_HEIGHT_SHIFT         21
6867ec681f3Smrg#define MS3_WIDTH_SHIFT          10
6877ec681f3Smrg#define MS3_PALETTE_SELECT       (1 << 9)
6887ec681f3Smrg#define MS3_MAPSURF_FORMAT_SHIFT 7
6897ec681f3Smrg#define MS3_MAPSURF_FORMAT_MASK  (0x7 << 7)
6907ec681f3Smrg#define MAPSURF_8BIT             (1 << 7)
6917ec681f3Smrg#define MAPSURF_16BIT            (2 << 7)
6927ec681f3Smrg#define MAPSURF_32BIT            (3 << 7)
6937ec681f3Smrg#define MAPSURF_422              (5 << 7)
6947ec681f3Smrg#define MAPSURF_COMPRESSED       (6 << 7)
6957ec681f3Smrg#define MAPSURF_4BIT_INDEXED     (7 << 7)
6967ec681f3Smrg#define MS3_MT_FORMAT_MASK       (0x7 << 3)
6977ec681f3Smrg#define MS3_MT_FORMAT_SHIFT      3
6987ec681f3Smrg#define MT_4BIT_P4               (7 << 3) /* SURFACE_4BIT_INDEXED */
6997ec681f3Smrg#define MT_8BIT_I8               (0 << 3) /* SURFACE_8BIT */
7007ec681f3Smrg#define MT_8BIT_L8               (1 << 3)
7017ec681f3Smrg#define MT_8BIT_A4P4             (2 << 3)
7027ec681f3Smrg#define MT_8BIT_P4A4             (3 << 3)
7037ec681f3Smrg#define MT_8BIT_A8               (4 << 3)
7047ec681f3Smrg#define MT_8BIT_MONO8            (5 << 3)
7057ec681f3Smrg#define MT_16BIT_RGB565          (0 << 3) /* SURFACE_16BIT */
7067ec681f3Smrg#define MT_16BIT_ARGB1555        (1 << 3)
7077ec681f3Smrg#define MT_16BIT_ARGB4444        (2 << 3)
7087ec681f3Smrg#define MT_16BIT_AY88            (3 << 3)
7097ec681f3Smrg#define MT_16BIT_88DVDU          (5 << 3)
7107ec681f3Smrg#define MT_16BIT_BUMP_655LDVDU   (6 << 3)
7117ec681f3Smrg#define MT_16BIT_I16             (7 << 3)
7127ec681f3Smrg#define MT_16BIT_L16             (8 << 3)
7137ec681f3Smrg#define MT_16BIT_A16             (9 << 3)
7147ec681f3Smrg#define MT_32BIT_ARGB8888        (0 << 3) /* SURFACE_32BIT */
7157ec681f3Smrg#define MT_32BIT_ABGR8888        (1 << 3)
7167ec681f3Smrg#define MT_32BIT_XRGB8888        (2 << 3)
7177ec681f3Smrg#define MT_32BIT_XBGR8888        (3 << 3)
7187ec681f3Smrg#define MT_32BIT_QWVU8888        (4 << 3)
7197ec681f3Smrg#define MT_32BIT_AXVU8888        (5 << 3)
7207ec681f3Smrg#define MT_32BIT_LXVU8888        (6 << 3)
7217ec681f3Smrg#define MT_32BIT_XLVU8888        (7 << 3)
7227ec681f3Smrg#define MT_32BIT_ARGB2101010     (8 << 3)
7237ec681f3Smrg#define MT_32BIT_ABGR2101010     (9 << 3)
7247ec681f3Smrg#define MT_32BIT_AWVU2101010     (0xA << 3)
7257ec681f3Smrg#define MT_32BIT_GR1616          (0xB << 3)
7267ec681f3Smrg#define MT_32BIT_VU1616          (0xC << 3)
7277ec681f3Smrg#define MT_32BIT_xI824           (0xD << 3)
7287ec681f3Smrg#define MT_32BIT_xL824           (0xE << 3)
7297ec681f3Smrg#define MT_32BIT_xA824           (0xF << 3)
7307ec681f3Smrg#define MT_422_YCRCB_SWAPY       (0 << 3) /* SURFACE_422 */
7317ec681f3Smrg#define MT_422_YCRCB_NORMAL      (1 << 3)
7327ec681f3Smrg#define MT_422_YCRCB_SWAPUV      (2 << 3)
7337ec681f3Smrg#define MT_422_YCRCB_SWAPUVY     (3 << 3)
7347ec681f3Smrg#define MT_COMPRESS_DXT1         (0 << 3) /* SURFACE_COMPRESSED */
7357ec681f3Smrg#define MT_COMPRESS_DXT2_3       (1 << 3)
7367ec681f3Smrg#define MT_COMPRESS_DXT4_5       (2 << 3)
7377ec681f3Smrg#define MT_COMPRESS_FXT1         (3 << 3)
7387ec681f3Smrg#define MT_COMPRESS_DXT1_RGB     (4 << 3)
7397ec681f3Smrg#define MS3_USE_FENCE_REGS       (1 << 2)
7407ec681f3Smrg#define MS3_TILED_SURFACE        (1 << 1)
7417ec681f3Smrg#define MS3_TILE_WALK_Y          (1 << 0)
7427ec681f3Smrg
7437ec681f3Smrg#define MS4_PITCH_SHIFT          21
7447ec681f3Smrg#define MS4_CUBE_FACE_ENA_NEGX   (1 << 20)
7457ec681f3Smrg#define MS4_CUBE_FACE_ENA_POSX   (1 << 19)
7467ec681f3Smrg#define MS4_CUBE_FACE_ENA_NEGY   (1 << 18)
7477ec681f3Smrg#define MS4_CUBE_FACE_ENA_POSY   (1 << 17)
7487ec681f3Smrg#define MS4_CUBE_FACE_ENA_NEGZ   (1 << 16)
7497ec681f3Smrg#define MS4_CUBE_FACE_ENA_POSZ   (1 << 15)
7507ec681f3Smrg#define MS4_CUBE_FACE_ENA_MASK   (0x3f << 15)
7517ec681f3Smrg#define MS4_MAX_LOD_SHIFT        9
7527ec681f3Smrg#define MS4_MAX_LOD_MASK         (0x3f << 9)
7537ec681f3Smrg#define MS4_MIP_LAYOUT_LEGACY    (0 << 8)
7547ec681f3Smrg#define MS4_MIP_LAYOUT_BELOW_LPT (0 << 8)
7557ec681f3Smrg#define MS4_MIP_LAYOUT_RIGHT_LPT (1 << 8)
7567ec681f3Smrg#define MS4_VOLUME_DEPTH_SHIFT   0
7577ec681f3Smrg#define MS4_VOLUME_DEPTH_MASK    (0xff << 0)
7584a49301eSmrg
7594a49301eSmrg/* p244 */
7607ec681f3Smrg#define _3DSTATE_SAMPLER_STATE (CMD_3D | (0x1d << 24) | (0x1 << 16))
7617ec681f3Smrg
7627ec681f3Smrg#define SS1_MAPMASK_SHIFT 0
7637ec681f3Smrg#define SS1_MAPMASK_MASK  (0x8fff << 0)
7647ec681f3Smrg
7657ec681f3Smrg#define SS2_REVERSE_GAMMA_ENABLE    (1 << 31)
7667ec681f3Smrg#define SS2_PACKED_TO_PLANAR_ENABLE (1 << 30)
7677ec681f3Smrg#define SS2_COLORSPACE_CONVERSION   (1 << 29)
7687ec681f3Smrg#define SS2_CHROMAKEY_SHIFT         27
7697ec681f3Smrg#define SS2_BASE_MIP_LEVEL_SHIFT    22
7707ec681f3Smrg#define SS2_BASE_MIP_LEVEL_MASK     (0x1f << 22)
7717ec681f3Smrg#define SS2_MIP_FILTER_SHIFT        20
7727ec681f3Smrg#define SS2_MIP_FILTER_MASK         (0x3 << 20)
7737ec681f3Smrg#define MIPFILTER_NONE              0
7747ec681f3Smrg#define MIPFILTER_NEAREST           1
7757ec681f3Smrg#define MIPFILTER_LINEAR            3
7767ec681f3Smrg#define SS2_MAG_FILTER_SHIFT        17
7777ec681f3Smrg#define SS2_MAG_FILTER_MASK         (0x7 << 17)
7787ec681f3Smrg#define FILTER_NEAREST              0
7797ec681f3Smrg#define FILTER_LINEAR               1
7807ec681f3Smrg#define FILTER_ANISOTROPIC          2
7817ec681f3Smrg#define FILTER_4X4_1                3
7827ec681f3Smrg#define FILTER_4X4_2                4
7837ec681f3Smrg#define FILTER_4X4_FLAT             5
7847ec681f3Smrg#define FILTER_6X5_MONO             6 /* XXX - check */
7857ec681f3Smrg#define SS2_MIN_FILTER_SHIFT        14
7867ec681f3Smrg#define SS2_MIN_FILTER_MASK         (0x7 << 14)
7877ec681f3Smrg#define SS2_LOD_BIAS_SHIFT          5
7887ec681f3Smrg#define SS2_LOD_BIAS_ONE            (0x10 << 5)
7897ec681f3Smrg#define SS2_LOD_BIAS_MASK           (0x1ff << 5)
7904a49301eSmrg/* Shadow requires:
7914a49301eSmrg *  MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
7924a49301eSmrg *  FILTER_4X4_x  MIN and MAG filters
7934a49301eSmrg */
7947ec681f3Smrg#define SS2_SHADOW_ENABLE     (1 << 4)
7957ec681f3Smrg#define SS2_MAX_ANISO_MASK    (1 << 3)
7967ec681f3Smrg#define SS2_MAX_ANISO_2       (0 << 3)
7977ec681f3Smrg#define SS2_MAX_ANISO_4       (1 << 3)
7987ec681f3Smrg#define SS2_SHADOW_FUNC_SHIFT 0
7997ec681f3Smrg#define SS2_SHADOW_FUNC_MASK  (0x7 << 0)
8004a49301eSmrg/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
8014a49301eSmrg
8027ec681f3Smrg#define SS3_MIN_LOD_SHIFT          24
8037ec681f3Smrg#define SS3_MIN_LOD_ONE            (0x10 << 24)
8047ec681f3Smrg#define SS3_MIN_LOD_MASK           (0xff << 24)
8057ec681f3Smrg#define SS3_KILL_PIXEL_ENABLE      (1 << 17)
8067ec681f3Smrg#define SS3_TCX_ADDR_MODE_SHIFT    12
8077ec681f3Smrg#define SS3_TCX_ADDR_MODE_MASK     (0x7 << 12)
8087ec681f3Smrg#define TEXCOORDMODE_WRAP          0
8097ec681f3Smrg#define TEXCOORDMODE_MIRROR        1
8107ec681f3Smrg#define TEXCOORDMODE_CLAMP_EDGE    2
8117ec681f3Smrg#define TEXCOORDMODE_CUBE          3
8127ec681f3Smrg#define TEXCOORDMODE_CLAMP_BORDER  4
8137ec681f3Smrg#define TEXCOORDMODE_MIRROR_ONCE   5
8147ec681f3Smrg#define SS3_TCY_ADDR_MODE_SHIFT    9
8157ec681f3Smrg#define SS3_TCY_ADDR_MODE_MASK     (0x7 << 9)
8167ec681f3Smrg#define SS3_TCZ_ADDR_MODE_SHIFT    6
8177ec681f3Smrg#define SS3_TCZ_ADDR_MODE_MASK     (0x7 << 6)
8187ec681f3Smrg#define SS3_NORMALIZED_COORDS      (1 << 5)
8197ec681f3Smrg#define SS3_TEXTUREMAP_INDEX_SHIFT 1
8207ec681f3Smrg#define SS3_TEXTUREMAP_INDEX_MASK  (0xf << 1)
8217ec681f3Smrg#define SS3_DEINTERLACER_ENABLE    (1 << 0)
8227ec681f3Smrg
8237ec681f3Smrg#define SS4_BORDER_COLOR_MASK (~0)
8244a49301eSmrg
8254a49301eSmrg/* 3DSTATE_SPAN_STIPPLE, p258
8264a49301eSmrg */
8277ec681f3Smrg#define _3DSTATE_STIPPLE ((0x3 << 29) | (0x1d << 24) | (0x83 << 16))
8287ec681f3Smrg#define ST1_ENABLE       (1 << 16)
8297ec681f3Smrg#define ST1_MASK         (0xffff)
8304a49301eSmrg
8317ec681f3Smrg#define _3DSTATE_DEFAULT_Z        ((0x3 << 29) | (0x1d << 24) | (0x98 << 16))
8327ec681f3Smrg#define _3DSTATE_DEFAULT_DIFFUSE  ((0x3 << 29) | (0x1d << 24) | (0x99 << 16))
8337ec681f3Smrg#define _3DSTATE_DEFAULT_SPECULAR ((0x3 << 29) | (0x1d << 24) | (0x9a << 16))
8344a49301eSmrg
8357ec681f3Smrg#define MI_FLUSH                   ((0 << 29) | (4 << 23))
8367ec681f3Smrg#define FLUSH_MAP_CACHE            (1 << 0)
8377ec681f3Smrg#define INHIBIT_FLUSH_RENDER_CACHE (1 << 2)
8383464ebd5Sriastradh#define MI_NOOP                    0
8394a49301eSmrg
8407ec681f3Smrg#define CMD_3D (0x3 << 29)
8417ec681f3Smrg
8427ec681f3Smrg#define _3DPRIMITIVE             ((0x3 << 29) | (0x1f << 24))
8437ec681f3Smrg#define PRIM_INDIRECT            (1 << 23)
8447ec681f3Smrg#define PRIM_INLINE              (0 << 23)
8457ec681f3Smrg#define PRIM_INDIRECT_SEQUENTIAL (0 << 17)
8467ec681f3Smrg#define PRIM_INDIRECT_ELTS       (1 << 17)
8477ec681f3Smrg
8487ec681f3Smrg#define PRIM3D_TRILIST        (0x0 << 18)
8497ec681f3Smrg#define PRIM3D_TRISTRIP       (0x1 << 18)
8507ec681f3Smrg#define PRIM3D_TRISTRIP_RVRSE (0x2 << 18)
8517ec681f3Smrg#define PRIM3D_TRIFAN         (0x3 << 18)
8527ec681f3Smrg#define PRIM3D_POLY           (0x4 << 18)
8537ec681f3Smrg#define PRIM3D_LINELIST       (0x5 << 18)
8547ec681f3Smrg#define PRIM3D_LINESTRIP      (0x6 << 18)
8557ec681f3Smrg#define PRIM3D_RECTLIST       (0x7 << 18)
8567ec681f3Smrg#define PRIM3D_POINTLIST      (0x8 << 18)
8577ec681f3Smrg#define PRIM3D_DIB            (0x9 << 18)
8587ec681f3Smrg#define PRIM3D_MASK           (0x1f << 18)
8597ec681f3Smrg
8607ec681f3Smrg#define I915PACKCOLOR4444(r, g, b, a)                                          \
8617ec681f3Smrg   ((((a)&0xf0) << 8) | (((r)&0xf0) << 4) | ((g)&0xf0) | ((b) >> 4))
8627ec681f3Smrg
8637ec681f3Smrg#define I915PACKCOLOR1555(r, g, b, a)                                          \
8647ec681f3Smrg   ((((r)&0xf8) << 7) | (((g)&0xf8) << 2) | (((b)&0xf8) >> 3) |                \
8654a49301eSmrg    ((a) ? 0x8000 : 0))
8664a49301eSmrg
8677ec681f3Smrg#define I915PACKCOLOR565(r, g, b)                                              \
8687ec681f3Smrg   ((((r)&0xf8) << 8) | (((g)&0xfc) << 3) | (((b)&0xf8) >> 3))
8694a49301eSmrg
8707ec681f3Smrg#define I915PACKCOLOR8888(r, g, b, a) ((a << 24) | (r << 16) | (g << 8) | b)
8714a49301eSmrg
8724a49301eSmrg#define BR00_BITBLT_CLIENT   0x40000000
8734a49301eSmrg#define BR00_OP_COLOR_BLT    0x10000000
8744a49301eSmrg#define BR00_OP_SRC_COPY_BLT 0x10C00000
8754a49301eSmrg#define BR13_SOLID_PATTERN   0x80000000
8764a49301eSmrg
8777ec681f3Smrg#define XY_COLOR_BLT_CMD         ((2 << 29) | (0x50 << 22) | 0x4)
8787ec681f3Smrg#define XY_COLOR_BLT_WRITE_ALPHA (1 << 21)
8797ec681f3Smrg#define XY_COLOR_BLT_WRITE_RGB   (1 << 20)
8807ec681f3Smrg
8817ec681f3Smrg#define XY_SRC_COPY_BLT_CMD         ((2 << 29) | (0x53 << 22) | 6)
8827ec681f3Smrg#define XY_SRC_COPY_BLT_WRITE_ALPHA (1 << 21)
8837ec681f3Smrg#define XY_SRC_COPY_BLT_WRITE_RGB   (1 << 20)
8847ec681f3Smrg
8857ec681f3Smrg#define MI_WAIT_FOR_EVENT        ((0x3 << 23))
8867ec681f3Smrg#define MI_WAIT_FOR_PLANE_B_FLIP (1 << 6)
8877ec681f3Smrg#define MI_WAIT_FOR_PLANE_A_FLIP (1 << 2)
8887ec681f3Smrg
8897ec681f3Smrg#define MI_BATCH_BUFFER       (0x30 << 23)
8907ec681f3Smrg#define MI_BATCH_BUFFER_START (0x31 << 23)
8917ec681f3Smrg#define MI_BATCH_BUFFER_END   (0xa << 23)
8927ec681f3Smrg
8937ec681f3Smrg#define COMPAREFUNC_ALWAYS   0
8947ec681f3Smrg#define COMPAREFUNC_NEVER    0x1
8957ec681f3Smrg#define COMPAREFUNC_LESS     0x2
8967ec681f3Smrg#define COMPAREFUNC_EQUAL    0x3
8977ec681f3Smrg#define COMPAREFUNC_LEQUAL   0x4
8987ec681f3Smrg#define COMPAREFUNC_GREATER  0x5
8997ec681f3Smrg#define COMPAREFUNC_NOTEQUAL 0x6
9007ec681f3Smrg#define COMPAREFUNC_GEQUAL   0x7
9017ec681f3Smrg
9027ec681f3Smrg#define STENCILOP_KEEP    0
9037ec681f3Smrg#define STENCILOP_ZERO    0x1
9047ec681f3Smrg#define STENCILOP_REPLACE 0x2
9057ec681f3Smrg#define STENCILOP_INCRSAT 0x3
9067ec681f3Smrg#define STENCILOP_DECRSAT 0x4
9077ec681f3Smrg#define STENCILOP_INCR    0x5
9087ec681f3Smrg#define STENCILOP_DECR    0x6
9097ec681f3Smrg#define STENCILOP_INVERT  0x7
9107ec681f3Smrg
9117ec681f3Smrg#define LOGICOP_CLEAR     0
9127ec681f3Smrg#define LOGICOP_NOR       0x1
9137ec681f3Smrg#define LOGICOP_AND_INV   0x2
9147ec681f3Smrg#define LOGICOP_COPY_INV  0x3
9157ec681f3Smrg#define LOGICOP_AND_RVRSE 0x4
9167ec681f3Smrg#define LOGICOP_INV       0x5
9177ec681f3Smrg#define LOGICOP_XOR       0x6
9187ec681f3Smrg#define LOGICOP_NAND      0x7
9197ec681f3Smrg#define LOGICOP_AND       0x8
9207ec681f3Smrg#define LOGICOP_EQUIV     0x9
9217ec681f3Smrg#define LOGICOP_NOOP      0xa
9227ec681f3Smrg#define LOGICOP_OR_INV    0xb
9237ec681f3Smrg#define LOGICOP_COPY      0xc
9247ec681f3Smrg#define LOGICOP_OR_RVRSE  0xd
9257ec681f3Smrg#define LOGICOP_OR        0xe
9267ec681f3Smrg#define LOGICOP_SET       0xf
9277ec681f3Smrg
9287ec681f3Smrg#define BLENDFACT_ZERO               0x01
9297ec681f3Smrg#define BLENDFACT_ONE                0x02
9307ec681f3Smrg#define BLENDFACT_SRC_COLR           0x03
9317ec681f3Smrg#define BLENDFACT_INV_SRC_COLR       0x04
9327ec681f3Smrg#define BLENDFACT_SRC_ALPHA          0x05
9337ec681f3Smrg#define BLENDFACT_INV_SRC_ALPHA      0x06
9347ec681f3Smrg#define BLENDFACT_DST_ALPHA          0x07
9357ec681f3Smrg#define BLENDFACT_INV_DST_ALPHA      0x08
9367ec681f3Smrg#define BLENDFACT_DST_COLR           0x09
9377ec681f3Smrg#define BLENDFACT_INV_DST_COLR       0x0a
9387ec681f3Smrg#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
9397ec681f3Smrg#define BLENDFACT_CONST_COLOR        0x0c
9407ec681f3Smrg#define BLENDFACT_INV_CONST_COLOR    0x0d
9417ec681f3Smrg#define BLENDFACT_CONST_ALPHA        0x0e
9427ec681f3Smrg#define BLENDFACT_INV_CONST_ALPHA    0x0f
9437ec681f3Smrg#define BLENDFACT_MASK               0x0f
9447ec681f3Smrg
9457ec681f3Smrg#define PCI_CHIP_I915_G     0x2582
9467ec681f3Smrg#define PCI_CHIP_I915_GM    0x2592
9477ec681f3Smrg#define PCI_CHIP_I945_G     0x2772
9487ec681f3Smrg#define PCI_CHIP_I945_GM    0x27A2
9497ec681f3Smrg#define PCI_CHIP_I945_GME   0x27AE
9507ec681f3Smrg#define PCI_CHIP_G33_G      0x29C2
9517ec681f3Smrg#define PCI_CHIP_Q35_G      0x29B2
9527ec681f3Smrg#define PCI_CHIP_Q33_G      0x29D2
9537ec681f3Smrg#define PCI_CHIP_PINEVIEW_G 0xA001
9547ec681f3Smrg#define PCI_CHIP_PINEVIEW_M 0xA011
9554a49301eSmrg
9564a49301eSmrg#endif
957