Commit ecfc3b45 authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video/encode: merge the object command for intra/inter frame

Signed-off-by: default avatarXiang, Haihao <haihao.xiang@intel.com>
parent 2c52a008
...@@ -519,10 +519,11 @@ static void gen6_vme_idrt(VADriverContextP ctx) ...@@ -519,10 +519,11 @@ static void gen6_vme_idrt(VADriverContextP ctx)
ADVANCE_BATCH(ctx); ADVANCE_BATCH(ctx);
} }
static int gen6_vme_media_object_intra(VADriverContextP ctx, static int gen6_vme_media_object(VADriverContextP ctx,
VAContextID context, VAContextID context,
struct mfc_encode_state *encode_state, struct mfc_encode_state *encode_state,
int mb_x, int mb_y) int mb_x, int mb_y,
int kernel)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE( encode_state->current_render_target); struct object_surface *obj_surface = SURFACE( encode_state->current_render_target);
...@@ -532,7 +533,7 @@ static int gen6_vme_media_object_intra(VADriverContextP ctx, ...@@ -532,7 +533,7 @@ static int gen6_vme_media_object_intra(VADriverContextP ctx,
BEGIN_BATCH(ctx, len_in_dowrds); BEGIN_BATCH(ctx, len_in_dowrds);
OUT_BATCH(ctx, CMD_MEDIA_OBJECT | (len_in_dowrds - 2)); OUT_BATCH(ctx, CMD_MEDIA_OBJECT | (len_in_dowrds - 2));
OUT_BATCH(ctx, VME_INTRA_SHADER); /*Interface Descriptor Offset*/ OUT_BATCH(ctx, kernel); /*Interface Descriptor Offset*/
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0); OUT_BATCH(ctx, 0);
...@@ -545,32 +546,6 @@ static int gen6_vme_media_object_intra(VADriverContextP ctx, ...@@ -545,32 +546,6 @@ static int gen6_vme_media_object_intra(VADriverContextP ctx,
return len_in_dowrds * 4; return len_in_dowrds * 4;
} }
static int gen6_vme_media_object_inter(VADriverContextP ctx,
VAContextID context,
struct mfc_encode_state *encode_state,
int mb_x, int mb_y)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE( encode_state->current_render_target);
int mb_width = ALIGN(obj_surface->orig_width, 16) / 16;
int len_in_dowrds = 6 + 1;
BEGIN_BATCH(ctx, len_in_dowrds);
OUT_BATCH(ctx, CMD_MEDIA_OBJECT | (len_in_dowrds - 2));
OUT_BATCH(ctx, VME_INTER_SHADER); /*Interface Descriptor Offset*/
OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0);
OUT_BATCH(ctx, 0);
/*inline data */
OUT_BATCH(ctx, mb_width << 16 | mb_y << 8 | mb_x);
ADVANCE_BATCH(ctx);
return len_in_dowrds * 4;
}
static void gen6_vme_media_init(VADriverContextP ctx) static void gen6_vme_media_init(VADriverContextP ctx)
{ {
int i; int i;
...@@ -667,11 +642,7 @@ static void gen6_vme_pipeline_programing(VADriverContextP ctx, ...@@ -667,11 +642,7 @@ static void gen6_vme_pipeline_programing(VADriverContextP ctx,
} }
/*Step4: Primitive commands*/ /*Step4: Primitive commands*/
if ( is_intra ) { object_len_in_bytes = gen6_vme_media_object(ctx, context, encode_state, x, y, is_intra ? VME_INTRA_SHADER : VME_INTER_SHADER);
object_len_in_bytes = gen6_vme_media_object_intra(ctx, context, encode_state, x, y);
} else {
object_len_in_bytes = gen6_vme_media_object_inter(ctx, context, encode_state, x, y);
}
if (intel_batchbuffer_check_free_space(ctx, object_len_in_bytes) == 0) { if (intel_batchbuffer_check_free_space(ctx, object_len_in_bytes) == 0) {
intel_batchbuffer_end_atomic(ctx); intel_batchbuffer_end_atomic(ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment