summaryrefslogtreecommitdiff
path: root/src/gen7_vme.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-01-14 10:45:14 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-01-17 13:08:40 +0800
commit54845cc2557f224ebb0fd66ce3629daf63aad021 (patch)
tree65ddd10cdd507c6bbafa8a8501ad532bea916c5f /src/gen7_vme.c
parent74194dfb52c87bc50289ff0c2714480e3c52fd35 (diff)
downloadvaapi-intel-driver-54845cc2557f224ebb0fd66ce3629daf63aad021.tar.gz
vaapi-intel-driver-54845cc2557f224ebb0fd66ce3629daf63aad021.tar.bz2
vaapi-intel-driver-54845cc2557f224ebb0fd66ce3629daf63aad021.zip
Use the common scoreboard code on Ivy/Haswell to remove the duplicated code
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Diffstat (limited to 'src/gen7_vme.c')
-rw-r--r--src/gen7_vme.c170
1 files changed, 1 insertions, 169 deletions
diff --git a/src/gen7_vme.c b/src/gen7_vme.c
index f05dcac..9c8f4fe 100644
--- a/src/gen7_vme.c
+++ b/src/gen7_vme.c
@@ -77,9 +77,6 @@ enum MPEG2_VME_KERNEL_TYPE{
MPEG2_VME_KERNEL_SUM
};
-#define MB_SCOREBOARD_A (1 << 0)
-#define MB_SCOREBOARD_B (1 << 1)
-#define MB_SCOREBOARD_C (1 << 2)
static const uint32_t gen7_vme_intra_frame[][4] = {
#include "shaders/vme/intra_frame_ivb.g7b"
@@ -543,12 +540,6 @@ static VAStatus gen7_vme_vme_state_setup(VADriverContextP ctx,
return VA_STATUS_SUCCESS;
}
-#define INTRA_PRED_AVAIL_FLAG_AE 0x60
-#define INTRA_PRED_AVAIL_FLAG_B 0x10
-#define INTRA_PRED_AVAIL_FLAG_C 0x8
-#define INTRA_PRED_AVAIL_FLAG_D 0x4
-#define INTRA_PRED_AVAIL_FLAG_BCD_MASK 0x1C
-
static void
gen7_vme_fill_vme_batchbuffer(VADriverContextP ctx,
struct encode_state *encode_state,
@@ -635,148 +626,6 @@ gen7_vme_fill_vme_batchbuffer(VADriverContextP ctx,
dri_bo_unmap(vme_context->vme_batchbuffer.bo);
}
-/* check whether the mb of (x_index, y_index) is out of bound */
-static inline int loop_in_bounds(int x_index, int y_index, int first_mb, int num_mb, int mb_width, int mb_height)
-{
- int mb_index;
- if (x_index < 0 || x_index >= mb_width)
- return -1;
- if (y_index < 0 || y_index >= mb_height)
- return -1;
-
- mb_index = y_index * mb_width + x_index;
- if (mb_index < first_mb || mb_index > (first_mb + num_mb))
- return -1;
- return 0;
-}
-
-static void
-gen7_vme_walker_fill_vme_batchbuffer(VADriverContextP ctx,
- struct encode_state *encode_state,
- int mb_width, int mb_height,
- int kernel,
- int transform_8x8_mode_flag,
- struct intel_encoder_context *encoder_context)
-{
- struct gen6_vme_context *vme_context = encoder_context->vme_context;
- int mb_x = 0, mb_y = 0;
- int mb_row;
- int s;
- unsigned int *command_ptr;
- int temp;
-
-
-#define USE_SCOREBOARD (1 << 21)
-
- dri_bo_map(vme_context->vme_batchbuffer.bo, 1);
- command_ptr = vme_context->vme_batchbuffer.bo->virtual;
-
- for (s = 0; s < encode_state->num_slice_params_ext; s++) {
- VAEncSliceParameterBufferH264 *pSliceParameter = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[s]->buffer;
- int first_mb = pSliceParameter->macroblock_address;
- int num_mb = pSliceParameter->num_macroblocks;
- unsigned int mb_intra_ub, score_dep;
- int x_outer, y_outer, x_inner, y_inner;
-
- x_outer = first_mb % mb_width;
- y_outer = first_mb / mb_width;
- mb_row = y_outer;
-
- for (; x_outer < (mb_width -2 ) && !loop_in_bounds(x_outer, y_outer, first_mb, num_mb, mb_width, mb_height); ) {
- x_inner = x_outer;
- y_inner = y_outer;
- for (; !loop_in_bounds(x_inner, y_inner, first_mb, num_mb, mb_width, mb_height);) {
- mb_intra_ub = 0;
- score_dep = 0;
- if (x_inner != 0) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_AE;
- score_dep |= MB_SCOREBOARD_A;
- }
- if (y_inner != mb_row) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_B;
- score_dep |= MB_SCOREBOARD_B;
- if (x_inner != 0)
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_D;
- if (x_inner != (mb_width -1)) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_C;
- score_dep |= MB_SCOREBOARD_C;
- }
- }
-
- *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
- *command_ptr++ = kernel;
- *command_ptr++ = USE_SCOREBOARD;
- /* Indirect data */
- *command_ptr++ = 0;
- /* the (X, Y) term of scoreboard */
- *command_ptr++ = ((y_inner << 16) | x_inner);
- *command_ptr++ = score_dep;
-
- /*inline data */
- *command_ptr++ = (mb_width << 16 | y_inner << 8 | x_inner);
- *command_ptr++ = ((1 << 18) | (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
- x_inner -= 2;
- y_inner += 1;
- }
- x_outer += 1;
- }
-
- x_outer = mb_width - 2;
- y_outer = first_mb / mb_width;
- temp = 0;
- for (;!loop_in_bounds(x_outer, y_outer, first_mb, num_mb, mb_width, mb_height); ) {
- y_inner = y_outer;
- x_inner = x_outer;
- for (; !loop_in_bounds(x_inner, y_inner, first_mb, num_mb, mb_width, mb_height);) {
- mb_intra_ub = 0;
- score_dep = 0;
- if (x_inner != 0) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_AE;
- score_dep |= MB_SCOREBOARD_A;
- }
- if (y_inner != mb_row) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_B;
- score_dep |= MB_SCOREBOARD_B;
- if (x_inner != 0)
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_D;
- if (x_inner != (mb_width -1)) {
- mb_intra_ub |= INTRA_PRED_AVAIL_FLAG_C;
- score_dep |= MB_SCOREBOARD_C;
- }
- }
-
- *command_ptr++ = (CMD_MEDIA_OBJECT | (8 - 2));
- *command_ptr++ = kernel;
- *command_ptr++ = USE_SCOREBOARD;
- /* Indirect data */
- *command_ptr++ = 0;
- /* the (X, Y) term of scoreboard */
- *command_ptr++ = ((y_inner << 16) | x_inner);
- *command_ptr++ = score_dep;
-
- /*inline data */
- *command_ptr++ = (mb_width << 16 | y_inner << 8 | x_inner);
- *command_ptr++ = ((1 << 18) | (1 << 16) | transform_8x8_mode_flag | (mb_intra_ub << 8));
-
- x_inner -= 2;
- y_inner += 1;
- }
- temp++;
- if (temp == 2) {
- y_outer += 1;
- temp = 0;
- x_outer = mb_width - 2;
- } else {
- x_outer++;
- }
- }
- }
-
- *command_ptr++ = 0;
- *command_ptr++ = MI_BATCH_BUFFER_END;
-
- dri_bo_unmap(vme_context->vme_batchbuffer.bo);
-}
static void gen7_vme_media_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context)
{
@@ -1219,24 +1068,7 @@ Bool gen7_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *e
vme_context->gpe_context.vfe_state.urb_entry_size = 59 - 1;
vme_context->gpe_context.vfe_state.curbe_allocation_size = CURBE_ALLOCATION_SIZE - 1;
- vme_context->gpe_context.vfe_desc5.scoreboard0.enable = 1;
- vme_context->gpe_context.vfe_desc5.scoreboard0.type = SCOREBOARD_STALLING;
- vme_context->gpe_context.vfe_desc5.scoreboard0.mask = (MB_SCOREBOARD_A |
- MB_SCOREBOARD_B |
- MB_SCOREBOARD_C);
-
- /* In VME prediction the current mb depends on the neighbour
- * A/B/C macroblock. So the left/up/up-right dependency should
- * be considered.
- */
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_x0 = -1;
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_y0 = 0;
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_x1 = 0;
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_y1 = -1;
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_x2 = 1;
- vme_context->gpe_context.vfe_desc6.scoreboard1.delta_y2 = -1;
-
- vme_context->gpe_context.vfe_desc7.dword = 0;
+ gen7_vme_scoreboard_init(ctx, vme_context);
if(encoder_context->profile == VAProfileH264Baseline ||
encoder_context->profile == VAProfileH264Main ||