[mpp_dec]: basic info change flow ready

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@377 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-10-13 16:15:35 +00:00
parent d9a1366054
commit df3995f9bf
5 changed files with 42 additions and 22 deletions

View File

@@ -69,7 +69,7 @@ typedef enum {
MPP_OSAL_CMD_BASE = 0x20000, MPP_OSAL_CMD_BASE = 0x20000,
MPP_CODEC_CMD_BASE = 0x30000, MPP_CODEC_CMD_BASE = 0x30000,
MPP_CODEC_INFO_CHANGE, MPP_CODEC_SET_INFO_CHANGE_READY,
MPP_CODEC_SET_DEFAULT_WIDTH_HEIGH, MPP_CODEC_SET_DEFAULT_WIDTH_HEIGH,
MPP_DEC_CMD_BASE = 0x40000, MPP_DEC_CMD_BASE = 0x40000,

View File

@@ -172,6 +172,7 @@ MPP_RET dummy_dec_prepare(void *dec, MppPacket pkt, HalDecTask *task)
* this step will enable the task and goto parse stage * this step will enable the task and goto parse stage
*/ */
task->input_packet = p->task_pkt; task->input_packet = p->task_pkt;
task->flags.eos = p->task_eos;
task->valid = 1; task->valid = 1;
return MPP_OK; return MPP_OK;
} }
@@ -195,6 +196,9 @@ MPP_RET dummy_dec_parse(void *dec, HalDecTask *task)
if (!p->slots_inited) { if (!p->slots_inited) {
mpp_buf_slot_setup(slots, DUMMY_DEC_FRAME_COUNT, DUMMY_DEC_FRAME_SIZE, 0); mpp_buf_slot_setup(slots, DUMMY_DEC_FRAME_COUNT, DUMMY_DEC_FRAME_SIZE, 0);
p->slots_inited = 1; p->slots_inited = 1;
} else if (frame_count == 2) {
// do info change test
mpp_buf_slot_setup(slots, DUMMY_DEC_FRAME_COUNT, DUMMY_DEC_FRAME_SIZE*2, 1);
} }
if (task->prev_status) { if (task->prev_status) {
@@ -252,17 +256,15 @@ MPP_RET dummy_dec_parse(void *dec, HalDecTask *task)
} }
} else { } else {
// clear unreference buffer // clear unreference buffer
if (p->slot_index[frame_count] >= 0) RK_U32 replace_index = frame_count & 1;
mpp_buf_slot_clr_flag(slots, p->slot_index[frame_count], SLOT_CODEC_USE); if (p->slot_index[replace_index] >= 0)
mpp_buf_slot_clr_flag(slots, p->slot_index[replace_index], SLOT_CODEC_USE);
p->slot_index[frame_count] = output; p->slot_index[replace_index] = output;
mpp_buf_slot_set_flag(slots, output, SLOT_CODEC_USE); mpp_buf_slot_set_flag(slots, output, SLOT_CODEC_USE);
} }
frame_count++; p->frame_count = ++frame_count;
if (frame_count >= DUMMY_DEC_REF_COUNT)
frame_count = 0;
p->frame_count = frame_count;
return MPP_OK; return MPP_OK;
} }

View File

@@ -212,11 +212,6 @@ void *mpp_dec_parser_thread(void *data)
*/ */
if (mpp_buf_slot_is_changed(frame_slots)) { if (mpp_buf_slot_is_changed(frame_slots)) {
if (!info_task_done) { if (!info_task_done) {
// do a chech here
MppFrame info_frame = NULL;
mpp_buf_slot_get_prop(frame_slots, task_dec->output, SLOT_FRAME, &info_frame);
mpp_assert(info_frame);
task_dec->flags.info_change = 1; task_dec->flags.info_change = 1;
hal_task_hnd_set_info(task, &task_local); hal_task_hnd_set_info(task, &task_local);
hal_task_hnd_set_status(task, TASK_PROCESSING); hal_task_hnd_set_status(task, TASK_PROCESSING);
@@ -230,7 +225,8 @@ void *mpp_dec_parser_thread(void *data)
if (wait_on_change) if (wait_on_change)
continue; continue;
info_task_done = 1; info_task_done = 0;
task_dec->flags.info_change = 0;
/* /*
* 5. chekc frame buffer group is internal or external * 5. chekc frame buffer group is internal or external
*/ */
@@ -339,13 +335,6 @@ void *mpp_dec_hal_thread(void *data)
mpp->mTaskGetCount++; mpp->mTaskGetCount++;
hal_task_hnd_get_info(task, &task_info); hal_task_hnd_get_info(task, &task_info);
mpp_hal_hw_wait(dec->hal, &task_info);
// TODO: may have risk here
hal_task_hnd_set_status(task, TASK_PROC_DONE);
task = NULL;
mpp->mThreadCodec->signal();
/* /*
* check info change flag * check info change flag
* if this is a info change frame, only output the mpp_frame for info change. * if this is a info change frame, only output the mpp_frame for info change.
@@ -357,9 +346,20 @@ void *mpp_dec_hal_thread(void *data)
mpp_assert(NULL == mpp_frame_get_buffer(info_frame)); mpp_assert(NULL == mpp_frame_get_buffer(info_frame));
mpp_frame_set_info_change(info_frame, 1); mpp_frame_set_info_change(info_frame, 1);
mpp_put_frame(mpp, info_frame); mpp_put_frame(mpp, info_frame);
hal_task_hnd_set_status(task, TASK_IDLE);
task = NULL;
continue; continue;
mpp->mThreadCodec->signal();
} }
mpp_hal_hw_wait(dec->hal, &task_info);
// TODO: may have risk here
hal_task_hnd_set_status(task, TASK_PROC_DONE);
task = NULL;
mpp->mThreadCodec->signal();
/* /*
* when hardware decoding is done: * when hardware decoding is done:
* 1. clear decoding flag (mark buffer is ready) * 1. clear decoding flag (mark buffer is ready)

View File

@@ -245,6 +245,12 @@ MPP_RET Mpp::control(MpiCmd cmd, MppParam param)
mOutputBlock = block; mOutputBlock = block;
break; break;
} }
case MPP_CODEC_SET_INFO_CHANGE_READY: {
if (mType == MPP_CTX_DEC) {
mpp_buf_slot_ready(mDec->frame_slots);
}
break;
}
default : { default : {
} break; } break;
} }

View File

@@ -141,10 +141,22 @@ int mpi_test()
MppFrame next = mpp_frame_get_next(dec_out); MppFrame next = mpp_frame_get_next(dec_out);
// TODO: diaplay function called here // TODO: diaplay function called here
/*
* NOTE: check info_change is needed
* step 1 : check info change flag
* step 2 : if info change then request new buffer
* step 3 : when new buffer is ready set control to mpp
*/
if (mpp_frame_get_info_change(dec_out)) {
mpp_log("decode_get_frame get info changed found\n");
// if work in external buffer mode re-commit buffer here
mpi->control(ctx, MPP_CODEC_SET_INFO_CHANGE_READY, NULL);
} else
i++;
mpp_frame_deinit(&dec_out); mpp_frame_deinit(&dec_out);
dec_out = next; dec_out = next;
i++;
} while (dec_out); } while (dec_out);
} }
} }