Add the NV12 scaling shader for BDW
authorZhao Yakui <yakui.zhao@intel.com>
Tue, 16 Apr 2013 05:57:38 +0000 (13:57 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 27 Feb 2014 02:17:02 +0000 (10:17 +0800)
This is the first VPP shader for BDW,which is used to do the
NV12 scaling conversion.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
15 files changed:
configure.ac
src/i965_post_processing.c
src/shaders/post_processing/Makefile.am
src/shaders/post_processing/gen8/EOT.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/Makefile.am [new file with mode: 0644]
src/shaders/post_processing/gen8/PL2_AVS_Buf_0.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/PL2_AVS_Buf_1.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/PL2_AVS_Buf_2.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/PL2_AVS_Buf_3.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/Save_AVS_NV12.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/Set_AVS_Buf_0123_PL2.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/Set_Layer_0.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/VP_Setup.g8a [new file with mode: 0644]
src/shaders/post_processing/gen8/pl2_to_pl2.asm [new file with mode: 0644]
src/shaders/post_processing/gen8/pl2_to_pl2.g8b [new file with mode: 0644]

index 7bd39ed..5f1f64a 100644 (file)
@@ -179,6 +179,7 @@ AC_OUTPUT([
     src/shaders/post_processing/gen5_6/Makefile
     src/shaders/post_processing/gen7/Makefile
     src/shaders/post_processing/gen75/Makefile
+    src/shaders/post_processing/gen8/Makefile
     src/shaders/render/Makefile
     src/shaders/utils/Makefile
     src/shaders/vme/Makefile
index 6db68d8..d0e4789 100755 (executable)
@@ -1168,7 +1168,7 @@ static const uint32_t pp_null_gen8[][4] = {
 };
 
 static const uint32_t pp_nv12_load_save_nv12_gen8[][4] = {
-#include "shaders/post_processing/gen7/pl2_to_pl2.g75b"
+#include "shaders/post_processing/gen8/pl2_to_pl2.g8b"
 };
 
 static const uint32_t pp_nv12_load_save_pl3_gen8[][4] = {
index a0022ca..0f5c2bf 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = gen5_6 gen7 gen75
+SUBDIRS = gen5_6 gen7 gen75 gen8
 
 # Extra clean files so that maintainer-clean removes *everything*
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/shaders/post_processing/gen8/EOT.g8a b/src/shaders/post_processing/gen8/EOT.g8a
new file mode 100644 (file)
index 0000000..72c3da3
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//    2    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+//End of Thread message
+
+mov (8) r127<1>:ud r0.0<8;8,1>:ud 
+ send (1) null<1>:d r127 0x27 0x02000010
diff --git a/src/shaders/post_processing/gen8/Makefile.am b/src/shaders/post_processing/gen8/Makefile.am
new file mode 100644 (file)
index 0000000..512d1cf
--- /dev/null
@@ -0,0 +1,43 @@
+INTEL_PP_G8B = \
+       pl2_to_pl2.g8b          \
+       $(NULL)
+
+INTEL_PP_G8A = \
+       EOT.g8a                         \
+       PL2_AVS_Buf_0.g8a               \
+       PL2_AVS_Buf_1.g8a               \
+       PL2_AVS_Buf_2.g8a               \
+       PL2_AVS_Buf_3.g8a               \
+       Save_AVS_NV12.g8a               \
+       Set_AVS_Buf_0123_PL2.g8a        \
+       Set_Layer_0.g8a                 \
+       VP_Setup.g8a                    \
+       $(NULL)
+
+INTEL_PP_ASM = $(INTEL_PP_G8B:%.g8b=%.asm)
+INTEL_PP_GEN8_ASM = $(INTEL_PP_G8B:%.g8b=%.g8s)
+
+TARGETS  =
+if HAVE_GEN4ASM
+TARGETS += $(INTEL_PP_G8B)
+endif
+
+all-local: $(TARGETS)
+
+SUFFIXES = .g8b .g8s .asm
+
+$(INTEL_PP_GEN8_ASM): $(INTEL_PP_ASM) $(INTEL_PP_G8A)
+.asm.g8s:
+       $(AM_V_GEN)cpp $< > _pp0.$@;            \
+       ../../gpp.py _pp0.$@ $@;        \
+       rm _pp0.$@
+.g8s.g8b:
+       $(AM_V_GEN)intel-gen4asm -a -o $@ -g 8 $<
+
+CLEANFILES = $(INTEL_PP_GEN7_ASM)
+
+EXTRA_DIST = \
+       $(INTEL_PP_G8B)
+
+# Extra clean files so that maintainer-clean removes *everything*
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/shaders/post_processing/gen8/PL2_AVS_Buf_0.g8a b/src/shaders/post_processing/gen8/PL2_AVS_Buf_0.g8a
new file mode 100644 (file)
index 0000000..bbff22c
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//   44    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// FileName:           PL2_AVS_Buf_0.asm
+// Author:                     Tatiya, Rupesh
+// Description:                Loads 8x8 AVS/IEF PL2 data into Buffer 0
+
+
+
+// FileName     :   PL2_AVS_Buf.asm
+// Author       :   Tatiya, Rupesh
+// Description  :   Loads 8x8 AVS/IEF PL2 data into Buffer N
+
+
+
+// Module name: Scaling.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+        // Message Header
+        // m0.7         31:0    Debug
+        // m0.6         31:0    Debug
+        // m0.5         31:0    Ignored
+        // m0.4         31:0    Ignored
+        // m0.3         31:0    Ignored
+        // m0.2         31:16   Ignored
+        //              15      Alpha Write Channel Mask        enable=0, disable=1
+        //              14      Blue Write Channel Mask  (U)
+        //              13      Green Write Channel Mask (Y)
+        //              12      Red Write Channel Mask   (V)
+        //              11:0    Ignored
+        // m0.1                 Ignored
+        // m0.0                 Ignored
+
+
+        // AVS payload
+        // m1.7                 Group ID Number
+        // m1.6                 U 2nd Derivative        ---> NLAS dx
+        // m1.5                 Delta V                 ---> Step Y
+        // m1.4                 Delta U                 ---> Step X
+        // m1.3                 Pixel 0 V Address       ---> ORIY (Y0)
+        // m1.2                 Pixel 0 U Address       ---> ORIX (X0)
+        // m1.1                 Vertical Block Number
+        // m1.0                 Reserved
+
+        // Sampler Message Descriptor
+        // 31:29        Reserved                        000
+        // 28:25        Message length                  0010
+        // 24:20        Response length                 xxxxx   ---> 4GRFs for each enabled channel (AVS), 2GRFs for each enabled channel (sample unorm)
+        // 19           Header Present                  1
+        // 18:17        SIMD Mode                       11      ---> SIMD32/64
+        // 16:12        Message Type                    xxxxx   ---> 01011 sample_8x8, 01100 (sample_unorm), 01010 (sample_unorm+killpix)
+        // 11:8         Sampler Index                   xxxx
+        // 7:0          Binding Table Index             xxxxxxxx
+
+
+        // Msg Header M0.2
+        // 15:15        Alpha Write Channel Mask, 0: written back, 1: not written back
+        // 14:14        Blue  Write Channel Mask
+        // 13:13        Green Write Channel Mask
+        // 12:12        Red   Write Channel Mask
+
+
+//By design, Buffer 0,1,2,3 always have Layer 0 and Buffer 4,5 always have L1-L7
+
+
+//used to generate LABELS at compile time.
+
+
+        // 18:17        SIMD Mode                       10      ---> SIMD16
+        // 16:12        Message Type                    xxxxx   ---> 00000 (SIMD16)
+
+
+//r10-17  - 8 GRFs to load SIMD16 data (upto 4 channels)
+//r18-19  - 2 GRFs to store sampler ramp.
+
+    .declare mfSCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+    .declare muwSCALING_0X_34X_PAYLOAD Base=r14.0      ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+    .declare mudCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+    .declare mubCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=1           SrcRegion=<32;32,1>             DstRegion=<1>           Type=ub
+
+
+       .declare fSCALING_0X_34X_TEMP           Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+       .declare udSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+       .declare ub4SCALING_0X_34X_TEMP         Base=r9.0       ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<1>           Type=ub
+       .declare uwSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+       // Sampler ramp is used for Scaling 0X_0.34X
+       .declare        fSAMPLER_RAMP           Base=r9.0 ElementSize=4 SrcRegion=<8;8,1> Type=f                // 1 GRFs, 8 elements
+
+
+       //#define rMSGDSC_UV                    r23.0
+
+
+//End of _SCALING_
+
+
+        //NOTE: We need offsets for second halfof LAYER 0 - even if we do not load it.
+        //Update the channel offset in the buffers for the lower 8x4 data for BUFFER_0.
+        mov (1)     r22.4<1>:ud       0x400040:ud
+
+
+    mov (1)     r16.3<1>:ud    r0.3<0;1,0>:ud
+
+
+    //AVS_PAYLOAD already has all the data loaded at this point
+    add (1)     a0.0<1>:ud     r23.5<0;1,0>:ud      0x44EB000:ud      //msg desc
+
+    mov (1)     r16.2<1>:ud      0x0000D000:ud                                        // Enable Red channel
+
+
+
+    // set the vertical block number
+
+
+    mov (8)     r17.0<1>:ud      r25.0<8;8,1>:ud                                     // Copy msg payload mirrors to MRFs
+
+    send (1)    uwBUFFER_0(0)<1>   r16    0x2    a0.0:ud
+    // Returns Y data in 4 GRFs in scrambled order
+
+    add (1)     a0.0<1>:ud                r23.5<0;1,0>:ud      0x48EB001:ud            // msg desc; 1 is added to change BI to UV
+    mov (1)     r16.2<1>:ud      0x0000A000:ud                                               // Enable Red+Blue channel
+
+    send (1)    uwBUFFER_0(4)<1>   r16    0x2    a0.0:ud
+    // Returns UV data in 8 GRFs in scrambled order
+
+SKIP_AVS_LOAD_L0_0_:
+    nop
+
+
diff --git a/src/shaders/post_processing/gen8/PL2_AVS_Buf_1.g8a b/src/shaders/post_processing/gen8/PL2_AVS_Buf_1.g8a
new file mode 100644 (file)
index 0000000..e916576
--- /dev/null
@@ -0,0 +1,458 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//   42    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// FileName:           PL2_AVS_Buf_1.asm
+// Author:                     Tatiya, Rupesh
+// Description:                Loads 8x8 AVS/IEF PL2 data into Buffer 1
+
+
+
+// FileName     :   PL2_AVS_Buf.asm
+// Author       :   Tatiya, Rupesh
+// Description  :   Loads 8x8 AVS/IEF PL2 data into Buffer N
+
+
+
+// Module name: Scaling.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+        // Message Header
+        // m0.7         31:0    Debug
+        // m0.6         31:0    Debug
+        // m0.5         31:0    Ignored
+        // m0.4         31:0    Ignored
+        // m0.3         31:0    Ignored
+        // m0.2         31:16   Ignored
+        //              15      Alpha Write Channel Mask        enable=0, disable=1
+        //              14      Blue Write Channel Mask  (U)
+        //              13      Green Write Channel Mask (Y)
+        //              12      Red Write Channel Mask   (V)
+        //              11:0    Ignored
+        // m0.1                 Ignored
+        // m0.0                 Ignored
+
+
+        // AVS payload
+        // m1.7                 Group ID Number
+        // m1.6                 U 2nd Derivative        ---> NLAS dx
+        // m1.5                 Delta V                 ---> Step Y
+        // m1.4                 Delta U                 ---> Step X
+        // m1.3                 Pixel 0 V Address       ---> ORIY (Y0)
+        // m1.2                 Pixel 0 U Address       ---> ORIX (X0)
+        // m1.1                 Vertical Block Number
+        // m1.0                 Reserved
+
+        // Sampler Message Descriptor
+        // 31:29        Reserved                        000
+        // 28:25        Message length                  0010
+        // 24:20        Response length                 xxxxx   ---> 4GRFs for each enabled channel (AVS), 2GRFs for each enabled channel (sample unorm)
+        // 19           Header Present                  1
+        // 18:17        SIMD Mode                       11      ---> SIMD32/64
+        // 16:12        Message Type                    xxxxx   ---> 01011 sample_8x8, 01100 (sample_unorm), 01010 (sample_unorm+killpix)
+        // 11:8         Sampler Index                   xxxx
+        // 7:0          Binding Table Index             xxxxxxxx
+
+
+        // Msg Header M0.2
+        // 15:15        Alpha Write Channel Mask, 0: written back, 1: not written back
+        // 14:14        Blue  Write Channel Mask
+        // 13:13        Green Write Channel Mask
+        // 12:12        Red   Write Channel Mask
+
+
+//By design, Buffer 0,1,2,3 always have Layer 0 and Buffer 4,5 always have L1-L7
+
+
+//used to generate LABELS at compile time.
+
+
+        // 18:17        SIMD Mode                       10      ---> SIMD16
+        // 16:12        Message Type                    xxxxx   ---> 00000 (SIMD16)
+
+
+//r10-17  - 8 GRFs to load SIMD16 data (upto 4 channels)
+//r18-19  - 2 GRFs to store sampler ramp.
+
+    .declare mfSCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+    .declare muwSCALING_0X_34X_PAYLOAD Base=r14.0      ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+    .declare mudCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+    .declare mubCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=1           SrcRegion=<32;32,1>             DstRegion=<1>           Type=ub
+
+
+       .declare fSCALING_0X_34X_TEMP           Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+       .declare udSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+       .declare ub4SCALING_0X_34X_TEMP         Base=r9.0       ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<1>           Type=ub
+       .declare uwSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+       // Sampler ramp is used for Scaling 0X_0.34X
+       .declare        fSAMPLER_RAMP           Base=r9.0 ElementSize=4 SrcRegion=<8;8,1> Type=f                // 1 GRFs, 8 elements
+
+
+       //#define rMSGDSC_UV                    r23.0
+
+
+//End of _SCALING_
+
+
+    mov (1)     r16.3<1>:ud    r0.3<0;1,0>:ud
+
+
+    //AVS_PAYLOAD already has all the data loaded at this point
+    add (1)     a0.0<1>:ud     r23.5<0;1,0>:ud      0x44EB000:ud      //msg desc
+
+    mov (1)     r16.2<1>:ud      0x0000D000:ud                                        // Enable Red channel
+
+
+    // set the vertical block number
+
+       mov (1)   r25.1<1>:ud     1:ud
+
+
+    mov (8)     r17.0<1>:ud      r25.0<8;8,1>:ud                                     // Copy msg payload mirrors to MRFs
+
+    send (1)    uwBUFFER_1(0)<1>   r16    0x2    a0.0:ud
+    // Returns Y data in 4 GRFs in scrambled order
+
+    add (1)     a0.0<1>:ud                r23.5<0;1,0>:ud      0x48EB001:ud            // msg desc; 1 is added to change BI to UV
+    mov (1)     r16.2<1>:ud      0x0000A000:ud                                               // Enable Red+Blue channel
+
+    send (1)    uwBUFFER_1(4)<1>   r16    0x2    a0.0:ud
+    // Returns UV data in 8 GRFs in scrambled order
+
+SKIP_AVS_LOAD_L0_1_:
+    nop
+
+
diff --git a/src/shaders/post_processing/gen8/PL2_AVS_Buf_2.g8a b/src/shaders/post_processing/gen8/PL2_AVS_Buf_2.g8a
new file mode 100644 (file)
index 0000000..ed51a19
--- /dev/null
@@ -0,0 +1,458 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//   42    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// FileName:           PL2_AVS_Buf_2.asm
+// Author:                     Tatiya, Rupesh
+// Description:                Loads 8x8 AVS/IEF PL2 data into Buffer 2
+
+
+
+// FileName     :   PL2_AVS_Buf.asm
+// Author       :   Tatiya, Rupesh
+// Description  :   Loads 8x8 AVS/IEF PL2 data into Buffer N
+
+
+
+// Module name: Scaling.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+        // Message Header
+        // m0.7         31:0    Debug
+        // m0.6         31:0    Debug
+        // m0.5         31:0    Ignored
+        // m0.4         31:0    Ignored
+        // m0.3         31:0    Ignored
+        // m0.2         31:16   Ignored
+        //              15      Alpha Write Channel Mask        enable=0, disable=1
+        //              14      Blue Write Channel Mask  (U)
+        //              13      Green Write Channel Mask (Y)
+        //              12      Red Write Channel Mask   (V)
+        //              11:0    Ignored
+        // m0.1                 Ignored
+        // m0.0                 Ignored
+
+
+        // AVS payload
+        // m1.7                 Group ID Number
+        // m1.6                 U 2nd Derivative        ---> NLAS dx
+        // m1.5                 Delta V                 ---> Step Y
+        // m1.4                 Delta U                 ---> Step X
+        // m1.3                 Pixel 0 V Address       ---> ORIY (Y0)
+        // m1.2                 Pixel 0 U Address       ---> ORIX (X0)
+        // m1.1                 Vertical Block Number
+        // m1.0                 Reserved
+
+        // Sampler Message Descriptor
+        // 31:29        Reserved                        000
+        // 28:25        Message length                  0010
+        // 24:20        Response length                 xxxxx   ---> 4GRFs for each enabled channel (AVS), 2GRFs for each enabled channel (sample unorm)
+        // 19           Header Present                  1
+        // 18:17        SIMD Mode                       11      ---> SIMD32/64
+        // 16:12        Message Type                    xxxxx   ---> 01011 sample_8x8, 01100 (sample_unorm), 01010 (sample_unorm+killpix)
+        // 11:8         Sampler Index                   xxxx
+        // 7:0          Binding Table Index             xxxxxxxx
+
+
+        // Msg Header M0.2
+        // 15:15        Alpha Write Channel Mask, 0: written back, 1: not written back
+        // 14:14        Blue  Write Channel Mask
+        // 13:13        Green Write Channel Mask
+        // 12:12        Red   Write Channel Mask
+
+
+//By design, Buffer 0,1,2,3 always have Layer 0 and Buffer 4,5 always have L1-L7
+
+
+//used to generate LABELS at compile time.
+
+
+        // 18:17        SIMD Mode                       10      ---> SIMD16
+        // 16:12        Message Type                    xxxxx   ---> 00000 (SIMD16)
+
+
+//r10-17  - 8 GRFs to load SIMD16 data (upto 4 channels)
+//r18-19  - 2 GRFs to store sampler ramp.
+
+    .declare mfSCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+    .declare muwSCALING_0X_34X_PAYLOAD Base=r14.0      ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+    .declare mudCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+    .declare mubCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=1           SrcRegion=<32;32,1>             DstRegion=<1>           Type=ub
+
+
+       .declare fSCALING_0X_34X_TEMP           Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+       .declare udSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+       .declare ub4SCALING_0X_34X_TEMP         Base=r9.0       ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<1>           Type=ub
+       .declare uwSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+       // Sampler ramp is used for Scaling 0X_0.34X
+       .declare        fSAMPLER_RAMP           Base=r9.0 ElementSize=4 SrcRegion=<8;8,1> Type=f                // 1 GRFs, 8 elements
+
+
+       //#define rMSGDSC_UV                    r23.0
+
+
+//End of _SCALING_
+
+
+    mov (1)     r16.3<1>:ud    r0.3<0;1,0>:ud
+
+    //AVS_PAYLOAD already has all the data loaded at this point
+    add (1)     a0.0<1>:ud     r23.5<0;1,0>:ud      0x44EB000:ud      //msg desc
+
+    mov (1)     r16.2<1>:ud      0x0000D000:ud                                        // Enable Red channel
+
+
+    // set the vertical block number
+
+
+      mov (1)   r25.1<1>:ud 2:ud
+
+
+    mov (8)     r17.0<1>:ud      r25.0<8;8,1>:ud                                     // Copy msg payload mirrors to MRFs
+
+    send (1)    uwBUFFER_2(0)<1>   r16    0x2    a0.0:ud
+    // Returns Y data in 4 GRFs in scrambled order
+
+    add (1)     a0.0<1>:ud                r23.5<0;1,0>:ud      0x48EB001:ud            // msg desc; 1 is added to change BI to UV
+    mov (1)     r16.2<1>:ud      0x0000A000:ud                                               // Enable Red+Blue channel
+
+    send (1)    uwBUFFER_2(4)<1>   r16    0x2    a0.0:ud
+    // Returns UV data in 8 GRFs in scrambled order
+
+SKIP_AVS_LOAD_L0_2_:
+    nop
+
+
diff --git a/src/shaders/post_processing/gen8/PL2_AVS_Buf_3.g8a b/src/shaders/post_processing/gen8/PL2_AVS_Buf_3.g8a
new file mode 100644 (file)
index 0000000..5b46bf7
--- /dev/null
@@ -0,0 +1,460 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//   42    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// FileName:           PL2_AVS_Buf_3.asm
+// Author:                     Tatiya, Rupesh
+// Description:                Loads 8x8 AVS/IEF PL2 data into Buffer 0
+
+
+
+// FileName     :   PL2_AVS_Buf.asm
+// Author       :   Tatiya, Rupesh
+// Description  :   Loads 8x8 AVS/IEF PL2 data into Buffer N
+
+
+
+// Module name: Scaling.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+        // Message Header
+        // m0.7         31:0    Debug
+        // m0.6         31:0    Debug
+        // m0.5         31:0    Ignored
+        // m0.4         31:0    Ignored
+        // m0.3         31:0    Ignored
+        // m0.2         31:16   Ignored
+        //              15      Alpha Write Channel Mask        enable=0, disable=1
+        //              14      Blue Write Channel Mask  (U)
+        //              13      Green Write Channel Mask (Y)
+        //              12      Red Write Channel Mask   (V)
+        //              11:0    Ignored
+        // m0.1                 Ignored
+        // m0.0                 Ignored
+
+
+        // AVS payload
+        // m1.7                 Group ID Number
+        // m1.6                 U 2nd Derivative        ---> NLAS dx
+        // m1.5                 Delta V                 ---> Step Y
+        // m1.4                 Delta U                 ---> Step X
+        // m1.3                 Pixel 0 V Address       ---> ORIY (Y0)
+        // m1.2                 Pixel 0 U Address       ---> ORIX (X0)
+        // m1.1                 Vertical Block Number
+        // m1.0                 Reserved
+
+        // Sampler Message Descriptor
+        // 31:29        Reserved                        000
+        // 28:25        Message length                  0010
+        // 24:20        Response length                 xxxxx   ---> 4GRFs for each enabled channel (AVS), 2GRFs for each enabled channel (sample unorm)
+        // 19           Header Present                  1
+        // 18:17        SIMD Mode                       11      ---> SIMD32/64
+        // 16:12        Message Type                    xxxxx   ---> 01011 sample_8x8, 01100 (sample_unorm), 01010 (sample_unorm+killpix)
+        // 11:8         Sampler Index                   xxxx
+        // 7:0          Binding Table Index             xxxxxxxx
+
+
+        // Msg Header M0.2
+        // 15:15        Alpha Write Channel Mask, 0: written back, 1: not written back
+        // 14:14        Blue  Write Channel Mask
+        // 13:13        Green Write Channel Mask
+        // 12:12        Red   Write Channel Mask
+
+
+//By design, Buffer 0,1,2,3 always have Layer 0 and Buffer 4,5 always have L1-L7
+
+
+//used to generate LABELS at compile time.
+
+
+        // 18:17        SIMD Mode                       10      ---> SIMD16
+        // 16:12        Message Type                    xxxxx   ---> 00000 (SIMD16)
+
+
+//r10-17  - 8 GRFs to load SIMD16 data (upto 4 channels)
+//r18-19  - 2 GRFs to store sampler ramp.
+
+    .declare mfSCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+    .declare muwSCALING_0X_34X_PAYLOAD Base=r14.0      ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+    .declare mudCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+    .declare mubCALING_0X_34X_PAYLOAD  Base=r14.0      ElementSize=1           SrcRegion=<32;32,1>             DstRegion=<1>           Type=ub
+
+
+       .declare fSCALING_0X_34X_TEMP           Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=f
+       .declare udSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=4           SrcRegion=<8;8,1>               DstRegion=<1>           Type=ud
+       .declare ub4SCALING_0X_34X_TEMP         Base=r9.0       ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<1>           Type=ub
+       .declare uwSCALING_0X_34X_TEMP          Base=r9.0       ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+       // Sampler ramp is used for Scaling 0X_0.34X
+       .declare        fSAMPLER_RAMP           Base=r9.0 ElementSize=4 SrcRegion=<8;8,1> Type=f                // 1 GRFs, 8 elements
+
+
+       //#define rMSGDSC_UV                    r23.0
+
+
+//End of _SCALING_
+
+
+
+    mov (1)     r16.3<1>:ud    r0.3<0;1,0>:ud
+
+
+    //AVS_PAYLOAD already has all the data loaded at this point
+    add (1)     a0.0<1>:ud     r23.5<0;1,0>:ud      0x44EB000:ud      //msg desc
+
+    mov (1)     r16.2<1>:ud      0x0000D000:ud                                        // Enable Red channel
+
+
+    // set the vertical block number
+
+
+      mov (1)   r25.1<1>:ud      3:ud
+
+
+    mov (8)     r17.0<1>:ud      r25.0<8;8,1>:ud                                     // Copy msg payload mirrors to MRFs
+
+    send (1)    uwBUFFER_3(0)<1>   r16    0x2    a0.0:ud
+    // Returns Y data in 4 GRFs in scrambled order
+
+    add (1)     a0.0<1>:ud                r23.5<0;1,0>:ud      0x48EB001:ud            // msg desc; 1 is added to change BI to UV
+    mov (1)     r16.2<1>:ud      0x0000A000:ud                                               // Enable Red+Blue channel
+
+    send (1)    uwBUFFER_3(4)<1>   r16    0x2    a0.0:ud
+    // Returns UV data in 8 GRFs in scrambled order
+
+SKIP_AVS_LOAD_L0_3_:
+    nop
+
+
diff --git a/src/shaders/post_processing/gen8/Save_AVS_NV12.g8a b/src/shaders/post_processing/gen8/Save_AVS_NV12.g8a
new file mode 100644 (file)
index 0000000..dcb7ce0
--- /dev/null
@@ -0,0 +1,621 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//  131    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// Module name: Save_AVS_NV12.asm
+//
+// Save NV12 420 frame data block of size 16x16
+//
+// To save 16x16 block (16x16 bytes of Y and 16x8 bytes of interleaved UV), we need 2 send instructions with of size 16x16 and 16x8 each.
+//  ---------------
+//  |    16x16    |
+//  |    YUYV     |
+//  ---------------
+//  | 16x8  UV   |
+//  ---------------
+
+//-----------------------------------------------------------------
+//The layout of data is as follows:
+//mMSGHDR0                     : Y data header (16x16)
+//mubMSGPAYLOAD0       : Y data payload (8 GRFs)
+//mMSGHDR1                     : U data header (16x8)
+//mubMSGPAYLOAD1       : U data payload (4 GRFs)
+//------------------------------------------------------------------
+
+
+
+// Module name: Save.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+//Msg payload buffers; upto 4 full-size messages can be written
+
+
+.declare    mudMSGPAYLOAD0  Base=r29.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mudMSGPAYLOAD1  Base=r38.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mudMSGPAYLOAD2  Base=r47.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mudMSGPAYLOAD3  Base=r56.0 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+
+.declare    muwMSGPAYLOAD0  Base=r29.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    muwMSGPAYLOAD1  Base=r38.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    muwMSGPAYLOAD2  Base=r47.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    muwMSGPAYLOAD3  Base=r56.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+
+.declare    mubMSGPAYLOAD0  Base=r29.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD1  Base=r38.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD2  Base=r47.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD3  Base=r56.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD4  Base=r32.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD5  Base=r41.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD6  Base=r50.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    mubMSGPAYLOAD7  Base=r59.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+
+
+       // the r17 register (nTEMP0) is originally defined from "Common.inc"
+       // instead of re-defining a nTEMP0 here, we use "SAVE_RGB" suffix for its naming
+
+       .declare uwTemp0 Base=r17.0 ElementSize=2 Type=uw
+
+
+//_SAVE_INC_
+
+
+       // At the save module we have all 8 address sub-registers available.
+       // So we will use PING-PONG type of scheme to save the data using
+       // pointers pBUF_CHNL_TOP_8x4 and pBUF_CHNL_BOT_8x4. This will help
+       // reduce dependency. - rT
+
+       //wBUFF_CHNL_PTR points to either buffer 0 or buffer 4.
+       //Add appropriate offsets to get pointers for all buffers (1,2,3 or 5).
+       //Offsets are zero for buffer 0 and buffer 4.
+       add   (4) a0.0<1>:uw   r22.0<4;4,1>:w          0:uw
+       add   (4) a0.4<1>:uw   r22.0<4;4,1>:w          512:uw
+
+       //Set up header for Y,U and V data
+       mov  (8) r28<1>:ud      r27<8;8,1>:ud
+       mov  (8) r37<1>:ud      r27<8;8,1>:ud
+
+       mov  (2) r28.0<1>:d     r7.0<2;2,1>:w                                   { NoDDClr }             //ORI Y (LUMA)  = ORI
+       mov  (1) r37.0<1>:d     r7.0<0;1,0>:w                                   { NoDDClr }             //H ORI (CHROMA)        = H ORI
+       shr  (1) r37.1<1>:d     r7.1<0;1,0>:w            1:w            { NoDDClr, NoDDChk }    //V ORI (CHROMA)        = V ORI/2
+
+       mov  (1) r28.2<1>:ud    0xF000F:ud      { NoDDChk }  // Y Block width and height (16x16)
+       mov  (1) r37.2<1>:ud    0x7000F:ud      { NoDDChk }  // UV Block width and height(16x8)
+
+// Unscramble, and pack data directly to MRFs
+
+//     Data 16x16 block is divided as -
+//             ---------
+//             |   0   |
+//             ---------
+//             |   1   |
+//             ---------
+//             |   2   |
+//             ---------
+//             |   3   |
+//             ---------
+//             All sub-blocks are of size 16x4
+//             0: ubBUFFER_0
+//             1: ubBUFFER_1, ubBUFFER_0+16
+//             2: ubBUFFER_2
+//             3: ubBUFFER_3, ubBUFFER_2+16
+
+       //Y Rounding 16x4 top part
+       add.sat (16) r[a0.1,0]<1>:uw            r[a0.1,0]<16;16,1>:uw                   0x0080:uw               
+       add.sat (16) r[a0.1,32]<1>:uw           r[a0.1,32]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.1,64]<1>:uw           r[a0.1,64]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.1,96]<1>:uw           r[a0.1,96]<16;16,1>:uw          0x0080:uw               
+
+       // U Averaging and Rounding, 8x2 top part
+       shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.2,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.2,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.2,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.2,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
+       add.sat (8) r[a0.2,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
+       add.sat (8) r[a0.2,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
+
+       // V Averaging and Rounding, 8x2 top part
+       shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.0,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.0,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.0,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.0,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
+       add.sat (8) r[a0.0,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
+       add.sat (8) r[a0.0,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
+
+       add   (4) a0.0<1>:uw                    r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
+
+       //Y Rounding, 16x4 bottom part
+       add.sat (16) r[a0.5,0]<1>:uw            r[a0.5,0]<16;16,1>:uw                   0x0080:uw               
+       add.sat (16) r[a0.5,32]<1>:uw           r[a0.5,32]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.5,64]<1>:uw           r[a0.5,64]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.5,96]<1>:uw           r[a0.5,96]<16;16,1>:uw          0x0080:uw               
+
+       // U Averaging and Rounding, 8x2 bottom part
+       shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.6,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.6,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.6,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.6,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
+       add.sat (8) r[a0.6,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
+       add.sat (8) r[a0.6,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
+
+       // V Averaging and Rounding, 8x2 bottom part
+       shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.4,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.4,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.4,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.4,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
+       add.sat (8) r[a0.4,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
+       add.sat (8) r[a0.4,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
+
+       add   (4) a0.4<1>:uw            r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
+       //Y Rounding 16x4 top part
+       add.sat (16) r[a0.1,0]<1>:uw            r[a0.1,0]<16;16,1>:uw                   0x0080:uw               
+       add.sat (16) r[a0.1,32]<1>:uw           r[a0.1,32]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.1,64]<1>:uw           r[a0.1,64]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.1,96]<1>:uw           r[a0.1,96]<16;16,1>:uw          0x0080:uw               
+
+       // U Averaging and Rounding, 8x2 top part
+       shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.2,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.2,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.2,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.2,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
+       add.sat (8) r[a0.2,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
+       add.sat (8) r[a0.2,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
+
+       // V Averaging and Rounding, 8x2 top part
+       shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.0,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.0,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.0,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.0,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
+       add.sat (8) r[a0.0,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
+       add.sat (8) r[a0.0,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
+
+       add   (4) a0.0<1>:uw                    r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
+
+       //Y Rounding, 16x4 bottom part
+       add.sat (16) r[a0.5,0]<1>:uw            r[a0.5,0]<16;16,1>:uw                   0x0080:uw               
+       add.sat (16) r[a0.5,32]<1>:uw           r[a0.5,32]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.5,64]<1>:uw           r[a0.5,64]<16;16,1>:uw          0x0080:uw               
+       add.sat (16) r[a0.5,96]<1>:uw           r[a0.5,96]<16;16,1>:uw          0x0080:uw               
+
+       // U Averaging and Rounding, 8x2 bottom part
+       shr   (8)       uwBUFFER_5(0,0)<2>                      r[a0.6,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(1,0)<2>                      r[a0.6,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(2,0)<2>                      r[a0.6,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(3,0)<2>                      r[a0.6,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(0,0)<2>                      uwBUFFER_5(0,0)<16;8,2>                         uwBUFFER_5(1,0)<16;8,2>
+       add.sat (8) r[a0.6,0]<2>:uw             uwBUFFER_5(0,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(2,0)<2>                      uwBUFFER_5(2,0)<16;8,2>                         uwBUFFER_5(3,0)<16;8,2>
+       add.sat (8) r[a0.6,64]<2>:uw            uwBUFFER_5(2,0)<16;8,2>                         0x0080:uw
+
+       // V Averaging and Rounding, 8x2 bottom part
+       shr   (8)       uwBUFFER_5(4,0)<2>                      r[a0.4,0]<16;8,2>:uw                    1:w
+       shr       (8)   uwBUFFER_5(5,0)<2>                      r[a0.4,32]<16;8,2>:uw                   1:w
+       shr       (8)   uwBUFFER_5(6,0)<2>                      r[a0.4,64]<16;8,2>:uw                   1:w
+       shr   (8)       uwBUFFER_5(7,0)<2>                      r[a0.4,96]<16;8,2>:uw                   1:w
+
+       add       (8)   uwBUFFER_5(4,0)<2>                      uwBUFFER_5(4,0)<16;8,2>                         uwBUFFER_5(5,0)<16;8,2>
+       add.sat (8) r[a0.4,0]<2>:uw             uwBUFFER_5(4,0)<16;8,2>                         0x0080:uw
+
+       add       (8)   uwBUFFER_5(6,0)<2>                      uwBUFFER_5(6,0)<16;8,2>                         uwBUFFER_5(7,0)<16;8,2>
+       add.sat (8) r[a0.4,64]<2>:uw            uwBUFFER_5(6,0)<16;8,2>                         0x0080:uw
+
+       add   (4) a0.4<1>:uw            r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
+       // restore pBUF_CHNL_TOP_8x4 and pBUF_CHNL_BOT_8x4 registers
+       add   (4) a0.0<1>:uw   r22.0<4;4,1>:w          0:uw
+       add   (4) a0.4<1>:uw   r22.0<4;4,1>:w          512:uw
+
+//Buffer 0
+//Move Y to msg payload
+       mov  (16)  mubMSGPAYLOAD0(0,0)<1>                       r[a0.1, 1]<32;16,2>:ub          { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(0,16)<1>                      r[a0.1, 33]<32;16,2>:ub         { NoDDChk }
+       mov  (16)  mubMSGPAYLOAD0(1,0)<1>                       r[a0.1, 65]<32;16,2>:ub         { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(1,16)<1>                      r[a0.1, 97]<32;16,2>:ub         { NoDDChk }
+
+//Move U to msg payload
+       mov  (8)  mubMSGPAYLOAD1(0,0)<2>                        r[a0.2, 1]<32;8,4>:ub           { NoDDClr }
+       mov  (8)  mubMSGPAYLOAD1(0,16)<2>                       r[a0.2, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
+
+//Move V to msg payload
+       mov  (8)  mubMSGPAYLOAD1(0,1)<2>                        r[a0.0, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
+       mov  (8)  mubMSGPAYLOAD1(0,17)<2>                       r[a0.0, 65]<32;8,4>:ub          { NoDDChk }
+
+       add   (4) a0.0<1>:uw                    r22.0<4;4,1>:w          1024:uw //Update Buffer 2 pointers
+
+//Buffer 1
+       mov  (16)  mubMSGPAYLOAD0(2,0)<1>                       r[a0.5, 1]<32;16,2>:ub          { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(2,16)<1>                      r[a0.5, 33]<32;16,2>:ub         { NoDDChk }
+       mov  (16)  mubMSGPAYLOAD0(3,0)<1>                       r[a0.5, 65]<32;16,2>:ub         { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(3,16)<1>                      r[a0.5, 97]<32;16,2>:ub         { NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(1,0)<2>                        r[a0.6, 1]<32;8,4>:ub           { NoDDClr }
+       mov  (8)  mubMSGPAYLOAD1(1,16)<2>                       r[a0.6, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(1,1)<2>                        r[a0.4, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
+       mov  (8)  mubMSGPAYLOAD1(1,17)<2>                       r[a0.4, 65]<32;8,4>:ub          { NoDDChk }
+
+       add   (4) a0.4<1>:uw            r22.0<4;4,1>:w          1536:uw //Update Buffer 3 pointers
+
+//Buffer 2
+       mov  (16)  mubMSGPAYLOAD0(4,0)<1>                       r[a0.1, 1]<32;16,2>:ub          { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(4,16)<1>                      r[a0.1, 33]<32;16,2>:ub         { NoDDChk }
+       mov  (16)  mubMSGPAYLOAD0(5,0)<1>                       r[a0.1, 65]<32;16,2>:ub         { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(5,16)<1>                      r[a0.1, 97]<32;16,2>:ub         { NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(2,0)<2>                        r[a0.2, 1]<32;8,4>:ub           { NoDDClr }
+       mov  (8)  mubMSGPAYLOAD1(2,16)<2>                       r[a0.2, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(2,1)<2>                        r[a0.0, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
+       mov  (8)  mubMSGPAYLOAD1(2,17)<2>                       r[a0.0, 65]<32;8,4>:ub          { NoDDChk }
+
+//Buffer 3
+       mov  (16)  mubMSGPAYLOAD0(6,0)<1>                       r[a0.5, 1]<32;16,2>:ub          { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(6,16)<1>                      r[a0.5, 33]<32;16,2>:ub         { NoDDChk }
+       mov  (16)  mubMSGPAYLOAD0(7,0)<1>                       r[a0.5, 65]<32;16,2>:ub         { NoDDClr }
+       mov  (16)  mubMSGPAYLOAD0(7,16)<1>                      r[a0.5, 97]<32;16,2>:ub         { NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(3,0)<2>                        r[a0.6, 1]<32;8,4>:ub           { NoDDClr }
+       mov  (8)  mubMSGPAYLOAD1(3,16)<2>                       r[a0.6, 65]<32;8,4>:ub          { NoDDClr, NoDDChk }
+
+       mov  (8)  mubMSGPAYLOAD1(3,1)<2>                        r[a0.4, 1]<32;8,4>:ub           { NoDDClr, NoDDChk }
+       mov  (8)  mubMSGPAYLOAD1(3,17)<2>                       r[a0.4, 65]<32;8,4>:ub          { NoDDChk }
+//===========================================================================
+
+send (1)    null<1>:d    r28           0xc                     0x120A8018:ud
+send (1)    null<1>:d    r37           0xc                     0xA0A8019:ud
diff --git a/src/shaders/post_processing/gen8/Set_AVS_Buf_0123_PL2.g8a b/src/shaders/post_processing/gen8/Set_AVS_Buf_0123_PL2.g8a
new file mode 100644 (file)
index 0000000..1d38ae2
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//    7    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+//Module Name: Set_AVS_Buf_0123_PL2.asm
+
+
+
+//Module Name: Set_Buf_0123_PL2
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+       //AVS LAYOUT: (YYUUVVAA)
+               //Assign buffer channel order for Buffer 0123 in the order AUYV a0.3>A, a0.2>U, a0.1>Y, a0.0>V
+               //For PL2-AVS: V = 8, Y= 0, U = 4, A = 12.
+               mov     (4)     acc0.0<1>:w                                     0x6EA2:v                                        //Subtract 6 from 0,4,8,12
+               add (4) acc0.0<1>:w                                     acc0<4;4,1>:w           70:uw           //add 6 back
+               shl (4) r22.0<1>:w              acc0<4;4,1>:w           5:uw                            //Convert to BYTE address.
+
+       //OPT: wAVS_SU_SHUFFLE_PTR_0 and udAVS_SU_SHUFFLE_OFF_0 are sub-regs of same GRF. -rT
+       //SU LAYOUT:(YUVAYUVA)
+               //V = 4, Y = 0, U = 2, A = 6
+               mov     (4)     acc0.0<1>:w                                     0x6204:v
+               add (4) acc0.0<1>:w                                     acc0<4;4,1>:w           64:uw
+               shl (4) r18.0<1>:w      acc0<4;4,1>:w           5:uw                                    { NoDDClr }     //Convert to BYTE address.
+
+               //OFFSET:
+               mov (1)   r18.4<1>:ud           0x1000100:ud    { NoDDChk }
+
+
diff --git a/src/shaders/post_processing/gen8/Set_Layer_0.g8a b/src/shaders/post_processing/gen8/Set_Layer_0.g8a
new file mode 100644 (file)
index 0000000..b1b574e
--- /dev/null
@@ -0,0 +1,483 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//   18    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+#define        MSG_AVS_SAMPLE          0x00000000
+#define                MSG_CONVOLE_SAMPLE      0x10000000
+#define                MSG_MINMAX_SAMPLE       0x20000000
+#define                MSG_MINMAXF_SAMPLE      0x30000000
+#define                MSG_ERODE_SAMPLE        0x40000000
+#define                MSG_DILATE_SAMPLE       0x50000000
+#define                MSG_BOOLCENT_SAMPLE     0x60000000
+#define                MSG_CENTROID_SAMPLE     0x70000000
+
+#define                MSG_IEF_BYPASS          0x08000000
+#define                MSG_IEF_ENABLE          0x00000000
+
+//16x4 or 8x4 or 16x8 or 4x4
+#define                MSG_AVS_164             0x00000000
+#define                MSG_AVS_84              0x02000000
+#define                MSG_AVS_168             0x04000000
+#define                MSG_AVS_44              0x06000000
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+
+
+
+
+//Module name:   Set_Layer_N.inc
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+//Used to generate LABELS at compile time.
+
+
+//definitions for Expand Mask
+.declare uwMask_Temp1           Base=r17.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw         // 1 GRF
+.declare ubMask_Temp1           Base=r17.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub         // 1 GRF
+.declare udMask_Temp1           Base=r17.0 ElementSize=4 Type=ud                                // 1 GRF
+.declare uwMask_Temp2           Base=r16.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw         // 1 GRF
+.declare ubMask_Temp2           Base=r16.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub         // 1 GRF
+.declare udMask_Temp2           Base=r16.0 ElementSize=4 Type=ud                                // 1 GRF
+
+.declare uwMask_Temp3           Base=r15.0 ElementSize=2 SrcRegion=<16;16,1> Type=uw         // 1 GRF
+.declare ubMask_Temp3           Base=r15.0 ElementSize=1 SrcRegion=<16;16,1> Type=ub         // 1 GRF
+
+.declare udALPHA_MASK_REG       Base=r21.0         ElementSize=4 Type=ud       // 1 GRF
+.declare udALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//Initialize mask reg to FFFF
+
+       mov     (16)    uwALPHA_MASK_REG(0)<1>          0xFFFF:uw
+
+
+//Fast jump for -
+//LAYER0: we determine whether layer 0 is to be loaded and processed or not based
+//             on block mask in module "Set_Layer_0" and store result in f0.1.
+//             This flag is then directly used to while loading buf0-3 and colorfill.
+//             (So flag f0.1 should not be changed from Set_Layer_0 till Colorfill)
+//
+//LAYER1-7: For all other layers, we compute whether layer is to be loaded and processed
+//               based on block mask in module "Set_Layer_1-7" and store result in SKIP_LAYER
+//               variable.
+//               While Loading buf 4 and 5, we move SKIP_LAYER to f0.0 every time and use it
+//               for Loading.
+//               For processing though, we move SKIP_LAYER only once to f0.1 in module
+//               "Set_Buf0_Buf4" and use f0.1 for deciding whether layer 1-7 (all 4 sub blocks)
+//               is to be processed or not.
+//               (So flag f0.1) should not be modififed from module "Set_Buf0_Buf4" till module
+//               that processess sub-block 3).
+//
+//None of the above fast jumps, apply to CSC modules. We always perform CSC irrespective of mask.
+//
+//Example: (Without going into finer details)
+//             Typical Combined kernel:
+//
+//             (let var = decision whether to load/process that layer)
+//
+//             Set_Layer_0                     //f0.1 <- var
+//             ..
+//             Set_Layer_1                     //f0.1 <- var, SKIP_LAYER <- var
+//             ..
+//             Load buf 0                      //use f0.1
+//             Load buf 4                      //f0.0 <- SKIP_LAYER
+//             Load buf 1                      //use f0.1
+//             Load buf 5                      //f0.0 <- SKIP_LAYER
+//             Load buf 2                      //use f0.1
+//             Load buf 3                      //use f0.1
+//             ..
+//             ..
+//             Colorfill
+//             ..
+//             Set_Buf0_Buf4           //f0.1 <- SKIP_LAYER
+//             process0-4                      //Use f0.1
+//             Load buf 4
+//             Set_Buf1_Buf5
+//             process1-5
+//             Load buf 5
+//             ..
+//             Set_Layer_2                     //f0.1 <-var, SKIP_LAYER <- var
+//             ..
+//             Set_Buf2_Buf4
+//             process2-4
+//             Load buf 4
+//             Set_Buf3_Buf5
+//             process3-5
+//             Load buf 5
+//             ..
+
+
+    and (1) r24.2<1>:ub    r2.2<0;1,0>:uw    3:uw    
+
+
+       //Copy all AVS Payload data
+       // Setup Message Payload Header for 1st block of Media Sampler 8x8 (16x4 for IVB+)
+        //currently the dx & dy is passed by Constant buffer (zero)
+        mov (1) r25.0<1>:f       r7.6<0;1,0>:f                 //NLAS dy
+       mov (1) r25.6<1>:f        r7.5<0;1,0>:f                 //NLAS dx
+       mov (1) r25.4<1>:f        r3.0<0;1,0>:f                 //Step X
+       mov (1) r25.5<1>:f        r4.0<0;1,0>:f                 //Step Y
+
+
+       mov (1) r25.2<1>:f      r6.0<0;1,0>:f           //Orig X
+       mov (1) r25.3<1>:f      r5.0<0;1,0>:f           //Orig Y
+  
+        mov (1) r25.7<1>:ud    0:ud
+       add (1) r25.7<1>:ud     r25.7<0;1,0>:ud MSG_AVS_SAMPLE + MSG_AVS_164 + MSG_IEF_BYPASS:ud        
+
+    //NLAS calculations for 2nd half of blocks of Media Sampler 8x8:
+    // X(i) = X0 + dx*i + ddx*i*(i-1)/2   ==>  X(8) = X0 + dx*8 +ddx*28
+    // dx(i)= dx(0) + ddx*i               ==>  dx(8)= dx + ddx*8
+
+       //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
+
+    // Calculating X(8)
+    mov (1)   acc0.2<1>:f                      r6.0<0;1,0>:f
+    mac (1)   acc0.2<1>:f                      r3.0<0;1,0>:f           8.0:f
+    mac (1)   r23.2<1>:f       r7.5<0;1,0>:f     28.0:f                { NoDDClr }
+
+    // Calculating Y(4)
+    mul (1)   r23.1<1>:f       r4.0<0;1,0>:f       4.0:f       { NoDDClr, NoDDChk }  //dY*4
+
+    // Calculating dx(8)
+    mov (1)   acc0.4<1>:f           r3.0<0;1,0>:f
+    mac (1)   r23.4<1>:f     r7.5<0;1,0>:f             8.0:f           { NoDDClr, NoDDChk }
+
+       // Binding Index
+       mov (1) r23.5<1>:ud             0:ud                                                    { NoDDChk }
+
+
+SKIP_LAYER_L0:
+       nop
+
+
diff --git a/src/shaders/post_processing/gen8/VP_Setup.g8a b/src/shaders/post_processing/gen8/VP_Setup.g8a
new file mode 100644 (file)
index 0000000..95f5fe2
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/*
+ *  Copyright 2000-2011 Intel Corporation All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  Authors: Zhao Yakui <yakui.zhao@intel.com>
+ */
+
+//  326    // Total instruction count
+//    1    // Total kernel count
+
+
+
+// Module name: common.inc
+//
+// Common header file for all Video-Processing kernels
+//
+
+.default_execution_size (16)
+.default_register_type  :ub
+
+.reg_count_total        128
+.reg_count_payload      7
+
+//========== Common constants ==========
+
+
+//========== Macros ==========
+
+
+//Fast Jump, For more details see "Set_Layer_N.asm"
+
+
+//========== Defines ====================
+
+//========== Static Parameters (Common To All) ==========
+//r1
+
+
+//r2
+
+                                    //  e.g.            byte0   byte1  byte2
+                                    // YUYV               0       1      3
+                                    // YVYU               0       3      1
+
+//Color Pipe (IECP) parameters
+
+
+//ByteCopy
+
+
+//r4
+
+                                    //  e.g.              byte0           byte1           byte2
+                                    // YUYV                 0               1               3
+                                    // YVYU                 0               3               1
+
+
+//========== Inline parameters (Common To All) ===========
+
+
+//============== Binding Index Table===========
+//Common between DNDI and DNUV
+
+
+//================= Common Message Descriptor =====
+// Message descriptor for thread spawning
+// Message Descriptors
+//                = 000 0001 (min message len 1 ) 0,0000 (resp len 0   -add later)
+//                  0000,0000,0000
+//                  0001(Spawn a root thread),0001 (Root thread spawn thread)
+//                = 0x02000011
+// Thread Spawner Message Descriptor
+
+
+// Message descriptor for atomic operation add
+// Message Descriptors
+//                = 000 0110 (min message len 6 ) 0,0000 (resp len 0   -add later)
+//                  1(header present)001,10(typed atomic operation)0(return enabled)0(slot group, low 8 bits),0111 (AOP_Add)
+//                  0000,0000 (Binding table index, added later)
+//                = 0x02000011
+
+// Atomic Operation Add Message Descriptor
+
+
+// Message descriptor for dataport media write
+        // Message Descriptors
+                //                = 000 0001 (min message len 1 - add later) 00000 (resp len 0)
+                //                  1 (header present 1) 0 1010 (media block write) 000000
+                //                  00000000 (binding table index - set later)
+                //                = 0x020A8000
+
+
+// Message Length defines
+
+
+// Response Length defines
+
+
+// Block Width and Height Size defines
+
+
+// Extended Message Descriptors
+
+
+// Common message descriptors:
+
+
+//===================== Math Function Control ===================================
+
+
+//============ Message Registers ===============
+                             // buf4 starts from r28
+
+
+//#define mMSGHDR_EOT  r43    // Dummy Message Register for EOT
+
+
+.declare    mubMSGPAYLOAD  Base=r30 ElementSize=1 SrcRegion=<16;16,1> Type=ub
+.declare    muwMSGPAYLOAD  Base=r30 ElementSize=2 SrcRegion=<16;16,1> Type=uw
+.declare    mudMSGPAYLOAD  Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=ud
+.declare    mfMSGPAYLOAD   Base=r30 ElementSize=4 SrcRegion=<8;8,1> Type=f
+
+//=================== End of thread instruction ===========================
+
+
+//=====================Pointers Used=====================================
+
+
+//=======================================================================
+
+
+//r9-r17
+// Define temp space for any usages
+
+
+// Common Buffers
+
+
+// temp space for rotation
+
+.declare fROBUF                  Base=r9.0             ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=f
+
+.declare udROBUF               Base=r9.0               ElementSize=4           SrcRegion=<8;8,1>                 DstRegion=<1>         Type=ud
+
+.declare uwROBUF               Base=r9.0               ElementSize=2           SrcRegion=<16;16,1>             DstRegion=<1>           Type=uw
+
+.declare ubROBUF               Base=r9.0               ElementSize=1           SrcRegion=<16;16,1>             DstRegion=<1>           Type=ub
+
+.declare ub4ROBUF      Base=r9.0               ElementSize=1           SrcRegion=<32;8,4>              DstRegion=<4>           Type=ub
+
+
+// End of common.inc
+
+
+// FileName:           VP_Setup.asm
+// Author:                     Vivek Kumar
+// Description:                Sets up all parameters for the Video Processing Kernel
+
+
+
+
+// Description: Includes all definitions explicit to Fast Composite.
+
+
+
+
+// End of common.inc
+
+
+//========== GRF partition ==========
+     // r0 header            :   r0          (1 GRF)
+     // Static parameters    :   r1 - r6     (6 GRFS)
+     // Inline parameters    :   r7 - r8     (2 GRFs)
+     // MSGSRC               :   r27         (1 GRF)
+//===================================
+
+//Interface:
+//========== Static Parameters (Explicit To Fast Composite) ==========
+//r1
+//CSC Set 0
+
+
+.declare udCSC_CURBE    Base=r1.0      ElementSize=4       Type=ud
+
+//Constant alpha
+
+
+//r2
+
+
+// Gen7 AVS WA
+
+
+// WiDi Definitions
+
+
+//Colorfill
+
+
+                                      // 0: 0-degree, 1: 90, 2: 180, 3: 270-degree, clockwise.     
+
+.declare ubCOLOR_PIXEL_VAL      Base=r2.20      ElementSize=1       SrcRegion=<0;1,0>       DstRegion=<1>       Type=ub
+
+//r3
+//Normalised Ratio of Horizontal step size with main video for all layers
+
+
+    //Normalised Ratio of Horizontal step size with main video for all layers becomes
+    //Normalised Horizontal step size for all layers in VP_Setup.asm
+
+
+//r4
+//Normalised Vertical step size for all layers
+
+
+//r5
+//Normalised Vertical Frame Origin for all layers
+
+
+//r6
+//Normalised Horizontal Frame Origin for all layers
+
+
+//========== Inline Parameters (Explicit To Fast Composite) ==========
+
+
+//Main video Step X
+
+
+//====================== Binding table (Explicit To Fast Composite)=========================================
+
+
+//Used by Interlaced Scaling Kernels
+
+
+//========== Sampler State Table Index (Explicit To Fast Composite)==========
+//Sampler Index for AVS/IEF messages
+
+
+//Sampler Index for SIMD16 sampler messages
+
+
+//=============================================================================
+
+.declare fBUFFER_0      Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_1      Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_2      Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_3      Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_4      Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+.declare fBUFFER_5      Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=f
+
+.declare udBUFFER_0     Base=r64.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_1     Base=r80.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_2     Base=r96.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_3     Base=r112.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_4     Base=r28.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+.declare udBUFFER_5     Base=r46.0       ElementSize=4       SrcRegion=<8;8,1>       DstRegion=<1>       Type=ud
+
+.declare uwBUFFER_0     Base=r64.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_1     Base=r80.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_2     Base=r96.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_3     Base=r112.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_4     Base=r28.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+.declare uwBUFFER_5     Base=r46.0       ElementSize=2       SrcRegion=<16;16,1>     DstRegion=<1>       Type=uw
+
+.declare ubBUFFER_0     Base=r64.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_1     Base=r80.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_2     Base=r96.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_3     Base=r112.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_4     Base=r28.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+.declare ubBUFFER_5     Base=r46.0       ElementSize=1       SrcRegion=<16;16,1>     DstRegion=<1>       Type=ub
+
+.declare ub4BUFFER_0    Base=r64.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_1    Base=r80.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_2    Base=r96.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_3    Base=r112.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_4    Base=r28.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+.declare ub4BUFFER_5    Base=r46.0       ElementSize=1       SrcRegion=<32;8,4>      DstRegion=<4>       Type=ub
+
+//Pointer to mask reg
+
+
+//r18
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+.declare udCSC_COEFF_0  Base=r18.0    ElementSize=4 Type=ud       // 1 GRF
+
+//r19
+
+
+.declare udCSC_COEFF_1  Base=r19.0    ElementSize=4 Type=ud       // 1 GRF
+
+
+//r20
+
+.declare uwALPHA_MASK_REG_TEMP  Base=r20.0    ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r21
+
+.declare uwALPHA_MASK_REG       Base=r21.0         ElementSize=2 SrcRegion=<16;16,1> Type=uw        // 1 GRF
+
+//r22
+
+
+//Always keep Cannel Pointers and Offsets in same GRF, so that we can use
+// NODDCLR, NODDCHK flags. -rT
+
+
+//Keep fORIGIN_X_NLAS, fY_OFFSET_2ND_BLOCK, fSTEP_X_NLAS, pMSGDSC_COPY, ubCONST_ALPHA_COPY as
+//sub registers of same GRF to enable using NODDCLR NODDCHK. -rT
+
+//r23
+
+
+//Lumakey
+
+
+//r24
+
+
+//r25
+
+
+//r26
+
+
+//defines to generate LABELS during compile time.
+
+
+//Setup pointer to the inline parameter
+
+// Copy MSG HDR
+       mov (8)         r27.0<1>:ud     r0.0<8;8,1>:ud  // Initialize message payload header with R0
+
+// Only one layer is enough
+//temp; remove it once unread msg warnings are resolved -vK
+mov (8) r25<1>:ud      r0.0<8;8,1>:ud
+mov (8) r26<1>:ud      r0.0<8;8,1>:ud
+
+// Calculate StepX for all layers and overwrite it on the ratio
+       mul     (8)             r3.0<1>:f   r3.0<8;8,1>:f       r7.4<0;1,0>:f                           //StepX_ratio = StepX / VideoStepX
+
+       //Normalised Ratio of Horizontal step size with main video for all layers now becomes
+       //Normalised Horizontal step size for all layers
+
+// Calculate block origin for all layers and overwrite it on the frame origin
+       mov (2) r8.5<1>:f                                               r7.0<2;2,1>:w           //Convert origin from word to float
+
+       cmp.e.f0.0      (1)     null<1>:d                               r2.26<0;1,0>:ub                 1:uw
+
+
+    shr (1) r17.0<1>:uw    r2.2<0;1,0>:uw    0:uw
+    and (1) r17.0<1>:uw    r17.0<0;1,0>:uw           3:uw
+    cmp.e.f0.1 (1) null<1>:w    r17.0<0;1,0>:uw    1:uw
+    (f0.1) jmpi (1) ROTATE_90_L0
+    cmp.e.f0.1 (1) null<1>:w    r17.0<0;1,0>:uw    2:uw
+    (f0.1) jmpi (1) ROTATE_180_L0
+    cmp.e.f0.1 (1) null<1>:w    r17.0<0;1,0>:uw    3:uw
+    (f0.1) jmpi (1) ROTATE_270_L0
+
+  // rotate 0 degree
+ROTATE_0_L0:  
+    (-f0.0)mov (1)     acc0.0<1>:f                                        r6.0<0;1,0>:f
+    (-f0.0)mac (1)     r6.0<1>:f    r3.0<0;1,0>:f              r8.5<0;1,0>:f
+
+    mov        (1)     acc0.0<1>:f            r5.0<0;1,0>:f
+    mac        (1)     r5.0<1>:f    r4.0<0;1,0>:f                  r8.6<0;1,0>:f
+    jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0
+
+  // rotate 90 degree
+ROTATE_90_L0:  
+    (-f0.0)mov (1)     acc0.0<1>:f            r6.0<0;1,0>:f
+    (-f0.0)mac (1)     r6.0<1>:f    r3.0<0;1,0>:f              r8.6<0;1,0>:f
+
+    mov (1) r16.0<1>:f    r2.0<0;1,0>:uw
+    add (1) r17.0<1>:f    -r8.5<0;1,0>:f               r16.0<0;1,0>:f
+    add (1) r17.0<1>:f    r17.0<0;1,0>:f        -16.0:f        
+
+    mov        (1)     acc0.0<1>:f                                                     r5.0<0;1,0>:f
+    mac        (1)     r5.0<1>:f     r4.0<0;1,0>:f             r17.0<0;1,0>:f
+    jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0
+
+  // rotate 180 degree
+ROTATE_180_L0:  
+    (-f0.0)mov (1) r16.0<1>:f    r2.0<0;1,0>:uw
+    (-f0.0)add (1) r17.0<1>:f    -r8.5<0;1,0>:f              r16.0<0;1,0>:f
+    (-f0.0)add (1) r17.0<1>:f    r17.0<0;1,0>:f       -16.0:f          
+    (-f0.0)mov (1) acc0.0<1>:f             r6.0<0;1,0>:f
+    (-f0.0)mac (1) r6.0<1>:f     r3.0<0;1,0>:f          r17.0<0;1,0>:f
+
+    mov (1) r16.0<1>:f    r2.1<0;1,0>:uw       
+    add (1) r17.0<1>:f    -r8.6<0;1,0>:f                     r16.0<0;1,0>:f
+    add (1) r17.0<1>:f    r17.0<0;1,0>:f              -16.0:f          
+    mov        (1)     acc0.0<1>:f             r5.0<0;1,0>:f
+    mac        (1)     r5.0<1>:f     r4.0<0;1,0>:f                 r17.0<0;1,0>:f
+    jmpi (1) END_SRC_BLOCK_ORIG_COMP_L0  
+
+  // rotate 270 degree
+ROTATE_270_L0:    
+    (-f0.0)mov (1) r16.0<1>:f    r2.1<0;1,0>:uw        
+    (-f0.0)add (1) r17.0<1>:f    -r8.6<0;1,0>:f              r16.0<0;1,0>:f
+    (-f0.0)add (1) r17.0<1>:f    r17.0<0;1,0>:f       -16.0:f          
+    (-f0.0)mov (1) acc0.0<1>:f             r6.0<0;1,0>:f
+    (-f0.0)mac (1) r6.0<1>:f     r3.0<0;1,0>:f          r17.0<0;1,0>:f
+
+    mov        (1)     acc0.0<1>:f                    r5.0<0;1,0>:f
+    mac        (1)     r5.0<1>:f            r4.0<0;1,0>:f          r8.5<0;1,0>:f
+
+END_SRC_BLOCK_ORIG_COMP_L0:            
+    nop        
diff --git a/src/shaders/post_processing/gen8/pl2_to_pl2.asm b/src/shaders/post_processing/gen8/pl2_to_pl2.asm
new file mode 100644 (file)
index 0000000..0281854
--- /dev/null
@@ -0,0 +1,17 @@
+// Module name: AVS
+.kernel PL2_TO_PL2
+.code
+
+#include "VP_Setup.g8a"
+#include "Set_Layer_0.g8a"
+#include "Set_AVS_Buf_0123_PL2.g8a"
+#include "PL2_AVS_Buf_0.g8a"
+#include "PL2_AVS_Buf_1.g8a"
+#include "PL2_AVS_Buf_2.g8a"
+#include "PL2_AVS_Buf_3.g8a"
+#include "Save_AVS_NV12.g8a"        
+#include "EOT.g8a"
+
+.end_code  
+
+.end_kernel
diff --git a/src/shaders/post_processing/gen8/pl2_to_pl2.g8b b/src/shaders/post_processing/gen8/pl2_to_pl2.g8b
new file mode 100644 (file)
index 0000000..fa72882
--- /dev/null
@@ -0,0 +1,244 @@
+   { 0x00600001, 0x23600208, 0x008d0000, 0x00000000 },
+   { 0x00600001, 0x23200208, 0x008d0000, 0x00000000 },
+   { 0x00600001, 0x23400208, 0x008d0000, 0x00000000 },
+   { 0x00600041, 0x20603ae8, 0x3a8d0060, 0x000000f0 },
+   { 0x00200001, 0x21141ae8, 0x004500e0, 0x00000000 },
+   { 0x01000010, 0x20002220, 0x1600005a, 0x00010001 },
+   { 0x00000008, 0x22201248, 0x16000044, 0x00000000 },
+   { 0x00000005, 0x22201248, 0x16000220, 0x00030003 },
+   { 0x01000010, 0x20001261, 0x16000220, 0x00010001 },
+   { 0x00010020, 0x34000005, 0x0e001400, 0x00000090 },
+   { 0x01000010, 0x20001261, 0x16000220, 0x00020002 },
+   { 0x00010020, 0x34000005, 0x0e001400, 0x000000f0 },
+   { 0x01000010, 0x20001261, 0x16000220, 0x00030003 },
+   { 0x00010020, 0x34000005, 0x0e001400, 0x00000180 },
+   { 0x00110001, 0x24003ae0, 0x000000c0, 0x00000000 },
+   { 0x00110048, 0x20c03ae8, 0x3a000060, 0x00000114 },
+   { 0x00000001, 0x24003ae0, 0x000000a0, 0x00000000 },
+   { 0x00000048, 0x20a03ae8, 0x3a000080, 0x00000118 },
+   { 0x00000020, 0x34000004, 0x0e001400, 0x000001a0 },
+   { 0x00110001, 0x24003ae0, 0x000000c0, 0x00000000 },
+   { 0x00110048, 0x20c03ae8, 0x3a000060, 0x00000118 },
+   { 0x00000001, 0x220012e8, 0x00000040, 0x00000000 },
+   { 0x00000040, 0x22203ae8, 0x3a004114, 0x00000200 },
+   { 0x00000040, 0x22203ae8, 0x3e000220, 0xc1800000 },
+   { 0x00000001, 0x24003ae0, 0x000000a0, 0x00000000 },
+   { 0x00000048, 0x20a03ae8, 0x3a000080, 0x00000220 },
+   { 0x00000020, 0x34000004, 0x0e001400, 0x00000120 },
+   { 0x00110001, 0x220012e8, 0x00000040, 0x00000000 },
+   { 0x00110040, 0x22203ae8, 0x3a004114, 0x00000200 },
+   { 0x00110040, 0x22203ae8, 0x3e000220, 0xc1800000 },
+   { 0x00110001, 0x24003ae0, 0x000000c0, 0x00000000 },
+   { 0x00110048, 0x20c03ae8, 0x3a000060, 0x00000220 },
+   { 0x00000001, 0x220012e8, 0x00000042, 0x00000000 },
+   { 0x00000040, 0x22203ae8, 0x3a004118, 0x00000200 },
+   { 0x00000040, 0x22203ae8, 0x3e000220, 0xc1800000 },
+   { 0x00000001, 0x24003ae0, 0x000000a0, 0x00000000 },
+   { 0x00000048, 0x20a03ae8, 0x3a000080, 0x00000220 },
+   { 0x00000020, 0x34000004, 0x0e001400, 0x00000070 },
+   { 0x00110001, 0x220012e8, 0x00000042, 0x00000000 },
+   { 0x00110040, 0x22203ae8, 0x3a004118, 0x00000200 },
+   { 0x00110040, 0x22203ae8, 0x3e000220, 0xc1800000 },
+   { 0x00110001, 0x24003ae0, 0x000000c0, 0x00000000 },
+   { 0x00110048, 0x20c03ae8, 0x3a000060, 0x00000220 },
+   { 0x00000001, 0x24003ae0, 0x000000a0, 0x00000000 },
+   { 0x00000048, 0x20a03ae8, 0x3a000080, 0x00000114 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00800001, 0x22a01648, 0x10000000, 0xffffffff },
+   { 0x00000005, 0x23021288, 0x16000044, 0x00030003 },
+   { 0x00000001, 0x23203ae8, 0x000000f8, 0x00000000 },
+   { 0x00000001, 0x23383ae8, 0x000000f4, 0x00000000 },
+   { 0x00000001, 0x23303ae8, 0x00000060, 0x00000000 },
+   { 0x00000001, 0x23343ae8, 0x00000080, 0x00000000 },
+   { 0x00000001, 0x23283ae8, 0x000000c0, 0x00000000 },
+   { 0x00000001, 0x232c3ae8, 0x000000a0, 0x00000000 },
+   { 0x00000001, 0x233c0608, 0x00000000, 0x00000000 },
+   { 0x00000040, 0x233c0208, 0x0600033c, 0x08000000 },
+   { 0x00000001, 0x24083ae0, 0x000000c0, 0x00000000 },
+   { 0x00000048, 0x24083ae0, 0x3e000060, 0x41000000 },
+   { 0x00000248, 0x22e83ae8, 0x3e0000f4, 0x41e00000 },
+   { 0x00000641, 0x22e43ae8, 0x3e000080, 0x40800000 },
+   { 0x00000001, 0x24103ae0, 0x00000060, 0x00000000 },
+   { 0x00000648, 0x22f03ae8, 0x3e0000f4, 0x41000000 },
+   { 0x00000401, 0x22f40608, 0x00000000, 0x00000000 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00400001, 0x24003660, 0x30000000, 0x00006ea2 },
+   { 0x00400040, 0x24001860, 0x16690400, 0x00460046 },
+   { 0x00400009, 0x22c01868, 0x16690400, 0x00050005 },
+   { 0x00400001, 0x24003660, 0x30000000, 0x00006204 },
+   { 0x00400040, 0x24001860, 0x16690400, 0x00400040 },
+   { 0x00400209, 0x22401868, 0x16690400, 0x00050005 },
+   { 0x00000401, 0x22500608, 0x00000000, 0x01000100 },
+   { 0x00000001, 0x22d00608, 0x00000000, 0x00400040 },
+   { 0x00000001, 0x220c0208, 0x0000000c, 0x00000000 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x044eb000 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000d000 },
+   { 0x00600001, 0x22200208, 0x008d0320, 0x00000000 },
+   { 0x02000031, 0x28002248, 0x00000200, 0x00000200 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x048eb001 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000a000 },
+   { 0x02000031, 0x28802248, 0x00000200, 0x00000200 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00000001, 0x220c0208, 0x0000000c, 0x00000000 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x044eb000 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000d000 },
+   { 0x00000001, 0x23240608, 0x00000000, 0x00000001 },
+   { 0x00600001, 0x22200208, 0x008d0320, 0x00000000 },
+   { 0x02000031, 0x2a002248, 0x00000200, 0x00000200 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x048eb001 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000a000 },
+   { 0x02000031, 0x2a802248, 0x00000200, 0x00000200 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00000001, 0x220c0208, 0x0000000c, 0x00000000 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x044eb000 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000d000 },
+   { 0x00000001, 0x23240608, 0x00000000, 0x00000002 },
+   { 0x00600001, 0x22200208, 0x008d0320, 0x00000000 },
+   { 0x02000031, 0x2c002248, 0x00000200, 0x00000200 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x048eb001 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000a000 },
+   { 0x02000031, 0x2c802248, 0x00000200, 0x00000200 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00000001, 0x220c0208, 0x0000000c, 0x00000000 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x044eb000 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000d000 },
+   { 0x00000001, 0x23240608, 0x00000000, 0x00000003 },
+   { 0x00600001, 0x22200208, 0x008d0320, 0x00000000 },
+   { 0x02000031, 0x2e002248, 0x00000200, 0x00000200 },
+   { 0x00000040, 0x22000200, 0x060002f4, 0x048eb001 },
+   { 0x00000001, 0x22080608, 0x00000000, 0x0000a000 },
+   { 0x02000031, 0x2e802248, 0x00000200, 0x00000200 },
+   { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+   { 0x00400040, 0x22001a40, 0x166902c0, 0x00000000 },
+   { 0x00400040, 0x22081a40, 0x166902c0, 0x02000200 },
+   { 0x00600001, 0x23800208, 0x008d0360, 0x00000000 },
+   { 0x00600001, 0x24a00208, 0x008d0360, 0x00000000 },
+   { 0x00200201, 0x23801a28, 0x004500e0, 0x00000000 },
+   { 0x00000201, 0x24a01a28, 0x000000e0, 0x00000000 },
+   { 0x00000608, 0x24a41a28, 0x1e0000e2, 0x00010001 },
+   { 0x00000401, 0x23880608, 0x00000000, 0x000f000f },
+   { 0x00000401, 0x24a80608, 0x00000000, 0x0007000f },
+   { 0x80800040, 0xa2001248, 0x16b18200, 0x00800080 },
+   { 0x80800040, 0xa2201248, 0x16b18220, 0x00800080 },
+   { 0x80800040, 0xa2401248, 0x16b18240, 0x00800080 },
+   { 0x80800040, 0xa2601248, 0x16b18260, 0x00800080 },
+   { 0x00600008, 0x45c01248, 0x1eae8400, 0x00010001 },
+   { 0x00600008, 0x45e01248, 0x1eae8420, 0x00010001 },
+   { 0x00600008, 0x46001248, 0x1eae8440, 0x00010001 },
+   { 0x00600008, 0x46201248, 0x1eae8460, 0x00010001 },
+   { 0x00600040, 0x45c01248, 0x12ae05c0, 0x00ae05e0 },
+   { 0x80600040, 0xc4001248, 0x16ae05c0, 0x00800080 },
+   { 0x00600040, 0x46001248, 0x12ae0600, 0x00ae0620 },
+   { 0x80600040, 0xc4401248, 0x16ae0600, 0x00800080 },
+   { 0x00600008, 0x46401248, 0x1eae8000, 0x00010001 },
+   { 0x00600008, 0x46601248, 0x1eae8020, 0x00010001 },
+   { 0x00600008, 0x46801248, 0x1eae8040, 0x00010001 },
+   { 0x00600008, 0x46a01248, 0x1eae8060, 0x00010001 },
+   { 0x00600040, 0x46401248, 0x12ae0640, 0x00ae0660 },
+   { 0x80600040, 0xc0001248, 0x16ae0640, 0x00800080 },
+   { 0x00600040, 0x46801248, 0x12ae0680, 0x00ae06a0 },
+   { 0x80600040, 0xc0401248, 0x16ae0680, 0x00800080 },
+   { 0x00400040, 0x22001a40, 0x166902c0, 0x04000400 },
+   { 0x80800040, 0xaa001248, 0x16b18a00, 0x00800080 },
+   { 0x80800040, 0xaa201248, 0x16b18a20, 0x00800080 },
+   { 0x80800040, 0xaa401248, 0x16b18a40, 0x00800080 },
+   { 0x80800040, 0xaa601248, 0x16b18a60, 0x00800080 },
+   { 0x00600008, 0x45c01248, 0x1eae8c00, 0x00010001 },
+   { 0x00600008, 0x45e01248, 0x1eae8c20, 0x00010001 },
+   { 0x00600008, 0x46001248, 0x1eae8c40, 0x00010001 },
+   { 0x00600008, 0x46201248, 0x1eae8c60, 0x00010001 },
+   { 0x00600040, 0x45c01248, 0x12ae05c0, 0x00ae05e0 },
+   { 0x80600040, 0xcc001248, 0x16ae05c0, 0x00800080 },
+   { 0x00600040, 0x46001248, 0x12ae0600, 0x00ae0620 },
+   { 0x80600040, 0xcc401248, 0x16ae0600, 0x00800080 },
+   { 0x00600008, 0x46401248, 0x1eae8800, 0x00010001 },
+   { 0x00600008, 0x46601248, 0x1eae8820, 0x00010001 },
+   { 0x00600008, 0x46801248, 0x1eae8840, 0x00010001 },
+   { 0x00600008, 0x46a01248, 0x1eae8860, 0x00010001 },
+   { 0x00600040, 0x46401248, 0x12ae0640, 0x00ae0660 },
+   { 0x80600040, 0xc8001248, 0x16ae0640, 0x00800080 },
+   { 0x00600040, 0x46801248, 0x12ae0680, 0x00ae06a0 },
+   { 0x80600040, 0xc8401248, 0x16ae0680, 0x00800080 },
+   { 0x00400040, 0x22081a40, 0x166902c0, 0x06000600 },
+   { 0x80800040, 0xa2001248, 0x16b18200, 0x00800080 },
+   { 0x80800040, 0xa2201248, 0x16b18220, 0x00800080 },
+   { 0x80800040, 0xa2401248, 0x16b18240, 0x00800080 },
+   { 0x80800040, 0xa2601248, 0x16b18260, 0x00800080 },
+   { 0x00600008, 0x45c01248, 0x1eae8400, 0x00010001 },
+   { 0x00600008, 0x45e01248, 0x1eae8420, 0x00010001 },
+   { 0x00600008, 0x46001248, 0x1eae8440, 0x00010001 },
+   { 0x00600008, 0x46201248, 0x1eae8460, 0x00010001 },
+   { 0x00600040, 0x45c01248, 0x12ae05c0, 0x00ae05e0 },
+   { 0x80600040, 0xc4001248, 0x16ae05c0, 0x00800080 },
+   { 0x00600040, 0x46001248, 0x12ae0600, 0x00ae0620 },
+   { 0x80600040, 0xc4401248, 0x16ae0600, 0x00800080 },
+   { 0x00600008, 0x46401248, 0x1eae8000, 0x00010001 },
+   { 0x00600008, 0x46601248, 0x1eae8020, 0x00010001 },
+   { 0x00600008, 0x46801248, 0x1eae8040, 0x00010001 },
+   { 0x00600008, 0x46a01248, 0x1eae8060, 0x00010001 },
+   { 0x00600040, 0x46401248, 0x12ae0640, 0x00ae0660 },
+   { 0x80600040, 0xc0001248, 0x16ae0640, 0x00800080 },
+   { 0x00600040, 0x46801248, 0x12ae0680, 0x00ae06a0 },
+   { 0x80600040, 0xc0401248, 0x16ae0680, 0x00800080 },
+   { 0x00400040, 0x22001a40, 0x166902c0, 0x04000400 },
+   { 0x80800040, 0xaa001248, 0x16b18a00, 0x00800080 },
+   { 0x80800040, 0xaa201248, 0x16b18a20, 0x00800080 },
+   { 0x80800040, 0xaa401248, 0x16b18a40, 0x00800080 },
+   { 0x80800040, 0xaa601248, 0x16b18a60, 0x00800080 },
+   { 0x00600008, 0x45c01248, 0x1eae8c00, 0x00010001 },
+   { 0x00600008, 0x45e01248, 0x1eae8c20, 0x00010001 },
+   { 0x00600008, 0x46001248, 0x1eae8c40, 0x00010001 },
+   { 0x00600008, 0x46201248, 0x1eae8c60, 0x00010001 },
+   { 0x00600040, 0x45c01248, 0x12ae05c0, 0x00ae05e0 },
+   { 0x80600040, 0xcc001248, 0x16ae05c0, 0x00800080 },
+   { 0x00600040, 0x46001248, 0x12ae0600, 0x00ae0620 },
+   { 0x80600040, 0xcc401248, 0x16ae0600, 0x00800080 },
+   { 0x00600008, 0x46401248, 0x1eae8800, 0x00010001 },
+   { 0x00600008, 0x46601248, 0x1eae8820, 0x00010001 },
+   { 0x00600008, 0x46801248, 0x1eae8840, 0x00010001 },
+   { 0x00600008, 0x46a01248, 0x1eae8860, 0x00010001 },
+   { 0x00600040, 0x46401248, 0x12ae0640, 0x00ae0660 },
+   { 0x80600040, 0xc8001248, 0x16ae0640, 0x00800080 },
+   { 0x00600040, 0x46801248, 0x12ae0680, 0x00ae06a0 },
+   { 0x80600040, 0xc8401248, 0x16ae0680, 0x00800080 },
+   { 0x00400040, 0x22081a40, 0x166902c0, 0x06000600 },
+   { 0x00400040, 0x22001a40, 0x166902c0, 0x00000000 },
+   { 0x00400040, 0x22081a40, 0x166902c0, 0x02000200 },
+   { 0x00800201, 0x23a02288, 0x00d28201, 0x00000000 },
+   { 0x00800401, 0x23b02288, 0x00d28221, 0x00000000 },
+   { 0x00800201, 0x23c02288, 0x00d28241, 0x00000000 },
+   { 0x00800401, 0x23d02288, 0x00d28261, 0x00000000 },
+   { 0x00600201, 0x44c02288, 0x00cf8401, 0x00000000 },
+   { 0x00600601, 0x44d02288, 0x00cf8441, 0x00000000 },
+   { 0x00600601, 0x44c12288, 0x00cf8001, 0x00000000 },
+   { 0x00600401, 0x44d12288, 0x00cf8041, 0x00000000 },
+   { 0x00400040, 0x22001a40, 0x166902c0, 0x04000400 },
+   { 0x00800201, 0x23e02288, 0x00d28a01, 0x00000000 },
+   { 0x00800401, 0x23f02288, 0x00d28a21, 0x00000000 },
+   { 0x00800201, 0x24002288, 0x00d28a41, 0x00000000 },
+   { 0x00800401, 0x24102288, 0x00d28a61, 0x00000000 },
+   { 0x00600201, 0x44e02288, 0x00cf8c01, 0x00000000 },
+   { 0x00600601, 0x44f02288, 0x00cf8c41, 0x00000000 },
+   { 0x00600601, 0x44e12288, 0x00cf8801, 0x00000000 },
+   { 0x00600401, 0x44f12288, 0x00cf8841, 0x00000000 },
+   { 0x00400040, 0x22081a40, 0x166902c0, 0x06000600 },
+   { 0x00800201, 0x24202288, 0x00d28201, 0x00000000 },
+   { 0x00800401, 0x24302288, 0x00d28221, 0x00000000 },
+   { 0x00800201, 0x24402288, 0x00d28241, 0x00000000 },
+   { 0x00800401, 0x24502288, 0x00d28261, 0x00000000 },
+   { 0x00600201, 0x45002288, 0x00cf8401, 0x00000000 },
+   { 0x00600601, 0x45102288, 0x00cf8441, 0x00000000 },
+   { 0x00600601, 0x45012288, 0x00cf8001, 0x00000000 },
+   { 0x00600401, 0x45112288, 0x00cf8041, 0x00000000 },
+   { 0x00800201, 0x24602288, 0x00d28a01, 0x00000000 },
+   { 0x00800401, 0x24702288, 0x00d28a21, 0x00000000 },
+   { 0x00800201, 0x24802288, 0x00d28a41, 0x00000000 },
+   { 0x00800401, 0x24902288, 0x00d28a61, 0x00000000 },
+   { 0x00600201, 0x45202288, 0x00cf8c01, 0x00000000 },
+   { 0x00600601, 0x45302288, 0x00cf8c41, 0x00000000 },
+   { 0x00600601, 0x45212288, 0x00cf8801, 0x00000000 },
+   { 0x00600401, 0x45312288, 0x00cf8841, 0x00000000 },
+   { 0x0c000031, 0x20002220, 0x06000380, 0x120a8018 },
+   { 0x0c000031, 0x20002220, 0x060004a0, 0x0a0a8019 },
+   { 0x00600001, 0x2fe00208, 0x008d0000, 0x00000000 },
+   { 0x07000031, 0x20002220, 0x0e000fe0, 0x82000010 },