summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhong Li <zhong.li@intel.com>2014-08-07 22:05:40 -0600
committerZhao, Yakui <yakui.zhao@intel.com>2014-09-09 09:14:19 +0800
commit0e5fd95b7ac614964ca157526ecc1b0a5d6a6ae0 (patch)
treec8d21d5f259095951212efeec08f9a7e58820664
parent22cdc92c99ef0805458e30b7b5ddb6b03c3731ff (diff)
downloadlibva-intel-driver-0e5fd95b7ac614964ca157526ecc1b0a5d6a6ae0.tar.gz
libva-intel-driver-0e5fd95b7ac614964ca157526ecc1b0a5d6a6ae0.tar.bz2
libva-intel-driver-0e5fd95b7ac614964ca157526ecc1b0a5d6a6ae0.zip
Enabling SNB avc encoding configuration
Signed-off-by: Zhong Li <zhong.li@intel.com> (cherry picked from commit 3e531e7d640ef329151b2205c2e61a67fb80862d)
-rw-r--r--src/gen6_vme.c50
-rw-r--r--src/shaders/vme/inter_frame.asm25
-rw-r--r--src/shaders/vme/inter_frame.g6b9
-rw-r--r--src/shaders/vme/inter_frame.g7b8
-rw-r--r--src/shaders/vme/vme.inc5
5 files changed, 79 insertions, 18 deletions
diff --git a/src/gen6_vme.c b/src/gen6_vme.c
index 8f0006f..2e02591 100644
--- a/src/gen6_vme.c
+++ b/src/gen6_vme.c
@@ -384,21 +384,38 @@ static VAStatus gen6_vme_vme_state_setup(VADriverContextP ctx,
dri_bo_map(vme_context->vme_state.bo, 1);
assert(vme_context->vme_state.bo->virtual);
vme_state_message = (unsigned int *)vme_context->vme_state.bo->virtual;
-
- vme_state_message[0] = 0x01010101;
- vme_state_message[1] = 0x10010101;
- vme_state_message[2] = 0x0F0F0F0F;
- vme_state_message[3] = 0x100F0F0F;
- vme_state_message[4] = 0x01010101;
- vme_state_message[5] = 0x10010101;
- vme_state_message[6] = 0x0F0F0F0F;
- vme_state_message[7] = 0x100F0F0F;
- vme_state_message[8] = 0x01010101;
- vme_state_message[9] = 0x10010101;
- vme_state_message[10] = 0x0F0F0F0F;
- vme_state_message[11] = 0x000F0F0F;
- vme_state_message[12] = 0x00;
- vme_state_message[13] = 0x00;
+
+ if (encoder_context->quality_level != ENCODER_LOW_QUALITY) {
+ vme_state_message[0] = 0x01010101;
+ vme_state_message[1] = 0x10010101;
+ vme_state_message[2] = 0x0F0F0F0F;
+ vme_state_message[3] = 0x100F0F0F;
+ vme_state_message[4] = 0x01010101;
+ vme_state_message[5] = 0x10010101;
+ vme_state_message[6] = 0x0F0F0F0F;
+ vme_state_message[7] = 0x100F0F0F;
+ vme_state_message[8] = 0x01010101;
+ vme_state_message[9] = 0x10010101;
+ vme_state_message[10] = 0x0F0F0F0F;
+ vme_state_message[11] = 0x000F0F0F;
+ vme_state_message[12] = 0x00;
+ vme_state_message[13] = 0x00;
+ } else {
+ vme_state_message[0] = 0x10010101;
+ vme_state_message[1] = 0x100F0F0F;
+ vme_state_message[2] = 0x10010101;
+ vme_state_message[3] = 0x000F0F0F;
+ vme_state_message[4] = 0;
+ vme_state_message[5] = 0;
+ vme_state_message[6] = 0;
+ vme_state_message[7] = 0;
+ vme_state_message[8] = 0;
+ vme_state_message[9] = 0;
+ vme_state_message[10] = 0;
+ vme_state_message[11] = 0;
+ vme_state_message[12] = 0;
+ vme_state_message[13] = 0;
+ }
vme_state_message[14] = 0x4a4a;
vme_state_message[15] = 0x0;
@@ -452,7 +469,7 @@ gen6_vme_fill_vme_batchbuffer(VADriverContextP ctx,
number_mb_cmds = slice_mb_number - i;
}
- *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
+ *command_ptr++ = (CMD_MEDIA_OBJECT | (9 - 2));
*command_ptr++ = kernel;
*command_ptr++ = 0;
*command_ptr++ = 0;
@@ -462,6 +479,7 @@ gen6_vme_fill_vme_batchbuffer(VADriverContextP ctx,
/*inline data */
*command_ptr++ = (mb_width << 16 | mb_y << 8 | mb_x);
*command_ptr++ = (number_mb_cmds << 16 | transform_8x8_mode_flag | ((i==0) << 1));
+ *command_ptr++ = encoder_context->quality_level;
i += number_mb_cmds;
}
diff --git a/src/shaders/vme/inter_frame.asm b/src/shaders/vme/inter_frame.asm
index e1b6e68..7c5cfd4 100644
--- a/src/shaders/vme/inter_frame.asm
+++ b/src/shaders/vme/inter_frame.asm
@@ -35,7 +35,11 @@ mov (1) read1_header.8<1>:UD BLOCK_4X16 {align1};
mov (1) read1_header.20<1>:UB thread_id_ub {align1}; /* dispatch id */
shl (2) vme_m0.8<1>:UW orig_xy_ub<2,2,1>:UB 4:UW {align1}; /* Source = (x, y) * 16 */
-
+
+cmp.z.f0.0 (1) null<1>:uw quality_level_ub<0,1,0>:ub LOW_QUALITY_LEVEL:uw {align1};
+(f0.0) jmpi (1) __low_quality_search;
+
+__high_quality_search:
#ifdef DEV_SNB
shl (2) vme_m0.0<1>:UW orig_xy_ub<2,2,1>:UB 4:UW {align1};
add (1) vme_m0.0<1>:W vme_m0.0<0,1,0>:W -16:W {align1}; /* Reference = (x-16,y-12)-(x+32,y+24) */
@@ -47,8 +51,25 @@ mov (1) vme_m0.2<1>:W -12:W {align1} ;
mov (1) vme_m0.12<1>:UD SEARCH_CTRL_SINGLE + INTER_PART_MASK + INTER_SAD_HAAR + SUB_PEL_MODE_QUARTER:UD {align1}; /* 16x16 Source, 1/4 pixel, harr */
mov (1) vme_m0.20<1>:UB thread_id_ub {align1}; /* dispatch id */
-mov (1) vme_m0.22<1>:UW REF_REGION_SIZE {align1}; /* Reference Width&Height, 32x32 */
+mov (1) vme_m0.22<1>:UW REF_REGION_SIZE {align1}; /* Reference Width&Height, 48x40 */
+jmpi __vme_msg1;
+
+
+__low_quality_search:
+#ifdef DEV_SNB
+shl (2) vme_m0.0<1>:UW orig_xy_ub<2,2,1>:UB 4:UW {align1};
+add (1) vme_m0.0<1>:W vme_m0.0<0,1,0>:W -8:W {align1};
+add (1) vme_m0.2<1>:W vme_m0.2<0,1,0>:W -8:W {align1};
+#else
+mov (1) vme_m0.0<1>:W -8:W {align1} ;
+mov (1) vme_m0.2<1>:W -8:W {align1} ;
+#endif
+
+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.20<1>:UB thread_id_ub {align1}; /* dispatch id */
+mov (1) vme_m0.22<1>:UW MIN_REF_REGION_SIZE {align1}; /* Reference Width&Height, 32x32 */
+__vme_msg1:
mov (1) vme_m1.0<1>:UD ADAPTIVE_SEARCH_ENABLE:ud {align1} ;
mov (1) vme_m1.4<1>:UD FB_PRUNING_ENABLE:UD {align1};
/* MV num is passed by constant buffer. R4.28 */
diff --git a/src/shaders/vme/inter_frame.g6b b/src/shaders/vme/inter_frame.g6b
index ca251bb..bc7cd43 100644
--- a/src/shaders/vme/inter_frame.g6b
+++ b/src/shaders/vme/inter_frame.g6b
@@ -11,12 +11,21 @@
{ 0x00000001, 0x242800e1, 0x00000000, 0x000f0003 },
{ 0x00000001, 0x24340231, 0x00000014, 0x00000000 },
{ 0x00200009, 0x24482e29, 0x004500a0, 0x00040004 },
+ { 0x01000010, 0x20002e28, 0x000000a8, 0x00020002 },
+ { 0x00010020, 0x34001c00, 0x00001400, 0x0000000e },
{ 0x00200009, 0x24402e29, 0x004500a0, 0x00040004 },
{ 0x00000040, 0x24403dad, 0x00000440, 0xfff0fff0 },
{ 0x00000040, 0x24423dad, 0x00000442, 0xfff4fff4 },
{ 0x00000001, 0x244c0061, 0x00000000, 0x00203000 },
{ 0x00000001, 0x24540231, 0x00000014, 0x00000000 },
{ 0x00000001, 0x24560169, 0x00000000, 0x28302830 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x0000000c },
+ { 0x00200009, 0x24402e29, 0x004500a0, 0x00040004 },
+ { 0x00000040, 0x24403dad, 0x00000440, 0xfff8fff8 },
+ { 0x00000040, 0x24423dad, 0x00000442, 0xfff8fff8 },
+ { 0x00000001, 0x244c0061, 0x00000000, 0x00201000 },
+ { 0x00000001, 0x24540231, 0x00000014, 0x00000000 },
+ { 0x00000001, 0x24560169, 0x00000000, 0x20202020 },
{ 0x00000001, 0x24600061, 0x00000000, 0x00000002 },
{ 0x00000001, 0x24640061, 0x00000000, 0x40000000 },
{ 0x00000001, 0x24640231, 0x0000009c, 0x00000000 },
diff --git a/src/shaders/vme/inter_frame.g7b b/src/shaders/vme/inter_frame.g7b
index 5273200..2a34927 100644
--- a/src/shaders/vme/inter_frame.g7b
+++ b/src/shaders/vme/inter_frame.g7b
@@ -11,11 +11,19 @@
{ 0x00000001, 0x242800e1, 0x00000000, 0x000f0003 },
{ 0x00000001, 0x24340231, 0x00000014, 0x00000000 },
{ 0x00200009, 0x24482e29, 0x004500a0, 0x00040004 },
+ { 0x01000010, 0x20002e28, 0x000000a8, 0x00020002 },
+ { 0x00010020, 0x34001c00, 0x00001400, 0x0000000c },
{ 0x00000001, 0x244001ed, 0x00000000, 0xfff0fff0 },
{ 0x00000001, 0x244201ed, 0x00000000, 0xfff4fff4 },
{ 0x00000001, 0x244c0061, 0x00000000, 0x00203000 },
{ 0x00000001, 0x24540231, 0x00000014, 0x00000000 },
{ 0x00000001, 0x24560169, 0x00000000, 0x28302830 },
+ { 0x00000020, 0x34001c00, 0x00001400, 0x0000000a },
+ { 0x00000001, 0x244001ed, 0x00000000, 0xfff8fff8 },
+ { 0x00000001, 0x244201ed, 0x00000000, 0xfff8fff8 },
+ { 0x00000001, 0x244c0061, 0x00000000, 0x00201000 },
+ { 0x00000001, 0x24540231, 0x00000014, 0x00000000 },
+ { 0x00000001, 0x24560169, 0x00000000, 0x20202020 },
{ 0x00000001, 0x24600061, 0x00000000, 0x00000002 },
{ 0x00000001, 0x24640061, 0x00000000, 0x40000000 },
{ 0x00000001, 0x24640231, 0x0000009c, 0x00000000 },
diff --git a/src/shaders/vme/vme.inc b/src/shaders/vme/vme.inc
index dd7e1bb..992c6b9 100644
--- a/src/shaders/vme/vme.inc
+++ b/src/shaders/vme/vme.inc
@@ -54,6 +54,7 @@ define(`SEARCH_CTRL_DUAL_RECORD', `0x00000300')
define(`SEARCH_CTRL_DUAL_REFERENCE', `0x00000700')
define(`REF_REGION_SIZE', `0x2830:UW')
+define(`MIN_REF_REGION_SIZE', `0x2020:UW')
define(`BI_SUB_MB_PART_MASK', `0x0c000000')
define(`MAX_NUM_MV', `0x00000020')
@@ -140,6 +141,7 @@ define(`orig_y_ub', `inline_reg0.1')
define(`transform_8x8_ub', `inline_reg0.4')
define(`slice_edge_ub', `inline_reg0.4')
define(`num_macroblocks', `inline_reg0.6')
+define(`quality_level_ub', `inline_reg0.8')
/*
* GRF 6~11 -- reserved
@@ -277,3 +279,6 @@ define(`vme_msg_4', `msg_reg4')
#endif
+define(`DEFAULT_QUALITY_LEVEL', `0x01')
+define(`HIGH_QUALITY_LEVEL', `DEFAULT_QUALITY_LEVEL')
+define(`LOW_QUALITY_LEVEL', `0x02')