File drivers/gpu/alga/amd/si/patterns/tri.c deleted (index 0601d0e..0000000) |
1 |
|
/* |
|
2 |
|
author Sylvain Bertrand <digital.ragnarok@gmail.com> |
|
3 |
|
Protected by GNU Affero GPL v3 with some exceptions. |
|
4 |
|
See README at root of alga tree. |
|
5 |
|
*/ |
|
6 |
|
#include <linux/module.h> |
|
7 |
|
#include <linux/pci.h> |
|
8 |
|
#include <linux/cdev.h> |
|
9 |
|
|
|
10 |
|
#include <alga/rng_mng.h> |
|
11 |
|
#include <alga/pixel_fmts.h> |
|
12 |
|
#include <alga/timing.h> |
|
13 |
|
#include <alga/amd/atombios/atb.h> |
|
14 |
|
#include <alga/amd/dce6/dce6.h> |
|
15 |
|
#include <alga/amd/si/ioctl.h> |
|
16 |
|
|
|
17 |
|
#include "mc.h" |
|
18 |
|
#include "rlc.h" |
|
19 |
|
#include "ih.h" |
|
20 |
|
#include "fence.h" |
|
21 |
|
#include "ring.h" |
|
22 |
|
#include "dmas.h" |
|
23 |
|
#include "bus/ba.h" |
|
24 |
|
#include "gpu/cps.h" |
|
25 |
|
#include "gpu/gpu.h" |
|
26 |
|
#include "drv.h" |
|
27 |
|
|
|
28 |
|
#include "regs.h" |
|
29 |
|
|
|
30 |
|
/* |
|
31 |
|
* XXX:This code is made to work on little endian 64 bits host systems. |
|
32 |
|
*/ |
|
33 |
|
|
|
34 |
|
#define IB_DWS_N_MAX (16 * 64) |
|
35 |
|
struct ib { |
|
36 |
|
u64 gpu_addr; |
|
37 |
|
u32 dws; |
|
38 |
|
u32 d[IB_DWS_N_MAX]; |
|
39 |
|
}; |
|
40 |
|
|
|
41 |
|
static u64 vtx_buf; |
|
42 |
|
static u64 vs_buf; |
|
43 |
|
static u64 ps_buf; |
|
44 |
|
static struct ib ib; |
|
45 |
|
|
|
46 |
|
struct vertex { |
|
47 |
|
float position[4]; |
|
48 |
|
float param0[4]; |
|
49 |
|
}; |
|
50 |
|
|
|
51 |
|
static struct vertex vertices[4] = { |
|
52 |
|
{ |
|
53 |
|
{ -0.2f, -0.9f, 0.0f, 1.0f }, |
|
54 |
|
{ 1.0f, 0.0f, 0.0f, 1.0f } |
|
55 |
|
}, |
|
56 |
|
{ |
|
57 |
|
{ -0.9f, 0.9f, 0.0f, 1.0f }, |
|
58 |
|
{ 0.0f, 1.0f, 0.0f, 1.0f } |
|
59 |
|
}, |
|
60 |
|
{ |
|
61 |
|
{ 0.9f, 0.9f, 0.0f, 1.0f }, |
|
62 |
|
{ 0.0f, 0.0f, 1.0f, 1.0f } |
|
63 |
|
}, |
|
64 |
|
{ |
|
65 |
|
{ 0, 0, 0, 0 }, |
|
66 |
|
{ 0, 0, 0, 0 } |
|
67 |
|
} |
|
68 |
|
}; |
|
69 |
|
|
|
70 |
|
static u32 buf_res_descs[] = { |
|
71 |
|
/* init with the vram lower 32 bits vertex position buffer address */ |
|
72 |
|
0x00000000, |
|
73 |
|
/* |
|
74 |
|
* oring the upper 8 remaining bits of buffer address. |
|
75 |
|
* stride=0x20 (8 floats (4 position+4 color components) of 4 bytes. |
|
76 |
|
*/ |
|
77 |
|
0x00200000, |
|
78 |
|
/* 4 records, namely 4 vertices, the last one in "null" */ |
|
79 |
|
0x00000004, |
|
80 |
|
/* |
|
81 |
|
* dst_sel_x=4(x) dst_sel_y=5(y) dst_sel_z=6(z) dest_sel_w=7(w) |
|
82 |
|
* nfmt=7(float) dfmt=14(32_32_32_32) |
|
83 |
|
*/ |
|
84 |
|
0x00077fac, |
|
85 |
|
/*--------------------------------------------------------------------*/ |
|
86 |
|
/* init with the vram lower 32 bits vertex param 0 buffer address */ |
|
87 |
|
0x00000000, |
|
88 |
|
/* |
|
89 |
|
* oring the upper 8 remaining bits of buffer address. |
|
90 |
|
* stride=0x20 (8 floats (4 position+4 param 0 components) of 4 bytes. |
|
91 |
|
*/ |
|
92 |
|
0x00200000, |
|
93 |
|
/* 4 records, namely 4 vertices, the last one in "null" */ |
|
94 |
|
0x00000004, |
|
95 |
|
/* |
|
96 |
|
* dst_sel_x=4(r) dst_sel_y=5(g) dst_sel_z=6(b) dst_sel_w=7(a) |
|
97 |
|
* (customary to use color terminology for params) |
|
98 |
|
* nfmt=7(float) dfmt=14(32_32_32_32) |
|
99 |
|
*/ |
|
100 |
|
0x00077fac |
|
101 |
|
}; |
|
102 |
|
|
|
103 |
|
/* |
|
104 |
|
* o USER_SGPR[3:0]<--buffer resouce descriptor of the buffer of vertex |
|
105 |
|
* positions |
|
106 |
|
* o USER_SGPR[7:4]<--buffer resouce descriptor of the buffer of vertex |
|
107 |
|
* parameter 0 (unused here) |
|
108 |
|
* note: the done bit in export instructions is only for vertex positions. |
|
109 |
|
*/ |
|
110 |
|
static const u8 vs_vgprs_n=9; |
|
111 |
|
static const u8 vs_user_sgprs_n=8; |
|
112 |
|
static const u8 vs_sgprs_n=8;/* at least vs_user_sgprs_n */ |
|
113 |
|
static const u8 vs_exported_params_n=1; |
|
114 |
|
static u32 vs[] = { |
|
115 |
|
0xe00c2000,/* buffer_load_format_xyzw idxen=1 */ |
|
116 |
|
0x80000100,/* soffset=128(=0) vdata=1 */ |
|
117 |
|
0xbf8c0000,/* s_waitcnt */ |
|
118 |
|
0xe00c2000,/* buffer_load_format_xyzw idxen=1 */ |
|
119 |
|
0x80010500,/* soffset=128(=0) srsrc=1(sgprs[4:7]) vdata=5 */ |
|
120 |
|
0xbf8c0000,/* s_waitcnt */ |
|
121 |
|
0xf80008cf,/* export en=0b1111 done=1 tgt=12(pos0) */ |
|
122 |
|
0x04030201,/* vsrc0=1 vsrc1=2 vsrc2=3 vsrc3=4 */ |
|
123 |
|
0xbf8c0000,/* s_waitcnt */ |
|
124 |
|
0xf800020f,/* export en=0b1111 tgt=32(param0) */ |
|
125 |
|
0x08070605,/* vsrc0=5 vsrc1=6 vsrc2=7 vsrc3=8 */ |
|
126 |
|
0xbf8c0000,/* s_waitcnt */ |
|
127 |
|
0xbf810000/* s_endpgm */ |
|
128 |
|
}; |
|
129 |
|
|
|
130 |
|
/* |
|
131 |
|
* m0 is put by the spi right after the last user pre-loaded sgprs. m0 must |
|
132 |
|
* be loaded in order to index properly the parameters in lds. |
|
133 |
|
* note: we don't deal with the "valid mask" for pixer en exec register. |
|
134 |
|
*/ |
|
135 |
|
static const u8 ps_vgprs_n=4; |
|
136 |
|
static const u8 ps_user_sgprs_n=0; |
|
137 |
|
static const u8 ps_sgprs_n=0;/* at least ps_user_sgprs_n */ |
|
138 |
|
static u32 ps[] = { |
|
139 |
|
0x7e0002f2,/* v_mov_b32 src0=242(1.0f) vdst=0 */ |
|
140 |
|
0xbf8c0000,/* s_waitcnt */ |
|
141 |
|
0x7e0202f2,/* v_mov_b32 src0=242(1.0f) vdst=1 */ |
|
142 |
|
0xbf8c0000,/* s_waitcnt */ |
|
143 |
|
0x7e0402f2,/* v_mov_b32 src0=242(1.0f) vdst=2 */ |
|
144 |
|
0xbf8c0000,/* s_waitcnt */ |
|
145 |
|
0x7e0602f2,/* v_mov_b32 src0=242(1.0f) vdst=3 */ |
|
146 |
|
0xbf8c0000,/* s_waitcnt */ |
|
147 |
|
0x5e000300,/* v_cvt_pkrtz_f16_f32 vdst=0 vsrc1=1 src0=256(vgpr0) */ |
|
148 |
|
0x5e020702,/* v_cvt_pkrtz_f16_f32 vdst=1 vsrc1=3 src0=258(vgpr2) */ |
|
149 |
|
0xf8001c0f,/* exp vm=1 done=1 compr=1 en=0x1111 */ |
|
150 |
|
0x01000100,/* vsrc3=1 vsrc2=0 vsrc1=1 vsrc0=0 */ |
|
151 |
|
0xbf8c0000,/* s_waitcnt */ |
|
152 |
|
0xbf810000/* s_endpgm */ |
|
153 |
|
}; |
|
154 |
|
|
|
155 |
|
static void ctx_vgt(struct pci_dev *dev) |
|
156 |
|
{ |
|
157 |
|
/* VGT (Vertex Grouper and Tesselator block) */ |
|
158 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 5); |
|
159 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_MAX_VTX_IDX); |
|
160 |
|
/* VGT_MAX_VTX_IDX */ |
|
161 |
|
ib.d[ib.dws++]=~0; |
|
162 |
|
/* VGT_MIN_VTX_IDX */ |
|
163 |
|
ib.d[ib.dws++]=0; |
|
164 |
|
/* VGT_IDX_OF */ |
|
165 |
|
ib.d[ib.dws++]=0; |
|
166 |
|
/* VGT_MULTI_PRIM_IB_RESET_IDX */ |
|
167 |
|
ib.d[ib.dws++]=0; |
|
168 |
|
|
|
169 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
170 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_MULTI_PRIM_IB_RESET_ENA); |
|
171 |
|
/* VGT_MULTI_PRIM_IB_RESET_ENA */ |
|
172 |
|
ib.d[ib.dws++]=0; |
|
173 |
|
} |
|
174 |
|
|
|
175 |
|
static void ctx_spi_sh_vs(struct pci_dev *dev) |
|
176 |
|
{ |
|
177 |
|
/* setup specific for the vertex shader */ |
|
178 |
|
|
|
179 |
|
/* Tell the spi to pre-load the buffer descriptors in user sgprs */ |
|
180 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_SH_REG,9); |
|
181 |
|
ib.d[ib.dws++]=SH_REG_IDX(SPI_SH_USER_DATA_VS_0); |
|
182 |
|
/* SPI_SH_USER_DATA_VS_0 */ |
|
183 |
|
ib.d[ib.dws++]=buf_res_descs[0]; |
|
184 |
|
/* SPI_SH_USER_DATA_VS_1 */ |
|
185 |
|
ib.d[ib.dws++]=buf_res_descs[1]; |
|
186 |
|
/* SPI_SH_USER_DATA_VS_2 */ |
|
187 |
|
ib.d[ib.dws++]=buf_res_descs[2]; |
|
188 |
|
/* SPI_SH_USER_DATA_VS_3 */ |
|
189 |
|
ib.d[ib.dws++]=buf_res_descs[3]; |
|
190 |
|
/* SPI_SH_USER_DATA_VS_4 */ |
|
191 |
|
ib.d[ib.dws++]=buf_res_descs[4]; |
|
192 |
|
/* SPI_SH_USER_DATA_VS_5 */ |
|
193 |
|
ib.d[ib.dws++]=buf_res_descs[5]; |
|
194 |
|
/* SPI_SH_USER_DATA_VS_6 */ |
|
195 |
|
ib.d[ib.dws++]=buf_res_descs[6]; |
|
196 |
|
/* SPI_SH_USER_DATA_VS_7 */ |
|
197 |
|
ib.d[ib.dws++]=buf_res_descs[7]; |
|
198 |
|
|
|
199 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_SH_REG, 5); |
|
200 |
|
ib.d[ib.dws++]=SH_REG_IDX(SPI_SH_PGM_LO_VS); |
|
201 |
|
/* SPI_SH_PGM_LO_VS */ |
|
202 |
|
ib.d[ib.dws++]=lower_32_bits(vs_buf>>8); |
|
203 |
|
/* SPI_SH_PGM_HI_VS */ |
|
204 |
|
ib.d[ib.dws++]=set(SSPHV_MEM_BASE, upper_32_bits(vs_buf>>8)); |
|
205 |
|
/* |
|
206 |
|
* SPI_SH_PGM_RSRC_VS_0: the vgrs are allocated using units of 4 vgprs, |
|
207 |
|
* sgprs using units of 8 sgprs. Don't forget to book 2 additionnal |
|
208 |
|
* sgprs for vcc. Both counts are minus one unit. |
|
209 |
|
*/ |
|
210 |
|
ib.d[ib.dws++]=set(SSPRV_VGPRS, ((vs_vgprs_n - 1) / 4)) |
|
211 |
|
| set (SSPRV_SGPRS, ((vs_sgprs_n + 2) - 1) / 8); |
|
212 |
|
/* |
|
213 |
|
* SPI_SH_PGM_RSRC_VS_1: tell the spi the count of sgprs which are not |
|
214 |
|
* vcc. |
|
215 |
|
*/ |
|
216 |
|
ib.d[ib.dws++]=set(SSPRV_USER_SGPR, vs_user_sgprs_n); |
|
217 |
|
|
|
218 |
|
/* our vertex shader export only the color as parameter */ |
|
219 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
220 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_VS_OUT_CFG); |
|
221 |
|
/* SPI_VS_OUT_CFG */ |
|
222 |
|
ib.d[ib.dws++]=set(SVOC_VS_PARAM_EXPORT_COUNT, |
|
223 |
|
vs_exported_params_n - 1); |
|
224 |
|
|
|
225 |
|
/* |
|
226 |
|
* The spi needs to be told what packing format is used by the vertex |
|
227 |
|
* shader to export the position. |
|
228 |
|
*/ |
|
229 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
230 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_SH_POS_FMT); |
|
231 |
|
/* SPI_SH_POS_FMT */ |
|
232 |
|
ib.d[ib.dws++]=set(SSPF_POS_0_EXPORT_FMT, SSPF_4COMP); |
|
233 |
|
} |
|
234 |
|
|
|
235 |
|
static void ctx_spi_sh_ps(struct pci_dev *dev) |
|
236 |
|
{ |
|
237 |
|
/* setup specific for the pixel/fragment shader */ |
|
238 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_SH_REG, 5); |
|
239 |
|
ib.d[ib.dws++]=SH_REG_IDX(SPI_SH_PGM_LO_PS); |
|
240 |
|
/* SPI_SH_PGM_LO_PS */ |
|
241 |
|
ib.d[ib.dws++]=lower_32_bits(ps_buf>>8); |
|
242 |
|
/* SPI_SH_PGM_HI_PS */ |
|
243 |
|
ib.d[ib.dws++]=set(SSPHP_MEM_BASE, upper_32_bits(ps_buf>>8)); |
|
244 |
|
/* |
|
245 |
|
* SPI_SH_PGM_RSRC_PS_0: we must account 1 additional sgpr for m0 since |
|
246 |
|
* which will be loaded in the sgpr right after the last user sgpr. |
|
247 |
|
*/ |
|
248 |
|
ib.d[ib.dws++]=set(SSPRP_VGPRS, ((ps_vgprs_n - 1) / 4)) |
|
249 |
|
| set(SSPRP_SGPRS, ((ps_sgprs_n + 1 + 2) - 1) / 8); |
|
250 |
|
/* |
|
251 |
|
* SPI_SH_PGM_RSRC_PS_1: same constrains than the vertex shaders |
|
252 |
|
* plus the fact the spi will load the m0 in the first sgpr after the |
|
253 |
|
* last user loaded sgpr, namely sgpr6 in this case. |
|
254 |
|
*/ |
|
255 |
|
ib.d[ib.dws++]=set(SSPRP_USER_SGPR, ps_sgprs_n); |
|
256 |
|
|
|
257 |
|
/* |
|
258 |
|
* tell the spi the pixel/fragment shader will need perpective center |
|
259 |
|
* interpolation data in input (mandatory or gpu hang) |
|
260 |
|
*/ |
|
261 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
262 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_PS_INPUT_ENA); |
|
263 |
|
/* SPI_PS_INPUT_ENA */ |
|
264 |
|
ib.d[ib.dws++]=SPIE_PERSP_CENTER_ENA; |
|
265 |
|
/* SPI_PS_INPUT_ADDR */ |
|
266 |
|
ib.d[ib.dws++]=SPIA_PERSP_CENTER_ENA; |
|
267 |
|
|
|
268 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
269 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_PS_IN_CTL); |
|
270 |
|
/* SPI_PS_IN_CTL: 1 parameter to interpolate. Must have at least one */ |
|
271 |
|
ib.d[ib.dws++]=set(SPIC_INTERP_N, 1); |
|
272 |
|
|
|
273 |
|
/* don't care about z depth export */ |
|
274 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
275 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_SH_Z_FMT); |
|
276 |
|
/* SPI_SH_Z_FMT */ |
|
277 |
|
ib.d[ib.dws++]=set(SSZF_Z_EXPORT_FMT, SSZF_ZERO); |
|
278 |
|
|
|
279 |
|
/* only 1 input param on 32, then only SPI_PS_INPUT_CTL_00 */ |
|
280 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
281 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_PS_INPUT_CTL_00); |
|
282 |
|
/* SPI_PS_INPUT_CTL_00 */ |
|
283 |
|
ib.d[ib.dws++]=0; |
|
284 |
|
|
|
285 |
|
/* |
|
286 |
|
* The spi sends the pixel color exported by a pixel/fragment shader to |
|
287 |
|
* a cb, it needs to be told about the special color packing format the |
|
288 |
|
* shader used. |
|
289 |
|
*/ |
|
290 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
291 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_SH_COLOR_FMT); |
|
292 |
|
/* SPI_SH_COLOR_FMT */ |
|
293 |
|
ib.d[ib.dws++]=set(SSCF_COLOR_0_EXPORT_FMT, SSCF_FP16_ABGR); |
|
294 |
|
} |
|
295 |
|
|
|
296 |
|
static void ctx_spi_sh(struct pci_dev *dev) |
|
297 |
|
{ |
|
298 |
|
/* SH (SHader block) */ |
|
299 |
|
ctx_spi_sh_vs(dev); |
|
300 |
|
ctx_spi_sh_ps(dev); |
|
301 |
|
} |
|
302 |
|
|
|
303 |
|
static void ctx_spi(struct pci_dev *dev) |
|
304 |
|
{ |
|
305 |
|
/* SPI (Shader Processor Interpolator) */ |
|
306 |
|
/* disable the point primitive sprite */ |
|
307 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
308 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_INTERPOL_CTL_0); |
|
309 |
|
/* SPI_INTERPOL_CTL_0 */ |
|
310 |
|
ib.d[ib.dws++]=0; |
|
311 |
|
|
|
312 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
313 |
|
ib.d[ib.dws++]=CTX_REG_IDX(SPI_BARYC_CTL); |
|
314 |
|
/* SPI_BARYC_CTL: want 0 in working sample */ |
|
315 |
|
ib.d[ib.dws++]=0; |
|
316 |
|
|
|
317 |
|
ctx_spi_sh(dev); |
|
318 |
|
} |
|
319 |
|
|
|
320 |
|
static void ctx_dbs(struct pci_dev *dev) |
|
321 |
|
{ |
|
322 |
|
/* DBs (Depth Blocks) */ |
|
323 |
|
/* disable the depth stencil/z-buffer */ |
|
324 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
325 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_Z_INFO); |
|
326 |
|
/* DB_Z_INFO */ |
|
327 |
|
ib.d[ib.dws++]=0; |
|
328 |
|
/* DB_STENCIL_INFO */ |
|
329 |
|
ib.d[ib.dws++]=0; |
|
330 |
|
|
|
331 |
|
/* even if disabled, setup some clean values in a few regs */ |
|
332 |
|
|
|
333 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
334 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_DEPTH_CTL); |
|
335 |
|
/* DB_DEPTH_CTL */ |
|
336 |
|
ib.d[ib.dws++]=0; |
|
337 |
|
|
|
338 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 5); |
|
339 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_DEPTH_BOUNDS_MIN); |
|
340 |
|
/* DB_DEPTH_BOUNDS_MIN */ |
|
341 |
|
ib.d[ib.dws++]=0; |
|
342 |
|
/* DB_DEPTH_BOUNDS_MAX */ |
|
343 |
|
ib.d[ib.dws++]=0; |
|
344 |
|
/* DB_STENCIL_CLR */ |
|
345 |
|
ib.d[ib.dws++]=0; |
|
346 |
|
/* DB_DEPTH_CLR */ |
|
347 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
348 |
|
|
|
349 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
350 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_RENDER_CTL); |
|
351 |
|
/* DB_RENDER_CTL */ |
|
352 |
|
ib.d[ib.dws++]=0; |
|
353 |
|
|
|
354 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
355 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_RENDER_OVERRIDE_0); |
|
356 |
|
/* DB_RENDER_OVERRIDE_0 */ |
|
357 |
|
ib.d[ib.dws++]=set(DRO_FORCE_HIZ_ENA, DRO_FORCE_DIS) |
|
358 |
|
| set(DRO_FORCE_HIS_ENA_0, DRO_FORCE_DIS) |
|
359 |
|
| set(DRO_FORCE_HIS_ENA_1, DRO_FORCE_DIS); |
|
360 |
|
|
|
361 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
362 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_STENCIL_CTL); |
|
363 |
|
/* DB_STENCIL_CTL */ |
|
364 |
|
ib.d[ib.dws++]=0; |
|
365 |
|
|
|
366 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 4); |
|
367 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_SRESULTS_CMP_STATE_0); |
|
368 |
|
/* DB_SRESULTS_CMP_STATE_0 */ |
|
369 |
|
ib.d[ib.dws++]=0; |
|
370 |
|
/* DB_SRESULTS_CMP_STATE_1 */ |
|
371 |
|
ib.d[ib.dws++]=0; |
|
372 |
|
/* DB_PRELOAD_CTL */ |
|
373 |
|
ib.d[ib.dws++]=0; |
|
374 |
|
|
|
375 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
376 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_ALPHA_TO_MASK); |
|
377 |
|
/* DB_ALPHA_TO_MASK */ |
|
378 |
|
ib.d[ib.dws++]=set(DATM_ALPHA_TO_MASK_OF_0, 2) |
|
379 |
|
| set(DATM_ALPHA_TO_MASK_OF_1, 2) |
|
380 |
|
| set(DATM_ALPHA_TO_MASK_OF_2, 2) |
|
381 |
|
| set(DATM_ALPHA_TO_MASK_OF_3, 2); |
|
382 |
|
|
|
383 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
384 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_STENCILREFMASK); |
|
385 |
|
/* DB_STENCILREFMASK */ |
|
386 |
|
ib.d[ib.dws++]=0; |
|
387 |
|
/* DB_STENCILREFMASK_BF */ |
|
388 |
|
ib.d[ib.dws++]=0; |
|
389 |
|
|
|
390 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
391 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_SH_CTL); |
|
392 |
|
/* DB_SH_CTL */ |
|
393 |
|
ib.d[ib.dws++]=set(DSC_Z_ORDER, DSC_EARLY_Z_THEN_LATE_Z); |
|
394 |
|
} |
|
395 |
|
|
|
396 |
|
static void ctx_cb_0(struct pci_dev *dev, struct ptn_tri *p) |
|
397 |
|
{ |
|
398 |
|
/* CB 0 (Color Block 0) */ |
|
399 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 7); |
|
400 |
|
ib.d[ib.dws++]=CTX_REG_IDX(CB_0_COLOR_BASE); |
|
401 |
|
/* CB_0_COLOR_BASE */ |
|
402 |
|
ib.d[ib.dws++]=p->fb_gpu_addr >> 8; |
|
403 |
|
/* CB_0_COLOR_PITCH: a thin1 tile is 8x8 pixels */ |
|
404 |
|
ib.d[ib.dws++]=set(CCP_TILE_MAX, p->w / 8 - 1); |
|
405 |
|
/* CB_0_COLOR_SLICE: a thin1 tile is 8x8 pixels */ |
|
406 |
|
ib.d[ib.dws++]=set(CCS_TILE_MAX, p->w * p->h / 64 - 1); |
|
407 |
|
/* CB_0_COLOR_VIEW: 0, or last tile index for an array of slices */ |
|
408 |
|
ib.d[ib.dws++]=0; |
|
409 |
|
/* |
|
410 |
|
* CB_0_COLOR_INFO: for sRGB color space, in 8 bits little endian argb, |
|
411 |
|
* the color component swap is ALT for the color components from the |
|
412 |
|
* pixel/fragment shader and value must be clamped before and after |
|
413 |
|
* blending to mrt range. |
|
414 |
|
*/ |
|
415 |
|
ib.d[ib.dws++]=set(CCI_ENDIAN, CCI_ENDIAN_NONE) |
|
416 |
|
| set(CCI_FMT, CCI_COLOR_8_8_8_8) |
|
417 |
|
| set(CCI_COMP_SWAP, CCI_SWAP_ALT) |
|
418 |
|
| set(CCI_NUMBER_TYPE, CCI_NUMBER_UNORM) |
|
419 |
|
| CCI_BLEND_CLAMP; |
|
420 |
|
/* CB_0_COLOR_ATTRIB: see gpu/tiling.c */ |
|
421 |
|
ib.d[ib.dws++]=set(CCA_TILE_MODE_IDX, 8); |
|
422 |
|
} |
|
423 |
|
|
|
424 |
|
static void ctx_cbs_blend(struct pci_dev *dev) |
|
425 |
|
{ |
|
426 |
|
/* blend blocks of CBs (Color Blocks) */ |
|
427 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 9); |
|
428 |
|
ib.d[ib.dws++]=CTX_REG_IDX(CB_0_BLEND_CTL); |
|
429 |
|
/* CB_0_BLEND_CTL: disable blending */ |
|
430 |
|
ib.d[ib.dws++]=0; |
|
431 |
|
/* CB_1_BLEND_CTL: disable blending */ |
|
432 |
|
ib.d[ib.dws++]=0; |
|
433 |
|
/* CB_2_BLEND_CTL: disable blending */ |
|
434 |
|
ib.d[ib.dws++]=0; |
|
435 |
|
/* CB_3_BLEND_CTL: disable blending */ |
|
436 |
|
ib.d[ib.dws++]=0; |
|
437 |
|
/* CB_4_BLEND_CTL: disable blending */ |
|
438 |
|
ib.d[ib.dws++]=0; |
|
439 |
|
/* CB_5_BLEND_CTL: disable blending */ |
|
440 |
|
ib.d[ib.dws++]=0; |
|
441 |
|
/* CB_6_BLEND_CTL: disable blending */ |
|
442 |
|
ib.d[ib.dws++]=0; |
|
443 |
|
/* CB_7_BLEND_CTL: disable blending */ |
|
444 |
|
ib.d[ib.dws++]=0; |
|
445 |
|
} |
|
446 |
|
|
|
447 |
|
static void ctx_cbs(struct pci_dev *dev, struct ptn_tri *p) |
|
448 |
|
{ |
|
449 |
|
/* CBs (Color Blocks) */ |
|
450 |
|
ctx_cbs_blend(dev); |
|
451 |
|
|
|
452 |
|
ctx_cb_0(dev, p); |
|
453 |
|
|
|
454 |
|
/* |
|
455 |
|
* do enable all color components (RGBA) from the pixel/fragment shader |
|
456 |
|
* to be used by the CB 0 and do enable CB 0 to output all computed |
|
457 |
|
* color components to target (here our framebuffer) |
|
458 |
|
*/ |
|
459 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
460 |
|
ib.d[ib.dws++]=CTX_REG_IDX(CB_TGT_MASK); |
|
461 |
|
/* CB_TGT_MASK */ |
|
462 |
|
ib.d[ib.dws++]=set(CTM_TGT_0_ENA, CTM_TGT_RED | CTM_TGT_GREEN |
|
463 |
|
| CTM_TGT_BLUE | CTM_TGT_ALPHA); |
|
464 |
|
/* CB_SH_MASK */ |
|
465 |
|
ib.d[ib.dws++]=set(CSM_OUTPUT_0_ENA, CSM_OUTPUT_RED | CSM_OUTPUT_GREEN |
|
466 |
|
| CSM_OUTPUT_BLUE | CSM_OUTPUT_ALPHA); |
|
467 |
|
|
|
468 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
469 |
|
ib.d[ib.dws++]=CTX_REG_IDX(CB_COLOR_CTL); |
|
470 |
|
/* CB_COLOR_CTL: switch normal mode for all CBs */ |
|
471 |
|
ib.d[ib.dws++]=set(CCC_MODE, CCC_CB_NORMAL) | set(CCC_ROP3, CCC_0XCC); |
|
472 |
|
} |
|
473 |
|
|
|
474 |
|
static void ctx_pa_su(struct pci_dev *dev) |
|
475 |
|
{ |
|
476 |
|
/* PA (Primitive Assembler) SU (Setup Unit) */ |
|
477 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
478 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SU_VTX_CTL); |
|
479 |
|
/* |
|
480 |
|
* PA_SU_VTX_CTL: tells the PA (Primitive Assembler) SU (Setup Unit) |
|
481 |
|
* to place the(?) pixel at the center of the vertex? |
|
482 |
|
*/ |
|
483 |
|
ib.d[ib.dws++]=PSVC_PIX_CENTER; |
|
484 |
|
|
|
485 |
|
/* |
|
486 |
|
* setup for the PA (Primitive Assembler) SU (Setup Unit) for the |
|
487 |
|
* point/line primitive rendering: we do not render point |
|
488 |
|
* or line primitives. |
|
489 |
|
* Set it to 8 like in working samples |
|
490 |
|
*/ |
|
491 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 4); |
|
492 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SU_POINT_SZ); |
|
493 |
|
/* PA_SU_POINT_SZ */ |
|
494 |
|
ib.d[ib.dws++]=set(PSPS_H, 8) | set(PSPS_W, 8); |
|
495 |
|
/* PA_SU_POINT_MINMAX */ |
|
496 |
|
ib.d[ib.dws++]=set(PSPM_MIN, 8) | set(PSPM_MAX, 8); |
|
497 |
|
/* PA_SU_LINE_CTL */ |
|
498 |
|
ib.d[ib.dws++]=set(PSLC_W, 8); |
|
499 |
|
|
|
500 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
501 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SU_POLY_OF_CLAMP); |
|
502 |
|
/* |
|
503 |
|
* PA_SU_POLY_OF_CLAMP: tell the PA (Primitive Assembler) SU |
|
504 |
|
* (Setup Unit) for polygon not to clamp something ? |
|
505 |
|
*/ |
|
506 |
|
ib.d[ib.dws++]=0; |
|
507 |
|
|
|
508 |
|
/* related to the SC (Scan Converter) */ |
|
509 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
510 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SU_SC_MODE_CTL); |
|
511 |
|
/* PA_SU_SC_MODE_CTL: removed FACE to follow working samples */ |
|
512 |
|
ib.d[ib.dws++]=set(PSSMC_POLY_MODE_FRONT_PTYPE, PSSMC_DRAW_TRIANGLES) |
|
513 |
|
| set(PSSMC_POLY_MODE_BACK_PTYPE, PSSMC_DRAW_TRIANGLES) |
|
514 |
|
| PSSMC_PROVOKING_VTX_LAST; |
|
515 |
|
|
|
516 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
517 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SU_PRIM_FILTER_CTL); |
|
518 |
|
/* PA_SU_PRIM_FILTER_CTL */ |
|
519 |
|
ib.d[ib.dws++]=0; |
|
520 |
|
} |
|
521 |
|
|
|
522 |
|
static void ctx_pa_cl(struct pci_dev *dev) |
|
523 |
|
{ |
|
524 |
|
/* PA (Primitive Assembler) CL (CLipper) */ |
|
525 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 5); |
|
526 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_CL_GB_VERT_CLIP_ADJ); |
|
527 |
|
/* disable GB (Guard Band) by setting those registers to 1.0f */ |
|
528 |
|
/* PA_CL_GB_VERT_CLIP_ADJ */ |
|
529 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
530 |
|
/* PA_CL_GB_VERT_DISC_ADJ */ |
|
531 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
532 |
|
/* PA_CL_GB_HORZ_CLIP_ADJ */ |
|
533 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
534 |
|
/* PA_CL_GB_HORZ_DISC_ADJ */ |
|
535 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
536 |
|
|
|
537 |
|
/* |
|
538 |
|
* define the way the PA (Primitive Assembler) CL (CLipper) will |
|
539 |
|
* behave regarding NAN (Not A Number) and INF (INFinity) values |
|
540 |
|
*/ |
|
541 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
542 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_CL_NANINF_CTL); |
|
543 |
|
/* PA_CL_NANINF_CTL: to hardware default behaviour */ |
|
544 |
|
ib.d[ib.dws++]=0; |
|
545 |
|
|
|
546 |
|
/* no clipping done on the input from the vertex shader */ |
|
547 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
548 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_CL_VS_OUT_CTL); |
|
549 |
|
/* PA_CL_VS_OUT_CTL */ |
|
550 |
|
ib.d[ib.dws++]=0; |
|
551 |
|
|
|
552 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
553 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_CL_CLIP_CTL); |
|
554 |
|
/* PA_CL_CLIP_CTL: ucp mode 3=always expand and clip as trifan */ |
|
555 |
|
ib.d[ib.dws++]=set(PCCC_PS_UCP_MODE, 3) | PCCC_DX_LINEAR_ATTR_CLIP_ENA; |
|
556 |
|
} |
|
557 |
|
|
|
558 |
|
static void ctx_pa_sc_vport_0_te(struct pci_dev *dev, struct ptn_tri *p) |
|
559 |
|
{ |
|
560 |
|
/* |
|
561 |
|
* PA (Primitive Assembler) SC (Scan Converter) VPORT (ViewPORT) 0 TE |
|
562 |
|
* (Transform Engine) |
|
563 |
|
*/ |
|
564 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 7); |
|
565 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_VPORT_0_TE_X_SCALE); |
|
566 |
|
/* PA_SC_VPORT_0_TE_X_SCALE */ |
|
567 |
|
ib.d[ib.dws++]=f2u(p->w / 2.0f); |
|
568 |
|
/* PA_SC_VPORT_0_TE_X_OF */ |
|
569 |
|
ib.d[ib.dws++]=f2u(p->w / 2.0f); |
|
570 |
|
/* PA_SC_VPORT_0_TE_Y_SCALE */ |
|
571 |
|
ib.d[ib.dws++]=f2u(p->h / 2.0f); |
|
572 |
|
/* PA_SC_VPORT_0_TE_Y_OF */ |
|
573 |
|
ib.d[ib.dws++]=f2u(p->h / 2.0f); |
|
574 |
|
/* PA_SC_VPORT_0_TE_Z_SCALE: stick to working sample values */ |
|
575 |
|
ib.d[ib.dws++]=f2u(0.5f); |
|
576 |
|
/* PA_SC_VPORT_0_TE_Z_OF: stick to working sample values */ |
|
577 |
|
ib.d[ib.dws++]=f2u(0.5f); |
|
578 |
|
|
|
579 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
580 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_VPORT_0_TE_ZMIN); |
|
581 |
|
/* PA_SC_VPORT_0_TE_ZMIN: min Z value from VPORT TE */ |
|
582 |
|
ib.d[ib.dws++]=f2u(0.0f); |
|
583 |
|
/* PA_SC_VPORT_0_TE_ZMAX: max Z value from VPORT TE */ |
|
584 |
|
ib.d[ib.dws++]=f2u(1.0f); |
|
585 |
|
} |
|
586 |
|
|
|
587 |
|
static void ctx_pa_sc_vport_0(struct pci_dev *dev, struct ptn_tri *p) |
|
588 |
|
{ |
|
589 |
|
/* PA (Primitive Assembler) SC (Scan Converter) VPORT (ViewPORT) 0 */ |
|
590 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
591 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_VPORT_0_SCISSOR_TL); |
|
592 |
|
/* PA_SC_VPORT_0_SCISSOR_TL */ |
|
593 |
|
ib.d[ib.dws++]=set(PSVST_X, 0) | set(PSVST_Y, 0); |
|
594 |
|
/* PA_SC_VPORT_0_SCISSOR_BR */ |
|
595 |
|
ib.d[ib.dws++]=set(PSVSB_X, p->w) | set(PSVSB_Y, p->h); |
|
596 |
|
|
|
597 |
|
ctx_pa_sc_vport_0_te(dev, p); |
|
598 |
|
} |
|
599 |
|
|
|
600 |
|
static void ctx_pa_sc_vports_te(struct pci_dev *dev) |
|
601 |
|
{ |
|
602 |
|
/* |
|
603 |
|
* PA (Primitive Assembler) SC (Scan Converter) VPORT (ViewPORT) |
|
604 |
|
* TE (Transform Engine) |
|
605 |
|
*/ |
|
606 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
607 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_VPORT_TE_CTL); |
|
608 |
|
/* PA_SC_VPORT_TE_CTL: no so called perpective division */ |
|
609 |
|
ib.d[ib.dws++]=PSVTC_VPORT_X_SCALE_ENA | PSVTC_VPORT_X_OF_ENA |
|
610 |
|
| PSVTC_VPORT_Y_SCALE_ENA | PSVTC_VPORT_Y_OF_ENA |
|
611 |
|
| PSVTC_VPORT_Z_SCALE_ENA | PSVTC_VPORT_Z_OF_ENA |
|
612 |
|
| PSVTC_VTX_W0_FMT; |
|
613 |
|
} |
|
614 |
|
|
|
615 |
|
static void ctx_pa_sc_vports(struct pci_dev *dev, struct ptn_tri *p) |
|
616 |
|
{ |
|
617 |
|
/* PA (Primitive Assembler) SC (Scan Converter) VPORT (ViewPORT) */ |
|
618 |
|
ctx_pa_sc_vport_0(dev, p); |
|
619 |
|
ctx_pa_sc_vports_te(dev); |
|
620 |
|
} |
|
621 |
|
|
|
622 |
|
static void ctx_pa_sc(struct pci_dev *dev, struct ptn_tri *p) |
|
623 |
|
{ |
|
624 |
|
/* PA (Primitive Assembler) SC (Scan Converter) */ |
|
625 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
626 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_MODE_CTL_0); |
|
627 |
|
/* PA_SC_MODE_CTL_0 */ |
|
628 |
|
ib.d[ib.dws++]=0; |
|
629 |
|
/* PA_SC_MODE_CTL_1 */ |
|
630 |
|
ib.d[ib.dws++]=0; |
|
631 |
|
|
|
632 |
|
/* defines how to render the edge of primitives */ |
|
633 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
634 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_EDGERULE); |
|
635 |
|
/* PA_SC_EDGERULE */ |
|
636 |
|
ib.d[ib.dws++]=0xaaaaaaaa; |
|
637 |
|
|
|
638 |
|
/*--------------------------------------------------------------------*/ |
|
639 |
|
/* Anti-Aliasing... probably */ |
|
640 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
641 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_AA_CFG); |
|
642 |
|
/* PA_SC_AA_CFG */ |
|
643 |
|
ib.d[ib.dws++]=0; |
|
644 |
|
|
|
645 |
|
/* do something AA related */ |
|
646 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
647 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_AA_MASK_X0Y0_X1Y0); |
|
648 |
|
/* PA_SC_AA_MASK_X0Y0_X1Y0 */ |
|
649 |
|
ib.d[ib.dws++]=0xffffffff; |
|
650 |
|
/* PA_SC_AA_MASK_X0Y1_X1Y1 */ |
|
651 |
|
ib.d[ib.dws++]=0xffffffff; |
|
652 |
|
/*--------------------------------------------------------------------*/ |
|
653 |
|
|
|
654 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 10); |
|
655 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_CLIPRECT_RULE); |
|
656 |
|
/* |
|
657 |
|
* PA_SC_CLIPRECT_RULE: no scissor required then clip rule |
|
658 |
|
* is 0xffff (no specs provided) |
|
659 |
|
*/ |
|
660 |
|
ib.d[ib.dws++]=set(PSCR_CLIP_RULE, 0xffff); |
|
661 |
|
/* PA_SC_CLIPRECT_0_TL */ |
|
662 |
|
ib.d[ib.dws++]=0; |
|
663 |
|
/* PA_SC_CLIPRECT_0_BR */ |
|
664 |
|
ib.d[ib.dws++]=set(PSCB_X, p->w) | set(PSCB_Y, p->h); |
|
665 |
|
/* PA_SC_CLIPRECT_1_TL */ |
|
666 |
|
ib.d[ib.dws++]=0; |
|
667 |
|
/* PA_SC_CLIPRECT_1_BR */ |
|
668 |
|
ib.d[ib.dws++]=set(PSCB_X, p->w) | set(PSCB_Y, p->h); |
|
669 |
|
/* PA_SC_CLIPRECT_2_TL */ |
|
670 |
|
ib.d[ib.dws++]=0; |
|
671 |
|
/* PA_SC_CLIPRECT_2_BR */ |
|
672 |
|
ib.d[ib.dws++]=set(PSCB_X, p->w) | set(PSCB_Y, p->h); |
|
673 |
|
/* PA_SC_CLIPRECT_3_TL */ |
|
674 |
|
ib.d[ib.dws++]=0; |
|
675 |
|
/* PA_SC_CLIPRECT_3_BR */ |
|
676 |
|
ib.d[ib.dws++]=set(PSCB_X, p->w) | set(PSCB_Y, p->h); |
|
677 |
|
|
|
678 |
|
/*--------------------------------------------------------------------*/ |
|
679 |
|
/* |
|
680 |
|
* Tells the SC (Scan Converter/rasteriser) we don't use |
|
681 |
|
* line stipple since we do not render line primitives. |
|
682 |
|
* XXX: ORed register? Because if not will set all bits to 0! |
|
683 |
|
* We only want to set to 0 LINE_STIPPLE_ENA. |
|
684 |
|
*/ |
|
685 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
686 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_LINE_STIPPLE); |
|
687 |
|
/* PA_SC_LINE_STIPPLE */ |
|
688 |
|
ib.d[ib.dws++]=0; |
|
689 |
|
|
|
690 |
|
/* |
|
691 |
|
* Even if we are not rendering line primitives, tells the |
|
692 |
|
* PA (Primitive Assembler) SC (scan converter/rasteriser) |
|
693 |
|
* to do "something with the last pixel |
|
694 |
|
*/ |
|
695 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
696 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_LINE_CTL); |
|
697 |
|
/* PA_SC_LINE_CTL */ |
|
698 |
|
ib.d[ib.dws++]=PSLC_LAST_PIXEL; |
|
699 |
|
/*--------------------------------------------------------------------*/ |
|
700 |
|
|
|
701 |
|
/*--------------------------------------------------------------------*/ |
|
702 |
|
/* set the value of the scissors */ |
|
703 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
704 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_GENERIC_SCISSOR_TL); |
|
705 |
|
/* PA_SC_GENERIC_SCISSOR_TL */ |
|
706 |
|
ib.d[ib.dws++]=set(PSGST_X, 0) | set(PSGST_Y, 0); |
|
707 |
|
/* PA_SC_GENERIC_SCISSOR_BR */ |
|
708 |
|
ib.d[ib.dws++]=set(PSGSB_X, p->w) | set(PSGSB_Y, p->h); |
|
709 |
|
|
|
710 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
711 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_SCREEN_SCISSOR_TL); |
|
712 |
|
/* PA_SC_SCREEN_SCISSOR_TL */ |
|
713 |
|
ib.d[ib.dws++]=set(PSSST_X, 0) | set(PSSST_Y, 0); |
|
714 |
|
/* PA_SC_SCREEN_SCISSOR_BR */ |
|
715 |
|
ib.d[ib.dws++]=set(PSSSB_X, p->w) | set(PSSSB_Y, p->h); |
|
716 |
|
|
|
717 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 4); |
|
718 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_WND_OF); |
|
719 |
|
/* |
|
720 |
|
* PA_SC_WND_OF: the window offset in the screen which can be used by |
|
721 |
|
* many scissors. |
|
722 |
|
*/ |
|
723 |
|
ib.d[ib.dws++]=0; |
|
724 |
|
/* PA_SC_WND_SCISSOR_TL */ |
|
725 |
|
ib.d[ib.dws++]=set(PSWST_X, 0) | set(PSWST_Y, 0); |
|
726 |
|
/* PA_SC_WND_SCISSOR_BR */ |
|
727 |
|
ib.d[ib.dws++]=set(PSWSB_X, p->w) | set(PSWSB_Y, p->h); |
|
728 |
|
/*--------------------------------------------------------------------*/ |
|
729 |
|
|
|
730 |
|
ctx_pa_sc_vports(dev, p); |
|
731 |
|
} |
|
732 |
|
|
|
733 |
|
static void ctx_pa(struct pci_dev *dev, struct ptn_tri *p) |
|
734 |
|
{ |
|
735 |
|
/* PA (Primitive Assembler) */ |
|
736 |
|
ctx_pa_su(dev); |
|
737 |
|
ctx_pa_cl(dev); |
|
738 |
|
ctx_pa_sc(dev, p); |
|
739 |
|
} |
|
740 |
|
|
|
741 |
|
void ctx_misc_init(struct pci_dev *dev) |
|
742 |
|
{ |
|
743 |
|
/*--------------------------------------------------------------------*/ |
|
744 |
|
/* basic init GPU context, XXX: not using the CLR_CTX command ??? */ |
|
745 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 14); |
|
746 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_OUTPUT_PATH_CTL); |
|
747 |
|
/* VGT_OUTPUT_PATH_CTL */ |
|
748 |
|
ib.d[ib.dws++]=0; |
|
749 |
|
/* VGT_HOS_CTL */ |
|
750 |
|
ib.d[ib.dws++]=0; |
|
751 |
|
/* VGT_HOS_MAX_TESS_LVL */ |
|
752 |
|
ib.d[ib.dws++]=0; |
|
753 |
|
/* VGT_HOS_MIN_TESS_LVL */ |
|
754 |
|
ib.d[ib.dws++]=0; |
|
755 |
|
/* VGT_HOS_REUSE_DEPTH */ |
|
756 |
|
ib.d[ib.dws++]=0; |
|
757 |
|
/* VGT_GROUP_PRIM_TYPE */ |
|
758 |
|
ib.d[ib.dws++]=0; |
|
759 |
|
/* VGT_GROUP_FIRST_DECR */ |
|
760 |
|
ib.d[ib.dws++]=0; |
|
761 |
|
/* VGT_GROUP_DECR */ |
|
762 |
|
ib.d[ib.dws++]=0; |
|
763 |
|
/* VGT_GROUP_VECT_0_CTL */ |
|
764 |
|
ib.d[ib.dws++]=0; |
|
765 |
|
/* VGT_GROUP_VECT_1_CTL */ |
|
766 |
|
ib.d[ib.dws++]=0; |
|
767 |
|
/* VGT_GROUP_VECT_0_FMT_CTL */ |
|
768 |
|
ib.d[ib.dws++]=0; |
|
769 |
|
/* VGT_GROUP_VECT_1_FMT_CTL */ |
|
770 |
|
ib.d[ib.dws++]=0; |
|
771 |
|
/* VGT_GS_MODE */ |
|
772 |
|
ib.d[ib.dws++]=0; |
|
773 |
|
|
|
774 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
775 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_PRIM_ID_ENA); |
|
776 |
|
/* VGT_PRIM_ID_ENA */ |
|
777 |
|
ib.d[ib.dws++]=0; |
|
778 |
|
|
|
779 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
780 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_PRIM_ID_RESET); |
|
781 |
|
/* VGT_PRIM_ID_RESET */ |
|
782 |
|
ib.d[ib.dws++]=0; |
|
783 |
|
|
|
784 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
785 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_STRMOUT_CFG); |
|
786 |
|
/* VGT_STRMOUT_CFG */ |
|
787 |
|
ib.d[ib.dws++]=0; |
|
788 |
|
/* VGT_STRMOUT_BUF_CFG */ |
|
789 |
|
ib.d[ib.dws++]=0; |
|
790 |
|
|
|
791 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
792 |
|
ib.d[ib.dws++]=CTX_REG_IDX(IA_MULTI_VGT_PARAM); |
|
793 |
|
/* IA_MULTI_VGT_PARAM */ |
|
794 |
|
ib.d[ib.dws++]=IMVP_SWITCH_ON_EOP | IMVP_PARTIAL_VS_WAVE_ON |
|
795 |
|
| set(IMVP_PRIM_GROUP_SZ, 63); |
|
796 |
|
|
|
797 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
798 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_REUSE_OFF); |
|
799 |
|
/* VGT_REUSE_OFF */ |
|
800 |
|
ib.d[ib.dws++]=0; |
|
801 |
|
/* VGT_VTX_CNT_ENA */ |
|
802 |
|
ib.d[ib.dws++]=0; |
|
803 |
|
|
|
804 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
805 |
|
ib.d[ib.dws++]=CTX_REG_IDX(VGT_SHADER_STAGES_ENA); |
|
806 |
|
/* VGT_SHADER_STAGES_ENA */ |
|
807 |
|
ib.d[ib.dws++]=0; |
|
808 |
|
|
|
809 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 3); |
|
810 |
|
ib.d[ib.dws++]=CTX_REG_IDX(PA_SC_CENTROID_PRIORITY_0); |
|
811 |
|
/* PA_SC_CENTROID_PRIORITY_0 */ |
|
812 |
|
ib.d[ib.dws++]=0x76543210; |
|
813 |
|
/* PA_SC_CENTROID_PRIORITY_1 */ |
|
814 |
|
ib.d[ib.dws++]=0xfedcba98; |
|
815 |
|
|
|
816 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CTX_REG, 2); |
|
817 |
|
ib.d[ib.dws++]=CTX_REG_IDX(DB_EQAA); |
|
818 |
|
/* DB_EQAA */ |
|
819 |
|
ib.d[ib.dws++]=0x00110000; |
|
820 |
|
/*--------------------------------------------------------------------*/ |
|
821 |
|
} |
|
822 |
|
|
|
823 |
|
/* |
|
824 |
|
* Config reg programming, then, in theory, flushing before modifiying their |
|
825 |
|
* values. If same value for *ALL* accel code, should go into the linux |
|
826 |
|
* module to be set once and for all. |
|
827 |
|
*/ |
|
828 |
|
static void cfg(struct pci_dev *dev, struct ptn_tri *p) |
|
829 |
|
{ |
|
830 |
|
/*--------------------------------------------------------------------*/ |
|
831 |
|
/* VGT (Vertex Grouper and Tesselator block) */ |
|
832 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CFG_REG, 2); |
|
833 |
|
ib.d[ib.dws++]=CFG_REG_IDX(VGT_PRIM_TYPE); |
|
834 |
|
/* VGT_PRIM_TYPE */ |
|
835 |
|
ib.d[ib.dws++]=set(VPT_PRIM_TYPE, VPT_TRILIST); |
|
836 |
|
/*--------------------------------------------------------------------*/ |
|
837 |
|
|
|
838 |
|
/*--------------------------------------------------------------------*/ |
|
839 |
|
/* PA (Primitive Assembler) CL (CLipper) */ |
|
840 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CFG_REG, 2); |
|
841 |
|
ib.d[ib.dws++]=CFG_REG_IDX(PA_CL_ENHANCE); |
|
842 |
|
/* PA_CL_ENHANCE */ |
|
843 |
|
ib.d[ib.dws++]=set(PCE_CLIP_SEQ_N, 3) | PCE_CLIP_VTX_REORDER_ENA; |
|
844 |
|
/*--------------------------------------------------------------------*/ |
|
845 |
|
} |
|
846 |
|
|
|
847 |
|
static void ctx(struct pci_dev *dev, struct ptn_tri *p) |
|
848 |
|
{ |
|
849 |
|
ctx_misc_init(dev); |
|
850 |
|
ctx_vgt(dev); |
|
851 |
|
ctx_spi(dev); |
|
852 |
|
ctx_pa(dev, p); |
|
853 |
|
ctx_dbs(dev); |
|
854 |
|
ctx_cbs(dev, p); |
|
855 |
|
} |
|
856 |
|
|
|
857 |
|
static void indirect_cpy(struct pci_dev *dev, u64 dst, u32 *src, u64 dws) |
|
858 |
|
{ |
|
859 |
|
while (dws--) { |
|
860 |
|
vram_w32(dev, *src, dst); |
|
861 |
|
++src; |
|
862 |
|
dst += sizeof(u32); |
|
863 |
|
} |
|
864 |
|
} |
|
865 |
|
|
|
866 |
|
/* build raw commands and raw buffer to render a basic triangle primitive */ |
|
867 |
|
long ptn_tri(struct pci_dev *dev, struct ptn_tri *p) |
|
868 |
|
{ |
|
869 |
|
struct dev_drv_data *dd; |
|
870 |
|
long r; |
|
871 |
|
|
|
872 |
|
dev_info(&dev->dev, "pattern triangle:fb=0x%016llx,w=%u,h=%u,pixel_fmt=%s\n", |
|
873 |
|
p->fb_gpu_addr, p->w, p->h, alga_pixel_fmts_str[p->pixel_fmt]); |
|
874 |
|
dd = pci_get_drvdata(dev); |
|
875 |
|
|
|
876 |
|
/*--------------------------------------------------------------------*/ |
|
877 |
|
/* copy the vertex array (position + color ) in vram */ |
|
878 |
|
r = rng_alloc_align(&vtx_buf, &dd->vram.mng, sizeof(vertices), 4 * 4); |
|
879 |
|
if (r != 0) { |
|
880 |
|
dev_err(&dev->dev, "pattern triangle:unable to allocate vertex buffer in (v)ram\n"); |
|
881 |
|
return -ENOMEM; |
|
882 |
|
} |
|
883 |
|
if (sizeof(vertices) & 0x3) { |
|
884 |
|
dev_err(&dev->dev, "pattern triangle:vertices size not dword aligned\n"); |
|
885 |
|
return -EINVAL; |
|
886 |
|
} |
|
887 |
|
indirect_cpy(dev, vtx_buf, (u32*)&vertices[0], sizeof(vertices) >> 2); |
|
888 |
|
/*--------------------------------------------------------------------*/ |
|
889 |
|
|
|
890 |
|
/*--------------------------------------------------------------------*/ |
|
891 |
|
/* copy the buffer resource descriptors in vram */ |
|
892 |
|
|
|
893 |
|
/* vertex position buffer start address */ |
|
894 |
|
buf_res_descs[0] = lower_32_bits(vtx_buf); |
|
895 |
|
buf_res_descs[1] |= upper_32_bits(vtx_buf); |
|
896 |
|
/* vertex color buffer start address */ |
|
897 |
|
buf_res_descs[4] = lower_32_bits(vtx_buf + 4 * sizeof(float)); |
|
898 |
|
buf_res_descs[5] |= upper_32_bits(vtx_buf + 4 * sizeof(float)); |
|
899 |
|
/*--------------------------------------------------------------------*/ |
|
900 |
|
|
|
901 |
|
/*--------------------------------------------------------------------*/ |
|
902 |
|
/* copy the vertex shader in vram */ |
|
903 |
|
r = rng_alloc_align(&vs_buf, &dd->vram.mng, sizeof(vs), 256); |
|
904 |
|
if (r != 0) { |
|
905 |
|
dev_err(&dev->dev, "pattern triangle:unable to allocate vertex shader buffer in (v)ram\n"); |
|
906 |
|
return -ENOMEM; |
|
907 |
|
} |
|
908 |
|
if (sizeof(vs) & 0x3) { |
|
909 |
|
dev_err(&dev->dev, "pattern triangle:vertex shader size not dword aligned\n"); |
|
910 |
|
return -EINVAL; |
|
911 |
|
} |
|
912 |
|
indirect_cpy(dev, vs_buf, &vs[0], sizeof(vs) >> 2); |
|
913 |
|
/*--------------------------------------------------------------------*/ |
|
914 |
|
|
|
915 |
|
/*--------------------------------------------------------------------*/ |
|
916 |
|
/* copy the pixel/fragment shader in vram */ |
|
917 |
|
r = rng_alloc_align(&ps_buf, &dd->vram.mng, sizeof(ps), 256); |
|
918 |
|
if (r != 0) { |
|
919 |
|
dev_err(&dev->dev, "pattern triangle:unable to allocate pixel/fragment shader buffer in (v)ram\n"); |
|
920 |
|
return -ENOMEM; |
|
921 |
|
} |
|
922 |
|
if (sizeof(ps) & 0x3) { |
|
923 |
|
dev_err(&dev->dev, "pattern triangle:pixel/fragment shader size not dword aligned\n"); |
|
924 |
|
return -EINVAL; |
|
925 |
|
} |
|
926 |
|
indirect_cpy(dev, ps_buf, &ps[0], sizeof(ps) >> 2); |
|
927 |
|
/*--------------------------------------------------------------------*/ |
|
928 |
|
|
|
929 |
|
/*--------------------------------------------------------------------*/ |
|
930 |
|
/* create the indirect buffer */ |
|
931 |
|
r = rng_alloc_align(&ib.gpu_addr, &dd->vram.mng, sizeof(ib.d), 16 * 4); |
|
932 |
|
if (r != 0) { |
|
933 |
|
dev_err(&dev->dev, "pattern triangle:unable to indirect buffer in (v)ram\n"); |
|
934 |
|
return -ENOMEM; |
|
935 |
|
} |
|
936 |
|
ib.dws=0; |
|
937 |
|
/*--------------------------------------------------------------------*/ |
|
938 |
|
|
|
939 |
|
/*--------------------------------------------------------------------*/ |
|
940 |
|
/* sync shader caches, texture cache, color block caches */ |
|
941 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CFG_REG, 2); |
|
942 |
|
ib.d[ib.dws++]=CFG_REG_IDX(CP_COHER_CTL_1); |
|
943 |
|
ib.d[ib.dws++]=0; |
|
944 |
|
ib.d[ib.dws++]=PKT3(PKT3_SURF_SYNC, 4); |
|
945 |
|
/* CP_COHER_CTL_0 */ |
|
946 |
|
ib.d[ib.dws++]=CCC_SH_ICACHE_ACTION_ENA | CCC_SH_KCACHE_ACTION_ENA |
|
947 |
|
| CCC_TC_ACTION_ENA | CCC_CB_ACTION_ENA |
|
948 |
|
| CCC_CB0_DEST_BASE_ENA; |
|
949 |
|
/* CP_COHER_SZ */ |
|
950 |
|
ib.d[ib.dws++]=0xffffffff; |
|
951 |
|
/* CP_COHER_BASE */ |
|
952 |
|
ib.d[ib.dws++]=0; |
|
953 |
|
ib.d[ib.dws++]=0x0000000a;/* polling interval, 0xa(10) * 16 clocks */ |
|
954 |
|
/*--------------------------------------------------------------------*/ |
|
955 |
|
|
|
956 |
|
/*--------------------------------------------------------------------*/ |
|
957 |
|
/* seems mandatory at the start of a command stream */ |
|
958 |
|
ib.d[ib.dws++]=PKT3(PKT3_CTX_CTL, 2); |
|
959 |
|
ib.d[ib.dws++]=0x80000000; |
|
960 |
|
ib.d[ib.dws++]=0x80000000; |
|
961 |
|
/*--------------------------------------------------------------------*/ |
|
962 |
|
|
|
963 |
|
/*====================================================================*/ |
|
964 |
|
/* the real thing is here */ |
|
965 |
|
cfg(dev, p); |
|
966 |
|
ctx(dev, p); |
|
967 |
|
/*====================================================================*/ |
|
968 |
|
|
|
969 |
|
/*--------------------------------------------------------------------*/ |
|
970 |
|
/* the draw command launch */ |
|
971 |
|
ib.d[ib.dws++]=PKT3(PKT3_IDX_TYPE, 1); |
|
972 |
|
ib.d[ib.dws++]=set(PKT3_SZ, PKT3_16BITS); |
|
973 |
|
|
|
974 |
|
ib.d[ib.dws++]=PKT3(PKT3_INST_N, 1); |
|
975 |
|
ib.d[ib.dws++]=1; |
|
976 |
|
|
|
977 |
|
ib.d[ib.dws++]=PKT3(PKT3_DRAW_IDX_AUTO, 2); |
|
978 |
|
/* 3 indices to generate */ |
|
979 |
|
ib.d[ib.dws++]=3; |
|
980 |
|
/* VGT_DRAW_INITIATOR */ |
|
981 |
|
ib.d[ib.dws++]=set(VDI_SRC_SELECT, VDI_AUTO_IDX); |
|
982 |
|
/*--------------------------------------------------------------------*/ |
|
983 |
|
|
|
984 |
|
/*--------------------------------------------------------------------*/ |
|
985 |
|
/* flush CBs and DB, XXX: miss the main CB? */ |
|
986 |
|
ib.d[ib.dws++]=PKT3(PKT3_SET_CFG_REG, 2); |
|
987 |
|
ib.d[ib.dws++]=CFG_REG_IDX(CP_COHER_CTL_1); |
|
988 |
|
ib.d[ib.dws++]=0; |
|
989 |
|
ib.d[ib.dws++]=PKT3(PKT3_SURF_SYNC, 4); |
|
990 |
|
/* CP_COHER_CTL_0 */ |
|
991 |
|
ib.d[ib.dws++]=CCC_CB0_DEST_BASE_ENA | CCC_CB1_DEST_BASE_ENA |
|
992 |
|
| CCC_CB2_DEST_BASE_ENA | CCC_CB3_DEST_BASE_ENA |
|
993 |
|
| CCC_CB4_DEST_BASE_ENA | CCC_CB5_DEST_BASE_ENA |
|
994 |
|
| CCC_CB6_DEST_BASE_ENA | CCC_CB7_DEST_BASE_ENA |
|
995 |
|
| CCC_DB_DEST_BASE_ENA | CCC_DB_ACTION_ENA | CCC_TCL1_ACTION_ENA |
|
996 |
|
| CCC_TC_ACTION_ENA | CCC_SH_KCACHE_ACTION_ENA |
|
997 |
|
| CCC_SH_ICACHE_ACTION_ENA; |
|
998 |
|
/* CP_COHER_SZ */ |
|
999 |
|
ib.d[ib.dws++]=0xffffffff; |
|
1000 |
|
/* CP_COHER_BASE */ |
|
1001 |
|
ib.d[ib.dws++]=0; |
|
1002 |
|
ib.d[ib.dws++]=0x0000000a;/* polling interval, 0xa(10) * 16 clocks */ |
|
1003 |
|
/*--------------------------------------------------------------------*/ |
|
1004 |
|
|
|
1005 |
|
/*--------------------------------------------------------------------*/ |
|
1006 |
|
/* EOP event with some caches flush and invalidation */ |
|
1007 |
|
ib.d[ib.dws++]=PKT3(PKT3_EVENT_WR_EOP, 5); |
|
1008 |
|
ib.d[ib.dws++]=set(PKT3_EVENT_IDX, 5) | set(VEI_EVENT_TYPE, |
|
1009 |
|
VEI_CACHE_FLUSH_AND_INV_TS_EVENT); |
|
1010 |
|
ib.d[ib.dws++]=lower_32_bits(p->fb_gpu_addr); |
|
1011 |
|
ib.d[ib.dws++]=upper_32_bits(p->fb_gpu_addr) |
|
1012 |
|
| set(PKT3_DATA_SEL, 2) | set(PKT3_INT_SEL, 2); |
|
1013 |
|
ib.d[ib.dws++]=0xdeadbeef; |
|
1014 |
|
ib.d[ib.dws++]=0xcafedead; |
|
1015 |
|
/*--------------------------------------------------------------------*/ |
|
1016 |
|
|
|
1017 |
|
/* align size, upload and run the indirect buffer */ |
|
1018 |
|
while ((ib.dws & CP_RING_PFP_DW_MASK) != 0) |
|
1019 |
|
ib.d[ib.dws++] = PKT2; |
|
1020 |
|
indirect_cpy(dev, ib.gpu_addr, (u32*)&ib.d[0], ib.dws); |
|
1021 |
|
|
|
1022 |
|
gfx_wr(dev, PKT3(PKT3_IB, 3)); |
|
1023 |
|
gfx_wr(dev, lower_32_bits(ib.gpu_addr)); |
|
1024 |
|
gfx_wr(dev, upper_32_bits(ib.gpu_addr)); |
|
1025 |
|
gfx_wr(dev, ib.dws); |
|
1026 |
|
gfx_commit(dev); |
|
1027 |
|
return 0; |
|
1028 |
|
} |
|