mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 09:36:49 +08:00
[buf_slot]: rename hw_dst operation to hw_use
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@321 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -139,7 +139,8 @@ MPP_RET dummy_dec_prepare(void *dec, MppPacket pkt, HalDecTask *task)
|
|||||||
mpp_frame_init(&frame);
|
mpp_frame_init(&frame);
|
||||||
mpp_frame_set_pts(frame, mpp_packet_get_pts(pkt));
|
mpp_frame_set_pts(frame, mpp_packet_get_pts(pkt));
|
||||||
mpp_buf_slot_get_unused(slots, &output);
|
mpp_buf_slot_get_unused(slots, &output);
|
||||||
mpp_buf_slot_set_hw_dst(slots, output, frame);
|
mpp_buf_slot_set_hw_use(slots, output);
|
||||||
|
mpp_buf_slot_set_frame(slots, output, frame);
|
||||||
mpp_frame_deinit(&frame);
|
mpp_frame_deinit(&frame);
|
||||||
mpp_assert(NULL == frame);
|
mpp_assert(NULL == frame);
|
||||||
|
|
||||||
|
@@ -156,7 +156,8 @@ int mpp_hevc_set_new_ref(HEVCContext *s, MppFrame *mframe, int poc)
|
|||||||
ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF;
|
ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF;
|
||||||
|
|
||||||
mpp_buf_slot_set_dpb_ref(s->slots, ref->slot_index);
|
mpp_buf_slot_set_dpb_ref(s->slots, ref->slot_index);
|
||||||
mpp_buf_slot_set_hw_dst(s->slots, ref->slot_index, ref->frame);
|
mpp_buf_slot_set_hw_use(s->slots, ref->slot_index);
|
||||||
|
mpp_buf_slot_set_frame(s->slots, ref->slot_index, ref->frame);
|
||||||
s->task->output = ref->slot_index;
|
s->task->output = ref->slot_index;
|
||||||
|
|
||||||
ref->sequence = s->seq_decode;
|
ref->sequence = s->seq_decode;
|
||||||
|
@@ -245,7 +245,7 @@ static RK_S32 poll_task(void *hal, MppBufSlots slots, HalDecTask *dec)
|
|||||||
syn.dec = *dec;
|
syn.dec = *dec;
|
||||||
hal_h265d_wait(hal, &syn);
|
hal_h265d_wait(hal, &syn);
|
||||||
mpp_err("dec->output = %d", dec->output);
|
mpp_err("dec->output = %d", dec->output);
|
||||||
mpp_buf_slot_clr_hw_dst(slots, dec->output);
|
mpp_buf_slot_clr_hw_use(slots, dec->output);
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(dec->refer); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(dec->refer); i++) {
|
||||||
RK_S32 id;
|
RK_S32 id;
|
||||||
id = dec->refer[i];
|
id = dec->refer[i];
|
||||||
@@ -383,7 +383,7 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd)
|
|||||||
if (cutask->valid) {
|
if (cutask->valid) {
|
||||||
HalTaskInfo syn;
|
HalTaskInfo syn;
|
||||||
syn.dec = *cutask;
|
syn.dec = *cutask;
|
||||||
mpp_buf_slot_get_hw_dst(slots, &index);
|
mpp_buf_slot_get_hw_use(slots, &index);
|
||||||
|
|
||||||
if (NULL == mpp_buf_slot_get_buffer(slots, index)) {
|
if (NULL == mpp_buf_slot_get_buffer(slots, index)) {
|
||||||
MppBuffer buffer = NULL;
|
MppBuffer buffer = NULL;
|
||||||
|
@@ -171,11 +171,10 @@ 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_get_unused(MppBufSlots slots, RK_U32 *index);
|
||||||
MPP_RET mpp_buf_slot_set_dpb_ref(MppBufSlots slots, RK_U32 index);
|
MPP_RET mpp_buf_slot_set_dpb_ref(MppBufSlots slots, RK_U32 index);
|
||||||
MPP_RET mpp_buf_slot_clr_dpb_ref(MppBufSlots slots, RK_U32 index);
|
MPP_RET mpp_buf_slot_clr_dpb_ref(MppBufSlots slots, RK_U32 index);
|
||||||
MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index);
|
|
||||||
|
|
||||||
MPP_RET mpp_buf_slot_set_hw_dst(MppBufSlots slots, RK_U32 index, MppFrame frame);
|
MPP_RET mpp_buf_slot_set_hw_use(MppBufSlots slots, RK_U32 index);
|
||||||
MPP_RET mpp_buf_slot_clr_hw_dst(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_dst(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_inc_hw_ref(MppBufSlots slots, RK_U32 index);
|
||||||
MPP_RET mpp_buf_slot_dec_hw_ref(MppBufSlots slots, RK_U32 index);
|
MPP_RET mpp_buf_slot_dec_hw_ref(MppBufSlots slots, RK_U32 index);
|
||||||
@@ -194,6 +193,10 @@ MPP_RET mpp_buf_slot_dec_hw_ref(MppBufSlots slots, RK_U32 index);
|
|||||||
*/
|
*/
|
||||||
MPP_RET mpp_buf_slot_set_buffer(MppBufSlots slots, RK_U32 index, MppBuffer buffer);
|
MPP_RET mpp_buf_slot_set_buffer(MppBufSlots slots, RK_U32 index, MppBuffer buffer);
|
||||||
MppBuffer mpp_buf_slot_get_buffer(MppBufSlots slots, RK_U32 index);
|
MppBuffer mpp_buf_slot_get_buffer(MppBufSlots slots, RK_U32 index);
|
||||||
|
MPP_RET mpp_buf_slot_set_frame(MppBufSlots slots, RK_U32 index, MppFrame frame);
|
||||||
|
MppFrame mpp_buf_slot_get_frame(MppBufSlots slots, RK_U32 index);
|
||||||
|
|
||||||
|
MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index);
|
||||||
MPP_RET mpp_buf_slot_get_display(MppBufSlots slots, MppFrame *frame);
|
MPP_RET mpp_buf_slot_get_display(MppBufSlots slots, MppFrame *frame);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ static RK_U32 buf_slot_debug = 0;
|
|||||||
#define MPP_SLOT_NOT_FILLED (0x00010000)
|
#define MPP_SLOT_NOT_FILLED (0x00010000)
|
||||||
#define MPP_SLOT_USED_AS_DPB_REF (0x00020000)
|
#define MPP_SLOT_USED_AS_DPB_REF (0x00020000)
|
||||||
#define MPP_SLOT_USED_AS_DISPLAY (0x00040000)
|
#define MPP_SLOT_USED_AS_DISPLAY (0x00040000)
|
||||||
#define MPP_SLOT_USED_AS_HW_DST (0x00080000)
|
#define MPP_SLOT_USED_AS_HW_USE (0x00080000)
|
||||||
#define MPP_SLOT_WITH_FRAME (0x01000000)
|
#define MPP_SLOT_WITH_FRAME (0x01000000)
|
||||||
#define MPP_SLOT_WITH_BUFFER (0x02000000)
|
#define MPP_SLOT_WITH_BUFFER (0x02000000)
|
||||||
#define MPP_SLOT_HW_REF_MASK (0x0000ffff)
|
#define MPP_SLOT_HW_REF_MASK (0x0000ffff)
|
||||||
@@ -81,8 +81,8 @@ typedef enum MppBufSlotOps_e {
|
|||||||
SLOT_CLR_DPB_REF,
|
SLOT_CLR_DPB_REF,
|
||||||
SLOT_SET_DISPLAY,
|
SLOT_SET_DISPLAY,
|
||||||
SLOT_CLR_DISPLAY,
|
SLOT_CLR_DISPLAY,
|
||||||
SLOT_SET_HW_DST,
|
SLOT_SET_HW_USE,
|
||||||
SLOT_CLR_HW_DST,
|
SLOT_CLR_HW_USE,
|
||||||
SLOT_INC_HW_REF,
|
SLOT_INC_HW_REF,
|
||||||
SLOT_DEC_HW_REF,
|
SLOT_DEC_HW_REF,
|
||||||
SLOT_SET_FRAME,
|
SLOT_SET_FRAME,
|
||||||
@@ -99,8 +99,8 @@ static const char op_string[][16] = {
|
|||||||
"clr dpb ref ",
|
"clr dpb ref ",
|
||||||
"set display ",
|
"set display ",
|
||||||
"clr display ",
|
"clr display ",
|
||||||
"set hw dst ",
|
"set hw use ",
|
||||||
"clr hw dst ",
|
"clr hw use ",
|
||||||
"inc hw ref ",
|
"inc hw ref ",
|
||||||
"dec hw ref ",
|
"dec hw ref ",
|
||||||
"set frame ",
|
"set frame ",
|
||||||
@@ -132,7 +132,7 @@ typedef struct MppBufSlotsImpl_t {
|
|||||||
RK_U32 new_size;
|
RK_U32 new_size;
|
||||||
|
|
||||||
// to record current output slot index
|
// to record current output slot index
|
||||||
RK_S32 output;
|
RK_S32 hw_use;
|
||||||
|
|
||||||
// list for display
|
// list for display
|
||||||
struct list_head display;
|
struct list_head display;
|
||||||
@@ -185,11 +185,11 @@ static void slot_ops_with_log(mpp_list *logs, MppBufSlotEntry *slot, MppBufSlotO
|
|||||||
case SLOT_CLR_DISPLAY : {
|
case SLOT_CLR_DISPLAY : {
|
||||||
status &= ~MPP_SLOT_USED_AS_DISPLAY;
|
status &= ~MPP_SLOT_USED_AS_DISPLAY;
|
||||||
} break;
|
} break;
|
||||||
case SLOT_SET_HW_DST : {
|
case SLOT_SET_HW_USE : {
|
||||||
status |= MPP_SLOT_USED_AS_HW_DST;
|
status |= MPP_SLOT_USED_AS_HW_USE;
|
||||||
} break;
|
} break;
|
||||||
case SLOT_CLR_HW_DST : {
|
case SLOT_CLR_HW_USE : {
|
||||||
status &= ~MPP_SLOT_USED_AS_HW_DST;
|
status &= ~MPP_SLOT_USED_AS_HW_USE;
|
||||||
} break;
|
} break;
|
||||||
case SLOT_INC_HW_REF : {
|
case SLOT_INC_HW_REF : {
|
||||||
status++;
|
status++;
|
||||||
@@ -232,7 +232,7 @@ static void dump_slots(MppBufSlotsImpl *impl)
|
|||||||
for (i = 0; i < impl->count; i++, slot++) {
|
for (i = 0; i < impl->count; i++, slot++) {
|
||||||
RK_U32 used = (slot->status & MPP_SLOT_USED) ? (1) : (0);
|
RK_U32 used = (slot->status & MPP_SLOT_USED) ? (1) : (0);
|
||||||
RK_U32 refer = (slot->status & MPP_SLOT_USED_AS_DPB_REF) ? (1) : (0);
|
RK_U32 refer = (slot->status & MPP_SLOT_USED_AS_DPB_REF) ? (1) : (0);
|
||||||
RK_U32 decoding = (slot->status & MPP_SLOT_USED_AS_HW_DST) ? (1) : (0);
|
RK_U32 decoding = (slot->status & MPP_SLOT_USED_AS_HW_USE) ? (1) : (0);
|
||||||
RK_U32 display = (slot->status & MPP_SLOT_USED_AS_DISPLAY) ? (1) : (0);
|
RK_U32 display = (slot->status & MPP_SLOT_USED_AS_DISPLAY) ? (1) : (0);
|
||||||
|
|
||||||
mpp_log("slot %2d used %d refer %d decoding %d display %d\n",
|
mpp_log("slot %2d used %d refer %d decoding %d display %d\n",
|
||||||
@@ -493,30 +493,7 @@ MPP_RET mpp_buf_slot_set_display(MppBufSlots slots, RK_U32 index)
|
|||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_buf_slot_set_hw_dst(MppBufSlots slots, RK_U32 index, MppFrame frame)
|
MPP_RET mpp_buf_slot_set_hw_use(MppBufSlots slots, RK_U32 index)
|
||||||
{
|
|
||||||
if (NULL == slots || NULL == frame) {
|
|
||||||
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_HW_DST);
|
|
||||||
|
|
||||||
slot_assert(impl, slot->status & MPP_SLOT_NOT_FILLED);
|
|
||||||
if (NULL == slot->frame)
|
|
||||||
mpp_frame_init(&slot->frame);
|
|
||||||
|
|
||||||
mpp_frame_copy(slot->frame, frame);
|
|
||||||
slot_ops_with_log(impl->logs, slot, SLOT_SET_FRAME);
|
|
||||||
impl->output = index;
|
|
||||||
return MPP_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
MPP_RET mpp_buf_slot_clr_hw_dst(MppBufSlots slots, RK_U32 index)
|
|
||||||
{
|
{
|
||||||
if (NULL == slots) {
|
if (NULL == slots) {
|
||||||
mpp_err_f("found NULL input\n");
|
mpp_err_f("found NULL input\n");
|
||||||
@@ -527,14 +504,30 @@ MPP_RET mpp_buf_slot_clr_hw_dst(MppBufSlots slots, RK_U32 index)
|
|||||||
Mutex::Autolock auto_lock(impl->lock);
|
Mutex::Autolock auto_lock(impl->lock);
|
||||||
slot_assert(impl, index < impl->count);
|
slot_assert(impl, index < impl->count);
|
||||||
MppBufSlotEntry *slot = &impl->slots[index];
|
MppBufSlotEntry *slot = &impl->slots[index];
|
||||||
slot_ops_with_log(impl->logs, slot, SLOT_CLR_HW_DST);
|
slot_ops_with_log(impl->logs, slot, SLOT_SET_HW_USE);
|
||||||
|
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_HW_USE);
|
||||||
slot_ops_with_log(impl->logs, slot, SLOT_CLR_NOT_READY);
|
slot_ops_with_log(impl->logs, slot, SLOT_CLR_NOT_READY);
|
||||||
impl->decode_count++;
|
impl->decode_count++;
|
||||||
check_entry_unused(impl, slot);
|
check_entry_unused(impl, slot);
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_buf_slot_get_hw_dst(MppBufSlots slots, RK_U32 *index)
|
MPP_RET mpp_buf_slot_get_hw_use(MppBufSlots slots, RK_U32 *index)
|
||||||
{
|
{
|
||||||
if (NULL == slots || NULL == index) {
|
if (NULL == slots || NULL == index) {
|
||||||
mpp_err_f("found NULL input\n");
|
mpp_err_f("found NULL input\n");
|
||||||
@@ -542,7 +535,7 @@ MPP_RET mpp_buf_slot_get_hw_dst(MppBufSlots slots, RK_U32 *index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
|
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
|
||||||
*index = impl->output;
|
*index = impl->hw_use;
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,6 +609,40 @@ MppBuffer mpp_buf_slot_get_buffer(MppBufSlots slots, RK_U32 index)
|
|||||||
return slot->buffer;
|
return slot->buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPP_RET mpp_buf_slot_set_frame(MppBufSlots slots, RK_U32 index, MppFrame frame)
|
||||||
|
{
|
||||||
|
if (NULL == slots || NULL == frame) {
|
||||||
|
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_assert(impl, slot->status & MPP_SLOT_NOT_FILLED);
|
||||||
|
if (NULL == slot->frame)
|
||||||
|
mpp_frame_init(&slot->frame);
|
||||||
|
|
||||||
|
mpp_frame_copy(slot->frame, frame);
|
||||||
|
slot_ops_with_log(impl->logs, slot, SLOT_SET_FRAME);
|
||||||
|
return MPP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
MppFrame mpp_buf_slot_get_frame(MppBufSlots slots, RK_U32 index)
|
||||||
|
{
|
||||||
|
if (NULL == slots) {
|
||||||
|
mpp_err_f("found NULL input\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MppBufSlotsImpl *impl = (MppBufSlotsImpl *)slots;
|
||||||
|
Mutex::Autolock auto_lock(impl->lock);
|
||||||
|
slot_assert(impl, index < impl->count);
|
||||||
|
MppBufSlotEntry *slot = &impl->slots[index];
|
||||||
|
return slot->frame;
|
||||||
|
}
|
||||||
|
|
||||||
MPP_RET mpp_buf_slot_get_display(MppBufSlots slots, MppFrame *frame)
|
MPP_RET mpp_buf_slot_get_display(MppBufSlots slots, MppFrame *frame)
|
||||||
{
|
{
|
||||||
if (NULL == slots || NULL == frame) {
|
if (NULL == slots || NULL == frame) {
|
||||||
|
@@ -35,6 +35,7 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
HalTaskGroup tasks = dec->tasks;
|
HalTaskGroup tasks = dec->tasks;
|
||||||
MppPacket packet = NULL;
|
MppPacket packet = NULL;
|
||||||
MppBufSlots frame_slots = dec->frame_slots;
|
MppBufSlots frame_slots = dec->frame_slots;
|
||||||
|
MppBufSlots packet_slots = dec->packet_slots;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* parser thread need to wait at cases below:
|
* parser thread need to wait at cases below:
|
||||||
@@ -114,7 +115,6 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!curr_task_ready) {
|
if (!curr_task_ready) {
|
||||||
hal_task_info_init(&task_local, MPP_CTX_DEC);
|
|
||||||
parser_prepare(dec->parser, packet, task_dec);
|
parser_prepare(dec->parser, packet, task_dec);
|
||||||
if (0 == mpp_packet_get_length(packet)) {
|
if (0 == mpp_packet_get_length(packet)) {
|
||||||
mpp_free(mpp_packet_get_data(packet));
|
mpp_free(mpp_packet_get_data(packet));
|
||||||
@@ -167,7 +167,7 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
* frame to hal loop.
|
* frame to hal loop.
|
||||||
*/
|
*/
|
||||||
RK_U32 output;
|
RK_U32 output;
|
||||||
mpp_buf_slot_get_hw_dst(frame_slots, &output);
|
mpp_buf_slot_get_hw_use(frame_slots, &output);
|
||||||
if (NULL == mpp_buf_slot_get_buffer(frame_slots, output)) {
|
if (NULL == mpp_buf_slot_get_buffer(frame_slots, output)) {
|
||||||
MppBuffer buffer = NULL;
|
MppBuffer buffer = NULL;
|
||||||
RK_U32 size = mpp_buf_slot_get_size(frame_slots);
|
RK_U32 size = mpp_buf_slot_get_size(frame_slots);
|
||||||
@@ -208,6 +208,7 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
curr_task_ready = 0;
|
curr_task_ready = 0;
|
||||||
curr_task_parsed = 0;
|
curr_task_parsed = 0;
|
||||||
prev_task_done = 0;
|
prev_task_done = 0;
|
||||||
|
hal_task_info_init(&task_local, MPP_CTX_DEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -259,7 +260,7 @@ void *mpp_dec_hal_thread(void *data)
|
|||||||
* 3. add frame to output list
|
* 3. add frame to output list
|
||||||
* repeat 2 and 3 until not frame can be output
|
* repeat 2 and 3 until not frame can be output
|
||||||
*/
|
*/
|
||||||
mpp_buf_slot_clr_hw_dst(frame_slots, task_dec->output);
|
mpp_buf_slot_clr_hw_use(frame_slots, task_dec->output);
|
||||||
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
|
for (RK_U32 i = 0; i < MPP_ARRAY_ELEMS(task_dec->refer); i++) {
|
||||||
RK_S32 index = task_dec->refer[i];
|
RK_S32 index = task_dec->refer[i];
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
|
Reference in New Issue
Block a user