summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-08-12 15:13:24 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-09-06 15:34:53 +0800
commitaf57700ca9d44cf16b132d9bd9ea41b1891c9973 (patch)
tree779dac99b47992f8864c553618d23e2192e1a23b
parent58e4c588326b332c2250842f6dd103a6e17adf2a (diff)
downloadlibva-intel-driver-af57700ca9d44cf16b132d9bd9ea41b1891c9973.tar.gz
libva-intel-driver-af57700ca9d44cf16b132d9bd9ea41b1891c9973.tar.bz2
libva-intel-driver-af57700ca9d44cf16b132d9bd9ea41b1891c9973.zip
Optimize the VME shader for MPEG2 encoding on Ivb
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit 15db142076321e9523db0c8be8e6bae5e1b64c8a)
-rw-r--r--src/shaders/vme/mpeg2_inter_ivb.asm112
-rw-r--r--src/shaders/vme/mpeg2_inter_ivb.g7b62
-rw-r--r--src/shaders/vme/vme7_mpeg2.inc11
3 files changed, 182 insertions, 3 deletions
diff --git a/src/shaders/vme/mpeg2_inter_ivb.asm b/src/shaders/vme/mpeg2_inter_ivb.asm
index 57522e1..261e74c 100644
--- a/src/shaders/vme/mpeg2_inter_ivb.asm
+++ b/src/shaders/vme/mpeg2_inter_ivb.asm
@@ -425,6 +425,11 @@ send (8)
rlen vme_inter_wb_length
{align1};
+and.z.f0.0 (1) null:uw mb_hwdep<0,1,0>:uw 0x04:uw {align1};
+(-f0.0) jmpi (1) vme_run_again;
+
+vme_mv_output:
+
and.z.f0.0 (1) null<1>:ud vme_wb0.0<0,1,0>:ud INTRAMBFLAG_MASK:ud {align1} ;
(-f0.0)jmpi (1) __INTRA_INFO ;
@@ -590,4 +595,111 @@ add (2) RET_ARG<1>:w TEMP_VAR0.0<2,2,1>:w TEMP_VAR1.0<2,2,1>:w {align1};
nop;
nop;
+vme_run_again:
+
+asr (2) mb_ref_win.0<1>:w mb_mvp_ref.0<2,2,1>:w 2:w {align1};
+mov (2) tmp_reg0.0<1>:w mb_ref_win.0<2,2,1>:w {align1};
+add (2) mb_ref_win.8<1>:w mb_ref_win.0<2,2,1>:w 3:w {align1};
+and (2) mb_ref_win.16<1>:uw mb_ref_win.8<2,2,1>:uw 0xFFFC:uw {align1};
+
+cmp.l.f0.0 (1) null:w tmp_reg0.0<0,1,0>:w 0:w {align1};
+(f0.0) mul (1) tmp_reg0.0<1>:w tmp_reg0.0<0,1,0>:w -1:w {align1};
+cmp.l.f0.0 (1) null:w tmp_reg0.2<0,1,0>:w 0:w {align1};
+(f0.0) mul (1) tmp_reg0.2<1>:w tmp_reg0.2<0,1,0>:w -1:w {align1};
+
+cmp.ge.f0.0 (1) null:w tmp_reg0.0<0,1,0>:w 4:w {align1};
+(f0.0) jmpi (1) vme_start;
+cmp.ge.f0.0 (1) null:w tmp_reg0.2<0,1,0>:w 4:w {align1};
+(f0.0) jmpi (1) vme_start;
+
+jmpi (1) vme_done;
+
+vme_start:
+ mov (8) tmp_vme_wb0.0<1>:ud vme_wb0.0<8,8,1>:ud {align1};
+ mov (8) tmp_vme_wb1.0<1>:ud vme_wb1.0<8,8,1>:ud {align1};
+
+/* Calibrate the ref window for MPEG2 */
+mov (1) vme_m0.0<1>:W -16:W {align1};
+mov (1) vme_m0.2<1>:W -12:W {align1};
+mov (1) INPUT_ARG0.8<1>:ud vme_m0.8<0,1,0>:ud {align1};
+add (2) INPUT_ARG0.0<1>:w vme_m0.0<2,2,1>:w mb_ref_win.16<2,2,1>:w {align1};
+mov (8) INPUT_ARG1.0<1>:ud pic_ref.0<8,8,1>:ud {align1};
+
+SAVE_RET {align1};
+jmpi (1) ref_boundary_check;
+mov (2) vme_m0.0<1>:w RET_ARG<2,2,1>:w {align1};
+
+/* m2 */
+mov (8) vme_msg_2<1>:UD 0x0:UD {align1};
+
+/* m3 */
+mov (8) vme_msg_3<1>:UD 0x0:UD {align1};
+
+/* m4 */
+mov (8) vme_msg_4<1>:UD 0x0:UD {align1};
+
+
+/* m1 */
+mov (8) vme_m1.0<1>:ud 0x0:ud {align1};
+mov (1) intra_flag<1>:UW 0x0:UW {align1} ;
+mov (1) tmp_reg0.0<1>:uw LUMA_INTRA_8x8_DISABLE:uw {align1};
+add (1) tmp_reg0.0<1>:uw tmp_reg0.0<0,1,0>:uw LUMA_INTRA_4x4_DISABLE:uw {align1};
+mov (1) intra_part_mask_ub<1>:UB tmp_reg0.0<0,1,0>:ub {align1};
+/* m1 */
+/* assign MB intra struct from the thread payload*/
+mov (1) mb_intra_struct_ub<1>:UB input_mb_intra_ub<0,1,0>:UB {align1};
+
+
+/* M0 */
+/* IME search */
+mov (1) vme_m0.12<1>:UD SEARCH_CTRL_SINGLE + INTER_PART_MASK + INTER_SAD_HAAR + SUB_PEL_MODE_HALF:UD {align1};
+/* 16x16 Source, 1/2 pixel, harr */
+mov (1) vme_m0.22<1>:UW REF_REGION_SIZE {align1}; /* Reference Width&Height, 48x40 */
+
+mov (1) vme_m0.4<1>:UD vme_m0.0<0,1,0>:UD {align1};
+mov (8) vme_msg_0.0<1>:UD vme_m0.0<8,8,1>:UD {align1};
+
+/* m1 */
+
+mov (1) vme_m1.0<1>:UD ADAPTIVE_SEARCH_ENABLE:ud {align1} ;
+/* MV num is passed by constant buffer. R4.28 */
+mov (1) vme_m1.4<1>:UB r4.28<0,1,0>:UB {align1};
+add (1) vme_m1.4<1>:UD vme_m1.4<0,1,0>:UD FB_PRUNING_DISABLE:UD {align1};
+mov (1) vme_m1.8<1>:UD START_CENTER + SEARCH_PATH_LEN:UD {align1};
+
+/* Bilinear filter */
+mov (1) tmp_reg0.0<1>:uw 0x04:uw {align1};
+add (1) vme_m1.30<1>:ub vme_m1.30<0,1,0>:ub tmp_reg0.0<0,1,0>:ub {align1};
+
+/* Set the MV cost center */
+mov (1) vme_m1.16<1>:ud mv_cc_ref.0<0,1,0>:ud {align1};
+mov (1) vme_m1.20<1>:ud mv_cc_ref.0<0,1,0>:ud {align1};
+mov (8) vme_msg_1.0<1>:UD vme_m1.0<8,8,1>:UD {align1};
+
+
+send (8)
+ vme_msg_ind
+ vme_wb
+ null
+ vme(
+ BIND_IDX_VME,
+ 0,
+ 0,
+ VME_MESSAGE_TYPE_INTER
+ )
+ mlen vme_msg_length
+ rlen vme_inter_wb_length
+ {align1};
+
+
+cmp.l.f0.0 (1) null:uw vme_wb0.6<0,1,0>:uw tmp_vme_wb0.6<0,1,0>:uw {align1};
+(f0.0) jmpi (1) vme_done;
+mov (8) vme_wb0.0<1>:ud tmp_vme_wb0.0<8,8,1>:ud {align1};
+mov (8) vme_wb1.0<1>:ud tmp_vme_wb1.0<8,8,1>:ud {align1};
+
+vme_done:
+ jmpi (1) vme_mv_output;
+nop;
+nop;
+nop;
diff --git a/src/shaders/vme/mpeg2_inter_ivb.g7b b/src/shaders/vme/mpeg2_inter_ivb.g7b
index 2973488..2ef3b13 100644
--- a/src/shaders/vme/mpeg2_inter_ivb.g7b
+++ b/src/shaders/vme/mpeg2_inter_ivb.g7b
@@ -130,13 +130,13 @@
{ 0x00000001, 0x2fa401ad, 0x00000b04, 0x00000000 },
{ 0x00000001, 0x2fa801ad, 0x00000b24, 0x00000000 },
{ 0x00000040, 0x2fe00c01, 0x00001400, 0x00000020 },
- { 0x00000020, 0x34001c00, 0x00001400, 0x0000008a },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x0000008e },
{ 0x00000001, 0x2ac001ad, 0x00000fe4, 0x00000000 },
{ 0x00000001, 0x2fa001ad, 0x00000ae6, 0x00000000 },
{ 0x00000001, 0x2fa401ad, 0x00000b06, 0x00000000 },
{ 0x00000001, 0x2fa801ad, 0x00000b26, 0x00000000 },
{ 0x00000040, 0x2fe00c01, 0x00001400, 0x00000020 },
- { 0x00000020, 0x34001c00, 0x00001400, 0x0000007e },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x00000082 },
{ 0x00000001, 0x2ac201ad, 0x00000fe4, 0x00000000 },
{ 0x00200001, 0x2a2001ad, 0x00450ae4, 0x00000000 },
{ 0x00000001, 0x244001ed, 0x00000000, 0xfff0fff0 },
@@ -145,7 +145,7 @@
{ 0x00000001, 0x2fa80021, 0x00000448, 0x00000000 },
{ 0x00600001, 0x2fc00021, 0x008d0a40, 0x00000000 },
{ 0x00000040, 0x2fe00c01, 0x00001400, 0x00000020 },
- { 0x00000020, 0x34001c00, 0x00001400, 0x00000090 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x00000094 },
{ 0x00200001, 0x244001ad, 0x00450fe4, 0x00000000 },
{ 0x00600001, 0x28400061, 0x00000000, 0x00000000 },
{ 0x00600001, 0x28600061, 0x00000000, 0x00000000 },
@@ -175,6 +175,8 @@
{ 0x00000001, 0x24740021, 0x00000a20, 0x00000000 },
{ 0x00600001, 0x28200021, 0x008d0460, 0x00000000 },
{ 0x08600031, 0x21801cbd, 0x00000800, 0x0a686000 },
+ { 0x01000005, 0x20002d28, 0x000000a6, 0x00040004 },
+ { 0x00110020, 0x34001c00, 0x00001400, 0x00000096 },
{ 0x01000005, 0x20000c20, 0x00000180, 0x00002000 },
{ 0x00110020, 0x34001c00, 0x00001400, 0x00000012 },
{ 0x00600001, 0x28000021, 0x008d0480, 0x00000000 },
@@ -250,3 +252,57 @@
{ 0x00000001, 0x34000020, 0x00000fe0, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x0020000c, 0x2a803dad, 0x00450ac0, 0x00020002 },
+ { 0x00200001, 0x240001ad, 0x00450a80, 0x00000000 },
+ { 0x00200040, 0x2a883dad, 0x00450a80, 0x00030003 },
+ { 0x00200005, 0x2a902d29, 0x00450a88, 0xfffcfffc },
+ { 0x05000010, 0x20003dac, 0x00000400, 0x00000000 },
+ { 0x00010041, 0x24003dad, 0x00000400, 0xffffffff },
+ { 0x05000010, 0x20003dac, 0x00000402, 0x00000000 },
+ { 0x00010041, 0x24023dad, 0x00000402, 0xffffffff },
+ { 0x04000010, 0x20003dac, 0x00000400, 0x00040004 },
+ { 0x00010020, 0x34001c00, 0x00001400, 0x00000006 },
+ { 0x04000010, 0x20003dac, 0x00000402, 0x00040004 },
+ { 0x00010020, 0x34001c00, 0x00001400, 0x00000002 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x0000004a },
+ { 0x00600001, 0x2c800021, 0x008d0180, 0x00000000 },
+ { 0x00600001, 0x2ca00021, 0x008d01a0, 0x00000000 },
+ { 0x00000001, 0x244001ed, 0x00000000, 0xfff0fff0 },
+ { 0x00000001, 0x244201ed, 0x00000000, 0xfff4fff4 },
+ { 0x00000001, 0x2fa80021, 0x00000448, 0x00000000 },
+ { 0x00200040, 0x2fa035ad, 0x00450440, 0x00450a90 },
+ { 0x00600001, 0x2fc00021, 0x008d0a40, 0x00000000 },
+ { 0x00000040, 0x2fe00c01, 0x00001400, 0x00000020 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0xffffff94 },
+ { 0x00200001, 0x244001ad, 0x00450fe4, 0x00000000 },
+ { 0x00600001, 0x28400061, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x28600061, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x28800061, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x24600061, 0x00000000, 0x00000000 },
+ { 0x00000001, 0x247c0169, 0x00000000, 0x00000000 },
+ { 0x00000001, 0x24000169, 0x00000000, 0x00020002 },
+ { 0x00000040, 0x24002d29, 0x00000400, 0x00040004 },
+ { 0x00000001, 0x247c0231, 0x00000400, 0x00000000 },
+ { 0x00000001, 0x247d0231, 0x000000a5, 0x00000000 },
+ { 0x00000001, 0x244c0061, 0x00000000, 0x7e201000 },
+ { 0x00000001, 0x24560169, 0x00000000, 0x28302830 },
+ { 0x00000001, 0x24440021, 0x00000440, 0x00000000 },
+ { 0x00600001, 0x28000021, 0x008d0440, 0x00000000 },
+ { 0x00000001, 0x24600061, 0x00000000, 0x00000002 },
+ { 0x00000001, 0x24640231, 0x0000009c, 0x00000000 },
+ { 0x00000040, 0x24640c21, 0x00000464, 0x00000000 },
+ { 0x00000001, 0x24680061, 0x00000000, 0x30003030 },
+ { 0x00000001, 0x24000169, 0x00000000, 0x00040004 },
+ { 0x00000040, 0x247e4631, 0x0000047e, 0x00000400 },
+ { 0x00000001, 0x24700021, 0x00000a20, 0x00000000 },
+ { 0x00000001, 0x24740021, 0x00000a20, 0x00000000 },
+ { 0x00600001, 0x28200021, 0x008d0460, 0x00000000 },
+ { 0x08600031, 0x21801cbd, 0x00000800, 0x0a682000 },
+ { 0x05000010, 0x20002528, 0x00000186, 0x00000c86 },
+ { 0x00010020, 0x34001c00, 0x00001400, 0x00000004 },
+ { 0x00600001, 0x21800021, 0x008d0c80, 0x00000000 },
+ { 0x00600001, 0x21a00021, 0x008d0ca0, 0x00000000 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0xffffff04 },
+ { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
diff --git a/src/shaders/vme/vme7_mpeg2.inc b/src/shaders/vme/vme7_mpeg2.inc
index 8ca768b..2d7852a 100644
--- a/src/shaders/vme/vme7_mpeg2.inc
+++ b/src/shaders/vme/vme7_mpeg2.inc
@@ -22,3 +22,14 @@ define(`INTRA16_DC_PRED', `0xBB')
/* Cost center ref */
define(`mv_cc_ref', `r81')
+
+define(`tmp_vme_wb0', `r100')
+define(`tmp_vme_wb1', `r101')
+define(`tmp_vme_wb2', `r102')
+define(`tmp_vme_wb3', `r103')
+define(`tmp_vme_wb4', `r104')
+define(`tmp_vme_wb5', `r105')
+define(`tmp_vme_wb6', `r106')
+define(`tmp_vme_wb7', `r107')
+define(`tmp_vme_wb8', `r108')
+define(`tmp_vme_wb9', `r109')