diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2016-08-15 10:46:10 +0800 |
---|---|---|
committer | Sean V Kelley <seanvk@posteo.de> | 2016-08-19 15:17:59 -0700 |
commit | 1dea706fe10f7161d880f889f37b7fc86b193e55 (patch) | |
tree | f848b588868d32301e2bebb6210a4d830d612d66 /src/gen9_vp9_encoder.c | |
parent | 1e98d344014d6e7415008f9ddc4f6cfd982143b0 (diff) | |
download | libva-intel-driver-1dea706fe10f7161d880f889f37b7fc86b193e55.tar.gz |
Encode/VP9: turn gen9_vp9_get_coded_status() into a local function
Set encoder_context->get_status to this local function when initializing,
so that we can fetch VP9 encoding status from the underlying context.
This patch changes the input parameters and removes redundant assigns
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Diffstat (limited to 'src/gen9_vp9_encoder.c')
-rw-r--r-- | src/gen9_vp9_encoder.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/src/gen9_vp9_encoder.c b/src/gen9_vp9_encoder.c index 0980a77f..6b9f13f5 100644 --- a/src/gen9_vp9_encoder.c +++ b/src/gen9_vp9_encoder.c @@ -5789,6 +5789,7 @@ gen9_vp9_pak_pipeline_prepare(VADriverContextP ctx, coded_buffer_segment = (struct i965_coded_buffer_segment *)bo->virtual; coded_buffer_segment->mapped = 0; coded_buffer_segment->codec = encoder_context->codec; + coded_buffer_segment->status_support = 1; dri_bo_unmap(bo); return VA_STATUS_SUCCESS; @@ -6007,58 +6008,50 @@ gen9_vp9_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *en return true; } -Bool -gen9_vp9_pak_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context) -{ - /* VME & PAK share the same context */ - struct gen9_encoder_context_vp9 *pak_context = encoder_context->vme_context; - - if (!pak_context) - return false; - - encoder_context->mfc_context = pak_context; - encoder_context->mfc_context_destroy = gen9_vp9_pak_context_destroy; - encoder_context->mfc_pipeline = gen9_vp9_pak_pipeline; - encoder_context->mfc_brc_prepare = gen9_vp9_pak_brc_prepare; - - return true; -} - -VAStatus +static VAStatus gen9_vp9_get_coded_status(VADriverContextP ctx, - char *buffer, - struct hw_context *hw_context) + struct intel_encoder_context *encoder_context, + struct i965_coded_buffer_segment *coded_buf_seg) { - struct intel_encoder_context *encoder_context = - (struct intel_encoder_context *)hw_context; struct gen9_vp9_state *vp9_state = NULL; struct vp9_encode_status_buffer_internal *status_buffer; - struct i965_coded_buffer_segment *coded_buf_seg; unsigned int *buf_ptr; - if (!encoder_context || !buffer) + if (!encoder_context || !coded_buf_seg) return VA_STATUS_ERROR_INVALID_BUFFER; vp9_state = (struct gen9_vp9_state *)(encoder_context->enc_priv_state); - coded_buf_seg = (struct i965_coded_buffer_segment *) buffer; if (!vp9_state) return VA_STATUS_ERROR_INVALID_BUFFER; status_buffer = &vp9_state->status_buffer; - buf_ptr = (unsigned int *)(buffer + status_buffer->bs_byte_count_offset); - coded_buf_seg->base.buf = buffer + I965_CODEDBUFFER_HEADER_SIZE; - coded_buf_seg->base.next = NULL; + buf_ptr = (unsigned int *)((char *)coded_buf_seg + status_buffer->bs_byte_count_offset); /* the stream size is writen into the bs_byte_count_offset address of buffer */ coded_buf_seg->base.size = *buf_ptr; - coded_buf_seg->mapped = 1; - /* One VACodedBufferSegment for VP9 will be added later. * It will be linked to the next element of coded_buf_seg->base.next */ return VA_STATUS_SUCCESS; } + +Bool +gen9_vp9_pak_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context) +{ + /* VME & PAK share the same context */ + struct gen9_encoder_context_vp9 *pak_context = encoder_context->vme_context; + + if (!pak_context) + return false; + + encoder_context->mfc_context = pak_context; + encoder_context->mfc_context_destroy = gen9_vp9_pak_context_destroy; + encoder_context->mfc_pipeline = gen9_vp9_pak_pipeline; + encoder_context->mfc_brc_prepare = gen9_vp9_pak_brc_prepare; + encoder_context->get_status = gen9_vp9_get_coded_status; + return true; +} |