summaryrefslogtreecommitdiff
path: root/src/gen75_mfc.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-11-08 15:36:32 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-11-13 15:33:51 +0800
commitb06e32d127e2f466e44a52b2b7ca559ab79890ff (patch)
treecdc8f79e50ea32b6d1ace15e4630a6e515f9e838 /src/gen75_mfc.c
parent8f68c229ba15f3d2c830edc043ad8a7895fa1bcb (diff)
downloadlibva-intel-driver-b06e32d127e2f466e44a52b2b7ca559ab79890ff.tar.gz
libva-intel-driver-b06e32d127e2f466e44a52b2b7ca559ab79890ff.tar.bz2
libva-intel-driver-b06e32d127e2f466e44a52b2b7ca559ab79890ff.zip
Encoding reuses aux_batchbuffer instead of allocating another new buffer
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit 052ce2930cd4661b7ce62902e6553eec0e2db9f1)
Diffstat (limited to 'src/gen75_mfc.c')
-rw-r--r--src/gen75_mfc.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index e16e649..c2b26d6 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -1261,17 +1261,14 @@ gen75_mfc_avc_software_batchbuffer(VADriverContextP ctx,
struct encode_state *encode_state,
struct intel_encoder_context *encoder_context)
{
+ struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch;
dri_bo *batch_bo;
int i;
int buffer_size;
- VAEncSequenceParameterBufferH264 *pSequenceParameter = (VAEncSequenceParameterBufferH264 *)encode_state->seq_param_ext->buffer;
- int width_in_mbs = pSequenceParameter->picture_width_in_mbs;
- int height_in_mbs = pSequenceParameter->picture_height_in_mbs;
- buffer_size = width_in_mbs * height_in_mbs * 64;
- batch = intel_batchbuffer_new(&i965->intel, I915_EXEC_BSD, buffer_size);
+ batch = mfc_context->aux_batchbuffer;
batch_bo = batch->buffer;
for (i = 0; i < encode_state->num_slice_params_ext; i++) {
gen75_mfc_avc_pipeline_slice_programing(ctx, encode_state, encoder_context, i, batch);
@@ -1285,7 +1282,9 @@ gen75_mfc_avc_software_batchbuffer(VADriverContextP ctx,
ADVANCE_BCS_BATCH(batch);
dri_bo_reference(batch_bo);
+
intel_batchbuffer_free(batch);
+ mfc_context->aux_batchbuffer = NULL;
return batch_bo;
}
@@ -2339,18 +2338,14 @@ gen75_mfc_mpeg2_software_slice_batchbuffer(VADriverContextP ctx,
struct encode_state *encode_state,
struct intel_encoder_context *encoder_context)
{
+ struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct intel_batchbuffer *batch;
- VAEncSequenceParameterBufferMPEG2 *seq_param = (VAEncSequenceParameterBufferMPEG2 *)encode_state->seq_param_ext->buffer;
VAEncSliceParameterBufferMPEG2 *next_slice_group_param = NULL;
dri_bo *batch_bo;
int i;
- int buffer_size;
- int width_in_mbs = ALIGN(seq_param->picture_width, 16) / 16;
- int height_in_mbs = ALIGN(seq_param->picture_height, 16) / 16;
- buffer_size = width_in_mbs * height_in_mbs * 64;
- batch = intel_batchbuffer_new(&i965->intel, I915_EXEC_BSD, buffer_size);
+ batch = mfc_context->aux_batchbuffer;
batch_bo = batch->buffer;
for (i = 0; i < encode_state->num_slice_params_ext; i++) {
@@ -2371,6 +2366,7 @@ gen75_mfc_mpeg2_software_slice_batchbuffer(VADriverContextP ctx,
dri_bo_reference(batch_bo);
intel_batchbuffer_free(batch);
+ mfc_context->aux_batchbuffer = NULL;
return batch_bo;
}