2 * Copyright 2010 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Alex Deucher <alexander.deucher@amd.com>
27 #include <linux/types.h>
28 #include <linux/kernel.h>
31 * evergreen cards need to use the 3D engine to blit data which requires
32 * quite a bit of hw state setup. Rather than pull the whole 3D driver
33 * (which normally generates the 3D state) into the DRM, we opt to use
34 * statically generated state tables. The regsiter state and shaders
35 * were hand generated to support blitting functionality. See the 3D
36 * driver or documentation for descriptions of the registers and
37 * shader instructions.
40 const u32 evergreen_default_state
[] =
44 0x00000000, /* SQ_LDS_ALLOC_PS */
48 0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
57 0x00000000, /* SQ_GS_VERT_ITEMSIZE */
64 0x00000000, /* DB_Z_INFO */
65 0x00000000, /* DB_STENCIL_INFO */
69 0x00000000, /* DB_DEPTH_CONTROL */
73 0x00000060, /* DB_RENDER_CONTROL */
74 0x00000000, /* DB_COUNT_CONTROL */
75 0x00000000, /* DB_DEPTH_VIEW */
76 0x0000002a, /* DB_RENDER_OVERRIDE */
77 0x00000000, /* DB_RENDER_OVERRIDE2 */
78 0x00000000, /* DB_HTILE_DATA_BASE */
82 0x00000000, /* DB_STENCIL_CLEAR */
83 0x00000000, /* DB_DEPTH_CLEAR */
87 0x0000aa00, /* DB_ALPHA_TO_MASK */
91 0x00000000, /* PA_SC_WINDOW_OFFSET */
95 0x0000ffff, /* PA_SC_CLIPRECT_RULE */
96 0x00000000, /* PA_SC_CLIPRECT_0_TL */
97 0x20002000, /* PA_SC_CLIPRECT_0_BR */
104 0xaaaaaaaa, /* PA_SC_EDGERULE */
105 0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
106 0x0000000f, /* CB_TARGET_MASK */
107 0x0000000f, /* CB_SHADER_MASK */
111 0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
112 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
143 0x00000000, /* PA_SC_VPORT_ZMIN_0 */
144 0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
148 0x00000000, /* SX_MISC */
152 0x00000000, /* PA_SC_MODE_CNTL_0 */
153 0x00000000, /* PA_SC_MODE_CNTL_1 */
157 0x00000000, /* PA_SC_LINE_CNTL */
158 0x00000000, /* PA_SC_AA_CONFIG */
159 0x00000005, /* PA_SU_VTX_CNTL */
160 0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
161 0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
162 0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
163 0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
164 0x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */
171 0x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */
172 0xffffffff, /* PA_SC_AA_MASK */
176 0x00cc0010, /* CB_COLOR_CONTROL */
177 0x00000210, /* DB_SHADER_CONTROL */
178 0x00010000, /* PA_CL_CLIP_CNTL */
179 0x00000004, /* PA_SU_SC_MODE_CNTL */
180 0x00000100, /* PA_CL_VTE_CNTL */
181 0x00000000, /* PA_CL_VS_OUT_CNTL */
182 0x00000000, /* PA_CL_NANINF_CNTL */
183 0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
184 0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
185 0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
188 0x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */
192 0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
201 0x00000000, /* SQ_PGM_START_FS */
205 0x00000000, /* SQ_PGM_RESOURCES_FS */
209 0x00ffffff, /* VGT_MAX_VTX_INDX */
213 0x00000000, /* SX_ALPHA_TEST_CONTROL */
214 0x00000000, /* CB_BLEND_RED */
215 0x00000000, /* CB_BLEND_GREEN */
216 0x00000000, /* CB_BLEND_BLUE */
217 0x00000000, /* CB_BLEND_ALPHA */
221 0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
226 0x00000000, /* VGT_REUSE_OFF */
231 0x00000000, /* PA_SU_POINT_SIZE */
232 0x00000000, /* PA_SU_POINT_MINMAX */
233 0x00000008, /* PA_SU_LINE_CNTL */
234 0x00000000, /* PA_SC_LINE_STIPPLE */
235 0x00000000, /* VGT_OUTPUT_PATH_CNTL */
236 0x00000000, /* VGT_HOS_CNTL */
247 0x00000000, /* VGT_GS_MODE */
251 0x00000000, /* VGT_PRIMITIVEID_EN */
255 0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
259 0x00000000, /* VGT_SHADER_STAGES_EN */
263 0x00000000, /* VGT_STRMOUT_CONFIG */
268 0x00000000, /* CB_BLEND0_CONTROL */
272 0x00000000, /* SPI_VS_OUT_CONFIG */
276 0x00000000, /* SPI_VS_OUT_ID_0 */
280 0x00000100, /* SPI_PS_INPUT_CNTL_0 */
284 0x20000001, /* SPI_PS_IN_CONTROL_0 */
285 0x00000000, /* SPI_PS_IN_CONTROL_1 */
286 0x00000000, /* SPI_INTERP_CONTROL_0 */
287 0x00000000, /* SPI_INPUT_Z */
288 0x00000000, /* SPI_FOG_CNTL */
289 0x00100000, /* SPI_BARYC_CNTL */
290 0x00000000, /* SPI_PS_IN_CONTROL_2 */
298 0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
302 const u32 evergreen_vs
[] =
330 const u32 evergreen_ps
[] =
354 const u32 evergreen_ps_size
= ARRAY_SIZE(evergreen_ps
);
355 const u32 evergreen_vs_size
= ARRAY_SIZE(evergreen_vs
);
356 const u32 evergreen_default_size
= ARRAY_SIZE(evergreen_default_state
);