From 23f3f65f2dd2f2dfc455406c0e41e96d75a155e7 Mon Sep 17 00:00:00 2001 From: ChenHengming Date: Wed, 7 Oct 2015 22:00:56 +0000 Subject: [PATCH] [buf_slot]: remove hw use function git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@330 6e48237b-75ef-9749-8fc9-41990f28c85a --- mpp/codec/dec/dummy/dummy_dec_api.c | 2 +- mpp/codec/dec/h265/h265d_refs.c | 2 +- mpp/codec/dec/h265/test/h265d_parser_test.c | 4 +- mpp/codec/inc/mpp_buf_slot.h | 4 -- mpp/codec/mpp_buf_slot.cpp | 53 ++------------------- mpp/codec/mpp_dec.cpp | 5 +- 6 files changed, 10 insertions(+), 60 deletions(-) diff --git a/mpp/codec/dec/dummy/dummy_dec_api.c b/mpp/codec/dec/dummy/dummy_dec_api.c index d8bc3673..0f5ab2db 100644 --- a/mpp/codec/dec/dummy/dummy_dec_api.c +++ b/mpp/codec/dec/dummy/dummy_dec_api.c @@ -139,7 +139,7 @@ MPP_RET dummy_dec_prepare(void *dec, MppPacket pkt, HalDecTask *task) mpp_frame_init(&frame); mpp_frame_set_pts(frame, mpp_packet_get_pts(pkt)); mpp_buf_slot_get_unused(slots, &output); - mpp_buf_slot_set_hw_use(slots, output); + mpp_buf_slot_set_flag(slots, output, SLOT_HAL_OUTPUT); mpp_buf_slot_set_frame(slots, output, frame); mpp_frame_deinit(&frame); mpp_assert(NULL == frame); diff --git a/mpp/codec/dec/h265/h265d_refs.c b/mpp/codec/dec/h265/h265d_refs.c index 58b59521..ec7e07ae 100644 --- a/mpp/codec/dec/h265/h265d_refs.c +++ b/mpp/codec/dec/h265/h265d_refs.c @@ -156,7 +156,7 @@ int mpp_hevc_set_new_ref(HEVCContext *s, MppFrame *mframe, int poc) ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF; mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_CODEC_USE); - mpp_buf_slot_set_hw_use(s->slots, ref->slot_index); + mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_HAL_OUTPUT); mpp_buf_slot_set_frame(s->slots, ref->slot_index, ref->frame); s->task->output = ref->slot_index; diff --git a/mpp/codec/dec/h265/test/h265d_parser_test.c b/mpp/codec/dec/h265/test/h265d_parser_test.c index ef6db408..726a6c53 100644 --- a/mpp/codec/dec/h265/test/h265d_parser_test.c +++ b/mpp/codec/dec/h265/test/h265d_parser_test.c @@ -245,7 +245,7 @@ static RK_S32 poll_task(void *hal, MppBufSlots slots, HalDecTask *dec) syn.dec = *dec; hal_h265d_wait(hal, &syn); mpp_err("dec->output = %d", dec->output); - mpp_buf_slot_clr_hw_use(slots, dec->output); + mpp_buf_slot_clr_flag(slots, dec->output, SLOT_HAL_OUTPUT); for (i = 0; i < MPP_ARRAY_ELEMS(dec->refer); i++) { RK_S32 id; id = dec->refer[i]; @@ -383,7 +383,7 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd) if (cutask->valid) { HalTaskInfo syn; syn.dec = *cutask; - mpp_buf_slot_get_hw_use(slots, &index); + index = cutask->output; if (NULL == mpp_buf_slot_get_buffer(slots, index)) { MppBuffer buffer = NULL; diff --git a/mpp/codec/inc/mpp_buf_slot.h b/mpp/codec/inc/mpp_buf_slot.h index e2a52874..cd168154 100644 --- a/mpp/codec/inc/mpp_buf_slot.h +++ b/mpp/codec/inc/mpp_buf_slot.h @@ -171,10 +171,6 @@ RK_U32 mpp_buf_slot_get_size(MppBufSlots slots); */ MPP_RET mpp_buf_slot_get_unused(MppBufSlots slots, RK_U32 *index); -MPP_RET mpp_buf_slot_set_hw_use(MppBufSlots slots, RK_U32 index); -MPP_RET mpp_buf_slot_clr_hw_use(MppBufSlots slots, RK_U32 index); -MPP_RET mpp_buf_slot_get_hw_use(MppBufSlots slots, RK_U32 *index); - MPP_RET mpp_buf_slot_inc_hw_ref(MppBufSlots slots, RK_U32 index); MPP_RET mpp_buf_slot_dec_hw_ref(MppBufSlots slots, RK_U32 index); diff --git a/mpp/codec/mpp_buf_slot.cpp b/mpp/codec/mpp_buf_slot.cpp index 22ba881f..62520d6e 100644 --- a/mpp/codec/mpp_buf_slot.cpp +++ b/mpp/codec/mpp_buf_slot.cpp @@ -158,9 +158,6 @@ struct MppBufSlotsImpl_t { RK_U32 new_count; RK_U32 new_size; - // to record current output slot index - RK_S32 hw_use; - // list for display struct list_head queue[QUEUE_BUTT]; @@ -485,52 +482,6 @@ MPP_RET mpp_buf_slot_get_unused(MppBufSlots slots, RK_U32 *index) return MPP_NOK; } -MPP_RET mpp_buf_slot_set_hw_use(MppBufSlots slots, RK_U32 index) -{ - if (NULL == slots) { - mpp_err_f("found NULL input\n"); - return MPP_ERR_NULL_PTR; - } - - MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; - Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); - MppBufSlotEntry *slot = &impl->slots[index]; - slot_ops_with_log(impl->logs, slot, SLOT_SET_HAL_OUTPUT); - impl->hw_use = index; - return MPP_OK; -} - -MPP_RET mpp_buf_slot_clr_hw_use(MppBufSlots slots, RK_U32 index) -{ - if (NULL == slots) { - mpp_err_f("found NULL input\n"); - return MPP_ERR_NULL_PTR; - } - - MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; - Mutex::Autolock auto_lock(impl->lock); - slot_assert(impl, index < impl->count); - MppBufSlotEntry *slot = &impl->slots[index]; - slot_ops_with_log(impl->logs, slot, SLOT_CLR_HAL_OUTPUT); - slot_ops_with_log(impl->logs, slot, SLOT_CLR_NOT_READY); - impl->decode_count++; - check_entry_unused(impl, slot); - return MPP_OK; -} - -MPP_RET mpp_buf_slot_get_hw_use(MppBufSlots slots, RK_U32 *index) -{ - if (NULL == slots || NULL == index) { - mpp_err_f("found NULL input\n"); - return MPP_ERR_NULL_PTR; - } - - MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots; - *index = impl->hw_use; - return MPP_OK; -} - MPP_RET mpp_buf_slot_inc_hw_ref(MppBufSlots slots, RK_U32 index) { if (NULL == slots) { @@ -733,6 +684,10 @@ MPP_RET mpp_buf_slot_clr_flag(MppBufSlots slots, RK_U32 index, SlotUsageType typ slot_assert(impl, index < impl->count); MppBufSlotEntry *slot = &impl->slots[index]; slot_ops_with_log(impl->logs, slot, clr_flag_op[type]); + + if (type == SLOT_HAL_OUTPUT) + impl->decode_count++; + check_entry_unused(impl, slot); return MPP_OK; } diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 4512245e..dc498ff5 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -168,8 +168,7 @@ void *mpp_dec_parser_thread(void *data) * - need buffer in different side, need to send a info change * frame to hal loop. */ - RK_U32 output; - mpp_buf_slot_get_hw_use(frame_slots, &output); + RK_S32 output = task_dec->output; if (NULL == mpp_buf_slot_get_buffer(frame_slots, output)) { MppBuffer buffer = NULL; RK_U32 size = mpp_buf_slot_get_size(frame_slots); @@ -262,7 +261,7 @@ void *mpp_dec_hal_thread(void *data) * 3. add frame to output list * repeat 2 and 3 until not frame can be output */ - mpp_buf_slot_clr_hw_use(frame_slots, task_dec->output); + mpp_buf_slot_clr_flag(frame_slots, task_dec->output, SLOT_HAL_OUTPUT); for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) { RK_S32 index = task_dec->refer[i]; if (index >= 0)