1d7ccd8fcSAlex Deucher /*
2d7ccd8fcSAlex Deucher  * Copyright 2009 Advanced Micro Devices, Inc.
3d7ccd8fcSAlex Deucher  *
4d7ccd8fcSAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
5d7ccd8fcSAlex Deucher  * copy of this software and associated documentation files (the "Software"),
6d7ccd8fcSAlex Deucher  * to deal in the Software without restriction, including without limitation
7d7ccd8fcSAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8d7ccd8fcSAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
9d7ccd8fcSAlex Deucher  * Software is furnished to do so, subject to the following conditions:
10d7ccd8fcSAlex Deucher  *
11d7ccd8fcSAlex Deucher  * The above copyright notice and this permission notice (including the next
12d7ccd8fcSAlex Deucher  * paragraph) shall be included in all copies or substantial portions of the
13d7ccd8fcSAlex Deucher  * Software.
14d7ccd8fcSAlex Deucher  *
15d7ccd8fcSAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16d7ccd8fcSAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17d7ccd8fcSAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18d7ccd8fcSAlex Deucher  * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19d7ccd8fcSAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20d7ccd8fcSAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21d7ccd8fcSAlex Deucher  * DEALINGS IN THE SOFTWARE.
22d7ccd8fcSAlex Deucher  *
23*79847f13STom Rix  * Authors:
24*79847f13STom Rix  *     Alex Deucher <alexander.deucher@amd.com>
25d7ccd8fcSAlex Deucher  */
26d7ccd8fcSAlex Deucher 
27d7ccd8fcSAlex Deucher #ifndef EVERGREEN_BLIT_SHADERS_H
28d7ccd8fcSAlex Deucher #define EVERGREEN_BLIT_SHADERS_H
29d7ccd8fcSAlex Deucher 
30*79847f13STom Rix /*
31*79847f13STom Rix  * evergreen cards need to use the 3D engine to blit data which requires
32*79847f13STom Rix  * quite a bit of hw state setup.  Rather than pull the whole 3D driver
33*79847f13STom Rix  * (which normally generates the 3D state) into the DRM, we opt to use
34*79847f13STom Rix  * statically generated state tables.  The register state and shaders
35*79847f13STom Rix  * were hand generated to support blitting functionality.  See the 3D
36*79847f13STom Rix  * driver or documentation for descriptions of the registers and
37*79847f13STom Rix  * shader instructions.
38*79847f13STom Rix  */
39d7ccd8fcSAlex Deucher 
40*79847f13STom Rix static const u32 evergreen_default_state[] = {
41*79847f13STom Rix 	0xc0016900,
42*79847f13STom Rix 	0x0000023b,
43*79847f13STom Rix 	0x00000000, /* SQ_LDS_ALLOC_PS */
44*79847f13STom Rix 
45*79847f13STom Rix 	0xc0066900,
46*79847f13STom Rix 	0x00000240,
47*79847f13STom Rix 	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
48*79847f13STom Rix 	0x00000000,
49*79847f13STom Rix 	0x00000000,
50*79847f13STom Rix 	0x00000000,
51*79847f13STom Rix 	0x00000000,
52*79847f13STom Rix 	0x00000000,
53*79847f13STom Rix 
54*79847f13STom Rix 	0xc0046900,
55*79847f13STom Rix 	0x00000247,
56*79847f13STom Rix 	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
57*79847f13STom Rix 	0x00000000,
58*79847f13STom Rix 	0x00000000,
59*79847f13STom Rix 	0x00000000,
60*79847f13STom Rix 
61*79847f13STom Rix 	0xc0026900,
62*79847f13STom Rix 	0x00000010,
63*79847f13STom Rix 	0x00000000, /* DB_Z_INFO */
64*79847f13STom Rix 	0x00000000, /* DB_STENCIL_INFO */
65*79847f13STom Rix 
66*79847f13STom Rix 	0xc0016900,
67*79847f13STom Rix 	0x00000200,
68*79847f13STom Rix 	0x00000000, /* DB_DEPTH_CONTROL */
69*79847f13STom Rix 
70*79847f13STom Rix 	0xc0066900,
71*79847f13STom Rix 	0x00000000,
72*79847f13STom Rix 	0x00000060, /* DB_RENDER_CONTROL */
73*79847f13STom Rix 	0x00000000, /* DB_COUNT_CONTROL */
74*79847f13STom Rix 	0x00000000, /* DB_DEPTH_VIEW */
75*79847f13STom Rix 	0x0000002a, /* DB_RENDER_OVERRIDE */
76*79847f13STom Rix 	0x00000000, /* DB_RENDER_OVERRIDE2 */
77*79847f13STom Rix 	0x00000000, /* DB_HTILE_DATA_BASE */
78*79847f13STom Rix 
79*79847f13STom Rix 	0xc0026900,
80*79847f13STom Rix 	0x0000000a,
81*79847f13STom Rix 	0x00000000, /* DB_STENCIL_CLEAR */
82*79847f13STom Rix 	0x00000000, /* DB_DEPTH_CLEAR */
83*79847f13STom Rix 
84*79847f13STom Rix 	0xc0016900,
85*79847f13STom Rix 	0x000002dc,
86*79847f13STom Rix 	0x0000aa00, /* DB_ALPHA_TO_MASK */
87*79847f13STom Rix 
88*79847f13STom Rix 	0xc0016900,
89*79847f13STom Rix 	0x00000080,
90*79847f13STom Rix 	0x00000000, /* PA_SC_WINDOW_OFFSET */
91*79847f13STom Rix 
92*79847f13STom Rix 	0xc00d6900,
93*79847f13STom Rix 	0x00000083,
94*79847f13STom Rix 	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
95*79847f13STom Rix 	0x00000000, /* PA_SC_CLIPRECT_0_TL */
96*79847f13STom Rix 	0x20002000, /* PA_SC_CLIPRECT_0_BR */
97*79847f13STom Rix 	0x00000000,
98*79847f13STom Rix 	0x20002000,
99*79847f13STom Rix 	0x00000000,
100*79847f13STom Rix 	0x20002000,
101*79847f13STom Rix 	0x00000000,
102*79847f13STom Rix 	0x20002000,
103*79847f13STom Rix 	0xaaaaaaaa, /* PA_SC_EDGERULE */
104*79847f13STom Rix 	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
105*79847f13STom Rix 	0x0000000f, /* CB_TARGET_MASK */
106*79847f13STom Rix 	0x0000000f, /* CB_SHADER_MASK */
107*79847f13STom Rix 
108*79847f13STom Rix 	0xc0226900,
109*79847f13STom Rix 	0x00000094,
110*79847f13STom Rix 	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
111*79847f13STom Rix 	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
112*79847f13STom Rix 	0x80000000,
113*79847f13STom Rix 	0x20002000,
114*79847f13STom Rix 	0x80000000,
115*79847f13STom Rix 	0x20002000,
116*79847f13STom Rix 	0x80000000,
117*79847f13STom Rix 	0x20002000,
118*79847f13STom Rix 	0x80000000,
119*79847f13STom Rix 	0x20002000,
120*79847f13STom Rix 	0x80000000,
121*79847f13STom Rix 	0x20002000,
122*79847f13STom Rix 	0x80000000,
123*79847f13STom Rix 	0x20002000,
124*79847f13STom Rix 	0x80000000,
125*79847f13STom Rix 	0x20002000,
126*79847f13STom Rix 	0x80000000,
127*79847f13STom Rix 	0x20002000,
128*79847f13STom Rix 	0x80000000,
129*79847f13STom Rix 	0x20002000,
130*79847f13STom Rix 	0x80000000,
131*79847f13STom Rix 	0x20002000,
132*79847f13STom Rix 	0x80000000,
133*79847f13STom Rix 	0x20002000,
134*79847f13STom Rix 	0x80000000,
135*79847f13STom Rix 	0x20002000,
136*79847f13STom Rix 	0x80000000,
137*79847f13STom Rix 	0x20002000,
138*79847f13STom Rix 	0x80000000,
139*79847f13STom Rix 	0x20002000,
140*79847f13STom Rix 	0x80000000,
141*79847f13STom Rix 	0x20002000,
142*79847f13STom Rix 	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
143*79847f13STom Rix 	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
144*79847f13STom Rix 
145*79847f13STom Rix 	0xc0016900,
146*79847f13STom Rix 	0x000000d4,
147*79847f13STom Rix 	0x00000000, /* SX_MISC */
148*79847f13STom Rix 
149*79847f13STom Rix 	0xc0026900,
150*79847f13STom Rix 	0x00000292,
151*79847f13STom Rix 	0x00000000, /* PA_SC_MODE_CNTL_0 */
152*79847f13STom Rix 	0x00000000, /* PA_SC_MODE_CNTL_1 */
153*79847f13STom Rix 
154*79847f13STom Rix 	0xc0106900,
155*79847f13STom Rix 	0x00000300,
156*79847f13STom Rix 	0x00000000, /* PA_SC_LINE_CNTL */
157*79847f13STom Rix 	0x00000000, /* PA_SC_AA_CONFIG */
158*79847f13STom Rix 	0x00000005, /* PA_SU_VTX_CNTL */
159*79847f13STom Rix 	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
160*79847f13STom Rix 	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
161*79847f13STom Rix 	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
162*79847f13STom Rix 	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
163*79847f13STom Rix 	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */
164*79847f13STom Rix 	0x00000000, /*  */
165*79847f13STom Rix 	0x00000000, /*  */
166*79847f13STom Rix 	0x00000000, /*  */
167*79847f13STom Rix 	0x00000000, /*  */
168*79847f13STom Rix 	0x00000000, /*  */
169*79847f13STom Rix 	0x00000000, /*  */
170*79847f13STom Rix 	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */
171*79847f13STom Rix 	0xffffffff, /* PA_SC_AA_MASK */
172*79847f13STom Rix 
173*79847f13STom Rix 	0xc00d6900,
174*79847f13STom Rix 	0x00000202,
175*79847f13STom Rix 	0x00cc0010, /* CB_COLOR_CONTROL */
176*79847f13STom Rix 	0x00000210, /* DB_SHADER_CONTROL */
177*79847f13STom Rix 	0x00010000, /* PA_CL_CLIP_CNTL */
178*79847f13STom Rix 	0x00000004, /* PA_SU_SC_MODE_CNTL */
179*79847f13STom Rix 	0x00000100, /* PA_CL_VTE_CNTL */
180*79847f13STom Rix 	0x00000000, /* PA_CL_VS_OUT_CNTL */
181*79847f13STom Rix 	0x00000000, /* PA_CL_NANINF_CNTL */
182*79847f13STom Rix 	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
183*79847f13STom Rix 	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
184*79847f13STom Rix 	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
185*79847f13STom Rix 	0x00000000, /*  */
186*79847f13STom Rix 	0x00000000, /*  */
187*79847f13STom Rix 	0x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */
188*79847f13STom Rix 
189*79847f13STom Rix 	0xc0066900,
190*79847f13STom Rix 	0x000002de,
191*79847f13STom Rix 	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
192*79847f13STom Rix 	0x00000000, /*  */
193*79847f13STom Rix 	0x00000000, /*  */
194*79847f13STom Rix 	0x00000000, /*  */
195*79847f13STom Rix 	0x00000000, /*  */
196*79847f13STom Rix 	0x00000000, /*  */
197*79847f13STom Rix 
198*79847f13STom Rix 	0xc0016900,
199*79847f13STom Rix 	0x00000229,
200*79847f13STom Rix 	0x00000000, /* SQ_PGM_START_FS */
201*79847f13STom Rix 
202*79847f13STom Rix 	0xc0016900,
203*79847f13STom Rix 	0x0000022a,
204*79847f13STom Rix 	0x00000000, /* SQ_PGM_RESOURCES_FS */
205*79847f13STom Rix 
206*79847f13STom Rix 	0xc0096900,
207*79847f13STom Rix 	0x00000100,
208*79847f13STom Rix 	0x00ffffff, /* VGT_MAX_VTX_INDX */
209*79847f13STom Rix 	0x00000000, /*  */
210*79847f13STom Rix 	0x00000000, /*  */
211*79847f13STom Rix 	0x00000000, /*  */
212*79847f13STom Rix 	0x00000000, /* SX_ALPHA_TEST_CONTROL */
213*79847f13STom Rix 	0x00000000, /* CB_BLEND_RED */
214*79847f13STom Rix 	0x00000000, /* CB_BLEND_GREEN */
215*79847f13STom Rix 	0x00000000, /* CB_BLEND_BLUE */
216*79847f13STom Rix 	0x00000000, /* CB_BLEND_ALPHA */
217*79847f13STom Rix 
218*79847f13STom Rix 	0xc0026900,
219*79847f13STom Rix 	0x000002a8,
220*79847f13STom Rix 	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
221*79847f13STom Rix 	0x00000000, /*  */
222*79847f13STom Rix 
223*79847f13STom Rix 	0xc0026900,
224*79847f13STom Rix 	0x000002ad,
225*79847f13STom Rix 	0x00000000, /* VGT_REUSE_OFF */
226*79847f13STom Rix 	0x00000000, /*  */
227*79847f13STom Rix 
228*79847f13STom Rix 	0xc0116900,
229*79847f13STom Rix 	0x00000280,
230*79847f13STom Rix 	0x00000000, /* PA_SU_POINT_SIZE */
231*79847f13STom Rix 	0x00000000, /* PA_SU_POINT_MINMAX */
232*79847f13STom Rix 	0x00000008, /* PA_SU_LINE_CNTL */
233*79847f13STom Rix 	0x00000000, /* PA_SC_LINE_STIPPLE */
234*79847f13STom Rix 	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
235*79847f13STom Rix 	0x00000000, /* VGT_HOS_CNTL */
236*79847f13STom Rix 	0x00000000, /*  */
237*79847f13STom Rix 	0x00000000, /*  */
238*79847f13STom Rix 	0x00000000, /*  */
239*79847f13STom Rix 	0x00000000, /*  */
240*79847f13STom Rix 	0x00000000, /*  */
241*79847f13STom Rix 	0x00000000, /*  */
242*79847f13STom Rix 	0x00000000, /*  */
243*79847f13STom Rix 	0x00000000, /*  */
244*79847f13STom Rix 	0x00000000, /*  */
245*79847f13STom Rix 	0x00000000, /*  */
246*79847f13STom Rix 	0x00000000, /* VGT_GS_MODE */
247*79847f13STom Rix 
248*79847f13STom Rix 	0xc0016900,
249*79847f13STom Rix 	0x000002a1,
250*79847f13STom Rix 	0x00000000, /* VGT_PRIMITIVEID_EN */
251*79847f13STom Rix 
252*79847f13STom Rix 	0xc0016900,
253*79847f13STom Rix 	0x000002a5,
254*79847f13STom Rix 	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
255*79847f13STom Rix 
256*79847f13STom Rix 	0xc0016900,
257*79847f13STom Rix 	0x000002d5,
258*79847f13STom Rix 	0x00000000, /* VGT_SHADER_STAGES_EN */
259*79847f13STom Rix 
260*79847f13STom Rix 	0xc0026900,
261*79847f13STom Rix 	0x000002e5,
262*79847f13STom Rix 	0x00000000, /* VGT_STRMOUT_CONFIG */
263*79847f13STom Rix 	0x00000000, /*  */
264*79847f13STom Rix 
265*79847f13STom Rix 	0xc0016900,
266*79847f13STom Rix 	0x000001e0,
267*79847f13STom Rix 	0x00000000, /* CB_BLEND0_CONTROL */
268*79847f13STom Rix 
269*79847f13STom Rix 	0xc0016900,
270*79847f13STom Rix 	0x000001b1,
271*79847f13STom Rix 	0x00000000, /* SPI_VS_OUT_CONFIG */
272*79847f13STom Rix 
273*79847f13STom Rix 	0xc0016900,
274*79847f13STom Rix 	0x00000187,
275*79847f13STom Rix 	0x00000000, /* SPI_VS_OUT_ID_0 */
276*79847f13STom Rix 
277*79847f13STom Rix 	0xc0016900,
278*79847f13STom Rix 	0x00000191,
279*79847f13STom Rix 	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
280*79847f13STom Rix 
281*79847f13STom Rix 	0xc00b6900,
282*79847f13STom Rix 	0x000001b3,
283*79847f13STom Rix 	0x20000001, /* SPI_PS_IN_CONTROL_0 */
284*79847f13STom Rix 	0x00000000, /* SPI_PS_IN_CONTROL_1 */
285*79847f13STom Rix 	0x00000000, /* SPI_INTERP_CONTROL_0 */
286*79847f13STom Rix 	0x00000000, /* SPI_INPUT_Z */
287*79847f13STom Rix 	0x00000000, /* SPI_FOG_CNTL */
288*79847f13STom Rix 	0x00100000, /* SPI_BARYC_CNTL */
289*79847f13STom Rix 	0x00000000, /* SPI_PS_IN_CONTROL_2 */
290*79847f13STom Rix 	0x00000000, /*  */
291*79847f13STom Rix 	0x00000000, /*  */
292*79847f13STom Rix 	0x00000000, /*  */
293*79847f13STom Rix 	0x00000000, /*  */
294*79847f13STom Rix 
295*79847f13STom Rix 	0xc0026900,
296*79847f13STom Rix 	0x00000316,
297*79847f13STom Rix 	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
298*79847f13STom Rix 	0x00000010, /*  */
299*79847f13STom Rix };
300*79847f13STom Rix 
301*79847f13STom Rix static const u32 evergreen_default_size = ARRAY_SIZE(evergreen_default_state);
302d7ccd8fcSAlex Deucher 
303d7ccd8fcSAlex Deucher #endif
304