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 <[email protected]> --- src/gen9_vp9_encapi.h | 9 --------- src/gen9_vp9_encoder.c | 53 ++++++++++++++++++++++---------------------------- src/i965_drv_video.c | 14 +------------ 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/src/gen9_vp9_encapi.h b/src/gen9_vp9_encapi.h index 0100a06..99963fc 100644 --- a/src/gen9_vp9_encapi.h +++ b/src/gen9_vp9_encapi.h @@ -40,13 +40,4 @@ gen9_vp9_vme_context_init(VADriverContextP ctx, struct intel_encoder_context *en extern Bool gen9_vp9_pak_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context); -/* buffer points to the start address of coded_buffer. It is also - * interpreted as i965_coded_buffer_segment. - */ -extern VAStatus -gen9_vp9_get_coded_status(VADriverContextP ctx, - char *buffer, - struct hw_context *hw_context); - - #endif // _INTE_VP9_ENC_API_H_ diff --git a/src/gen9_vp9_encoder.c b/src/gen9_vp9_encoder.c index eecd206..edfbda6 100644 --- a/src/gen9_vp9_encoder.c +++ b/src/gen9_vp9_encoder.c @@ -5790,6 +5790,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; @@ -6008,58 +6009,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; +} diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 9839584..05743ef 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -2644,16 +2644,7 @@ i965_MapBuffer(VADriverContextP ctx, coded_buffer_segment->status_support) { vaStatus = obj_context->hw_context->get_status(ctx, obj_context->hw_context, coded_buffer_segment); } else { - - if (coded_buffer_segment->codec == CODEC_VP9) { - - if (obj_context == NULL) - return VA_STATUS_ERROR_ENCODING_ERROR; - - gen9_vp9_get_coded_status(ctx, (char *)coded_buffer_segment, - obj_context->hw_context); - } - else if (coded_buffer_segment->codec == CODEC_H264 || + if (coded_buffer_segment->codec == CODEC_H264 || coded_buffer_segment->codec == CODEC_H264_MVC) { delimiter0 = H264_DELIMITER0; delimiter1 = H264_DELIMITER1; @@ -2680,9 +2671,6 @@ i965_MapBuffer(VADriverContextP ctx, ASSERT_RET(0, VA_STATUS_ERROR_UNSUPPORTED_PROFILE); } - if(coded_buffer_segment->codec == CODEC_VP9) { - /* it is already handled */ - } else if(coded_buffer_segment->codec == CODEC_JPEG) { for(i = 0; i < obj_buffer->size_element - header_offset - 1 - 0x1000; i++) { if( (buffer[i] == 0xFF) && (buffer[i + 1] == 0xD9)) { -- 1.9.1 _______________________________________________ Libva mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libva
