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