xref: /dflybsd-src/sys/dev/drm/radeon/evergreen_blit_shaders.c (revision c59a5c484fdf34b9afa6e283014e4fff693253cc)
1926deccbSFrançois Tigeot /*
2926deccbSFrançois Tigeot  * Copyright 2010 Advanced Micro Devices, Inc.
3926deccbSFrançois Tigeot  *
4926deccbSFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
5926deccbSFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
6926deccbSFrançois Tigeot  * to deal in the Software without restriction, including without limitation
7926deccbSFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8926deccbSFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
9926deccbSFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
10926deccbSFrançois Tigeot  *
11926deccbSFrançois Tigeot  * The above copyright notice and this permission notice (including the next
12926deccbSFrançois Tigeot  * paragraph) shall be included in all copies or substantial portions of the
13926deccbSFrançois Tigeot  * Software.
14926deccbSFrançois Tigeot  *
15926deccbSFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16926deccbSFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17926deccbSFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18926deccbSFrançois Tigeot  * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19926deccbSFrançois Tigeot  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20926deccbSFrançois Tigeot  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21926deccbSFrançois Tigeot  * DEALINGS IN THE SOFTWARE.
22926deccbSFrançois Tigeot  *
23926deccbSFrançois Tigeot  * Authors:
24926deccbSFrançois Tigeot  *     Alex Deucher <alexander.deucher@amd.com>
25926deccbSFrançois Tigeot  */
26926deccbSFrançois Tigeot 
27c4ef309bSzrj #include <linux/bug.h>
28c4ef309bSzrj #include <linux/types.h>
29c4ef309bSzrj #include <linux/kernel.h>
30926deccbSFrançois Tigeot 
31926deccbSFrançois Tigeot /*
32926deccbSFrançois Tigeot  * evergreen cards need to use the 3D engine to blit data which requires
33926deccbSFrançois Tigeot  * quite a bit of hw state setup.  Rather than pull the whole 3D driver
34926deccbSFrançois Tigeot  * (which normally generates the 3D state) into the DRM, we opt to use
35*c59a5c48SFrançois Tigeot  * statically generated state tables.  The register state and shaders
36926deccbSFrançois Tigeot  * were hand generated to support blitting functionality.  See the 3D
37926deccbSFrançois Tigeot  * driver or documentation for descriptions of the registers and
38926deccbSFrançois Tigeot  * shader instructions.
39926deccbSFrançois Tigeot  */
40926deccbSFrançois Tigeot 
41926deccbSFrançois Tigeot const u32 evergreen_default_state[] =
42926deccbSFrançois Tigeot {
43926deccbSFrançois Tigeot 	0xc0016900,
44926deccbSFrançois Tigeot 	0x0000023b,
45926deccbSFrançois Tigeot 	0x00000000, /* SQ_LDS_ALLOC_PS */
46926deccbSFrançois Tigeot 
47926deccbSFrançois Tigeot 	0xc0066900,
48926deccbSFrançois Tigeot 	0x00000240,
49926deccbSFrançois Tigeot 	0x00000000, /* SQ_ESGS_RING_ITEMSIZE */
50926deccbSFrançois Tigeot 	0x00000000,
51926deccbSFrançois Tigeot 	0x00000000,
52926deccbSFrançois Tigeot 	0x00000000,
53926deccbSFrançois Tigeot 	0x00000000,
54926deccbSFrançois Tigeot 	0x00000000,
55926deccbSFrançois Tigeot 
56926deccbSFrançois Tigeot 	0xc0046900,
57926deccbSFrançois Tigeot 	0x00000247,
58926deccbSFrançois Tigeot 	0x00000000, /* SQ_GS_VERT_ITEMSIZE */
59926deccbSFrançois Tigeot 	0x00000000,
60926deccbSFrançois Tigeot 	0x00000000,
61926deccbSFrançois Tigeot 	0x00000000,
62926deccbSFrançois Tigeot 
63926deccbSFrançois Tigeot 	0xc0026900,
64926deccbSFrançois Tigeot 	0x00000010,
65926deccbSFrançois Tigeot 	0x00000000, /* DB_Z_INFO */
66926deccbSFrançois Tigeot 	0x00000000, /* DB_STENCIL_INFO */
67926deccbSFrançois Tigeot 
68926deccbSFrançois Tigeot 	0xc0016900,
69926deccbSFrançois Tigeot 	0x00000200,
70926deccbSFrançois Tigeot 	0x00000000, /* DB_DEPTH_CONTROL */
71926deccbSFrançois Tigeot 
72926deccbSFrançois Tigeot 	0xc0066900,
73926deccbSFrançois Tigeot 	0x00000000,
74926deccbSFrançois Tigeot 	0x00000060, /* DB_RENDER_CONTROL */
75926deccbSFrançois Tigeot 	0x00000000, /* DB_COUNT_CONTROL */
76926deccbSFrançois Tigeot 	0x00000000, /* DB_DEPTH_VIEW */
77926deccbSFrançois Tigeot 	0x0000002a, /* DB_RENDER_OVERRIDE */
78926deccbSFrançois Tigeot 	0x00000000, /* DB_RENDER_OVERRIDE2 */
79926deccbSFrançois Tigeot 	0x00000000, /* DB_HTILE_DATA_BASE */
80926deccbSFrançois Tigeot 
81926deccbSFrançois Tigeot 	0xc0026900,
82926deccbSFrançois Tigeot 	0x0000000a,
83926deccbSFrançois Tigeot 	0x00000000, /* DB_STENCIL_CLEAR */
84926deccbSFrançois Tigeot 	0x00000000, /* DB_DEPTH_CLEAR */
85926deccbSFrançois Tigeot 
86926deccbSFrançois Tigeot 	0xc0016900,
87926deccbSFrançois Tigeot 	0x000002dc,
88926deccbSFrançois Tigeot 	0x0000aa00, /* DB_ALPHA_TO_MASK */
89926deccbSFrançois Tigeot 
90926deccbSFrançois Tigeot 	0xc0016900,
91926deccbSFrançois Tigeot 	0x00000080,
92926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_WINDOW_OFFSET */
93926deccbSFrançois Tigeot 
94926deccbSFrançois Tigeot 	0xc00d6900,
95926deccbSFrançois Tigeot 	0x00000083,
96926deccbSFrançois Tigeot 	0x0000ffff, /* PA_SC_CLIPRECT_RULE */
97926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_CLIPRECT_0_TL */
98926deccbSFrançois Tigeot 	0x20002000, /* PA_SC_CLIPRECT_0_BR */
99926deccbSFrançois Tigeot 	0x00000000,
100926deccbSFrançois Tigeot 	0x20002000,
101926deccbSFrançois Tigeot 	0x00000000,
102926deccbSFrançois Tigeot 	0x20002000,
103926deccbSFrançois Tigeot 	0x00000000,
104926deccbSFrançois Tigeot 	0x20002000,
105926deccbSFrançois Tigeot 	0xaaaaaaaa, /* PA_SC_EDGERULE */
106926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */
107926deccbSFrançois Tigeot 	0x0000000f, /* CB_TARGET_MASK */
108926deccbSFrançois Tigeot 	0x0000000f, /* CB_SHADER_MASK */
109926deccbSFrançois Tigeot 
110926deccbSFrançois Tigeot 	0xc0226900,
111926deccbSFrançois Tigeot 	0x00000094,
112926deccbSFrançois Tigeot 	0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */
113926deccbSFrançois Tigeot 	0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */
114926deccbSFrançois Tigeot 	0x80000000,
115926deccbSFrançois Tigeot 	0x20002000,
116926deccbSFrançois Tigeot 	0x80000000,
117926deccbSFrançois Tigeot 	0x20002000,
118926deccbSFrançois Tigeot 	0x80000000,
119926deccbSFrançois Tigeot 	0x20002000,
120926deccbSFrançois Tigeot 	0x80000000,
121926deccbSFrançois Tigeot 	0x20002000,
122926deccbSFrançois Tigeot 	0x80000000,
123926deccbSFrançois Tigeot 	0x20002000,
124926deccbSFrançois Tigeot 	0x80000000,
125926deccbSFrançois Tigeot 	0x20002000,
126926deccbSFrançois Tigeot 	0x80000000,
127926deccbSFrançois Tigeot 	0x20002000,
128926deccbSFrançois Tigeot 	0x80000000,
129926deccbSFrançois Tigeot 	0x20002000,
130926deccbSFrançois Tigeot 	0x80000000,
131926deccbSFrançois Tigeot 	0x20002000,
132926deccbSFrançois Tigeot 	0x80000000,
133926deccbSFrançois Tigeot 	0x20002000,
134926deccbSFrançois Tigeot 	0x80000000,
135926deccbSFrançois Tigeot 	0x20002000,
136926deccbSFrançois Tigeot 	0x80000000,
137926deccbSFrançois Tigeot 	0x20002000,
138926deccbSFrançois Tigeot 	0x80000000,
139926deccbSFrançois Tigeot 	0x20002000,
140926deccbSFrançois Tigeot 	0x80000000,
141926deccbSFrançois Tigeot 	0x20002000,
142926deccbSFrançois Tigeot 	0x80000000,
143926deccbSFrançois Tigeot 	0x20002000,
144926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_VPORT_ZMIN_0 */
145926deccbSFrançois Tigeot 	0x3f800000, /* PA_SC_VPORT_ZMAX_0 */
146926deccbSFrançois Tigeot 
147926deccbSFrançois Tigeot 	0xc0016900,
148926deccbSFrançois Tigeot 	0x000000d4,
149926deccbSFrançois Tigeot 	0x00000000, /* SX_MISC */
150926deccbSFrançois Tigeot 
151926deccbSFrançois Tigeot 	0xc0026900,
152926deccbSFrançois Tigeot 	0x00000292,
153926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_MODE_CNTL_0 */
154926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_MODE_CNTL_1 */
155926deccbSFrançois Tigeot 
156926deccbSFrançois Tigeot 	0xc0106900,
157926deccbSFrançois Tigeot 	0x00000300,
158926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_LINE_CNTL */
159926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_AA_CONFIG */
160926deccbSFrançois Tigeot 	0x00000005, /* PA_SU_VTX_CNTL */
161926deccbSFrançois Tigeot 	0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */
162926deccbSFrançois Tigeot 	0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */
163926deccbSFrançois Tigeot 	0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */
164926deccbSFrançois Tigeot 	0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */
165926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_0 */
166926deccbSFrançois Tigeot 	0x00000000, /*  */
167926deccbSFrançois Tigeot 	0x00000000, /*  */
168926deccbSFrançois Tigeot 	0x00000000, /*  */
169926deccbSFrançois Tigeot 	0x00000000, /*  */
170926deccbSFrançois Tigeot 	0x00000000, /*  */
171926deccbSFrançois Tigeot 	0x00000000, /*  */
172926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_AA_SAMPLE_LOCS_7 */
173926deccbSFrançois Tigeot 	0xffffffff, /* PA_SC_AA_MASK */
174926deccbSFrançois Tigeot 
175926deccbSFrançois Tigeot 	0xc00d6900,
176926deccbSFrançois Tigeot 	0x00000202,
177926deccbSFrançois Tigeot 	0x00cc0010, /* CB_COLOR_CONTROL */
178926deccbSFrançois Tigeot 	0x00000210, /* DB_SHADER_CONTROL */
179926deccbSFrançois Tigeot 	0x00010000, /* PA_CL_CLIP_CNTL */
180926deccbSFrançois Tigeot 	0x00000004, /* PA_SU_SC_MODE_CNTL */
181926deccbSFrançois Tigeot 	0x00000100, /* PA_CL_VTE_CNTL */
182926deccbSFrançois Tigeot 	0x00000000, /* PA_CL_VS_OUT_CNTL */
183926deccbSFrançois Tigeot 	0x00000000, /* PA_CL_NANINF_CNTL */
184926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */
185926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */
186926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_PRIM_FILTER_CNTL */
187926deccbSFrançois Tigeot 	0x00000000, /*  */
188926deccbSFrançois Tigeot 	0x00000000, /*  */
189926deccbSFrançois Tigeot 	0x00000000, /* SQ_DYN_GPR_RESOURCE_LIMIT_1 */
190926deccbSFrançois Tigeot 
191926deccbSFrançois Tigeot 	0xc0066900,
192926deccbSFrançois Tigeot 	0x000002de,
193926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */
194926deccbSFrançois Tigeot 	0x00000000, /*  */
195926deccbSFrançois Tigeot 	0x00000000, /*  */
196926deccbSFrançois Tigeot 	0x00000000, /*  */
197926deccbSFrançois Tigeot 	0x00000000, /*  */
198926deccbSFrançois Tigeot 	0x00000000, /*  */
199926deccbSFrançois Tigeot 
200926deccbSFrançois Tigeot 	0xc0016900,
201926deccbSFrançois Tigeot 	0x00000229,
202926deccbSFrançois Tigeot 	0x00000000, /* SQ_PGM_START_FS */
203926deccbSFrançois Tigeot 
204926deccbSFrançois Tigeot 	0xc0016900,
205926deccbSFrançois Tigeot 	0x0000022a,
206926deccbSFrançois Tigeot 	0x00000000, /* SQ_PGM_RESOURCES_FS */
207926deccbSFrançois Tigeot 
208926deccbSFrançois Tigeot 	0xc0096900,
209926deccbSFrançois Tigeot 	0x00000100,
210926deccbSFrançois Tigeot 	0x00ffffff, /* VGT_MAX_VTX_INDX */
211926deccbSFrançois Tigeot 	0x00000000, /*  */
212926deccbSFrançois Tigeot 	0x00000000, /*  */
213926deccbSFrançois Tigeot 	0x00000000, /*  */
214926deccbSFrançois Tigeot 	0x00000000, /* SX_ALPHA_TEST_CONTROL */
215926deccbSFrançois Tigeot 	0x00000000, /* CB_BLEND_RED */
216926deccbSFrançois Tigeot 	0x00000000, /* CB_BLEND_GREEN */
217926deccbSFrançois Tigeot 	0x00000000, /* CB_BLEND_BLUE */
218926deccbSFrançois Tigeot 	0x00000000, /* CB_BLEND_ALPHA */
219926deccbSFrançois Tigeot 
220926deccbSFrançois Tigeot 	0xc0026900,
221926deccbSFrançois Tigeot 	0x000002a8,
222926deccbSFrançois Tigeot 	0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */
223926deccbSFrançois Tigeot 	0x00000000, /*  */
224926deccbSFrançois Tigeot 
225926deccbSFrançois Tigeot 	0xc0026900,
226926deccbSFrançois Tigeot 	0x000002ad,
227926deccbSFrançois Tigeot 	0x00000000, /* VGT_REUSE_OFF */
228926deccbSFrançois Tigeot 	0x00000000, /*  */
229926deccbSFrançois Tigeot 
230926deccbSFrançois Tigeot 	0xc0116900,
231926deccbSFrançois Tigeot 	0x00000280,
232926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_POINT_SIZE */
233926deccbSFrançois Tigeot 	0x00000000, /* PA_SU_POINT_MINMAX */
234926deccbSFrançois Tigeot 	0x00000008, /* PA_SU_LINE_CNTL */
235926deccbSFrançois Tigeot 	0x00000000, /* PA_SC_LINE_STIPPLE */
236926deccbSFrançois Tigeot 	0x00000000, /* VGT_OUTPUT_PATH_CNTL */
237926deccbSFrançois Tigeot 	0x00000000, /* VGT_HOS_CNTL */
238926deccbSFrançois Tigeot 	0x00000000, /*  */
239926deccbSFrançois Tigeot 	0x00000000, /*  */
240926deccbSFrançois Tigeot 	0x00000000, /*  */
241926deccbSFrançois Tigeot 	0x00000000, /*  */
242926deccbSFrançois Tigeot 	0x00000000, /*  */
243926deccbSFrançois Tigeot 	0x00000000, /*  */
244926deccbSFrançois Tigeot 	0x00000000, /*  */
245926deccbSFrançois Tigeot 	0x00000000, /*  */
246926deccbSFrançois Tigeot 	0x00000000, /*  */
247926deccbSFrançois Tigeot 	0x00000000, /*  */
248926deccbSFrançois Tigeot 	0x00000000, /* VGT_GS_MODE */
249926deccbSFrançois Tigeot 
250926deccbSFrançois Tigeot 	0xc0016900,
251926deccbSFrançois Tigeot 	0x000002a1,
252926deccbSFrançois Tigeot 	0x00000000, /* VGT_PRIMITIVEID_EN */
253926deccbSFrançois Tigeot 
254926deccbSFrançois Tigeot 	0xc0016900,
255926deccbSFrançois Tigeot 	0x000002a5,
256926deccbSFrançois Tigeot 	0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */
257926deccbSFrançois Tigeot 
258926deccbSFrançois Tigeot 	0xc0016900,
259926deccbSFrançois Tigeot 	0x000002d5,
260926deccbSFrançois Tigeot 	0x00000000, /* VGT_SHADER_STAGES_EN */
261926deccbSFrançois Tigeot 
262926deccbSFrançois Tigeot 	0xc0026900,
263926deccbSFrançois Tigeot 	0x000002e5,
264926deccbSFrançois Tigeot 	0x00000000, /* VGT_STRMOUT_CONFIG */
265926deccbSFrançois Tigeot 	0x00000000, /*  */
266926deccbSFrançois Tigeot 
267926deccbSFrançois Tigeot 	0xc0016900,
268926deccbSFrançois Tigeot 	0x000001e0,
269926deccbSFrançois Tigeot 	0x00000000, /* CB_BLEND0_CONTROL */
270926deccbSFrançois Tigeot 
271926deccbSFrançois Tigeot 	0xc0016900,
272926deccbSFrançois Tigeot 	0x000001b1,
273926deccbSFrançois Tigeot 	0x00000000, /* SPI_VS_OUT_CONFIG */
274926deccbSFrançois Tigeot 
275926deccbSFrançois Tigeot 	0xc0016900,
276926deccbSFrançois Tigeot 	0x00000187,
277926deccbSFrançois Tigeot 	0x00000000, /* SPI_VS_OUT_ID_0 */
278926deccbSFrançois Tigeot 
279926deccbSFrançois Tigeot 	0xc0016900,
280926deccbSFrançois Tigeot 	0x00000191,
281926deccbSFrançois Tigeot 	0x00000100, /* SPI_PS_INPUT_CNTL_0 */
282926deccbSFrançois Tigeot 
283926deccbSFrançois Tigeot 	0xc00b6900,
284926deccbSFrançois Tigeot 	0x000001b3,
285926deccbSFrançois Tigeot 	0x20000001, /* SPI_PS_IN_CONTROL_0 */
286926deccbSFrançois Tigeot 	0x00000000, /* SPI_PS_IN_CONTROL_1 */
287926deccbSFrançois Tigeot 	0x00000000, /* SPI_INTERP_CONTROL_0 */
288926deccbSFrançois Tigeot 	0x00000000, /* SPI_INPUT_Z */
289926deccbSFrançois Tigeot 	0x00000000, /* SPI_FOG_CNTL */
290926deccbSFrançois Tigeot 	0x00100000, /* SPI_BARYC_CNTL */
291926deccbSFrançois Tigeot 	0x00000000, /* SPI_PS_IN_CONTROL_2 */
292926deccbSFrançois Tigeot 	0x00000000, /*  */
293926deccbSFrançois Tigeot 	0x00000000, /*  */
294926deccbSFrançois Tigeot 	0x00000000, /*  */
295926deccbSFrançois Tigeot 	0x00000000, /*  */
296926deccbSFrançois Tigeot 
297926deccbSFrançois Tigeot 	0xc0026900,
298926deccbSFrançois Tigeot 	0x00000316,
299926deccbSFrançois Tigeot 	0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */
300926deccbSFrançois Tigeot 	0x00000010, /*  */
301926deccbSFrançois Tigeot };
302926deccbSFrançois Tigeot 
303c4ef309bSzrj const u32 evergreen_default_size = ARRAY_SIZE(evergreen_default_state);
304