Debian Codegraph @

src/shaders/post_processing/gen8/Set_Layer_0.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 // 18 // Total instruction count
17 // 1 // Total kernel count
18
19
20
21 // Module name: common.inc
22 //
23 // Common header file for all Video-Processing kernels
24 //
25
26 .default_execution_size (16)
27 .default_register_type :ub
28
29 .reg_count_total 128
30 .reg_count_payload 7
31
32 //========== Common constants ==========
33
34
35 //========== Macros ==========
36
37
38 //Fast Jump, For more details see "Set_Layer_N.asm"
39
40
41 //========== Defines ====================
42
43 //========== Static Parameters (Common To All) ==========
44 //r1
45
46
47 //r2
48
49 // e.g. byte0 byte1 byte2
50 // YUYV 0 1 3
51 // YVYU 0 3 1
52
53 //Color Pipe (IECP) parameters
54
55
56 //ByteCopy
57
58
59 //r4
60
61 // e.g. byte0 byte1 byte2
62 // YUYV 0 1 3
63 // YVYU 0 3 1
64
65
66 //========== Inline parameters (Common To All) ===========
67
68
69 //============== Binding Index Table===========
70 //Common between DNDI and DNUV
71
72
73 //================= Common Message Descriptor =====
74 // Message descriptor for thread spawning
75 // Message Descriptors
76 // = 000 0001 (min message len 1 ) 0,0000 (resp len 0 -add later)
77 // 0000,0000,0000
78 // 0001(Spawn a root thread),0001 (Root thread spawn thread)
79 // = 0x02000011
80 // Thread Spawner Message Descriptor
81
82
83 // Message descriptor for atomic operation add
84 // Message Descriptors
85 // = 000 0110 (min message len 6 ) 0,0000 (resp len 0 -add later)
86 // 1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
87 // 0000,0000 (Binding table index, added later)
88 // = 0x02000011
89
90 // Atomic Operation Add Message Descriptor
91
92
93 // Message descriptor for dataport media write
94 // Message Descriptors
95 // = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
96 // 1 (header present 1) 0 1010 (media block write) 000000
97 // 00000000 (binding table index - set later)
98 // = 0x020A8000
99
100
101 // Message Length defines
102
103
104 // Response Length defines
105
106
107 // Block Width and Height Size defines
108
109
110 // Extended Message Descriptors
111
112
113 // Common message descriptors:
114
115
116 //===================== Math Function Control ===================================
117
118
119 //============ Message Registers ===============
120 // buf4 starts from r28
121
122 #define MSG_AVS_SAMPLE 0x00000000
123 #define MSG_CONVOLE_SAMPLE 0x10000000
124 #define MSG_MINMAX_SAMPLE 0x20000000
125 #define MSG_MINMAXF_SAMPLE 0x30000000
126 #define MSG_ERODE_SAMPLE 0x40000000
127 #define MSG_DILATE_SAMPLE 0x50000000
128 #define MSG_BOOLCENT_SAMPLE 0x60000000
129 #define MSG_CENTROID_SAMPLE 0x70000000
130
131 #define MSG_IEF_BYPASS 0x08000000
132 #define MSG_IEF_ENABLE 0x00000000
133
134 //16x4 or 8x4 or 16x8 or 4x4
135 #define MSG_AVS_164 0x00000000
136 #define MSG_AVS_84 0x02000000
137 #define MSG_AVS_168 0x04000000
138 #define MSG_AVS_44 0x06000000
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
181
182
183
184 //Module name: Set_Layer_N.inc
185
186
187
188
189 // Description: Includes all definitions explicit to Fast Composite.
190
191
192
193
194 // End of common.inc
195
196
197 //========== GRF partition ==========
198 // r0 header : r0 (1 GRF)
199 // Static parameters : r1 - r6 (6 GRFS)
200 // Inline parameters : r7 - r8 (2 GRFs)
201 // MSGSRC : r27 (1 GRF)
202 //===================================
203
204 //Interface:
205 //========== Static Parameters (Explicit To Fast Composite) ==========
206 //r1
207 //CSC Set 0
208
209
210 .declare udCSC_CURBE Base=r1.0 ElementSize=4 Type=ud
211
212 //Constant alpha
213
214
215 //r2
216
217
218 // Gen7 AVS WA
219
220
221 // WiDi Definitions
222
223
224 //Colorfill
225
226
227 // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.
228
229 .declare ubCOLOR_PIXEL_VAL Base=r2.20 ElementSize=1 SrcRegion=<0;1,0> DstRegion=<1> Type=ub
230
231 //r3
232 //Normalised Ratio of Horizontal step size with main video for all layers
233
234
235 //Normalised Ratio of Horizontal step size with main video for all layers becomes
236 //Normalised Horizontal step size for all layers in VP_Setup.asm
237
238
239 //r4
240 //Normalised Vertical step size for all layers
241
242
243 //r5
244 //Normalised Vertical Frame Origin for all layers
245
246
247 //r6
248 //Normalised Horizontal Frame Origin for all layers
249
250
251 //========== Inline Parameters (Explicit To Fast Composite) ==========
252
253
254 //Main video Step X
255
256
257 //====================== Binding table (Explicit To Fast Composite)=========================================
258
259
260 //Used by Interlaced Scaling Kernels
261
262
263 //========== Sampler State Table Index (Explicit To Fast Composite)==========
264 //Sampler Index for AVS/IEF messages
265
266
267 //Sampler Index for SIMD16 sampler messages
268
269
270 //=============================================================================
271
272 .declare fBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
273 .declare fBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
274 .declare fBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
275 .declare fBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
276 .declare fBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
277 .declare fBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=f
278
279 .declare udBUFFER_0 Base=r64.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
280 .declare udBUFFER_1 Base=r80.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
281 .declare udBUFFER_2 Base=r96.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
282 .declare udBUFFER_3 Base=r112.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
283 .declare udBUFFER_4 Base=r28.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
284 .declare udBUFFER_5 Base=r46.0 ElementSize=4 SrcRegion=<8;8,1> DstRegion=<1> Type=ud
285
286 .declare uwBUFFER_0 Base=r64.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
287 .declare uwBUFFER_1 Base=r80.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
288 .declare uwBUFFER_2 Base=r96.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
289 .declare uwBUFFER_3 Base=r112.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
290 .declare uwBUFFER_4 Base=r28.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
291 .declare uwBUFFER_5 Base=r46.0 ElementSize=2 SrcRegion=<16;16,1> DstRegion=<1> Type=uw
292
293 .declare ubBUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
294 .declare ubBUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
295 .declare ubBUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
296 .declare ubBUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
297 .declare ubBUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
298 .declare ubBUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<16;16,1> DstRegion=<1> Type=ub
299
300 .declare ub4BUFFER_0 Base=r64.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
301 .declare ub4BUFFER_1 Base=r80.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
302 .declare ub4BUFFER_2 Base=r96.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
303 .declare ub4BUFFER_3 Base=r112.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
304 .declare ub4BUFFER_4 Base=r28.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
305 .declare ub4BUFFER_5 Base=r46.0 ElementSize=1 SrcRegion=<32;8,4> DstRegion=<4> Type=ub
306
307 //Pointer to mask reg
308
309
310 //r18
311
312
313 //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
314 // NODDCLR, NODDCHK flags. -rT
315
316
317 .declare udCSC_COEFF_0 Base=r18.0 ElementSize=4 Type=ud // 1 GRF
318
319 //r19
320
321
322 .declare udCSC_COEFF_1 Base=r19.0 ElementSize=4 Type=ud // 1 GRF
323
324
325 //r20
326
327 .declare uwALPHA_MASK_REG_TEMP Base=r20.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
328
329 //r21
330
331 .declare uwALPHA_MASK_REG Base=r21.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
332
333 //r22
334
335
336 //Always keep Cannel Pointers and Offsets in same GRF, so that we can use
337 // NODDCLR, NODDCHK flags. -rT
338
339
340 //Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
341 //sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
342
343 //r23
344
345
346 //Lumakey
347
348
349 //r24
350
351
352 //r25
353
354
355 //r26
356
357
358 //defines to generate LABELS during compile time.
359
360
361 //Used to generate LABELS at compile time.
362
363
364 //definitions for Expand Mask
365 .declare uwMask_Temp1 Base=r17.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
366 .declare ubMask_Temp1 Base=r17.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub // 1 GRF
367 .declare udMask_Temp1 Base=r17.0 ElementSize=4 Type=ud // 1 GRF
368 .declare uwMask_Temp2 Base=r16.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
369 .declare ubMask_Temp2 Base=r16.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub // 1 GRF
370 .declare udMask_Temp2 Base=r16.0 ElementSize=4 Type=ud // 1 GRF
371
372 .declare uwMask_Temp3 Base=r15.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw // 1 GRF
373 .declare ubMask_Temp3 Base=r15.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub // 1 GRF
374
375 .declare udALPHA_MASK_REG Base=r21.0 ElementSize=4 Type=ud // 1 GRF
376 .declare udALPHA_MASK_REG_TEMP Base=r20.0 ElementSize=4 Type=ud // 1 GRF
377
378
379 //Initialize mask reg to FFFF
380
381 mov (16) uwALPHA_MASK_REG(0)<1> 0xFFFF:uw
382
383
384 //Fast jump for -
385 //LAYER0: we determine whether layer 0 is to be loaded and processed or not based
386 // on block mask in module "Set_Layer_0" and store result in f0.1.
387 // This flag is then directly used to while loading buf0-3 and colorfill.
388 // (So flag f0.1 should not be changed from Set_Layer_0 till Colorfill)
389 //
390 //LAYER1-7: For all other layers, we compute whether layer is to be loaded and processed
391 // based on block mask in module "Set_Layer_1-7" and store result in SKIP_LAYER
392 // variable.
393 // While Loading buf 4 and 5, we move SKIP_LAYER to f0.0 every time and use it
394 // for Loading.
395 // For processing though, we move SKIP_LAYER only once to f0.1 in module
396 // "Set_Buf0_Buf4" and use f0.1 for deciding whether layer 1-7 (all 4 sub blocks)
397 // is to be processed or not.
398 // (So flag f0.1) should not be modififed from module "Set_Buf0_Buf4" till module
399 // that processess sub-block 3).
400 //
401 //None of the above fast jumps, apply to CSC modules. We always perform CSC irrespective of mask.
402 //
403 //Example: (Without going into finer details)
404 // Typical Combined kernel:
405 //
406 // (let var = decision whether to load/process that layer)
407 //
408 // Set_Layer_0 //f0.1 <- var
409 // ..
410 // Set_Layer_1 //f0.1 <- var, SKIP_LAYER <- var
411 // ..
412 // Load buf 0 //use f0.1
413 // Load buf 4 //f0.0 <- SKIP_LAYER
414 // Load buf 1 //use f0.1
415 // Load buf 5 //f0.0 <- SKIP_LAYER
416 // Load buf 2 //use f0.1
417 // Load buf 3 //use f0.1
418 // ..
419 // ..
420 // Colorfill
421 // ..
422 // Set_Buf0_Buf4 //f0.1 <- SKIP_LAYER
423 // process0-4 //Use f0.1
424 // Load buf 4
425 // Set_Buf1_Buf5
426 // process1-5
427 // Load buf 5
428 // ..
429 // Set_Layer_2 //f0.1 <-var, SKIP_LAYER <- var
430 // ..
431 // Set_Buf2_Buf4
432 // process2-4
433 // Load buf 4
434 // Set_Buf3_Buf5
435 // process3-5
436 // Load buf 5
437 // ..
438
439
440 and (1) r24.2<1>:ub r2.2<0;1,0>:uw 3:uw
441
442
443 //Copy all AVS Payload data
444 // Setup Message Payload Header for 1st block of Media Sampler 8x8 (16x4 for IVB+)
445 //currently the dx & dy is passed by Constant buffer (zero)
446 mov (1) r25.0<1>:f r9.6<0;1,0>:f //NLAS dy
447 mov (1) r25.6<1>:f r9.5<0;1,0>:f //NLAS dx
448 mov (1) r25.4<1>:f r3.0<0;1,0>:f //Step X
449 mov (1) r25.5<1>:f r4.0<0;1,0>:f //Step Y
450
451
452 mov (1) r25.2<1>:f r6.0<0;1,0>:f //Orig X
453 mov (1) r25.3<1>:f r5.0<0;1,0>:f //Orig Y
454
455 mov (1) r25.7<1>:ud 0:ud
456 add (1) r25.7<1>:ud r25.7<0;1,0>:ud MSG_AVS_SAMPLE + MSG_AVS_164 + MSG_IEF_BYPASS:ud
457
458 //NLAS calculations for 2nd half of blocks of Media Sampler 8x8:
459 // X(i) = X0 + dx*i + ddx*i*(i-1)/2 ==> X(8) = X0 + dx*8 +ddx*28
460 // dx(i)= dx(0) + ddx*i ==> dx(8)= dx + ddx*8
461
462 //OPTIMIZATION: fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY - are sub registers of same GRF. Use NODDCLR NODDCHK. -rT
463
464 // Calculating X(8)
465 mov (1) acc0.2<1>:f r6.0<0;1,0>:f
466 mac (1) acc0.2<1>:f r3.0<0;1,0>:f 8.0:f
467 mac (1) r23.2<1>:f r9.5<0;1,0>:f 28.0:f { NoDDClr }
468
469 // Calculating Y(4)
470 mul (1) r23.1<1>:f r4.0<0;1,0>:f 4.0:f { NoDDClr, NoDDChk } //dY*4
471
472 // Calculating dx(8)
473 mov (1) acc0.4<1>:f r3.0<0;1,0>:f
474 mac (1) r23.4<1>:f r9.5<0;1,0>:f 8.0:f { NoDDClr, NoDDChk }
475
476 // Binding Index
477 mov (1) r23.5<1>:ud 0:ud { NoDDChk }
478
479
480 SKIP_LAYER_L0:
481 nop
482
483