18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2005 Nicolai Haehnle et al.
38c2ecf20Sopenharmony_ci * Copyright 2008 Advanced Micro Devices, Inc.
48c2ecf20Sopenharmony_ci * Copyright 2009 Jerome Glisse.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
78c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
88c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
98c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
108c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
118c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
148c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
198c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
208c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
218c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
228c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Authors: Nicolai Haehnle
258c2ecf20Sopenharmony_ci *          Jerome Glisse
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci#ifndef _R300_REG_H_
288c2ecf20Sopenharmony_ci#define _R300_REG_H_
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define R300_SURF_TILE_MACRO (1<<16)
318c2ecf20Sopenharmony_ci#define R300_SURF_TILE_MICRO (2<<16)
328c2ecf20Sopenharmony_ci#define R300_SURF_TILE_BOTH (3<<16)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define R300_MC_INIT_MISC_LAT_TIMER	0x180
368c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_CPR_INIT_LAT_SHIFT	0
378c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_VF_INIT_LAT_SHIFT	4
388c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_DISP0R_INIT_LAT_SHIFT	8
398c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_DISP1R_INIT_LAT_SHIFT	12
408c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_FIXED_INIT_LAT_SHIFT	16
418c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_E2R_INIT_LAT_SHIFT	20
428c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_SAME_PAGE_PRIO_SHIFT	24
438c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_GLOBW_INIT_LAT_SHIFT	28
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define R300_MC_INIT_GFX_LAT_TIMER	0x154
468c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_G3D0R_INIT_LAT_SHIFT	0
478c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_G3D1R_INIT_LAT_SHIFT	4
488c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_G3D2R_INIT_LAT_SHIFT	8
498c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_G3D3R_INIT_LAT_SHIFT	12
508c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_TX0R_INIT_LAT_SHIFT	16
518c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_TX1R_INIT_LAT_SHIFT	20
528c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_GLOBR_INIT_LAT_SHIFT	24
538c2ecf20Sopenharmony_ci#	define R300_MC_MISC__MC_GLOBW_FULL_LAT_SHIFT	28
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci * This file contains registers and constants for the R300. They have been
578c2ecf20Sopenharmony_ci * found mostly by examining command buffers captured using glxtest, as well
588c2ecf20Sopenharmony_ci * as by extrapolating some known registers and constants from the R200.
598c2ecf20Sopenharmony_ci * I am fairly certain that they are correct unless stated otherwise
608c2ecf20Sopenharmony_ci * in comments.
618c2ecf20Sopenharmony_ci */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define R300_SE_VPORT_XSCALE                0x1D98
648c2ecf20Sopenharmony_ci#define R300_SE_VPORT_XOFFSET               0x1D9C
658c2ecf20Sopenharmony_ci#define R300_SE_VPORT_YSCALE                0x1DA0
668c2ecf20Sopenharmony_ci#define R300_SE_VPORT_YOFFSET               0x1DA4
678c2ecf20Sopenharmony_ci#define R300_SE_VPORT_ZSCALE                0x1DA8
688c2ecf20Sopenharmony_ci#define R300_SE_VPORT_ZOFFSET               0x1DAC
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/*
728c2ecf20Sopenharmony_ci * Vertex Array Processing (VAP) Control
738c2ecf20Sopenharmony_ci * Stolen from r200 code from Christoph Brill (It's a guess!)
748c2ecf20Sopenharmony_ci */
758c2ecf20Sopenharmony_ci#define R300_VAP_CNTL	0x2080
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* This register is written directly and also starts data section
788c2ecf20Sopenharmony_ci * in many 3d CP_PACKET3's
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci#define R300_VAP_VF_CNTL	0x2084
818c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_TYPE__SHIFT              0
828c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_NONE                     (0<<0)
838c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_POINTS                   (1<<0)
848c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_LINES                    (2<<0)
858c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_LINE_STRIP               (3<<0)
868c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_TRIANGLES                (4<<0)
878c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN             (5<<0)
888c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP           (6<<0)
898c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_LINE_LOOP                (12<<0)
908c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_QUADS                    (13<<0)
918c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_QUAD_STRIP               (14<<0)
928c2ecf20Sopenharmony_ci#	define  R300_VAP_VF_CNTL__PRIM_POLYGON                  (15<<0)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_WALK__SHIFT              4
958c2ecf20Sopenharmony_ci	/* State based - direct writes to registers trigger vertex
968c2ecf20Sopenharmony_ci           generation */
978c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_WALK_STATE_BASED         (0<<4)
988c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_WALK_INDICES             (1<<4)
998c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST         (2<<4)
1008c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED     (3<<4)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci	/* I don't think I saw these three used.. */
1038c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__COLOR_ORDER__SHIFT            6
1048c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__TCL_OUTPUT_CTL_ENA__SHIFT     9
1058c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__PROG_STREAM_ENA__SHIFT        10
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	/* index size - when not set the indices are assumed to be 16 bit */
1088c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__INDEX_SIZE_32bit              (1<<11)
1098c2ecf20Sopenharmony_ci	/* number of vertices */
1108c2ecf20Sopenharmony_ci#	define	R300_VAP_VF_CNTL__NUM_VERTICES__SHIFT           16
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* BEGIN: Wild guesses */
1138c2ecf20Sopenharmony_ci#define R300_VAP_OUTPUT_VTX_FMT_0           0x2090
1148c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT     (1<<0)
1158c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT   (1<<1)
1168c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT (1<<2)  /* GUESS */
1178c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT (1<<3)  /* GUESS */
1188c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT (1<<4)  /* GUESS */
1198c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT (1<<16) /* GUESS */
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define R300_VAP_OUTPUT_VTX_FMT_1           0x2094
1228c2ecf20Sopenharmony_ci	/* each of the following is 3 bits wide, specifies number
1238c2ecf20Sopenharmony_ci	   of components */
1248c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0
1258c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3
1268c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6
1278c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT 9
1288c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT 12
1298c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15
1308c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
1318c2ecf20Sopenharmony_ci#       define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
1328c2ecf20Sopenharmony_ci/* END: Wild guesses */
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define R300_SE_VTE_CNTL                  0x20b0
1358c2ecf20Sopenharmony_ci#	define     R300_VPORT_X_SCALE_ENA                0x00000001
1368c2ecf20Sopenharmony_ci#	define     R300_VPORT_X_OFFSET_ENA               0x00000002
1378c2ecf20Sopenharmony_ci#	define     R300_VPORT_Y_SCALE_ENA                0x00000004
1388c2ecf20Sopenharmony_ci#	define     R300_VPORT_Y_OFFSET_ENA               0x00000008
1398c2ecf20Sopenharmony_ci#	define     R300_VPORT_Z_SCALE_ENA                0x00000010
1408c2ecf20Sopenharmony_ci#	define     R300_VPORT_Z_OFFSET_ENA               0x00000020
1418c2ecf20Sopenharmony_ci#	define     R300_VTX_XY_FMT                       0x00000100
1428c2ecf20Sopenharmony_ci#	define     R300_VTX_Z_FMT                        0x00000200
1438c2ecf20Sopenharmony_ci#	define     R300_VTX_W0_FMT                       0x00000400
1448c2ecf20Sopenharmony_ci#	define     R300_VTX_W0_NORMALIZE                 0x00000800
1458c2ecf20Sopenharmony_ci#	define     R300_VTX_ST_DENORMALIZED              0x00001000
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* BEGIN: Vertex data assembly - lots of uncertainties */
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* gap */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define R300_VAP_CNTL_STATUS              0x2140
1528c2ecf20Sopenharmony_ci#	define R300_VC_NO_SWAP                  (0 << 0)
1538c2ecf20Sopenharmony_ci#	define R300_VC_16BIT_SWAP               (1 << 0)
1548c2ecf20Sopenharmony_ci#	define R300_VC_32BIT_SWAP               (2 << 0)
1558c2ecf20Sopenharmony_ci#	define R300_VAP_TCL_BYPASS		(1 << 8)
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* gap */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* Where do we get our vertex data?
1608c2ecf20Sopenharmony_ci *
1618c2ecf20Sopenharmony_ci * Vertex data either comes either from immediate mode registers or from
1628c2ecf20Sopenharmony_ci * vertex arrays.
1638c2ecf20Sopenharmony_ci * There appears to be no mixed mode (though we can force the pitch of
1648c2ecf20Sopenharmony_ci * vertex arrays to 0, effectively reusing the same element over and over
1658c2ecf20Sopenharmony_ci * again).
1668c2ecf20Sopenharmony_ci *
1678c2ecf20Sopenharmony_ci * Immediate mode is controlled by the INPUT_CNTL registers. I am not sure
1688c2ecf20Sopenharmony_ci * if these registers influence vertex array processing.
1698c2ecf20Sopenharmony_ci *
1708c2ecf20Sopenharmony_ci * Vertex arrays are controlled via the 3D_LOAD_VBPNTR packet3.
1718c2ecf20Sopenharmony_ci *
1728c2ecf20Sopenharmony_ci * In both cases, vertex attributes are then passed through INPUT_ROUTE.
1738c2ecf20Sopenharmony_ci *
1748c2ecf20Sopenharmony_ci * Beginning with INPUT_ROUTE_0_0 is a list of WORDs that route vertex data
1758c2ecf20Sopenharmony_ci * into the vertex processor's input registers.
1768c2ecf20Sopenharmony_ci * The first word routes the first input, the second word the second, etc.
1778c2ecf20Sopenharmony_ci * The corresponding input is routed into the register with the given index.
1788c2ecf20Sopenharmony_ci * The list is ended by a word with INPUT_ROUTE_END set.
1798c2ecf20Sopenharmony_ci *
1808c2ecf20Sopenharmony_ci * Always set COMPONENTS_4 in immediate mode.
1818c2ecf20Sopenharmony_ci */
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_0            0x2150
1848c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_COMPONENTS_1     (0 << 0)
1858c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_COMPONENTS_2     (1 << 0)
1868c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_COMPONENTS_3     (2 << 0)
1878c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_COMPONENTS_4     (3 << 0)
1888c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_COMPONENTS_RGBA  (4 << 0) /* GUESS */
1898c2ecf20Sopenharmony_ci#       define R300_VAP_INPUT_ROUTE_IDX_SHIFT    8
1908c2ecf20Sopenharmony_ci#       define R300_VAP_INPUT_ROUTE_IDX_MASK     (31 << 8) /* GUESS */
1918c2ecf20Sopenharmony_ci#       define R300_VAP_INPUT_ROUTE_END          (1 << 13)
1928c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_IMMEDIATE_MODE   (0 << 14) /* GUESS */
1938c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_FLOAT            (1 << 14) /* GUESS */
1948c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_UNSIGNED_BYTE    (2 << 14) /* GUESS */
1958c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_FLOAT_COLOR      (3 << 14) /* GUESS */
1968c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_1            0x2154
1978c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_2            0x2158
1988c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_3            0x215C
1998c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_4            0x2160
2008c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_5            0x2164
2018c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_6            0x2168
2028c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_0_7            0x216C
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* gap */
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci/* Notes:
2078c2ecf20Sopenharmony_ci *  - always set up to produce at least two attributes:
2088c2ecf20Sopenharmony_ci *    if vertex program uses only position, fglrx will set normal, too
2098c2ecf20Sopenharmony_ci *  - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal.
2108c2ecf20Sopenharmony_ci */
2118c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_CNTL_0               0x2180
2128c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_0_COLOR           0x00000001
2138c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_CNTL_1               0x2184
2148c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_POS               0x00000001
2158c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_NORMAL            0x00000002
2168c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_COLOR             0x00000004
2178c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC0               0x00000400
2188c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC1               0x00000800
2198c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC2               0x00001000 /* GUESS */
2208c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC3               0x00002000 /* GUESS */
2218c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC4               0x00004000 /* GUESS */
2228c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC5               0x00008000 /* GUESS */
2238c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC6               0x00010000 /* GUESS */
2248c2ecf20Sopenharmony_ci#       define R300_INPUT_CNTL_TC7               0x00020000 /* GUESS */
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/* gap */
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* Words parallel to INPUT_ROUTE_0; All words that are active in INPUT_ROUTE_0
2298c2ecf20Sopenharmony_ci * are set to a swizzling bit pattern, other words are 0.
2308c2ecf20Sopenharmony_ci *
2318c2ecf20Sopenharmony_ci * In immediate mode, the pattern is always set to xyzw. In vertex array
2328c2ecf20Sopenharmony_ci * mode, the swizzling pattern is e.g. used to set zw components in texture
2338c2ecf20Sopenharmony_ci * coordinates with only tweo components.
2348c2ecf20Sopenharmony_ci */
2358c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_0            0x21E0
2368c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_X    0
2378c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_Y    1
2388c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_Z    2
2398c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_W    3
2408c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_ZERO 4
2418c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_ONE  5
2428c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_SELECT_MASK 7
2438c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_X_SHIFT     0
2448c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_Y_SHIFT     3
2458c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_Z_SHIFT     6
2468c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_W_SHIFT     9
2478c2ecf20Sopenharmony_ci#       define R300_INPUT_ROUTE_ENABLE      (15 << 12)
2488c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_1            0x21E4
2498c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_2            0x21E8
2508c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_3            0x21EC
2518c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_4            0x21F0
2528c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_5            0x21F4
2538c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_6            0x21F8
2548c2ecf20Sopenharmony_ci#define R300_VAP_INPUT_ROUTE_1_7            0x21FC
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/* END: Vertex data assembly */
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci/* gap */
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/* BEGIN: Upload vertex program and data */
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci/*
2638c2ecf20Sopenharmony_ci * The programmable vertex shader unit has a memory bank of unknown size
2648c2ecf20Sopenharmony_ci * that can be written to in 16 byte units by writing the address into
2658c2ecf20Sopenharmony_ci * UPLOAD_ADDRESS, followed by data in UPLOAD_DATA (multiples of 4 DWORDs).
2668c2ecf20Sopenharmony_ci *
2678c2ecf20Sopenharmony_ci * Pointers into the memory bank are always in multiples of 16 bytes.
2688c2ecf20Sopenharmony_ci *
2698c2ecf20Sopenharmony_ci * The memory bank is divided into areas with fixed meaning.
2708c2ecf20Sopenharmony_ci *
2718c2ecf20Sopenharmony_ci * Starting at address UPLOAD_PROGRAM: Vertex program instructions.
2728c2ecf20Sopenharmony_ci * Native limits reported by drivers from ATI suggest size 256 (i.e. 4KB),
2738c2ecf20Sopenharmony_ci * whereas the difference between known addresses suggests size 512.
2748c2ecf20Sopenharmony_ci *
2758c2ecf20Sopenharmony_ci * Starting at address UPLOAD_PARAMETERS: Vertex program parameters.
2768c2ecf20Sopenharmony_ci * Native reported limits and the VPI layout suggest size 256, whereas
2778c2ecf20Sopenharmony_ci * difference between known addresses suggests size 512.
2788c2ecf20Sopenharmony_ci *
2798c2ecf20Sopenharmony_ci * At address UPLOAD_POINTSIZE is a vector (0, 0, ps, 0), where ps is the
2808c2ecf20Sopenharmony_ci * floating point pointsize. The exact purpose of this state is uncertain,
2818c2ecf20Sopenharmony_ci * as there is also the R300_RE_POINTSIZE register.
2828c2ecf20Sopenharmony_ci *
2838c2ecf20Sopenharmony_ci * Multiple vertex programs and parameter sets can be loaded at once,
2848c2ecf20Sopenharmony_ci * which could explain the size discrepancy.
2858c2ecf20Sopenharmony_ci */
2868c2ecf20Sopenharmony_ci#define R300_VAP_PVS_UPLOAD_ADDRESS         0x2200
2878c2ecf20Sopenharmony_ci#       define R300_PVS_UPLOAD_PROGRAM           0x00000000
2888c2ecf20Sopenharmony_ci#       define R300_PVS_UPLOAD_PARAMETERS        0x00000200
2898c2ecf20Sopenharmony_ci#       define R300_PVS_UPLOAD_POINTSIZE         0x00000406
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci/* gap */
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci#define R300_VAP_PVS_UPLOAD_DATA            0x2208
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci/* END: Upload vertex program and data */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci/* gap */
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/* I do not know the purpose of this register. However, I do know that
3008c2ecf20Sopenharmony_ci * it is set to 221C_CLEAR for clear operations and to 221C_NORMAL
3018c2ecf20Sopenharmony_ci * for normal rendering.
3028c2ecf20Sopenharmony_ci */
3038c2ecf20Sopenharmony_ci#define R300_VAP_UNKNOWN_221C               0x221C
3048c2ecf20Sopenharmony_ci#       define R300_221C_NORMAL                  0x00000000
3058c2ecf20Sopenharmony_ci#       define R300_221C_CLEAR                   0x0001C000
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/* These seem to be per-pixel and per-vertex X and Y clipping planes. The first
3088c2ecf20Sopenharmony_ci * plane is per-pixel and the second plane is per-vertex.
3098c2ecf20Sopenharmony_ci *
3108c2ecf20Sopenharmony_ci * This was determined by experimentation alone but I believe it is correct.
3118c2ecf20Sopenharmony_ci *
3128c2ecf20Sopenharmony_ci * These registers are called X_QUAD0_1_FL to X_QUAD0_4_FL by glxtest.
3138c2ecf20Sopenharmony_ci */
3148c2ecf20Sopenharmony_ci#define R300_VAP_CLIP_X_0                   0x2220
3158c2ecf20Sopenharmony_ci#define R300_VAP_CLIP_X_1                   0x2224
3168c2ecf20Sopenharmony_ci#define R300_VAP_CLIP_Y_0                   0x2228
3178c2ecf20Sopenharmony_ci#define R300_VAP_CLIP_Y_1                   0x2230
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/* gap */
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/* Sometimes, END_OF_PKT and 0x2284=0 are the only commands sent between
3228c2ecf20Sopenharmony_ci * rendering commands and overwriting vertex program parameters.
3238c2ecf20Sopenharmony_ci * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and
3248c2ecf20Sopenharmony_ci * avoids bugs caused by still running shaders reading bad data from memory.
3258c2ecf20Sopenharmony_ci */
3268c2ecf20Sopenharmony_ci#define R300_VAP_PVS_STATE_FLUSH_REG        0x2284
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci/* Absolutely no clue what this register is about. */
3298c2ecf20Sopenharmony_ci#define R300_VAP_UNKNOWN_2288               0x2288
3308c2ecf20Sopenharmony_ci#       define R300_2288_R300                    0x00750000 /* -- nh */
3318c2ecf20Sopenharmony_ci#       define R300_2288_RV350                   0x0000FFFF /* -- Vladimir */
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci/* gap */
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* Addresses are relative to the vertex program instruction area of the
3368c2ecf20Sopenharmony_ci * memory bank. PROGRAM_END points to the last instruction of the active
3378c2ecf20Sopenharmony_ci * program
3388c2ecf20Sopenharmony_ci *
3398c2ecf20Sopenharmony_ci * The meaning of the two UNKNOWN fields is obviously not known. However,
3408c2ecf20Sopenharmony_ci * experiments so far have shown that both *must* point to an instruction
3418c2ecf20Sopenharmony_ci * inside the vertex program, otherwise the GPU locks up.
3428c2ecf20Sopenharmony_ci *
3438c2ecf20Sopenharmony_ci * fglrx usually sets CNTL_3_UNKNOWN to the end of the program and
3448c2ecf20Sopenharmony_ci * R300_PVS_CNTL_1_POS_END_SHIFT points to instruction where last write to
3458c2ecf20Sopenharmony_ci * position takes place.
3468c2ecf20Sopenharmony_ci *
3478c2ecf20Sopenharmony_ci * Most likely this is used to ignore rest of the program in cases
3488c2ecf20Sopenharmony_ci * where group of verts arent visible. For some reason this "section"
3498c2ecf20Sopenharmony_ci * is sometimes accepted other instruction that have no relationship with
3508c2ecf20Sopenharmony_ci * position calculations.
3518c2ecf20Sopenharmony_ci */
3528c2ecf20Sopenharmony_ci#define R300_VAP_PVS_CNTL_1                 0x22D0
3538c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_1_PROGRAM_START_SHIFT   0
3548c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_1_POS_END_SHIFT         10
3558c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_1_PROGRAM_END_SHIFT     20
3568c2ecf20Sopenharmony_ci/* Addresses are relative the the vertex program parameters area. */
3578c2ecf20Sopenharmony_ci#define R300_VAP_PVS_CNTL_2                 0x22D4
3588c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0
3598c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT  16
3608c2ecf20Sopenharmony_ci#define R300_VAP_PVS_CNTL_3	           0x22D8
3618c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT 10
3628c2ecf20Sopenharmony_ci#       define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci/* The entire range from 0x2300 to 0x2AC inclusive seems to be used for
3658c2ecf20Sopenharmony_ci * immediate vertices
3668c2ecf20Sopenharmony_ci */
3678c2ecf20Sopenharmony_ci#define R300_VAP_VTX_COLOR_R                0x2464
3688c2ecf20Sopenharmony_ci#define R300_VAP_VTX_COLOR_G                0x2468
3698c2ecf20Sopenharmony_ci#define R300_VAP_VTX_COLOR_B                0x246C
3708c2ecf20Sopenharmony_ci#define R300_VAP_VTX_POS_0_X_1              0x2490 /* used for glVertex2*() */
3718c2ecf20Sopenharmony_ci#define R300_VAP_VTX_POS_0_Y_1              0x2494
3728c2ecf20Sopenharmony_ci#define R300_VAP_VTX_COLOR_PKD              0x249C /* RGBA */
3738c2ecf20Sopenharmony_ci#define R300_VAP_VTX_POS_0_X_2              0x24A0 /* used for glVertex3*() */
3748c2ecf20Sopenharmony_ci#define R300_VAP_VTX_POS_0_Y_2              0x24A4
3758c2ecf20Sopenharmony_ci#define R300_VAP_VTX_POS_0_Z_2              0x24A8
3768c2ecf20Sopenharmony_ci/* write 0 to indicate end of packet? */
3778c2ecf20Sopenharmony_ci#define R300_VAP_VTX_END_OF_PKT             0x24AC
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci/* gap */
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/* These are values from r300_reg/r300_reg.h - they are known to be correct
3828c2ecf20Sopenharmony_ci * and are here so we can use one register file instead of several
3838c2ecf20Sopenharmony_ci * - Vladimir
3848c2ecf20Sopenharmony_ci */
3858c2ecf20Sopenharmony_ci#define R300_GB_VAP_RASTER_VTX_FMT_0	0x4000
3868c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT	(1<<0)
3878c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT	(1<<1)
3888c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_1_PRESENT	(1<<2)
3898c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_2_PRESENT	(1<<3)
3908c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_3_PRESENT	(1<<4)
3918c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_SPACE	(0xf<<5)
3928c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_0__PT_SIZE_PRESENT	(0x1<<16)
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci#define R300_GB_VAP_RASTER_VTX_FMT_1	0x4004
3958c2ecf20Sopenharmony_ci	/* each of the following is 3 bits wide, specifies number
3968c2ecf20Sopenharmony_ci	   of components */
3978c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT	0
3988c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT	3
3998c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT	6
4008c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT	9
4018c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT	12
4028c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT	15
4038c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT	18
4048c2ecf20Sopenharmony_ci#	define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT	21
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/* UNK30 seems to enables point to quad transformation on textures
4078c2ecf20Sopenharmony_ci * (or something closely related to that).
4088c2ecf20Sopenharmony_ci * This bit is rather fatal at the time being due to lackings at pixel
4098c2ecf20Sopenharmony_ci * shader side
4108c2ecf20Sopenharmony_ci */
4118c2ecf20Sopenharmony_ci#define R300_GB_ENABLE	0x4008
4128c2ecf20Sopenharmony_ci#	define R300_GB_POINT_STUFF_ENABLE	(1<<0)
4138c2ecf20Sopenharmony_ci#	define R300_GB_LINE_STUFF_ENABLE	(1<<1)
4148c2ecf20Sopenharmony_ci#	define R300_GB_TRIANGLE_STUFF_ENABLE	(1<<2)
4158c2ecf20Sopenharmony_ci#	define R300_GB_STENCIL_AUTO_ENABLE	(1<<4)
4168c2ecf20Sopenharmony_ci#	define R300_GB_UNK31			(1<<31)
4178c2ecf20Sopenharmony_ci	/* each of the following is 2 bits wide */
4188c2ecf20Sopenharmony_ci#define R300_GB_TEX_REPLICATE	0
4198c2ecf20Sopenharmony_ci#define R300_GB_TEX_ST		1
4208c2ecf20Sopenharmony_ci#define R300_GB_TEX_STR		2
4218c2ecf20Sopenharmony_ci#	define R300_GB_TEX0_SOURCE_SHIFT	16
4228c2ecf20Sopenharmony_ci#	define R300_GB_TEX1_SOURCE_SHIFT	18
4238c2ecf20Sopenharmony_ci#	define R300_GB_TEX2_SOURCE_SHIFT	20
4248c2ecf20Sopenharmony_ci#	define R300_GB_TEX3_SOURCE_SHIFT	22
4258c2ecf20Sopenharmony_ci#	define R300_GB_TEX4_SOURCE_SHIFT	24
4268c2ecf20Sopenharmony_ci#	define R300_GB_TEX5_SOURCE_SHIFT	26
4278c2ecf20Sopenharmony_ci#	define R300_GB_TEX6_SOURCE_SHIFT	28
4288c2ecf20Sopenharmony_ci#	define R300_GB_TEX7_SOURCE_SHIFT	30
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* MSPOS - positions for multisample antialiasing (?) */
4318c2ecf20Sopenharmony_ci#define R300_GB_MSPOS0	0x4010
4328c2ecf20Sopenharmony_ci	/* shifts - each of the fields is 4 bits */
4338c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_X0_SHIFT	0
4348c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_Y0_SHIFT	4
4358c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_X1_SHIFT	8
4368c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_Y1_SHIFT	12
4378c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_X2_SHIFT	16
4388c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MS_Y2_SHIFT	20
4398c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MSBD0_Y		24
4408c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS0__MSBD0_X		28
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci#define R300_GB_MSPOS1	0x4014
4438c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_X3_SHIFT	0
4448c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_Y3_SHIFT	4
4458c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_X4_SHIFT	8
4468c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_Y4_SHIFT	12
4478c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_X5_SHIFT	16
4488c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MS_Y5_SHIFT	20
4498c2ecf20Sopenharmony_ci#	define R300_GB_MSPOS1__MSBD1		24
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci#define R300_GB_TILE_CONFIG	0x4018
4538c2ecf20Sopenharmony_ci#	define R300_GB_TILE_ENABLE	(1<<0)
4548c2ecf20Sopenharmony_ci#	define R300_GB_TILE_PIPE_COUNT_RV300	0
4558c2ecf20Sopenharmony_ci#	define R300_GB_TILE_PIPE_COUNT_R300	(3<<1)
4568c2ecf20Sopenharmony_ci#	define R300_GB_TILE_PIPE_COUNT_R420	(7<<1)
4578c2ecf20Sopenharmony_ci#	define R300_GB_TILE_PIPE_COUNT_RV410	(3<<1)
4588c2ecf20Sopenharmony_ci#	define R300_GB_TILE_SIZE_8		0
4598c2ecf20Sopenharmony_ci#	define R300_GB_TILE_SIZE_16		(1<<4)
4608c2ecf20Sopenharmony_ci#	define R300_GB_TILE_SIZE_32		(2<<4)
4618c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_1		(0<<6)
4628c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_2		(1<<6)
4638c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_4		(2<<6)
4648c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_8		(3<<6)
4658c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_16		(4<<6)
4668c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_32		(5<<6)
4678c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_64		(6<<6)
4688c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_SIZE_128		(7<<6)
4698c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_X_SHIFT		9	/* 3 bits wide */
4708c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_Y_SHIFT		12	/* 3 bits wide */
4718c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_TILE_A		0
4728c2ecf20Sopenharmony_ci#	define R300_GB_SUPER_TILE_B		(1<<15)
4738c2ecf20Sopenharmony_ci#	define R300_GB_SUBPIXEL_1_12		0
4748c2ecf20Sopenharmony_ci#	define R300_GB_SUBPIXEL_1_16		(1<<16)
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci#define R300_GB_FIFO_SIZE	0x4024
4778c2ecf20Sopenharmony_ci	/* each of the following is 2 bits wide */
4788c2ecf20Sopenharmony_ci#define R300_GB_FIFO_SIZE_32	0
4798c2ecf20Sopenharmony_ci#define R300_GB_FIFO_SIZE_64	1
4808c2ecf20Sopenharmony_ci#define R300_GB_FIFO_SIZE_128	2
4818c2ecf20Sopenharmony_ci#define R300_GB_FIFO_SIZE_256	3
4828c2ecf20Sopenharmony_ci#	define R300_SC_IFIFO_SIZE_SHIFT	0
4838c2ecf20Sopenharmony_ci#	define R300_SC_TZFIFO_SIZE_SHIFT	2
4848c2ecf20Sopenharmony_ci#	define R300_SC_BFIFO_SIZE_SHIFT	4
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci#	define R300_US_OFIFO_SIZE_SHIFT	12
4878c2ecf20Sopenharmony_ci#	define R300_US_WFIFO_SIZE_SHIFT	14
4888c2ecf20Sopenharmony_ci	/* the following use the same constants as above, but meaning is
4898c2ecf20Sopenharmony_ci	   is times 2 (i.e. instead of 32 words it means 64 */
4908c2ecf20Sopenharmony_ci#	define R300_RS_TFIFO_SIZE_SHIFT	6
4918c2ecf20Sopenharmony_ci#	define R300_RS_CFIFO_SIZE_SHIFT	8
4928c2ecf20Sopenharmony_ci#	define R300_US_RAM_SIZE_SHIFT		10
4938c2ecf20Sopenharmony_ci	/* watermarks, 3 bits wide */
4948c2ecf20Sopenharmony_ci#	define R300_RS_HIGHWATER_COL_SHIFT	16
4958c2ecf20Sopenharmony_ci#	define R300_RS_HIGHWATER_TEX_SHIFT	19
4968c2ecf20Sopenharmony_ci#	define R300_OFIFO_HIGHWATER_SHIFT	22	/* two bits only */
4978c2ecf20Sopenharmony_ci#	define R300_CUBE_FIFO_HIGHWATER_COL_SHIFT	24
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci#define R300_GB_SELECT	0x401C
5008c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_C0A		0
5018c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_C1A		1
5028c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_C2A		2
5038c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_C3A		3
5048c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_1_1_W	4
5058c2ecf20Sopenharmony_ci#	define R300_GB_FOG_SELECT_Z		5
5068c2ecf20Sopenharmony_ci#	define R300_GB_DEPTH_SELECT_Z		0
5078c2ecf20Sopenharmony_ci#	define R300_GB_DEPTH_SELECT_1_1_W	(1<<3)
5088c2ecf20Sopenharmony_ci#	define R300_GB_W_SELECT_1_W		0
5098c2ecf20Sopenharmony_ci#	define R300_GB_W_SELECT_1		(1<<4)
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci#define R300_GB_AA_CONFIG		0x4020
5128c2ecf20Sopenharmony_ci#	define R300_AA_DISABLE			0x00
5138c2ecf20Sopenharmony_ci#	define R300_AA_ENABLE			0x01
5148c2ecf20Sopenharmony_ci#	define R300_AA_SUBSAMPLES_2		0
5158c2ecf20Sopenharmony_ci#	define R300_AA_SUBSAMPLES_3		(1<<1)
5168c2ecf20Sopenharmony_ci#	define R300_AA_SUBSAMPLES_4		(2<<1)
5178c2ecf20Sopenharmony_ci#	define R300_AA_SUBSAMPLES_6		(3<<1)
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci/* gap */
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci/* Zero to flush caches. */
5228c2ecf20Sopenharmony_ci#define R300_TX_INVALTAGS                   0x4100
5238c2ecf20Sopenharmony_ci#define R300_TX_FLUSH                       0x0
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci/* The upper enable bits are guessed, based on fglrx reported limits. */
5268c2ecf20Sopenharmony_ci#define R300_TX_ENABLE                      0x4104
5278c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_0                  (1 << 0)
5288c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_1                  (1 << 1)
5298c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_2                  (1 << 2)
5308c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_3                  (1 << 3)
5318c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_4                  (1 << 4)
5328c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_5                  (1 << 5)
5338c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_6                  (1 << 6)
5348c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_7                  (1 << 7)
5358c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_8                  (1 << 8)
5368c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_9                  (1 << 9)
5378c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_10                 (1 << 10)
5388c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_11                 (1 << 11)
5398c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_12                 (1 << 12)
5408c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_13                 (1 << 13)
5418c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_14                 (1 << 14)
5428c2ecf20Sopenharmony_ci#       define R300_TX_ENABLE_15                 (1 << 15)
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci/* The pointsize is given in multiples of 6. The pointsize can be
5458c2ecf20Sopenharmony_ci * enormous: Clear() renders a single point that fills the entire
5468c2ecf20Sopenharmony_ci * framebuffer.
5478c2ecf20Sopenharmony_ci */
5488c2ecf20Sopenharmony_ci#define R300_RE_POINTSIZE                   0x421C
5498c2ecf20Sopenharmony_ci#       define R300_POINTSIZE_Y_SHIFT            0
5508c2ecf20Sopenharmony_ci#       define R300_POINTSIZE_Y_MASK             (0xFFFF << 0) /* GUESS */
5518c2ecf20Sopenharmony_ci#       define R300_POINTSIZE_X_SHIFT            16
5528c2ecf20Sopenharmony_ci#       define R300_POINTSIZE_X_MASK             (0xFFFF << 16) /* GUESS */
5538c2ecf20Sopenharmony_ci#       define R300_POINTSIZE_MAX             (R300_POINTSIZE_Y_MASK / 6)
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ci/* The line width is given in multiples of 6.
5568c2ecf20Sopenharmony_ci * In default mode lines are classified as vertical lines.
5578c2ecf20Sopenharmony_ci * HO: horizontal
5588c2ecf20Sopenharmony_ci * VE: vertical or horizontal
5598c2ecf20Sopenharmony_ci * HO & VE: no classification
5608c2ecf20Sopenharmony_ci */
5618c2ecf20Sopenharmony_ci#define R300_RE_LINE_CNT                      0x4234
5628c2ecf20Sopenharmony_ci#       define R300_LINESIZE_SHIFT            0
5638c2ecf20Sopenharmony_ci#       define R300_LINESIZE_MASK             (0xFFFF << 0) /* GUESS */
5648c2ecf20Sopenharmony_ci#       define R300_LINESIZE_MAX             (R300_LINESIZE_MASK / 6)
5658c2ecf20Sopenharmony_ci#       define R300_LINE_CNT_HO               (1 << 16)
5668c2ecf20Sopenharmony_ci#       define R300_LINE_CNT_VE               (1 << 17)
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci/* Some sort of scale or clamp value for texcoordless textures. */
5698c2ecf20Sopenharmony_ci#define R300_RE_UNK4238                       0x4238
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci/* Something shade related */
5728c2ecf20Sopenharmony_ci#define R300_RE_SHADE                         0x4274
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci#define R300_RE_SHADE_MODEL                   0x4278
5758c2ecf20Sopenharmony_ci#	define R300_RE_SHADE_MODEL_SMOOTH     0x3aaaa
5768c2ecf20Sopenharmony_ci#	define R300_RE_SHADE_MODEL_FLAT       0x39595
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci/* Dangerous */
5798c2ecf20Sopenharmony_ci#define R300_RE_POLYGON_MODE                  0x4288
5808c2ecf20Sopenharmony_ci#	define R300_PM_ENABLED                (1 << 0)
5818c2ecf20Sopenharmony_ci#	define R300_PM_FRONT_POINT            (0 << 0)
5828c2ecf20Sopenharmony_ci#	define R300_PM_BACK_POINT             (0 << 0)
5838c2ecf20Sopenharmony_ci#	define R300_PM_FRONT_LINE             (1 << 4)
5848c2ecf20Sopenharmony_ci#	define R300_PM_FRONT_FILL             (1 << 5)
5858c2ecf20Sopenharmony_ci#	define R300_PM_BACK_LINE              (1 << 7)
5868c2ecf20Sopenharmony_ci#	define R300_PM_BACK_FILL              (1 << 8)
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci/* Fog parameters */
5898c2ecf20Sopenharmony_ci#define R300_RE_FOG_SCALE                     0x4294
5908c2ecf20Sopenharmony_ci#define R300_RE_FOG_START                     0x4298
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci/* Not sure why there are duplicate of factor and constant values.
5938c2ecf20Sopenharmony_ci * My best guess so far is that there are separate zbiases for test and write.
5948c2ecf20Sopenharmony_ci * Ordering might be wrong.
5958c2ecf20Sopenharmony_ci * Some of the tests indicate that fgl has a fallback implementation of zbias
5968c2ecf20Sopenharmony_ci * via pixel shaders.
5978c2ecf20Sopenharmony_ci */
5988c2ecf20Sopenharmony_ci#define R300_RE_ZBIAS_CNTL                    0x42A0 /* GUESS */
5998c2ecf20Sopenharmony_ci#define R300_RE_ZBIAS_T_FACTOR                0x42A4
6008c2ecf20Sopenharmony_ci#define R300_RE_ZBIAS_T_CONSTANT              0x42A8
6018c2ecf20Sopenharmony_ci#define R300_RE_ZBIAS_W_FACTOR                0x42AC
6028c2ecf20Sopenharmony_ci#define R300_RE_ZBIAS_W_CONSTANT              0x42B0
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/* This register needs to be set to (1<<1) for RV350 to correctly
6058c2ecf20Sopenharmony_ci * perform depth test (see --vb-triangles in r300_demo)
6068c2ecf20Sopenharmony_ci * Don't know about other chips. - Vladimir
6078c2ecf20Sopenharmony_ci * This is set to 3 when GL_POLYGON_OFFSET_FILL is on.
6088c2ecf20Sopenharmony_ci * My guess is that there are two bits for each zbias primitive
6098c2ecf20Sopenharmony_ci * (FILL, LINE, POINT).
6108c2ecf20Sopenharmony_ci *  One to enable depth test and one for depth write.
6118c2ecf20Sopenharmony_ci * Yet this doesn't explain why depth writes work ...
6128c2ecf20Sopenharmony_ci */
6138c2ecf20Sopenharmony_ci#define R300_RE_OCCLUSION_CNTL		    0x42B4
6148c2ecf20Sopenharmony_ci#	define R300_OCCLUSION_ON		(1<<1)
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci#define R300_RE_CULL_CNTL                   0x42B8
6178c2ecf20Sopenharmony_ci#       define R300_CULL_FRONT                   (1 << 0)
6188c2ecf20Sopenharmony_ci#       define R300_CULL_BACK                    (1 << 1)
6198c2ecf20Sopenharmony_ci#       define R300_FRONT_FACE_CCW               (0 << 2)
6208c2ecf20Sopenharmony_ci#       define R300_FRONT_FACE_CW                (1 << 2)
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_ci/* BEGIN: Rasterization / Interpolators - many guesses */
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci/* 0_UNKNOWN_18 has always been set except for clear operations.
6268c2ecf20Sopenharmony_ci * TC_CNT is the number of incoming texture coordinate sets (i.e. it depends
6278c2ecf20Sopenharmony_ci * on the vertex program, *not* the fragment program)
6288c2ecf20Sopenharmony_ci */
6298c2ecf20Sopenharmony_ci#define R300_RS_CNTL_0                      0x4300
6308c2ecf20Sopenharmony_ci#       define R300_RS_CNTL_TC_CNT_SHIFT         2
6318c2ecf20Sopenharmony_ci#       define R300_RS_CNTL_TC_CNT_MASK          (7 << 2)
6328c2ecf20Sopenharmony_ci	/* number of color interpolators used */
6338c2ecf20Sopenharmony_ci#	define R300_RS_CNTL_CI_CNT_SHIFT         7
6348c2ecf20Sopenharmony_ci#       define R300_RS_CNTL_0_UNKNOWN_18         (1 << 18)
6358c2ecf20Sopenharmony_ci	/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n
6368c2ecf20Sopenharmony_ci	   register. */
6378c2ecf20Sopenharmony_ci#define R300_RS_CNTL_1                      0x4304
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci/* gap */
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci/* Only used for texture coordinates.
6428c2ecf20Sopenharmony_ci * Use the source field to route texture coordinate input from the
6438c2ecf20Sopenharmony_ci * vertex program to the desired interpolator. Note that the source
6448c2ecf20Sopenharmony_ci * field is relative to the outputs the vertex program *actually*
6458c2ecf20Sopenharmony_ci * writes. If a vertex program only writes texcoord[1], this will
6468c2ecf20Sopenharmony_ci * be source index 0.
6478c2ecf20Sopenharmony_ci * Set INTERP_USED on all interpolators that produce data used by
6488c2ecf20Sopenharmony_ci * the fragment program. INTERP_USED looks like a swizzling mask,
6498c2ecf20Sopenharmony_ci * but I haven't seen it used that way.
6508c2ecf20Sopenharmony_ci *
6518c2ecf20Sopenharmony_ci * Note: The _UNKNOWN constants are always set in their respective
6528c2ecf20Sopenharmony_ci * register. I don't know if this is necessary.
6538c2ecf20Sopenharmony_ci */
6548c2ecf20Sopenharmony_ci#define R300_RS_INTERP_0                    0x4310
6558c2ecf20Sopenharmony_ci#define R300_RS_INTERP_1                    0x4314
6568c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_1_UNKNOWN          0x40
6578c2ecf20Sopenharmony_ci#define R300_RS_INTERP_2                    0x4318
6588c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_2_UNKNOWN          0x80
6598c2ecf20Sopenharmony_ci#define R300_RS_INTERP_3                    0x431C
6608c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_3_UNKNOWN          0xC0
6618c2ecf20Sopenharmony_ci#define R300_RS_INTERP_4                    0x4320
6628c2ecf20Sopenharmony_ci#define R300_RS_INTERP_5                    0x4324
6638c2ecf20Sopenharmony_ci#define R300_RS_INTERP_6                    0x4328
6648c2ecf20Sopenharmony_ci#define R300_RS_INTERP_7                    0x432C
6658c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_SRC_SHIFT          2
6668c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_SRC_MASK           (7 << 2)
6678c2ecf20Sopenharmony_ci#       define R300_RS_INTERP_USED               0x00D10000
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci/* These DWORDs control how vertex data is routed into fragment program
6708c2ecf20Sopenharmony_ci * registers, after interpolators.
6718c2ecf20Sopenharmony_ci */
6728c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_0                     0x4330
6738c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_1                     0x4334
6748c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_2                     0x4338
6758c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_3                     0x433C /* GUESS */
6768c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_4                     0x4340 /* GUESS */
6778c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_5                     0x4344 /* GUESS */
6788c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_6                     0x4348 /* GUESS */
6798c2ecf20Sopenharmony_ci#define R300_RS_ROUTE_7                     0x434C /* GUESS */
6808c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_0     0
6818c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_1     1
6828c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_2     2
6838c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_3     3
6848c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_4     4
6858c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_5     5 /* GUESS */
6868c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_6     6 /* GUESS */
6878c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_SOURCE_INTERP_7     7 /* GUESS */
6888c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_ENABLE              (1 << 3) /* GUESS */
6898c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_DEST_SHIFT          6
6908c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_DEST_MASK           (31 << 6) /* GUESS */
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_ci/* Special handling for color: When the fragment program uses color,
6938c2ecf20Sopenharmony_ci * the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the
6948c2ecf20Sopenharmony_ci * color register index.
6958c2ecf20Sopenharmony_ci *
6968c2ecf20Sopenharmony_ci * Apperently you may set the R300_RS_ROUTE_0_COLOR bit, but not provide any
6978c2ecf20Sopenharmony_ci * R300_RS_ROUTE_0_COLOR_DEST value; this setup is used for clearing the state.
6988c2ecf20Sopenharmony_ci * See r300_ioctl.c:r300EmitClearState. I'm not sure if this setup is strictly
6998c2ecf20Sopenharmony_ci * correct or not. - Oliver.
7008c2ecf20Sopenharmony_ci */
7018c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_0_COLOR             (1 << 14)
7028c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_0_COLOR_DEST_SHIFT  17
7038c2ecf20Sopenharmony_ci#       define R300_RS_ROUTE_0_COLOR_DEST_MASK   (31 << 17) /* GUESS */
7048c2ecf20Sopenharmony_ci/* As above, but for secondary color */
7058c2ecf20Sopenharmony_ci#		define R300_RS_ROUTE_1_COLOR1            (1 << 14)
7068c2ecf20Sopenharmony_ci#		define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17
7078c2ecf20Sopenharmony_ci#		define R300_RS_ROUTE_1_COLOR1_DEST_MASK  (31 << 17)
7088c2ecf20Sopenharmony_ci#		define R300_RS_ROUTE_1_UNKNOWN11         (1 << 11)
7098c2ecf20Sopenharmony_ci/* END: Rasterization / Interpolators - many guesses */
7108c2ecf20Sopenharmony_ci
7118c2ecf20Sopenharmony_ci/* Hierarchical Z Enable */
7128c2ecf20Sopenharmony_ci#define R300_SC_HYPERZ                   0x43a4
7138c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_DISABLE     (0 << 0)
7148c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ENABLE      (1 << 0)
7158c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_MIN         (0 << 1)
7168c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_MAX         (1 << 1)
7178c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_256     (0 << 2)
7188c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_128     (1 << 2)
7198c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_64      (2 << 2)
7208c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_32      (3 << 2)
7218c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_16      (4 << 2)
7228c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_8       (5 << 2)
7238c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_4       (6 << 2)
7248c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_ADJ_2       (7 << 2)
7258c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_HZ_Z0MIN_NO (0 << 5)
7268c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_HZ_Z0MIN    (1 << 5)
7278c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_HZ_Z0MAX_NO (0 << 6)
7288c2ecf20Sopenharmony_ci#	define R300_SC_HYPERZ_HZ_Z0MAX    (1 << 6)
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci#define R300_SC_EDGERULE                 0x43a8
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci/* BEGIN: Scissors and cliprects */
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci/* There are four clipping rectangles. Their corner coordinates are inclusive.
7358c2ecf20Sopenharmony_ci * Every pixel is assigned a number from 0 and 15 by setting bits 0-3 depending
7368c2ecf20Sopenharmony_ci * on whether the pixel is inside cliprects 0-3, respectively. For example,
7378c2ecf20Sopenharmony_ci * if a pixel is inside cliprects 0 and 1, but outside 2 and 3, it is assigned
7388c2ecf20Sopenharmony_ci * the number 3 (binary 0011).
7398c2ecf20Sopenharmony_ci * Iff the bit corresponding to the pixel's number in RE_CLIPRECT_CNTL is set,
7408c2ecf20Sopenharmony_ci * the pixel is rasterized.
7418c2ecf20Sopenharmony_ci *
7428c2ecf20Sopenharmony_ci * In addition to this, there is a scissors rectangle. Only pixels inside the
7438c2ecf20Sopenharmony_ci * scissors rectangle are drawn. (coordinates are inclusive)
7448c2ecf20Sopenharmony_ci *
7458c2ecf20Sopenharmony_ci * For some reason, the top-left corner of the framebuffer is at (1440, 1440)
7468c2ecf20Sopenharmony_ci * for the purpose of clipping and scissors.
7478c2ecf20Sopenharmony_ci */
7488c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_TL_0               0x43B0
7498c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_BR_0               0x43B4
7508c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_TL_1               0x43B8
7518c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_BR_1               0x43BC
7528c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_TL_2               0x43C0
7538c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_BR_2               0x43C4
7548c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_TL_3               0x43C8
7558c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_BR_3               0x43CC
7568c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_OFFSET              1440
7578c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_MASK                0x1FFF
7588c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_X_SHIFT             0
7598c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_X_MASK              (0x1FFF << 0)
7608c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_Y_SHIFT             13
7618c2ecf20Sopenharmony_ci#       define R300_CLIPRECT_Y_MASK              (0x1FFF << 13)
7628c2ecf20Sopenharmony_ci#define R300_RE_CLIPRECT_CNTL               0x43D0
7638c2ecf20Sopenharmony_ci#       define R300_CLIP_OUT                     (1 << 0)
7648c2ecf20Sopenharmony_ci#       define R300_CLIP_0                       (1 << 1)
7658c2ecf20Sopenharmony_ci#       define R300_CLIP_1                       (1 << 2)
7668c2ecf20Sopenharmony_ci#       define R300_CLIP_10                      (1 << 3)
7678c2ecf20Sopenharmony_ci#       define R300_CLIP_2                       (1 << 4)
7688c2ecf20Sopenharmony_ci#       define R300_CLIP_20                      (1 << 5)
7698c2ecf20Sopenharmony_ci#       define R300_CLIP_21                      (1 << 6)
7708c2ecf20Sopenharmony_ci#       define R300_CLIP_210                     (1 << 7)
7718c2ecf20Sopenharmony_ci#       define R300_CLIP_3                       (1 << 8)
7728c2ecf20Sopenharmony_ci#       define R300_CLIP_30                      (1 << 9)
7738c2ecf20Sopenharmony_ci#       define R300_CLIP_31                      (1 << 10)
7748c2ecf20Sopenharmony_ci#       define R300_CLIP_310                     (1 << 11)
7758c2ecf20Sopenharmony_ci#       define R300_CLIP_32                      (1 << 12)
7768c2ecf20Sopenharmony_ci#       define R300_CLIP_320                     (1 << 13)
7778c2ecf20Sopenharmony_ci#       define R300_CLIP_321                     (1 << 14)
7788c2ecf20Sopenharmony_ci#       define R300_CLIP_3210                    (1 << 15)
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_ci/* gap */
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_ci#define R300_RE_SCISSORS_TL                 0x43E0
7838c2ecf20Sopenharmony_ci#define R300_RE_SCISSORS_BR                 0x43E4
7848c2ecf20Sopenharmony_ci#       define R300_SCISSORS_OFFSET              1440
7858c2ecf20Sopenharmony_ci#       define R300_SCISSORS_X_SHIFT             0
7868c2ecf20Sopenharmony_ci#       define R300_SCISSORS_X_MASK              (0x1FFF << 0)
7878c2ecf20Sopenharmony_ci#       define R300_SCISSORS_Y_SHIFT             13
7888c2ecf20Sopenharmony_ci#       define R300_SCISSORS_Y_MASK              (0x1FFF << 13)
7898c2ecf20Sopenharmony_ci/* END: Scissors and cliprects */
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci/* BEGIN: Texture specification */
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ci/*
7948c2ecf20Sopenharmony_ci * The texture specification dwords are grouped by meaning and not by texture
7958c2ecf20Sopenharmony_ci * unit. This means that e.g. the offset for texture image unit N is found in
7968c2ecf20Sopenharmony_ci * register TX_OFFSET_0 + (4*N)
7978c2ecf20Sopenharmony_ci */
7988c2ecf20Sopenharmony_ci#define R300_TX_FILTER_0                    0x4400
7998c2ecf20Sopenharmony_ci#       define R300_TX_REPEAT                    0
8008c2ecf20Sopenharmony_ci#       define R300_TX_MIRRORED                  1
8018c2ecf20Sopenharmony_ci#       define R300_TX_CLAMP                     4
8028c2ecf20Sopenharmony_ci#       define R300_TX_CLAMP_TO_EDGE             2
8038c2ecf20Sopenharmony_ci#       define R300_TX_CLAMP_TO_BORDER           6
8048c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_S_SHIFT              0
8058c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_S_MASK               (7 << 0)
8068c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_T_SHIFT              3
8078c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_T_MASK               (7 << 3)
8088c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_Q_SHIFT              6
8098c2ecf20Sopenharmony_ci#       define R300_TX_WRAP_Q_MASK               (7 << 6)
8108c2ecf20Sopenharmony_ci#       define R300_TX_MAG_FILTER_NEAREST        (1 << 9)
8118c2ecf20Sopenharmony_ci#       define R300_TX_MAG_FILTER_LINEAR         (2 << 9)
8128c2ecf20Sopenharmony_ci#       define R300_TX_MAG_FILTER_MASK           (3 << 9)
8138c2ecf20Sopenharmony_ci#       define R300_TX_MIN_FILTER_NEAREST        (1 << 11)
8148c2ecf20Sopenharmony_ci#       define R300_TX_MIN_FILTER_LINEAR         (2 << 11)
8158c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST       (5  <<  11)
8168c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR        (9  <<  11)
8178c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST        (6  <<  11)
8188c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR         (10 <<  11)
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ci/* NOTE: NEAREST doesn't seem to exist.
8218c2ecf20Sopenharmony_ci * Im not seting MAG_FILTER_MASK and (3 << 11) on for all
8228c2ecf20Sopenharmony_ci * anisotropy modes because that would void selected mag filter
8238c2ecf20Sopenharmony_ci */
8248c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_ANISO_NEAREST             (0 << 13)
8258c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_ANISO_LINEAR              (0 << 13)
8268c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (1 << 13)
8278c2ecf20Sopenharmony_ci#	define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR  (2 << 13)
8288c2ecf20Sopenharmony_ci#       define R300_TX_MIN_FILTER_MASK   ( (15 << 11) | (3 << 13) )
8298c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_1_TO_1  (0 << 21)
8308c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_2_TO_1  (2 << 21)
8318c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_4_TO_1  (4 << 21)
8328c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_8_TO_1  (6 << 21)
8338c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_16_TO_1 (8 << 21)
8348c2ecf20Sopenharmony_ci#	define R300_TX_MAX_ANISO_MASK    (14 << 21)
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_ci#define R300_TX_FILTER1_0                      0x4440
8378c2ecf20Sopenharmony_ci#	define R300_CHROMA_KEY_MODE_DISABLE    0
8388c2ecf20Sopenharmony_ci#	define R300_CHROMA_KEY_FORCE	       1
8398c2ecf20Sopenharmony_ci#	define R300_CHROMA_KEY_BLEND           2
8408c2ecf20Sopenharmony_ci#	define R300_MC_ROUND_NORMAL            (0<<2)
8418c2ecf20Sopenharmony_ci#	define R300_MC_ROUND_MPEG4             (1<<2)
8428c2ecf20Sopenharmony_ci#	define R300_LOD_BIAS_MASK	    0x1fff
8438c2ecf20Sopenharmony_ci#	define R300_EDGE_ANISO_EDGE_DIAG       (0<<13)
8448c2ecf20Sopenharmony_ci#	define R300_EDGE_ANISO_EDGE_ONLY       (1<<13)
8458c2ecf20Sopenharmony_ci#	define R300_MC_COORD_TRUNCATE_DISABLE  (0<<14)
8468c2ecf20Sopenharmony_ci#	define R300_MC_COORD_TRUNCATE_MPEG     (1<<14)
8478c2ecf20Sopenharmony_ci#	define R300_TX_TRI_PERF_0_8            (0<<15)
8488c2ecf20Sopenharmony_ci#	define R300_TX_TRI_PERF_1_8            (1<<15)
8498c2ecf20Sopenharmony_ci#	define R300_TX_TRI_PERF_1_4            (2<<15)
8508c2ecf20Sopenharmony_ci#	define R300_TX_TRI_PERF_3_8            (3<<15)
8518c2ecf20Sopenharmony_ci#	define R300_ANISO_THRESHOLD_MASK       (7<<17)
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci#define R300_TX_SIZE_0                      0x4480
8548c2ecf20Sopenharmony_ci#       define R300_TX_WIDTHMASK_SHIFT           0
8558c2ecf20Sopenharmony_ci#       define R300_TX_WIDTHMASK_MASK            (2047 << 0)
8568c2ecf20Sopenharmony_ci#       define R300_TX_HEIGHTMASK_SHIFT          11
8578c2ecf20Sopenharmony_ci#       define R300_TX_HEIGHTMASK_MASK           (2047 << 11)
8588c2ecf20Sopenharmony_ci#       define R300_TX_UNK23                     (1 << 23)
8598c2ecf20Sopenharmony_ci#       define R300_TX_MAX_MIP_LEVEL_SHIFT       26
8608c2ecf20Sopenharmony_ci#       define R300_TX_MAX_MIP_LEVEL_MASK        (0xf << 26)
8618c2ecf20Sopenharmony_ci#       define R300_TX_SIZE_PROJECTED            (1<<30)
8628c2ecf20Sopenharmony_ci#       define R300_TX_SIZE_TXPITCH_EN           (1<<31)
8638c2ecf20Sopenharmony_ci#define R300_TX_FORMAT_0                    0x44C0
8648c2ecf20Sopenharmony_ci	/* The interpretation of the format word by Wladimir van der Laan */
8658c2ecf20Sopenharmony_ci	/* The X, Y, Z and W refer to the layout of the components.
8668c2ecf20Sopenharmony_ci	   They are given meanings as R, G, B and Alpha by the swizzle
8678c2ecf20Sopenharmony_ci	   specification */
8688c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_X8		    0x0
8698c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_X16		    0x1
8708c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Y4X4		    0x2
8718c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Y8X8		    0x3
8728c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Y16X16		    0x4
8738c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z3Y3X2		    0x5
8748c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z5Y6X5		    0x6
8758c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z6Y5X5		    0x7
8768c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z11Y11X10		    0x8
8778c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z10Y11X11		    0x9
8788c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W4Z4Y4X4		    0xA
8798c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W1Z5Y5X5		    0xB
8808c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W8Z8Y8X8		    0xC
8818c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W2Z10Y10X10	    0xD
8828c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W16Z16Y16X16	    0xE
8838c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_DXT1		    0xF
8848c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_DXT3		    0x10
8858c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_DXT5		    0x11
8868c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_D3DMFT_CxV8U8	    0x12     /* no swizzle */
8878c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_A8R8G8B8		    0x13     /* no swizzle */
8888c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_B8G8_B8G8		    0x14     /* no swizzle */
8898c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_G8R8_G8B8		    0x15     /* no swizzle */
8908c2ecf20Sopenharmony_ci	/* 0x16 - some 16 bit green format.. ?? */
8918c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_UNK25		   (1 << 25) /* no swizzle */
8928c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CUBIC_MAP		   (1 << 26)
8938c2ecf20Sopenharmony_ci
8948c2ecf20Sopenharmony_ci	/* gap */
8958c2ecf20Sopenharmony_ci	/* Floating point formats */
8968c2ecf20Sopenharmony_ci	/* Note - hardware supports both 16 and 32 bit floating point */
8978c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_I16		    0x18
8988c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_I16A16		    0x19
8998c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_R16G16B16A16	    0x1A
9008c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_I32		    0x1B
9018c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_I32A32		    0x1C
9028c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_FL_R32G32B32A32	    0x1D
9038c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ATI2N		    0x1F
9048c2ecf20Sopenharmony_ci	/* alpha modes, convenience mostly */
9058c2ecf20Sopenharmony_ci	/* if you have alpha, pick constant appropriate to the
9068c2ecf20Sopenharmony_ci	   number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */
9078c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ALPHA_1CH		    0x000
9088c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ALPHA_2CH		    0x200
9098c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ALPHA_4CH		    0x600
9108c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ALPHA_NONE	    0xA00
9118c2ecf20Sopenharmony_ci	/* Swizzling */
9128c2ecf20Sopenharmony_ci	/* constants */
9138c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_X		0
9148c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Y		1
9158c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_Z		2
9168c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_W		3
9178c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ZERO	4
9188c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_ONE	5
9198c2ecf20Sopenharmony_ci	/* 2.0*Z, everything above 1.0 is set to 0.0 */
9208c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CUT_Z	6
9218c2ecf20Sopenharmony_ci	/* 2.0*W, everything above 1.0 is set to 0.0 */
9228c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CUT_W	7
9238c2ecf20Sopenharmony_ci
9248c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_B_SHIFT	18
9258c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_G_SHIFT	15
9268c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_R_SHIFT	12
9278c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_A_SHIFT	9
9288c2ecf20Sopenharmony_ci	/* Convenience macro to take care of layout and swizzling */
9298c2ecf20Sopenharmony_ci#	define R300_EASY_TX_FORMAT(B, G, R, A, FMT)	(		\
9308c2ecf20Sopenharmony_ci		((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT)		\
9318c2ecf20Sopenharmony_ci		| ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT)	\
9328c2ecf20Sopenharmony_ci		| ((R300_TX_FORMAT_##R)<<R300_TX_FORMAT_R_SHIFT)	\
9338c2ecf20Sopenharmony_ci		| ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT)	\
9348c2ecf20Sopenharmony_ci		| (R300_TX_FORMAT_##FMT)				\
9358c2ecf20Sopenharmony_ci		)
9368c2ecf20Sopenharmony_ci	/* These can be ORed with result of R300_EASY_TX_FORMAT()
9378c2ecf20Sopenharmony_ci	   We don't really know what they do. Take values from a
9388c2ecf20Sopenharmony_ci           constant color ? */
9398c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CONST_X		(1<<5)
9408c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CONST_Y		(2<<5)
9418c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CONST_Z		(4<<5)
9428c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_CONST_W		(8<<5)
9438c2ecf20Sopenharmony_ci
9448c2ecf20Sopenharmony_ci#	define R300_TX_FORMAT_YUV_MODE		0x00800000
9458c2ecf20Sopenharmony_ci
9468c2ecf20Sopenharmony_ci#define R300_TX_PITCH_0			    0x4500 /* obvious missing in gap */
9478c2ecf20Sopenharmony_ci#define R300_TX_OFFSET_0                    0x4540
9488c2ecf20Sopenharmony_ci	/* BEGIN: Guess from R200 */
9498c2ecf20Sopenharmony_ci#       define R300_TXO_ENDIAN_NO_SWAP           (0 << 0)
9508c2ecf20Sopenharmony_ci#       define R300_TXO_ENDIAN_BYTE_SWAP         (1 << 0)
9518c2ecf20Sopenharmony_ci#       define R300_TXO_ENDIAN_WORD_SWAP         (2 << 0)
9528c2ecf20Sopenharmony_ci#       define R300_TXO_ENDIAN_HALFDW_SWAP       (3 << 0)
9538c2ecf20Sopenharmony_ci#       define R300_TXO_MACRO_TILE               (1 << 2)
9548c2ecf20Sopenharmony_ci#       define R300_TXO_MICRO_TILE               (1 << 3)
9558c2ecf20Sopenharmony_ci#       define R300_TXO_MICRO_TILE_SQUARE        (2 << 3)
9568c2ecf20Sopenharmony_ci#       define R300_TXO_OFFSET_MASK              0xffffffe0
9578c2ecf20Sopenharmony_ci#       define R300_TXO_OFFSET_SHIFT             5
9588c2ecf20Sopenharmony_ci	/* END: Guess from R200 */
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci/* 32 bit chroma key */
9618c2ecf20Sopenharmony_ci#define R300_TX_CHROMA_KEY_0                      0x4580
9628c2ecf20Sopenharmony_ci/* ff00ff00 == { 0, 1.0, 0, 1.0 } */
9638c2ecf20Sopenharmony_ci#define R300_TX_BORDER_COLOR_0              0x45C0
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_ci/* END: Texture specification */
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci/* BEGIN: Fragment program instruction set */
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ci/* Fragment programs are written directly into register space.
9708c2ecf20Sopenharmony_ci * There are separate instruction streams for texture instructions and ALU
9718c2ecf20Sopenharmony_ci * instructions.
9728c2ecf20Sopenharmony_ci * In order to synchronize these streams, the program is divided into up
9738c2ecf20Sopenharmony_ci * to 4 nodes. Each node begins with a number of TEX operations, followed
9748c2ecf20Sopenharmony_ci * by a number of ALU operations.
9758c2ecf20Sopenharmony_ci * The first node can have zero TEX ops, all subsequent nodes must have at
9768c2ecf20Sopenharmony_ci * least
9778c2ecf20Sopenharmony_ci * one TEX ops.
9788c2ecf20Sopenharmony_ci * All nodes must have at least one ALU op.
9798c2ecf20Sopenharmony_ci *
9808c2ecf20Sopenharmony_ci * The index of the last node is stored in PFS_CNTL_0: A value of 0 means
9818c2ecf20Sopenharmony_ci * 1 node, a value of 3 means 4 nodes.
9828c2ecf20Sopenharmony_ci * The total amount of instructions is defined in PFS_CNTL_2. The offsets are
9838c2ecf20Sopenharmony_ci * offsets into the respective instruction streams, while *_END points to the
9848c2ecf20Sopenharmony_ci * last instruction relative to this offset.
9858c2ecf20Sopenharmony_ci */
9868c2ecf20Sopenharmony_ci#define R300_PFS_CNTL_0                     0x4600
9878c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_LAST_NODES_SHIFT    0
9888c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_LAST_NODES_MASK     (3 << 0)
9898c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_FIRST_NODE_HAS_TEX  (1 << 3)
9908c2ecf20Sopenharmony_ci#define R300_PFS_CNTL_1                     0x4604
9918c2ecf20Sopenharmony_ci/* There is an unshifted value here which has so far always been equal to the
9928c2ecf20Sopenharmony_ci * index of the highest used temporary register.
9938c2ecf20Sopenharmony_ci */
9948c2ecf20Sopenharmony_ci#define R300_PFS_CNTL_2                     0x4608
9958c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_ALU_OFFSET_SHIFT    0
9968c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_ALU_OFFSET_MASK     (63 << 0)
9978c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_ALU_END_SHIFT       6
9988c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_ALU_END_MASK        (63 << 6)
9998c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_TEX_OFFSET_SHIFT    12
10008c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_TEX_OFFSET_MASK     (31 << 12) /* GUESS */
10018c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_TEX_END_SHIFT       18
10028c2ecf20Sopenharmony_ci#       define R300_PFS_CNTL_TEX_END_MASK        (31 << 18) /* GUESS */
10038c2ecf20Sopenharmony_ci
10048c2ecf20Sopenharmony_ci/* gap */
10058c2ecf20Sopenharmony_ci
10068c2ecf20Sopenharmony_ci/* Nodes are stored backwards. The last active node is always stored in
10078c2ecf20Sopenharmony_ci * PFS_NODE_3.
10088c2ecf20Sopenharmony_ci * Example: In a 2-node program, NODE_0 and NODE_1 are set to 0. The
10098c2ecf20Sopenharmony_ci * first node is stored in NODE_2, the second node is stored in NODE_3.
10108c2ecf20Sopenharmony_ci *
10118c2ecf20Sopenharmony_ci * Offsets are relative to the master offset from PFS_CNTL_2.
10128c2ecf20Sopenharmony_ci */
10138c2ecf20Sopenharmony_ci#define R300_PFS_NODE_0                     0x4610
10148c2ecf20Sopenharmony_ci#define R300_PFS_NODE_1                     0x4614
10158c2ecf20Sopenharmony_ci#define R300_PFS_NODE_2                     0x4618
10168c2ecf20Sopenharmony_ci#define R300_PFS_NODE_3                     0x461C
10178c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_ALU_OFFSET_SHIFT    0
10188c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_ALU_OFFSET_MASK     (63 << 0)
10198c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_ALU_END_SHIFT       6
10208c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_ALU_END_MASK        (63 << 6)
10218c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_TEX_OFFSET_SHIFT    12
10228c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_TEX_OFFSET_MASK     (31 << 12)
10238c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_TEX_END_SHIFT       17
10248c2ecf20Sopenharmony_ci#       define R300_PFS_NODE_TEX_END_MASK        (31 << 17)
10258c2ecf20Sopenharmony_ci#		define R300_PFS_NODE_OUTPUT_COLOR        (1 << 22)
10268c2ecf20Sopenharmony_ci#		define R300_PFS_NODE_OUTPUT_DEPTH        (1 << 23)
10278c2ecf20Sopenharmony_ci
10288c2ecf20Sopenharmony_ci/* TEX
10298c2ecf20Sopenharmony_ci * As far as I can tell, texture instructions cannot write into output
10308c2ecf20Sopenharmony_ci * registers directly. A subsequent ALU instruction is always necessary,
10318c2ecf20Sopenharmony_ci * even if it's just MAD o0, r0, 1, 0
10328c2ecf20Sopenharmony_ci */
10338c2ecf20Sopenharmony_ci#define R300_PFS_TEXI_0                     0x4620
10348c2ecf20Sopenharmony_ci#	define R300_FPITX_SRC_SHIFT              0
10358c2ecf20Sopenharmony_ci#	define R300_FPITX_SRC_MASK               (31 << 0)
10368c2ecf20Sopenharmony_ci	/* GUESS */
10378c2ecf20Sopenharmony_ci#	define R300_FPITX_SRC_CONST              (1 << 5)
10388c2ecf20Sopenharmony_ci#	define R300_FPITX_DST_SHIFT              6
10398c2ecf20Sopenharmony_ci#	define R300_FPITX_DST_MASK               (31 << 6)
10408c2ecf20Sopenharmony_ci#	define R300_FPITX_IMAGE_SHIFT            11
10418c2ecf20Sopenharmony_ci	/* GUESS based on layout and native limits */
10428c2ecf20Sopenharmony_ci#       define R300_FPITX_IMAGE_MASK             (15 << 11)
10438c2ecf20Sopenharmony_ci/* Unsure if these are opcodes, or some kind of bitfield, but this is how
10448c2ecf20Sopenharmony_ci * they were set when I checked
10458c2ecf20Sopenharmony_ci */
10468c2ecf20Sopenharmony_ci#	define R300_FPITX_OPCODE_SHIFT		15
10478c2ecf20Sopenharmony_ci#		define R300_FPITX_OP_TEX	1
10488c2ecf20Sopenharmony_ci#		define R300_FPITX_OP_KIL	2
10498c2ecf20Sopenharmony_ci#		define R300_FPITX_OP_TXP	3
10508c2ecf20Sopenharmony_ci#		define R300_FPITX_OP_TXB	4
10518c2ecf20Sopenharmony_ci#	define R300_FPITX_OPCODE_MASK           (7 << 15)
10528c2ecf20Sopenharmony_ci
10538c2ecf20Sopenharmony_ci/* ALU
10548c2ecf20Sopenharmony_ci * The ALU instructions register blocks are enumerated according to the order
10558c2ecf20Sopenharmony_ci * in which fglrx. I assume there is space for 64 instructions, since
10568c2ecf20Sopenharmony_ci * each block has space for a maximum of 64 DWORDs, and this matches reported
10578c2ecf20Sopenharmony_ci * native limits.
10588c2ecf20Sopenharmony_ci *
10598c2ecf20Sopenharmony_ci * The basic functional block seems to be one MAD for each color and alpha,
10608c2ecf20Sopenharmony_ci * and an adder that adds all components after the MUL.
10618c2ecf20Sopenharmony_ci *  - ADD, MUL, MAD etc.: use MAD with appropriate neutral operands
10628c2ecf20Sopenharmony_ci *  - DP4: Use OUTC_DP4, OUTA_DP4
10638c2ecf20Sopenharmony_ci *  - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands
10648c2ecf20Sopenharmony_ci *  - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands
10658c2ecf20Sopenharmony_ci *  - CMPH: If ARG2 > 0.5, return ARG0, else return ARG1
10668c2ecf20Sopenharmony_ci *  - CMP: If ARG2 < 0, return ARG1, else return ARG0
10678c2ecf20Sopenharmony_ci *  - FLR: use FRC+MAD
10688c2ecf20Sopenharmony_ci *  - XPD: use MAD+MAD
10698c2ecf20Sopenharmony_ci *  - SGE, SLT: use MAD+CMP
10708c2ecf20Sopenharmony_ci *  - RSQ: use ABS modifier for argument
10718c2ecf20Sopenharmony_ci *  - Use OUTC_REPL_ALPHA to write results of an alpha-only operation
10728c2ecf20Sopenharmony_ci *    (e.g. RCP) into color register
10738c2ecf20Sopenharmony_ci *  - apparently, there's no quick DST operation
10748c2ecf20Sopenharmony_ci *  - fglrx set FPI2_UNKNOWN_31 on a "MAD fragment.color, tmp0, tmp1, tmp2"
10758c2ecf20Sopenharmony_ci *  - fglrx set FPI2_UNKNOWN_31 on a "MAX r2, r1, c0"
10768c2ecf20Sopenharmony_ci *  - fglrx once set FPI0_UNKNOWN_31 on a "FRC r1, r1"
10778c2ecf20Sopenharmony_ci *
10788c2ecf20Sopenharmony_ci * Operand selection
10798c2ecf20Sopenharmony_ci * First stage selects three sources from the available registers and
10808c2ecf20Sopenharmony_ci * constant parameters. This is defined in INSTR1 (color) and INSTR3 (alpha).
10818c2ecf20Sopenharmony_ci * fglrx sorts the three source fields: Registers before constants,
10828c2ecf20Sopenharmony_ci * lower indices before higher indices; I do not know whether this is
10838c2ecf20Sopenharmony_ci * necessary.
10848c2ecf20Sopenharmony_ci *
10858c2ecf20Sopenharmony_ci * fglrx fills unused sources with "read constant 0"
10868c2ecf20Sopenharmony_ci * According to specs, you cannot select more than two different constants.
10878c2ecf20Sopenharmony_ci *
10888c2ecf20Sopenharmony_ci * Second stage selects the operands from the sources. This is defined in
10898c2ecf20Sopenharmony_ci * INSTR0 (color) and INSTR2 (alpha). You can also select the special constants
10908c2ecf20Sopenharmony_ci * zero and one.
10918c2ecf20Sopenharmony_ci * Swizzling and negation happens in this stage, as well.
10928c2ecf20Sopenharmony_ci *
10938c2ecf20Sopenharmony_ci * Important: Color and alpha seem to be mostly separate, i.e. their sources
10948c2ecf20Sopenharmony_ci * selection appears to be fully independent (the register storage is probably
10958c2ecf20Sopenharmony_ci * physically split into a color and an alpha section).
10968c2ecf20Sopenharmony_ci * However (because of the apparent physical split), there is some interaction
10978c2ecf20Sopenharmony_ci * WRT swizzling. If, for example, you want to load an R component into an
10988c2ecf20Sopenharmony_ci * Alpha operand, this R component is taken from a *color* source, not from
10998c2ecf20Sopenharmony_ci * an alpha source. The corresponding register doesn't even have to appear in
11008c2ecf20Sopenharmony_ci * the alpha sources list. (I hope this all makes sense to you)
11018c2ecf20Sopenharmony_ci *
11028c2ecf20Sopenharmony_ci * Destination selection
11038c2ecf20Sopenharmony_ci * The destination register index is in FPI1 (color) and FPI3 (alpha)
11048c2ecf20Sopenharmony_ci * together with enable bits.
11058c2ecf20Sopenharmony_ci * There are separate enable bits for writing into temporary registers
11068c2ecf20Sopenharmony_ci * (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_*
11078c2ecf20Sopenharmony_ci * /DSTA_OUTPUT). You can write to both at once, or not write at all (the
11088c2ecf20Sopenharmony_ci * same index must be used for both).
11098c2ecf20Sopenharmony_ci *
11108c2ecf20Sopenharmony_ci * Note: There is a special form for LRP
11118c2ecf20Sopenharmony_ci *  - Argument order is the same as in ARB_fragment_program.
11128c2ecf20Sopenharmony_ci *  - Operation is MAD
11138c2ecf20Sopenharmony_ci *  - ARG1 is set to ARGC_SRC1C_LRP/ARGC_SRC1A_LRP
11148c2ecf20Sopenharmony_ci *  - Set FPI0/FPI2_SPECIAL_LRP
11158c2ecf20Sopenharmony_ci * Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD
11168c2ecf20Sopenharmony_ci */
11178c2ecf20Sopenharmony_ci#define R300_PFS_INSTR1_0                   0x46C0
11188c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC0C_SHIFT             0
11198c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC0C_MASK              (31 << 0)
11208c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC0C_CONST             (1 << 5)
11218c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC1C_SHIFT             6
11228c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC1C_MASK              (31 << 6)
11238c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC1C_CONST             (1 << 11)
11248c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC2C_SHIFT             12
11258c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC2C_MASK              (31 << 12)
11268c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC2C_CONST             (1 << 17)
11278c2ecf20Sopenharmony_ci#       define R300_FPI1_SRC_MASK                0x0003ffff
11288c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_SHIFT              18
11298c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_MASK               (31 << 18)
11308c2ecf20Sopenharmony_ci#		define R300_FPI1_DSTC_REG_MASK_SHIFT     23
11318c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_REG_X              (1 << 23)
11328c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_REG_Y              (1 << 24)
11338c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_REG_Z              (1 << 25)
11348c2ecf20Sopenharmony_ci#		define R300_FPI1_DSTC_OUTPUT_MASK_SHIFT  26
11358c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_OUTPUT_X           (1 << 26)
11368c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_OUTPUT_Y           (1 << 27)
11378c2ecf20Sopenharmony_ci#       define R300_FPI1_DSTC_OUTPUT_Z           (1 << 28)
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci#define R300_PFS_INSTR3_0                   0x47C0
11408c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC0A_SHIFT             0
11418c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC0A_MASK              (31 << 0)
11428c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC0A_CONST             (1 << 5)
11438c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC1A_SHIFT             6
11448c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC1A_MASK              (31 << 6)
11458c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC1A_CONST             (1 << 11)
11468c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC2A_SHIFT             12
11478c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC2A_MASK              (31 << 12)
11488c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC2A_CONST             (1 << 17)
11498c2ecf20Sopenharmony_ci#       define R300_FPI3_SRC_MASK                0x0003ffff
11508c2ecf20Sopenharmony_ci#       define R300_FPI3_DSTA_SHIFT              18
11518c2ecf20Sopenharmony_ci#       define R300_FPI3_DSTA_MASK               (31 << 18)
11528c2ecf20Sopenharmony_ci#       define R300_FPI3_DSTA_REG                (1 << 23)
11538c2ecf20Sopenharmony_ci#       define R300_FPI3_DSTA_OUTPUT             (1 << 24)
11548c2ecf20Sopenharmony_ci#		define R300_FPI3_DSTA_DEPTH              (1 << 27)
11558c2ecf20Sopenharmony_ci
11568c2ecf20Sopenharmony_ci#define R300_PFS_INSTR0_0                   0x48C0
11578c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_XYZ          0
11588c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_XXX          1
11598c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_YYY          2
11608c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_ZZZ          3
11618c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_XYZ          4
11628c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_XXX          5
11638c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_YYY          6
11648c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_ZZZ          7
11658c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_XYZ          8
11668c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_XXX          9
11678c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_YYY          10
11688c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_ZZZ          11
11698c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0A              12
11708c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1A              13
11718c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2A              14
11728c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_LRP          15
11738c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_ZERO               20
11748c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_ONE                21
11758c2ecf20Sopenharmony_ci	/* GUESS */
11768c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_HALF               22
11778c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_YZX          23
11788c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_YZX          24
11798c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_YZX          25
11808c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0C_ZXY          26
11818c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1C_ZXY          27
11828c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2C_ZXY          28
11838c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC0CA_WZY         29
11848c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC1CA_WZY         30
11858c2ecf20Sopenharmony_ci#       define R300_FPI0_ARGC_SRC2CA_WZY         31
11868c2ecf20Sopenharmony_ci
11878c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG0C_SHIFT             0
11888c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG0C_MASK              (31 << 0)
11898c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG0C_NEG               (1 << 5)
11908c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG0C_ABS               (1 << 6)
11918c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG1C_SHIFT             7
11928c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG1C_MASK              (31 << 7)
11938c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG1C_NEG               (1 << 12)
11948c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG1C_ABS               (1 << 13)
11958c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG2C_SHIFT             14
11968c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG2C_MASK              (31 << 14)
11978c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG2C_NEG               (1 << 19)
11988c2ecf20Sopenharmony_ci#       define R300_FPI0_ARG2C_ABS               (1 << 20)
11998c2ecf20Sopenharmony_ci#       define R300_FPI0_SPECIAL_LRP             (1 << 21)
12008c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_MAD                (0 << 23)
12018c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_DP3                (1 << 23)
12028c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_DP4                (2 << 23)
12038c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_MIN                (4 << 23)
12048c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_MAX                (5 << 23)
12058c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_CMPH               (7 << 23)
12068c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_CMP                (8 << 23)
12078c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_FRC                (9 << 23)
12088c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_REPL_ALPHA         (10 << 23)
12098c2ecf20Sopenharmony_ci#       define R300_FPI0_OUTC_SAT                (1 << 30)
12108c2ecf20Sopenharmony_ci#       define R300_FPI0_INSERT_NOP              (1 << 31)
12118c2ecf20Sopenharmony_ci
12128c2ecf20Sopenharmony_ci#define R300_PFS_INSTR2_0                   0x49C0
12138c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC0C_X            0
12148c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC0C_Y            1
12158c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC0C_Z            2
12168c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC1C_X            3
12178c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC1C_Y            4
12188c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC1C_Z            5
12198c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC2C_X            6
12208c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC2C_Y            7
12218c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC2C_Z            8
12228c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC0A              9
12238c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC1A              10
12248c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC2A              11
12258c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_SRC1A_LRP          15
12268c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_ZERO               16
12278c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_ONE                17
12288c2ecf20Sopenharmony_ci	/* GUESS */
12298c2ecf20Sopenharmony_ci#       define R300_FPI2_ARGA_HALF               18
12308c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG0A_SHIFT             0
12318c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG0A_MASK              (31 << 0)
12328c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG0A_NEG               (1 << 5)
12338c2ecf20Sopenharmony_ci	/* GUESS */
12348c2ecf20Sopenharmony_ci#	define R300_FPI2_ARG0A_ABS		 (1 << 6)
12358c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG1A_SHIFT             7
12368c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG1A_MASK              (31 << 7)
12378c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG1A_NEG               (1 << 12)
12388c2ecf20Sopenharmony_ci	/* GUESS */
12398c2ecf20Sopenharmony_ci#	define R300_FPI2_ARG1A_ABS		 (1 << 13)
12408c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG2A_SHIFT             14
12418c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG2A_MASK              (31 << 14)
12428c2ecf20Sopenharmony_ci#       define R300_FPI2_ARG2A_NEG               (1 << 19)
12438c2ecf20Sopenharmony_ci	/* GUESS */
12448c2ecf20Sopenharmony_ci#	define R300_FPI2_ARG2A_ABS		 (1 << 20)
12458c2ecf20Sopenharmony_ci#       define R300_FPI2_SPECIAL_LRP             (1 << 21)
12468c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_MAD                (0 << 23)
12478c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_DP4                (1 << 23)
12488c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_MIN                (2 << 23)
12498c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_MAX                (3 << 23)
12508c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_CMP                (6 << 23)
12518c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_FRC                (7 << 23)
12528c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_EX2                (8 << 23)
12538c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_LG2                (9 << 23)
12548c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_RCP                (10 << 23)
12558c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_RSQ                (11 << 23)
12568c2ecf20Sopenharmony_ci#       define R300_FPI2_OUTA_SAT                (1 << 30)
12578c2ecf20Sopenharmony_ci#       define R300_FPI2_UNKNOWN_31              (1 << 31)
12588c2ecf20Sopenharmony_ci/* END: Fragment program instruction set */
12598c2ecf20Sopenharmony_ci
12608c2ecf20Sopenharmony_ci/* Fog state and color */
12618c2ecf20Sopenharmony_ci#define R300_RE_FOG_STATE                   0x4BC0
12628c2ecf20Sopenharmony_ci#       define R300_FOG_ENABLE                   (1 << 0)
12638c2ecf20Sopenharmony_ci#	define R300_FOG_MODE_LINEAR              (0 << 1)
12648c2ecf20Sopenharmony_ci#	define R300_FOG_MODE_EXP                 (1 << 1)
12658c2ecf20Sopenharmony_ci#	define R300_FOG_MODE_EXP2                (2 << 1)
12668c2ecf20Sopenharmony_ci#	define R300_FOG_MODE_MASK                (3 << 1)
12678c2ecf20Sopenharmony_ci#define R300_FOG_COLOR_R                    0x4BC8
12688c2ecf20Sopenharmony_ci#define R300_FOG_COLOR_G                    0x4BCC
12698c2ecf20Sopenharmony_ci#define R300_FOG_COLOR_B                    0x4BD0
12708c2ecf20Sopenharmony_ci
12718c2ecf20Sopenharmony_ci#define R300_PP_ALPHA_TEST                  0x4BD4
12728c2ecf20Sopenharmony_ci#       define R300_REF_ALPHA_MASK               0x000000ff
12738c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_FAIL              (0 << 8)
12748c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_LESS              (1 << 8)
12758c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_LEQUAL            (3 << 8)
12768c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_EQUAL             (2 << 8)
12778c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_GEQUAL            (6 << 8)
12788c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_GREATER           (4 << 8)
12798c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_NEQUAL            (5 << 8)
12808c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_PASS              (7 << 8)
12818c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_OP_MASK           (7 << 8)
12828c2ecf20Sopenharmony_ci#       define R300_ALPHA_TEST_ENABLE            (1 << 11)
12838c2ecf20Sopenharmony_ci
12848c2ecf20Sopenharmony_ci/* gap */
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_ci/* Fragment program parameters in 7.16 floating point */
12878c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_0_X                  0x4C00
12888c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_0_Y                  0x4C04
12898c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_0_Z                  0x4C08
12908c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_0_W                  0x4C0C
12918c2ecf20Sopenharmony_ci/* GUESS: PARAM_31 is last, based on native limits reported by fglrx */
12928c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_31_X                 0x4DF0
12938c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_31_Y                 0x4DF4
12948c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_31_Z                 0x4DF8
12958c2ecf20Sopenharmony_ci#define R300_PFS_PARAM_31_W                 0x4DFC
12968c2ecf20Sopenharmony_ci
12978c2ecf20Sopenharmony_ci/* Notes:
12988c2ecf20Sopenharmony_ci * - AFAIK fglrx always sets BLEND_UNKNOWN when blending is used in
12998c2ecf20Sopenharmony_ci *   the application
13008c2ecf20Sopenharmony_ci * - AFAIK fglrx always sets BLEND_NO_SEPARATE when CBLEND and ABLEND
13018c2ecf20Sopenharmony_ci *    are set to the same
13028c2ecf20Sopenharmony_ci *   function (both registers are always set up completely in any case)
13038c2ecf20Sopenharmony_ci * - Most blend flags are simply copied from R200 and not tested yet
13048c2ecf20Sopenharmony_ci */
13058c2ecf20Sopenharmony_ci#define R300_RB3D_CBLEND                    0x4E04
13068c2ecf20Sopenharmony_ci#define R300_RB3D_ABLEND                    0x4E08
13078c2ecf20Sopenharmony_ci/* the following only appear in CBLEND */
13088c2ecf20Sopenharmony_ci#       define R300_BLEND_ENABLE                     (1 << 0)
13098c2ecf20Sopenharmony_ci#       define R300_BLEND_UNKNOWN                    (3 << 1)
13108c2ecf20Sopenharmony_ci#       define R300_BLEND_NO_SEPARATE                (1 << 3)
13118c2ecf20Sopenharmony_ci/* the following are shared between CBLEND and ABLEND */
13128c2ecf20Sopenharmony_ci#       define R300_FCN_MASK                         (3  << 12)
13138c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_ADD_CLAMP               (0  << 12)
13148c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_ADD_NOCLAMP             (1  << 12)
13158c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_SUB_CLAMP               (2  << 12)
13168c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_SUB_NOCLAMP             (3  << 12)
13178c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_MIN                     (4  << 12)
13188c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_MAX                     (5  << 12)
13198c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_RSUB_CLAMP              (6  << 12)
13208c2ecf20Sopenharmony_ci#       define R300_COMB_FCN_RSUB_NOCLAMP            (7  << 12)
13218c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ZERO                    (32)
13228c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE                     (33)
13238c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_SRC_COLOR               (34)
13248c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_SRC_COLOR     (35)
13258c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_DST_COLOR               (36)
13268c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_DST_COLOR     (37)
13278c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_SRC_ALPHA               (38)
13288c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_SRC_ALPHA     (39)
13298c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_DST_ALPHA               (40)
13308c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_DST_ALPHA     (41)
13318c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_SRC_ALPHA_SATURATE      (42)
13328c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_CONST_COLOR             (43)
13338c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_CONST_COLOR   (44)
13348c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_CONST_ALPHA             (45)
13358c2ecf20Sopenharmony_ci#       define R300_BLEND_GL_ONE_MINUS_CONST_ALPHA   (46)
13368c2ecf20Sopenharmony_ci#       define R300_BLEND_MASK                       (63)
13378c2ecf20Sopenharmony_ci#       define R300_SRC_BLEND_SHIFT                  (16)
13388c2ecf20Sopenharmony_ci#       define R300_DST_BLEND_SHIFT                  (24)
13398c2ecf20Sopenharmony_ci#define R300_RB3D_BLEND_COLOR               0x4E10
13408c2ecf20Sopenharmony_ci#define R300_RB3D_COLORMASK                 0x4E0C
13418c2ecf20Sopenharmony_ci#       define R300_COLORMASK0_B                 (1<<0)
13428c2ecf20Sopenharmony_ci#       define R300_COLORMASK0_G                 (1<<1)
13438c2ecf20Sopenharmony_ci#       define R300_COLORMASK0_R                 (1<<2)
13448c2ecf20Sopenharmony_ci#       define R300_COLORMASK0_A                 (1<<3)
13458c2ecf20Sopenharmony_ci
13468c2ecf20Sopenharmony_ci/* gap */
13478c2ecf20Sopenharmony_ci
13488c2ecf20Sopenharmony_ci#define R300_RB3D_COLOROFFSET0              0x4E28
13498c2ecf20Sopenharmony_ci#       define R300_COLOROFFSET_MASK             0xFFFFFFF0 /* GUESS */
13508c2ecf20Sopenharmony_ci#define R300_RB3D_COLOROFFSET1              0x4E2C /* GUESS */
13518c2ecf20Sopenharmony_ci#define R300_RB3D_COLOROFFSET2              0x4E30 /* GUESS */
13528c2ecf20Sopenharmony_ci#define R300_RB3D_COLOROFFSET3              0x4E34 /* GUESS */
13538c2ecf20Sopenharmony_ci
13548c2ecf20Sopenharmony_ci/* gap */
13558c2ecf20Sopenharmony_ci
13568c2ecf20Sopenharmony_ci/* Bit 16: Larger tiles
13578c2ecf20Sopenharmony_ci * Bit 17: 4x2 tiles
13588c2ecf20Sopenharmony_ci * Bit 18: Extremely weird tile like, but some pixels duplicated?
13598c2ecf20Sopenharmony_ci */
13608c2ecf20Sopenharmony_ci#define R300_RB3D_COLORPITCH0               0x4E38
13618c2ecf20Sopenharmony_ci#       define R300_COLORPITCH_MASK              0x00001FF8 /* GUESS */
13628c2ecf20Sopenharmony_ci#       define R300_COLOR_TILE_ENABLE            (1 << 16) /* GUESS */
13638c2ecf20Sopenharmony_ci#       define R300_COLOR_MICROTILE_ENABLE       (1 << 17) /* GUESS */
13648c2ecf20Sopenharmony_ci#       define R300_COLOR_MICROTILE_SQUARE_ENABLE (2 << 17)
13658c2ecf20Sopenharmony_ci#       define R300_COLOR_ENDIAN_NO_SWAP         (0 << 18) /* GUESS */
13668c2ecf20Sopenharmony_ci#       define R300_COLOR_ENDIAN_WORD_SWAP       (1 << 18) /* GUESS */
13678c2ecf20Sopenharmony_ci#       define R300_COLOR_ENDIAN_DWORD_SWAP      (2 << 18) /* GUESS */
13688c2ecf20Sopenharmony_ci#       define R300_COLOR_FORMAT_RGB565          (2 << 22)
13698c2ecf20Sopenharmony_ci#       define R300_COLOR_FORMAT_ARGB8888        (3 << 22)
13708c2ecf20Sopenharmony_ci#define R300_RB3D_COLORPITCH1               0x4E3C /* GUESS */
13718c2ecf20Sopenharmony_ci#define R300_RB3D_COLORPITCH2               0x4E40 /* GUESS */
13728c2ecf20Sopenharmony_ci#define R300_RB3D_COLORPITCH3               0x4E44 /* GUESS */
13738c2ecf20Sopenharmony_ci
13748c2ecf20Sopenharmony_ci#define R300_RB3D_AARESOLVE_OFFSET          0x4E80
13758c2ecf20Sopenharmony_ci#define R300_RB3D_AARESOLVE_PITCH           0x4E84
13768c2ecf20Sopenharmony_ci#define R300_RB3D_AARESOLVE_CTL             0x4E88
13778c2ecf20Sopenharmony_ci/* gap */
13788c2ecf20Sopenharmony_ci
13798c2ecf20Sopenharmony_ci/* Guess by Vladimir.
13808c2ecf20Sopenharmony_ci * Set to 0A before 3D operations, set to 02 afterwards.
13818c2ecf20Sopenharmony_ci */
13828c2ecf20Sopenharmony_ci/*#define R300_RB3D_DSTCACHE_CTLSTAT          0x4E4C*/
13838c2ecf20Sopenharmony_ci#       define R300_RB3D_DSTCACHE_UNKNOWN_02             0x00000002
13848c2ecf20Sopenharmony_ci#       define R300_RB3D_DSTCACHE_UNKNOWN_0A             0x0000000A
13858c2ecf20Sopenharmony_ci
13868c2ecf20Sopenharmony_ci/* gap */
13878c2ecf20Sopenharmony_ci/* There seems to be no "write only" setting, so use Z-test = ALWAYS
13888c2ecf20Sopenharmony_ci * for this.
13898c2ecf20Sopenharmony_ci * Bit (1<<8) is the "test" bit. so plain write is 6  - vd
13908c2ecf20Sopenharmony_ci */
13918c2ecf20Sopenharmony_ci#define R300_ZB_CNTL                             0x4F00
13928c2ecf20Sopenharmony_ci#	define R300_STENCIL_ENABLE		 (1 << 0)
13938c2ecf20Sopenharmony_ci#	define R300_Z_ENABLE		         (1 << 1)
13948c2ecf20Sopenharmony_ci#	define R300_Z_WRITE_ENABLE		 (1 << 2)
13958c2ecf20Sopenharmony_ci#	define R300_Z_SIGNED_COMPARE		 (1 << 3)
13968c2ecf20Sopenharmony_ci#	define R300_STENCIL_FRONT_BACK		 (1 << 4)
13978c2ecf20Sopenharmony_ci
13988c2ecf20Sopenharmony_ci#define R300_ZB_ZSTENCILCNTL                   0x4f04
13998c2ecf20Sopenharmony_ci	/* functions */
14008c2ecf20Sopenharmony_ci#	define R300_ZS_NEVER			0
14018c2ecf20Sopenharmony_ci#	define R300_ZS_LESS			1
14028c2ecf20Sopenharmony_ci#	define R300_ZS_LEQUAL			2
14038c2ecf20Sopenharmony_ci#	define R300_ZS_EQUAL			3
14048c2ecf20Sopenharmony_ci#	define R300_ZS_GEQUAL			4
14058c2ecf20Sopenharmony_ci#	define R300_ZS_GREATER			5
14068c2ecf20Sopenharmony_ci#	define R300_ZS_NOTEQUAL			6
14078c2ecf20Sopenharmony_ci#	define R300_ZS_ALWAYS			7
14088c2ecf20Sopenharmony_ci#       define R300_ZS_MASK                     7
14098c2ecf20Sopenharmony_ci	/* operations */
14108c2ecf20Sopenharmony_ci#	define R300_ZS_KEEP			0
14118c2ecf20Sopenharmony_ci#	define R300_ZS_ZERO			1
14128c2ecf20Sopenharmony_ci#	define R300_ZS_REPLACE			2
14138c2ecf20Sopenharmony_ci#	define R300_ZS_INCR			3
14148c2ecf20Sopenharmony_ci#	define R300_ZS_DECR			4
14158c2ecf20Sopenharmony_ci#	define R300_ZS_INVERT			5
14168c2ecf20Sopenharmony_ci#	define R300_ZS_INCR_WRAP		6
14178c2ecf20Sopenharmony_ci#	define R300_ZS_DECR_WRAP		7
14188c2ecf20Sopenharmony_ci#	define R300_Z_FUNC_SHIFT		0
14198c2ecf20Sopenharmony_ci	/* front and back refer to operations done for front
14208c2ecf20Sopenharmony_ci	   and back faces, i.e. separate stencil function support */
14218c2ecf20Sopenharmony_ci#	define R300_S_FRONT_FUNC_SHIFT	        3
14228c2ecf20Sopenharmony_ci#	define R300_S_FRONT_SFAIL_OP_SHIFT	6
14238c2ecf20Sopenharmony_ci#	define R300_S_FRONT_ZPASS_OP_SHIFT	9
14248c2ecf20Sopenharmony_ci#	define R300_S_FRONT_ZFAIL_OP_SHIFT      12
14258c2ecf20Sopenharmony_ci#	define R300_S_BACK_FUNC_SHIFT           15
14268c2ecf20Sopenharmony_ci#	define R300_S_BACK_SFAIL_OP_SHIFT       18
14278c2ecf20Sopenharmony_ci#	define R300_S_BACK_ZPASS_OP_SHIFT       21
14288c2ecf20Sopenharmony_ci#	define R300_S_BACK_ZFAIL_OP_SHIFT       24
14298c2ecf20Sopenharmony_ci
14308c2ecf20Sopenharmony_ci#define R300_ZB_STENCILREFMASK                        0x4f08
14318c2ecf20Sopenharmony_ci#	define R300_STENCILREF_SHIFT       0
14328c2ecf20Sopenharmony_ci#	define R300_STENCILREF_MASK        0x000000ff
14338c2ecf20Sopenharmony_ci#	define R300_STENCILMASK_SHIFT      8
14348c2ecf20Sopenharmony_ci#	define R300_STENCILMASK_MASK       0x0000ff00
14358c2ecf20Sopenharmony_ci#	define R300_STENCILWRITEMASK_SHIFT 16
14368c2ecf20Sopenharmony_ci#	define R300_STENCILWRITEMASK_MASK  0x00ff0000
14378c2ecf20Sopenharmony_ci
14388c2ecf20Sopenharmony_ci/* gap */
14398c2ecf20Sopenharmony_ci
14408c2ecf20Sopenharmony_ci#define R300_ZB_FORMAT                             0x4f10
14418c2ecf20Sopenharmony_ci#	define R300_DEPTHFORMAT_16BIT_INT_Z   (0 << 0)
14428c2ecf20Sopenharmony_ci#	define R300_DEPTHFORMAT_16BIT_13E3    (1 << 0)
14438c2ecf20Sopenharmony_ci#	define R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL   (2 << 0)
14448c2ecf20Sopenharmony_ci/* reserved up to (15 << 0) */
14458c2ecf20Sopenharmony_ci#	define R300_INVERT_13E3_LEADING_ONES  (0 << 4)
14468c2ecf20Sopenharmony_ci#	define R300_INVERT_13E3_LEADING_ZEROS (1 << 4)
14478c2ecf20Sopenharmony_ci
14488c2ecf20Sopenharmony_ci#define R300_ZB_ZTOP                             0x4F14
14498c2ecf20Sopenharmony_ci#	define R300_ZTOP_DISABLE                 (0 << 0)
14508c2ecf20Sopenharmony_ci#	define R300_ZTOP_ENABLE                  (1 << 0)
14518c2ecf20Sopenharmony_ci
14528c2ecf20Sopenharmony_ci/* gap */
14538c2ecf20Sopenharmony_ci
14548c2ecf20Sopenharmony_ci#define R300_ZB_ZCACHE_CTLSTAT            0x4f18
14558c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_NO_EFFECT      (0 << 0)
14568c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE (1 << 0)
14578c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_NO_EFFECT       (0 << 1)
14588c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE            (1 << 1)
14598c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_BUSY_IDLE            (0 << 31)
14608c2ecf20Sopenharmony_ci#       define R300_ZB_ZCACHE_CTLSTAT_ZC_BUSY_BUSY            (1 << 31)
14618c2ecf20Sopenharmony_ci
14628c2ecf20Sopenharmony_ci#define R300_ZB_BW_CNTL                     0x4f1c
14638c2ecf20Sopenharmony_ci#	define R300_HIZ_DISABLE                              (0 << 0)
14648c2ecf20Sopenharmony_ci#	define R300_HIZ_ENABLE                               (1 << 0)
14658c2ecf20Sopenharmony_ci#	define R300_HIZ_MIN                                  (0 << 1)
14668c2ecf20Sopenharmony_ci#	define R300_HIZ_MAX                                  (1 << 1)
14678c2ecf20Sopenharmony_ci#	define R300_FAST_FILL_DISABLE                        (0 << 2)
14688c2ecf20Sopenharmony_ci#	define R300_FAST_FILL_ENABLE                         (1 << 2)
14698c2ecf20Sopenharmony_ci#	define R300_RD_COMP_DISABLE                          (0 << 3)
14708c2ecf20Sopenharmony_ci#	define R300_RD_COMP_ENABLE                           (1 << 3)
14718c2ecf20Sopenharmony_ci#	define R300_WR_COMP_DISABLE                          (0 << 4)
14728c2ecf20Sopenharmony_ci#	define R300_WR_COMP_ENABLE                           (1 << 4)
14738c2ecf20Sopenharmony_ci#	define R300_ZB_CB_CLEAR_RMW                          (0 << 5)
14748c2ecf20Sopenharmony_ci#	define R300_ZB_CB_CLEAR_CACHE_LINEAR                 (1 << 5)
14758c2ecf20Sopenharmony_ci#	define R300_FORCE_COMPRESSED_STENCIL_VALUE_DISABLE   (0 << 6)
14768c2ecf20Sopenharmony_ci#	define R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE    (1 << 6)
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_ci#	define R500_ZEQUAL_OPTIMIZE_ENABLE                   (0 << 7)
14798c2ecf20Sopenharmony_ci#	define R500_ZEQUAL_OPTIMIZE_DISABLE                  (1 << 7)
14808c2ecf20Sopenharmony_ci#	define R500_SEQUAL_OPTIMIZE_ENABLE                   (0 << 8)
14818c2ecf20Sopenharmony_ci#	define R500_SEQUAL_OPTIMIZE_DISABLE                  (1 << 8)
14828c2ecf20Sopenharmony_ci
14838c2ecf20Sopenharmony_ci#	define R500_BMASK_ENABLE                             (0 << 10)
14848c2ecf20Sopenharmony_ci#	define R500_BMASK_DISABLE                            (1 << 10)
14858c2ecf20Sopenharmony_ci#	define R500_HIZ_EQUAL_REJECT_DISABLE                 (0 << 11)
14868c2ecf20Sopenharmony_ci#	define R500_HIZ_EQUAL_REJECT_ENABLE                  (1 << 11)
14878c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_DISABLE                  (0 << 12)
14888c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_1                        (1 << 12)
14898c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_2                        (2 << 12)
14908c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_3                        (3 << 12)
14918c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_4                        (4 << 12)
14928c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_EXP_BITS_5                        (5 << 12)
14938c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_INVERT_LEADING_ONES               (0 << 15)
14948c2ecf20Sopenharmony_ci#	define R500_HIZ_FP_INVERT_LEADING_ZEROS              (1 << 15)
14958c2ecf20Sopenharmony_ci#	define R500_TILE_OVERWRITE_RECOMPRESSION_ENABLE      (0 << 16)
14968c2ecf20Sopenharmony_ci#	define R500_TILE_OVERWRITE_RECOMPRESSION_DISABLE     (1 << 16)
14978c2ecf20Sopenharmony_ci#	define R500_CONTIGUOUS_6XAA_SAMPLES_ENABLE           (0 << 17)
14988c2ecf20Sopenharmony_ci#	define R500_CONTIGUOUS_6XAA_SAMPLES_DISABLE          (1 << 17)
14998c2ecf20Sopenharmony_ci#	define R500_PEQ_PACKING_DISABLE                      (0 << 18)
15008c2ecf20Sopenharmony_ci#	define R500_PEQ_PACKING_ENABLE                       (1 << 18)
15018c2ecf20Sopenharmony_ci#	define R500_COVERED_PTR_MASKING_DISABLE              (0 << 18)
15028c2ecf20Sopenharmony_ci#	define R500_COVERED_PTR_MASKING_ENABLE               (1 << 18)
15038c2ecf20Sopenharmony_ci
15048c2ecf20Sopenharmony_ci
15058c2ecf20Sopenharmony_ci/* gap */
15068c2ecf20Sopenharmony_ci
15078c2ecf20Sopenharmony_ci/* Z Buffer Address Offset.
15088c2ecf20Sopenharmony_ci * Bits 31 to 5 are used for aligned Z buffer address offset for macro tiles.
15098c2ecf20Sopenharmony_ci */
15108c2ecf20Sopenharmony_ci#define R300_ZB_DEPTHOFFSET               0x4f20
15118c2ecf20Sopenharmony_ci
15128c2ecf20Sopenharmony_ci/* Z Buffer Pitch and Endian Control */
15138c2ecf20Sopenharmony_ci#define R300_ZB_DEPTHPITCH                0x4f24
15148c2ecf20Sopenharmony_ci#       define R300_DEPTHPITCH_MASK              0x00003FFC
15158c2ecf20Sopenharmony_ci#       define R300_DEPTHMACROTILE_DISABLE      (0 << 16)
15168c2ecf20Sopenharmony_ci#       define R300_DEPTHMACROTILE_ENABLE       (1 << 16)
15178c2ecf20Sopenharmony_ci#       define R300_DEPTHMICROTILE_LINEAR       (0 << 17)
15188c2ecf20Sopenharmony_ci#       define R300_DEPTHMICROTILE_TILED        (1 << 17)
15198c2ecf20Sopenharmony_ci#       define R300_DEPTHMICROTILE_TILED_SQUARE (2 << 17)
15208c2ecf20Sopenharmony_ci#       define R300_DEPTHENDIAN_NO_SWAP         (0 << 18)
15218c2ecf20Sopenharmony_ci#       define R300_DEPTHENDIAN_WORD_SWAP       (1 << 18)
15228c2ecf20Sopenharmony_ci#       define R300_DEPTHENDIAN_DWORD_SWAP      (2 << 18)
15238c2ecf20Sopenharmony_ci#       define R300_DEPTHENDIAN_HALF_DWORD_SWAP (3 << 18)
15248c2ecf20Sopenharmony_ci
15258c2ecf20Sopenharmony_ci/* Z Buffer Clear Value */
15268c2ecf20Sopenharmony_ci#define R300_ZB_DEPTHCLEARVALUE                  0x4f28
15278c2ecf20Sopenharmony_ci
15288c2ecf20Sopenharmony_ci#define R300_ZB_ZMASK_OFFSET			 0x4f30
15298c2ecf20Sopenharmony_ci#define R300_ZB_ZMASK_PITCH			 0x4f34
15308c2ecf20Sopenharmony_ci#define R300_ZB_ZMASK_WRINDEX			 0x4f38
15318c2ecf20Sopenharmony_ci#define R300_ZB_ZMASK_DWORD			 0x4f3c
15328c2ecf20Sopenharmony_ci#define R300_ZB_ZMASK_RDINDEX			 0x4f40
15338c2ecf20Sopenharmony_ci
15348c2ecf20Sopenharmony_ci/* Hierarchical Z Memory Offset */
15358c2ecf20Sopenharmony_ci#define R300_ZB_HIZ_OFFSET                       0x4f44
15368c2ecf20Sopenharmony_ci
15378c2ecf20Sopenharmony_ci/* Hierarchical Z Write Index */
15388c2ecf20Sopenharmony_ci#define R300_ZB_HIZ_WRINDEX                      0x4f48
15398c2ecf20Sopenharmony_ci
15408c2ecf20Sopenharmony_ci/* Hierarchical Z Data */
15418c2ecf20Sopenharmony_ci#define R300_ZB_HIZ_DWORD                        0x4f4c
15428c2ecf20Sopenharmony_ci
15438c2ecf20Sopenharmony_ci/* Hierarchical Z Read Index */
15448c2ecf20Sopenharmony_ci#define R300_ZB_HIZ_RDINDEX                      0x4f50
15458c2ecf20Sopenharmony_ci
15468c2ecf20Sopenharmony_ci/* Hierarchical Z Pitch */
15478c2ecf20Sopenharmony_ci#define R300_ZB_HIZ_PITCH                        0x4f54
15488c2ecf20Sopenharmony_ci
15498c2ecf20Sopenharmony_ci/* Z Buffer Z Pass Counter Data */
15508c2ecf20Sopenharmony_ci#define R300_ZB_ZPASS_DATA                       0x4f58
15518c2ecf20Sopenharmony_ci
15528c2ecf20Sopenharmony_ci/* Z Buffer Z Pass Counter Address */
15538c2ecf20Sopenharmony_ci#define R300_ZB_ZPASS_ADDR                       0x4f5c
15548c2ecf20Sopenharmony_ci
15558c2ecf20Sopenharmony_ci/* Depth buffer X and Y coordinate offset */
15568c2ecf20Sopenharmony_ci#define R300_ZB_DEPTHXY_OFFSET                   0x4f60
15578c2ecf20Sopenharmony_ci#	define R300_DEPTHX_OFFSET_SHIFT  1
15588c2ecf20Sopenharmony_ci#	define R300_DEPTHX_OFFSET_MASK   0x000007FE
15598c2ecf20Sopenharmony_ci#	define R300_DEPTHY_OFFSET_SHIFT  17
15608c2ecf20Sopenharmony_ci#	define R300_DEPTHY_OFFSET_MASK   0x07FE0000
15618c2ecf20Sopenharmony_ci
15628c2ecf20Sopenharmony_ci/* Sets the fifo sizes */
15638c2ecf20Sopenharmony_ci#define R500_ZB_FIFO_SIZE                        0x4fd0
15648c2ecf20Sopenharmony_ci#	define R500_OP_FIFO_SIZE_FULL   (0 << 0)
15658c2ecf20Sopenharmony_ci#	define R500_OP_FIFO_SIZE_HALF   (1 << 0)
15668c2ecf20Sopenharmony_ci#	define R500_OP_FIFO_SIZE_QUATER (2 << 0)
15678c2ecf20Sopenharmony_ci#	define R500_OP_FIFO_SIZE_EIGTHS (4 << 0)
15688c2ecf20Sopenharmony_ci
15698c2ecf20Sopenharmony_ci/* Stencil Reference Value and Mask for backfacing quads */
15708c2ecf20Sopenharmony_ci/* R300_ZB_STENCILREFMASK handles front face */
15718c2ecf20Sopenharmony_ci#define R500_ZB_STENCILREFMASK_BF                0x4fd4
15728c2ecf20Sopenharmony_ci#	define R500_STENCILREF_SHIFT       0
15738c2ecf20Sopenharmony_ci#	define R500_STENCILREF_MASK        0x000000ff
15748c2ecf20Sopenharmony_ci#	define R500_STENCILMASK_SHIFT      8
15758c2ecf20Sopenharmony_ci#	define R500_STENCILMASK_MASK       0x0000ff00
15768c2ecf20Sopenharmony_ci#	define R500_STENCILWRITEMASK_SHIFT 16
15778c2ecf20Sopenharmony_ci#	define R500_STENCILWRITEMASK_MASK  0x00ff0000
15788c2ecf20Sopenharmony_ci
15798c2ecf20Sopenharmony_ci/* BEGIN: Vertex program instruction set */
15808c2ecf20Sopenharmony_ci
15818c2ecf20Sopenharmony_ci/* Every instruction is four dwords long:
15828c2ecf20Sopenharmony_ci *  DWORD 0: output and opcode
15838c2ecf20Sopenharmony_ci *  DWORD 1: first argument
15848c2ecf20Sopenharmony_ci *  DWORD 2: second argument
15858c2ecf20Sopenharmony_ci *  DWORD 3: third argument
15868c2ecf20Sopenharmony_ci *
15878c2ecf20Sopenharmony_ci * Notes:
15888c2ecf20Sopenharmony_ci *  - ABS r, a is implemented as MAX r, a, -a
15898c2ecf20Sopenharmony_ci *  - MOV is implemented as ADD to zero
15908c2ecf20Sopenharmony_ci *  - XPD is implemented as MUL + MAD
15918c2ecf20Sopenharmony_ci *  - FLR is implemented as FRC + ADD
15928c2ecf20Sopenharmony_ci *  - apparently, fglrx tries to schedule instructions so that there is at
15938c2ecf20Sopenharmony_ci *    least one instruction between the write to a temporary and the first
15948c2ecf20Sopenharmony_ci *    read from said temporary; however, violations of this scheduling are
15958c2ecf20Sopenharmony_ci *    allowed
15968c2ecf20Sopenharmony_ci *  - register indices seem to be unrelated with OpenGL aliasing to
15978c2ecf20Sopenharmony_ci *    conventional state
15988c2ecf20Sopenharmony_ci *  - only one attribute and one parameter can be loaded at a time; however,
15998c2ecf20Sopenharmony_ci *    the same attribute/parameter can be used for more than one argument
16008c2ecf20Sopenharmony_ci *  - the second software argument for POW is the third hardware argument
16018c2ecf20Sopenharmony_ci *    (no idea why)
16028c2ecf20Sopenharmony_ci *  - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2
16038c2ecf20Sopenharmony_ci *
16048c2ecf20Sopenharmony_ci * There is some magic surrounding LIT:
16058c2ecf20Sopenharmony_ci *   The single argument is replicated across all three inputs, but swizzled:
16068c2ecf20Sopenharmony_ci *     First argument: xyzy
16078c2ecf20Sopenharmony_ci *     Second argument: xyzx
16088c2ecf20Sopenharmony_ci *     Third argument: xyzw
16098c2ecf20Sopenharmony_ci *   Whenever the result is used later in the fragment program, fglrx forces
16108c2ecf20Sopenharmony_ci *   x and w to be 1.0 in the input selection; I don't know whether this is
16118c2ecf20Sopenharmony_ci *   strictly necessary
16128c2ecf20Sopenharmony_ci */
16138c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_DOT                     (1 << 0)
16148c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_MUL                     (2 << 0)
16158c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_ADD                     (3 << 0)
16168c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_MAD                     (4 << 0)
16178c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_DST                     (5 << 0)
16188c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_FRC                     (6 << 0)
16198c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_MAX                     (7 << 0)
16208c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_MIN                     (8 << 0)
16218c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_SGE                     (9 << 0)
16228c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_SLT                     (10 << 0)
16238c2ecf20Sopenharmony_ci	/* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */
16248c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_UNK12                   (12 << 0)
16258c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_ARL                     (13 << 0)
16268c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_EXP                     (65 << 0)
16278c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_LOG                     (66 << 0)
16288c2ecf20Sopenharmony_ci	/* Used in fog computations, scalar(scalar) */
16298c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_UNK67                   (67 << 0)
16308c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_LIT                     (68 << 0)
16318c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_POW                     (69 << 0)
16328c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_RCP                     (70 << 0)
16338c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_RSQ                     (72 << 0)
16348c2ecf20Sopenharmony_ci	/* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */
16358c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_UNK73                   (73 << 0)
16368c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_EX2                     (75 << 0)
16378c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_LG2                     (76 << 0)
16388c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_MAD_2                   (128 << 0)
16398c2ecf20Sopenharmony_ci	/* all temps, vector(scalar, vector, vector) */
16408c2ecf20Sopenharmony_ci#define R300_VPI_OUT_OP_UNK129                  (129 << 0)
16418c2ecf20Sopenharmony_ci
16428c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_CLASS_TEMPORARY        (0 << 8)
16438c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_CLASS_ADDR             (1 << 8)
16448c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_CLASS_RESULT           (2 << 8)
16458c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_CLASS_MASK             (31 << 8)
16468c2ecf20Sopenharmony_ci
16478c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_INDEX_SHIFT            13
16488c2ecf20Sopenharmony_ci	/* GUESS based on fglrx native limits */
16498c2ecf20Sopenharmony_ci#define R300_VPI_OUT_REG_INDEX_MASK             (31 << 13)
16508c2ecf20Sopenharmony_ci
16518c2ecf20Sopenharmony_ci#define R300_VPI_OUT_WRITE_X                    (1 << 20)
16528c2ecf20Sopenharmony_ci#define R300_VPI_OUT_WRITE_Y                    (1 << 21)
16538c2ecf20Sopenharmony_ci#define R300_VPI_OUT_WRITE_Z                    (1 << 22)
16548c2ecf20Sopenharmony_ci#define R300_VPI_OUT_WRITE_W                    (1 << 23)
16558c2ecf20Sopenharmony_ci
16568c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_CLASS_TEMPORARY         (0 << 0)
16578c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_CLASS_ATTRIBUTE         (1 << 0)
16588c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_CLASS_PARAMETER         (2 << 0)
16598c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_CLASS_NONE              (9 << 0)
16608c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_CLASS_MASK              (31 << 0)
16618c2ecf20Sopenharmony_ci
16628c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_INDEX_SHIFT             5
16638c2ecf20Sopenharmony_ci	/* GUESS based on fglrx native limits */
16648c2ecf20Sopenharmony_ci#define R300_VPI_IN_REG_INDEX_MASK              (255 << 5)
16658c2ecf20Sopenharmony_ci
16668c2ecf20Sopenharmony_ci/* The R300 can select components from the input register arbitrarily.
16678c2ecf20Sopenharmony_ci * Use the following constants, shifted by the component shift you
16688c2ecf20Sopenharmony_ci * want to select
16698c2ecf20Sopenharmony_ci */
16708c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_X    0
16718c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_Y    1
16728c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_Z    2
16738c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_W    3
16748c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_ZERO 4
16758c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_ONE  5
16768c2ecf20Sopenharmony_ci#define R300_VPI_IN_SELECT_MASK 7
16778c2ecf20Sopenharmony_ci
16788c2ecf20Sopenharmony_ci#define R300_VPI_IN_X_SHIFT                     13
16798c2ecf20Sopenharmony_ci#define R300_VPI_IN_Y_SHIFT                     16
16808c2ecf20Sopenharmony_ci#define R300_VPI_IN_Z_SHIFT                     19
16818c2ecf20Sopenharmony_ci#define R300_VPI_IN_W_SHIFT                     22
16828c2ecf20Sopenharmony_ci
16838c2ecf20Sopenharmony_ci#define R300_VPI_IN_NEG_X                       (1 << 25)
16848c2ecf20Sopenharmony_ci#define R300_VPI_IN_NEG_Y                       (1 << 26)
16858c2ecf20Sopenharmony_ci#define R300_VPI_IN_NEG_Z                       (1 << 27)
16868c2ecf20Sopenharmony_ci#define R300_VPI_IN_NEG_W                       (1 << 28)
16878c2ecf20Sopenharmony_ci/* END: Vertex program instruction set */
16888c2ecf20Sopenharmony_ci
16898c2ecf20Sopenharmony_ci/* BEGIN: Packet 3 commands */
16908c2ecf20Sopenharmony_ci
16918c2ecf20Sopenharmony_ci/* A primitive emission dword. */
16928c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_NONE                     (0 << 0)
16938c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_POINT                    (1 << 0)
16948c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_LINE                     (2 << 0)
16958c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_LINE_STRIP               (3 << 0)
16968c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_TRI_LIST                 (4 << 0)
16978c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_TRI_FAN                  (5 << 0)
16988c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_TRI_STRIP                (6 << 0)
16998c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_TRI_TYPE2                (7 << 0)
17008c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_RECT_LIST                (8 << 0)
17018c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_3VRT_POINT_LIST          (9 << 0)
17028c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_3VRT_LINE_LIST           (10 << 0)
17038c2ecf20Sopenharmony_ci	/* GUESS (based on r200) */
17048c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_POINT_SPRITES            (11 << 0)
17058c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_LINE_LOOP                (12 << 0)
17068c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_QUADS                    (13 << 0)
17078c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_QUAD_STRIP               (14 << 0)
17088c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_POLYGON                  (15 << 0)
17098c2ecf20Sopenharmony_ci#define R300_PRIM_TYPE_MASK                     0xF
17108c2ecf20Sopenharmony_ci#define R300_PRIM_WALK_IND                      (1 << 4)
17118c2ecf20Sopenharmony_ci#define R300_PRIM_WALK_LIST                     (2 << 4)
17128c2ecf20Sopenharmony_ci#define R300_PRIM_WALK_RING                     (3 << 4)
17138c2ecf20Sopenharmony_ci#define R300_PRIM_WALK_MASK                     (3 << 4)
17148c2ecf20Sopenharmony_ci	/* GUESS (based on r200) */
17158c2ecf20Sopenharmony_ci#define R300_PRIM_COLOR_ORDER_BGRA              (0 << 6)
17168c2ecf20Sopenharmony_ci#define R300_PRIM_COLOR_ORDER_RGBA              (1 << 6)
17178c2ecf20Sopenharmony_ci#define R300_PRIM_NUM_VERTICES_SHIFT            16
17188c2ecf20Sopenharmony_ci#define R300_PRIM_NUM_VERTICES_MASK             0xffff
17198c2ecf20Sopenharmony_ci
17208c2ecf20Sopenharmony_ci/* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR.
17218c2ecf20Sopenharmony_ci * Two parameter dwords:
17228c2ecf20Sopenharmony_ci * 0. The first parameter appears to be always 0
17238c2ecf20Sopenharmony_ci * 1. The second parameter is a standard primitive emission dword.
17248c2ecf20Sopenharmony_ci */
17258c2ecf20Sopenharmony_ci#define R300_PACKET3_3D_DRAW_VBUF           0x00002800
17268c2ecf20Sopenharmony_ci
17278c2ecf20Sopenharmony_ci/* Specify the full set of vertex arrays as (address, stride).
17288c2ecf20Sopenharmony_ci * The first parameter is the number of vertex arrays specified.
17298c2ecf20Sopenharmony_ci * The rest of the command is a variable length list of blocks, where
17308c2ecf20Sopenharmony_ci * each block is three dwords long and specifies two arrays.
17318c2ecf20Sopenharmony_ci * The first dword of a block is split into two words, the lower significant
17328c2ecf20Sopenharmony_ci * word refers to the first array, the more significant word to the second
17338c2ecf20Sopenharmony_ci * array in the block.
17348c2ecf20Sopenharmony_ci * The low byte of each word contains the size of an array entry in dwords,
17358c2ecf20Sopenharmony_ci * the high byte contains the stride of the array.
17368c2ecf20Sopenharmony_ci * The second dword of a block contains the pointer to the first array,
17378c2ecf20Sopenharmony_ci * the third dword of a block contains the pointer to the second array.
17388c2ecf20Sopenharmony_ci * Note that if the total number of arrays is odd, the third dword of
17398c2ecf20Sopenharmony_ci * the last block is omitted.
17408c2ecf20Sopenharmony_ci */
17418c2ecf20Sopenharmony_ci#define R300_PACKET3_3D_LOAD_VBPNTR         0x00002F00
17428c2ecf20Sopenharmony_ci
17438c2ecf20Sopenharmony_ci#define R300_PACKET3_INDX_BUFFER            0x00003300
17448c2ecf20Sopenharmony_ci#    define R300_EB_UNK1_SHIFT                      24
17458c2ecf20Sopenharmony_ci#    define R300_EB_UNK1                    (0x80<<24)
17468c2ecf20Sopenharmony_ci#    define R300_EB_UNK2                        0x0810
17478c2ecf20Sopenharmony_ci#define R300_PACKET3_3D_DRAW_VBUF_2         0x00003400
17488c2ecf20Sopenharmony_ci#define R300_PACKET3_3D_DRAW_INDX_2         0x00003600
17498c2ecf20Sopenharmony_ci
17508c2ecf20Sopenharmony_ci/* END: Packet 3 commands */
17518c2ecf20Sopenharmony_ci
17528c2ecf20Sopenharmony_ci
17538c2ecf20Sopenharmony_ci/* Color formats for 2d packets
17548c2ecf20Sopenharmony_ci */
17558c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_CI8	2
17568c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_ARGB1555	3
17578c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_RGB565	4
17588c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_ARGB8888	6
17598c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_RGB332	7
17608c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_RGB8	9
17618c2ecf20Sopenharmony_ci#define R300_CP_COLOR_FORMAT_ARGB4444	15
17628c2ecf20Sopenharmony_ci
17638c2ecf20Sopenharmony_ci/*
17648c2ecf20Sopenharmony_ci * CP type-3 packets
17658c2ecf20Sopenharmony_ci */
17668c2ecf20Sopenharmony_ci#define R300_CP_CMD_BITBLT_MULTI	0xC0009B00
17678c2ecf20Sopenharmony_ci
17688c2ecf20Sopenharmony_ci#define R500_VAP_INDEX_OFFSET		0x208c
17698c2ecf20Sopenharmony_ci
17708c2ecf20Sopenharmony_ci#define R500_GA_US_VECTOR_INDEX         0x4250
17718c2ecf20Sopenharmony_ci#define R500_GA_US_VECTOR_DATA          0x4254
17728c2ecf20Sopenharmony_ci
17738c2ecf20Sopenharmony_ci#define R500_RS_IP_0                    0x4074
17748c2ecf20Sopenharmony_ci#define R500_RS_INST_0                  0x4320
17758c2ecf20Sopenharmony_ci
17768c2ecf20Sopenharmony_ci#define R500_US_CONFIG                  0x4600
17778c2ecf20Sopenharmony_ci
17788c2ecf20Sopenharmony_ci#define R500_US_FC_CTRL			0x4624
17798c2ecf20Sopenharmony_ci#define R500_US_CODE_ADDR		0x4630
17808c2ecf20Sopenharmony_ci
17818c2ecf20Sopenharmony_ci#define R500_RB3D_COLOR_CLEAR_VALUE_AR  0x46c0
17828c2ecf20Sopenharmony_ci#define R500_RB3D_CONSTANT_COLOR_AR     0x4ef8
17838c2ecf20Sopenharmony_ci
17848c2ecf20Sopenharmony_ci#define R300_SU_REG_DEST                0x42c8
17858c2ecf20Sopenharmony_ci#define RV530_FG_ZBREG_DEST             0x4be8
17868c2ecf20Sopenharmony_ci#define R300_ZB_ZPASS_DATA              0x4f58
17878c2ecf20Sopenharmony_ci#define R300_ZB_ZPASS_ADDR              0x4f5c
17888c2ecf20Sopenharmony_ci
17898c2ecf20Sopenharmony_ci#endif /* _R300_REG_H */
1790