Debian Codegraph @

src/shaders/post_processing/gen8/VP_Setup.g8a

raw
1 /*
2 * Copyright 2000-2011 Intel Corporation All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 /*
17 * Copyright 2000-2011 Intel Corporation All Rights Reserved
18 *
19 * Licensed under the Apache License, Version 2.0 (the "License");
20 * you may not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
22 *
23 * http://www.apache.org/licenses/LICENSE-2.0
24 *
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS,
27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
30 * Authors: Zhao Yakui <[email protected]>
31 */
32
33 // 326 // Total instruction count
34 // 1 // Total kernel count
35
36
37
38 // Module name: common.inc
39 //
40 // Common header file for all Video-Processing kernels
41 //
42
43 .default_execution_size (16)
44 .default_register_type :ub
45
46 .reg_count_total 128
47 .reg_count_payload 7
48
49 //========== Common constants ==========
50
51
52 //========== Macros ==========
53
54
55 //Fast Jump, For more details see "Set_Layer_N.asm"
56
57
58 //========== Defines ====================
59
60 //========== Static Parameters (Common To All) ==========
61 //r1
62
63
64 //r2
65
66 // e.g. byte0 byte1 byte2
67 // YUYV 0 1 3
68 // YVYU 0 3 1
69
70 //Color Pipe (IECP) parameters
71
72
73 //ByteCopy
74
75
76 //r4
77
78 // e.g. byte0 byte1 byte2
79 // YUYV 0 1 3
80 // YVYU 0 3 1
81
82
83 //========== Inline parameters (Common To All) ===========
84
85
86 //============== Binding Index Table===========
87 //Common between DNDI and DNUV
88
89
90 //================= Common Message Descriptor =====
91 // Message descriptor for thread spawning
92 // Message Descriptors
93 // = 000 0001 (min message len 1 ) 0,0000 (resp len 0 -add later)
94 // 0000,0000,0000
95 // 0001(Spawn a root thread),0001 (Root thread spawn thread)
96 // = 0x02000011
97 // Thread Spawner Message Descriptor
98
99
100 // Message descriptor for atomic operation add
101 // Message Descriptors
102 // = 000 0110 (min message len 6 ) 0,0000 (resp len 0 -add later)
103 // 1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
104 // 0000,0000 (Binding table index, added later)
105 // = 0x02000011
106
107 // Atomic Operation Add Message Descriptor
108
109
110 // Message descriptor for dataport media write
111 // Message Descriptors
112 // = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
113 // 1 (header present 1) 0 1010 (media block write) 000000
114 // 00000000 (binding table index - set later)
115 // = 0x020A8000
116
117
118 // Message Length defines
119
120
121 // Response Length defines
122
123
124 // Block Width and Height Size defines
125
126
127 // Extended Message Descriptors
128
129
130 // Common message descriptors:
131
132
133 //===================== Math Function Control ===================================
134
135
136 //============ Message Registers ===============
137 // buf4 starts from r28
138
139
140 //#define mMSGHDR_EOT r43 // Dummy Message Register for EOT
141
142
143 .declare mubMSGPAYLOAD Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
144 .declare muwMSGPAYLOAD Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
145 .declare mudMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
146 .declare mfMSGPAYLOAD Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
147
148 //=================== End of thread instruction ===========================
149
150
151 //=====================Pointers Used=====================================
152
153
154 //=======================================================================
155
156
157 //r11-r17
158 // Define temp space for any usages
159
160
161 // Common Buffers
162
163
164 // temp space for rotation
165
166 .declare fROBUF Base=r11.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
167
168 .declare udROBUF Base=r11.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
169
170 .declare uwROBUF Base=r11.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
171
172 .declare ubROBUF Base=r11.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
173
174 .declare ub4ROBUF Base=r11.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
175
176
177 // End of common.inc
178
179
180 // FileName: VP_Setup.asm
181 // Author: Vivek Kumar
182 // Description: Sets up all parameters for the Video Processing Kernel
183
184
185
186
187 // Description: Includes all definitions explicit to Fast Composite.
188
189
190
191
192 // End of common.inc
193
194
195 //========== GRF partition ==========
196 // r0 header : r0 (1 GRF)
197 // Static parameters : r1 - r6 (6 GRFS)
198 // Inline parameters : r7 - r8 (2 GRFs)
199 // MSGSRC : r27 (1 GRF)
200 //===================================
201
202 //Interface:
203 //========== Static Parameters (Explicit To Fast Composite) ==========
204 //r1
205 //CSC Set 0
206
207
208 .declare udCSC_CURBE Base=r1.0 ElementSize=4 Type=ud
209
210 //Constant alpha
211
212
213 //r2
214
215
216 // Gen7 AVS WA
217
218
219 // WiDi Definitions
220
221
222 //Colorfill
223
224
225 // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.
226
227 .declare ubCOLOR_PIXEL_VAL Base=r2.20 ElementSize=1 SrcRegion=<0;1,0> DstRegion=<1> Type=ub
228
229 //r3
230 //Normalised Ratio of Horizontal step size with main video for all layers
231
232
233 //Normalised Ratio of Horizontal step size with main video for all layers becomes
234 //Normalised Horizontal step size for all layers in VP_Setup.asm
235
236
237 //r4
238 //Normalised Vertical step size for all layers
239
240
241 //r5
242 //Normalised Vertical Frame Origin for all layers
243
244
245 //r6
246 //Normalised Horizontal Frame Origin for all layers
247
248
249 //========== Inline Parameters (Explicit To Fast Composite) ==========
250
251
252 //Main video Step X
253
254
255 //====================== Binding table (Explicit To Fast Composite)=========================================
256
257
258 //Used by Interlaced Scaling Kernels
259
260
261 //========== Sampler State Table Index (Explicit To Fast Composite)==========
262 //Sampler Index for AVS/IEF messages
263
264
265 //Sampler Index for SIMD16 sampler messages
266
267
268 //=============================================================================
269
270 .declare fBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
271 .declare fBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
272 .declare fBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
273 .declare fBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
274 .declare fBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
275 .declare fBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
276
277 .declare udBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
278 .declare udBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
279 .declare udBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
280 .declare udBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
281 .declare udBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
282 .declare udBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
283
284 .declare uwBUFFER_0 Base=r64.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
285 .declare uwBUFFER_1 Base=r80.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
286 .declare uwBUFFER_2 Base=r96.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
287 .declare uwBUFFER_3 Base=r112.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
288 .declare uwBUFFER_4 Base=r28.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
289 .declare uwBUFFER_5 Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
290
291 .declare ubBUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
292 .declare ubBUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
293 .declare ubBUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
294 .declare ubBUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
295 .declare ubBUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
296 .declare ubBUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
297
298 .declare ub4BUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
299 .declare ub4BUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
300 .declare ub4BUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
301 .declare ub4BUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
302 .declare ub4BUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
303 .declare ub4BUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
304
305 //Pointer to mask reg
306
307
308 //r18
309
310
311 //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
312 // NODDCLR, NODDCHK flags. -rT
313
314
315 .declare udCSC_COEFF_0 Base=r18.0 ElementSize=4 Type=ud // 1 GRF
316
317 //r19
318
319
320 .declare udCSC_COEFF_1 Base=r19.0 ElementSize=4 Type=ud // 1 GRF
321
322
323 //r20
324
325 .declare uwALPHA_MASK_REG_TEMP Base=r20.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
326
327 //r21
328
329 .declare uwALPHA_MASK_REG Base=r21.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
330
331 //r22
332
333
334 //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
335 // NODDCLR, NODDCHK flags. -rT
336
337
338 //Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
339 //sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
340
341 //r23
342
343
344 //Lumakey
345
346
347 //r24
348
349
350 //r25
351
352
353 //r26
354
355
356 //defines to generate LABELS during compile time.
357
358
359 //Setup pointer to the inline parameter
360
361 // Copy MSG HDR
362 mov (8) r27.0<1>:ud r0.0<8;8,1>:ud // Initialize message payload header with R0
363
364 // Only one layer is enough
365
366 //temp; remove it once unread msg warnings are resolved -vK
367 mov (8) r25<1>:ud r0.0<8;8,1>:ud
368 mov (8) r26<1>:ud r0.0<8;8,1>:ud
369
370 // Calculate StepX for all layers and overwrite it on the ratio
371 mul (8) r3.0<1>:f r3.0<8;8,1>:f r9.4<0;1,0>:f //StepX_ratio = StepX / VideoStepX
372
373 //Normalised Ratio of Horizontal step size with main video for all layers now becomes
374 //Normalised Horizontal step size for all layers
375
376 // Calculate block origin for all layers and overwrite it on the frame origin
377 mov (2) r10.5<1>:f r9.0<2;2,1>:w //Convert origin from word to float
378
379 cmp.e.f0.0 (1) null<1>:d r2.26<0;1,0>:ub 1:uw
380
381
382 shr (1) r17.0<1>:uw r2.2<0;1,0>:uw 0:uw
383 and (1) r17.0<1>:uw r17.0<0;1,0>:uw 3:uw
384 cmp.e.f0.1 (1) null<1>:w r17.0<0;1,0>:uw 1:uw
385 (f0.1) jmpi (1) ROTATE_90_L0
386 cmp.e.f0.1 (1) null<1>:w r17.0<0;1,0>:uw 2:uw
387 (f0.1) jmpi (1) ROTATE_180_L0
388 cmp.e.f0.1 (1) null<1>:w r17.0<0;1,0>:uw 3:uw
389 (f0.1) jmpi (1) ROTATE_270_L0
390
391 // rotate 0 degree
392 ROTATE_0_L0:
393 (-f0.0)mov (1) acc0.0<1>:f r6.0<0;1,0>:f
394 (-f0.0)mac (1) r6.0<1>:f r3.0<0;1,0>:f r10.5<0;1,0>:f
395
396 mov (1) acc0.0<1>:f r5.0<0;1,0>:f
397 mac (1) r5.0<1>:f r4.0<0;1,0>:f r10.6<0;1,0>:f
398 jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0
399
400 // rotate 90 degree
401 ROTATE_90_L0:
402 (-f0.0)mov (1) acc0.0<1>:f r6.0<0;1,0>:f
403 (-f0.0)mac (1) r6.0<1>:f r3.0<0;1,0>:f r10.6<0;1,0>:f
404
405 mov (1) r16.0<1>:f r2.0<0;1,0>:uw
406 add (1) r17.0<1>:f -r10.5<0;1,0>:f r16.0<0;1,0>:f
407 add (1) r17.0<1>:f r17.0<0;1,0>:f -16.0:f
408
409 mov (1) acc0.0<1>:f r5.0<0;1,0>:f
410 mac (1) r5.0<1>:f r4.0<0;1,0>:f r17.0<0;1,0>:f
411 jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0
412
413 // rotate 180 degree
414 ROTATE_180_L0:
415 (-f0.0)mov (1) r16.0<1>:f r2.0<0;1,0>:uw
416 (-f0.0)add (1) r17.0<1>:f -r10.5<0;1,0>:f r16.0<0;1,0>:f
417 (-f0.0)add (1) r17.0<1>:f r17.0<0;1,0>:f -16.0:f
418 (-f0.0)mov (1) acc0.0<1>:f r6.0<0;1,0>:f
419 (-f0.0)mac (1) r6.0<1>:f r3.0<0;1,0>:f r17.0<0;1,0>:f
420
421 mov (1) r16.0<1>:f r2.1<0;1,0>:uw
422 add (1) r17.0<1>:f -r10.6<0;1,0>:f r16.0<0;1,0>:f
423 add (1) r17.0<1>:f r17.0<0;1,0>:f -16.0:f
424 mov (1) acc0.0<1>:f r5.0<0;1,0>:f
425 mac (1) r5.0<1>:f r4.0<0;1,0>:f r17.0<0;1,0>:f
426 jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0
427
428 // rotate 270 degree
429 ROTATE_270_L0:
430 (-f0.0)mov (1) r16.0<1>:f r2.1<0;1,0>:uw
431 (-f0.0)add (1) r17.0<1>:f -r10.6<0;1,0>:f r16.0<0;1,0>:f
432 (-f0.0)add (1) r17.0<1>:f r17.0<0;1,0>:f -16.0:f
433 (-f0.0)mov (1) acc0.0<1>:f r6.0<0;1,0>:f
434 (-f0.0)mac (1) r6.0<1>:f r3.0<0;1,0>:f r17.0<0;1,0>:f
435
436 mov (1) acc0.0<1>:f r5.0<0;1,0>:f
437 mac (1) r5.0<1>:f r4.0<0;1,0>:f r10.5<0;1,0>:f
438
439 END_SRC_BLOCK_ORIG_COMP_L0:
440 nop