vdec->dec_prop.param = (void *)sync_mode;
vdec->dec_prop.format = vdec->format;
vdec->dec_prop.width = 1920;
- vdec->dec_prop.height = 1080;
+ vdec->dec_prop.height = 1088;
vdec->dec_prop.rate = 3200;
}
vdec_set_eos(vdec, true);
}
-int aml_codec_reset(struct aml_vdec_adapt *ada_ctx, int *flag)
+int aml_codec_reset(struct aml_vdec_adapt *ada_ctx, int *mode)
{
struct vdec_s *vdec = ada_ctx->vdec;
int ret = 0;
if (vdec) {
- if (*flag != 2)
- vdec_set_eos(vdec, false);
- ret = vdec_v4l2_reset(vdec, *flag);
- *flag = 0;
+ vdec_set_eos(vdec, false);
+
+ if (*mode == V4L_RESET_MODE_NORMAL &&
+ vdec->input.have_frame_num == 0)
+ *mode = V4L_RESET_MODE_LIGHT;
+
+ aml_v4l2_debug(2, "%s, reset mode: %d\n", __func__, *mode);
+
+ ret = vdec_v4l2_reset(vdec, *mode);
+ *mode = V4L_RESET_MODE_NORMAL;
}
return ret;
static void aml_check_dpb_ready(struct aml_vcodec_ctx *ctx)
{
if (!ctx->v4l_codec_dpb_ready) {
- int buf_ready_num;
-
- /* is there enough dst bufs for decoding? */
- buf_ready_num = v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx);
- if ((ctx->dpb_size) &&
- ((buf_ready_num + ctx->buf_used_count) >= ctx->dpb_size))
+ /*
+ * make sure enough dst bufs for decoding, and
+ * the backend maybe hold 4 frms so need to minus 4.
+ */
+ if ((ctx->dpb_size) && (ctx->cap_pool.in >= ctx->dpb_size - 4))
ctx->v4l_codec_dpb_ready = true;
+
aml_v4l2_debug(2, "[%d] %s() dpb: %d, ready: %d, used: %d, dpb is ready: %s",
ctx->id, __func__, ctx->dpb_size,
- buf_ready_num, ctx->buf_used_count,
- ctx->v4l_codec_dpb_ready ? "yes" : "no");
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx),
+ ctx->cap_pool.out, ctx->v4l_codec_dpb_ready ? "yes" : "no");
}
}
if ((ctx->state == AML_STATE_ACTIVE ||
ctx->state == AML_STATE_FLUSHING ||
ctx->state == AML_STATE_FLUSHED) ||
- (ctx->reset_flag == 2)) {
+ (ctx->reset_flag == V4L_RESET_MODE_LIGHT)) {
ctx->state = AML_STATE_RESET;
ATRACE_COUNTER("v4l2_state", ctx->state);
ctx->v4l_codec_ready = false;
q_data->bytesperline[0] = q_data->coded_width;
q_data->sizeimage[1] = q_data->sizeimage[0] / 2;
q_data->bytesperline[1] = q_data->coded_width;
+ ctx->reset_flag = V4L_RESET_MODE_NORMAL;
ctx->state = AML_STATE_IDLE;
ATRACE_COUNTER("v4l2_state", ctx->state);
if (hw->is_used_v4l && hw->eos) {
expires = jiffies + msecs_to_jiffies(2000);
while (INVALID_IDX == (index = v4l_get_free_buf_idx(vdec))) {
- if (time_after(jiffies, expires))
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
break;
}
if (hw->is_used_v4l && hw->eos) {
expires = jiffies + msecs_to_jiffies(2000);
while (INVALID_IDX == (index = get_free_buf_idx(hw))) {
- if (time_after(jiffies, expires))
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
break;
}
int i, int size)
{
int ret = 0;
+
+ if (pbi->m_mv_BUF[i].start_adr &&
+ size > pbi->m_mv_BUF[i].size) {
+ dealloc_mv_bufs(pbi);
+ } else if (pbi->m_mv_BUF[i].start_adr)
+ return 0;
+
if (decoder_bmmu_box_alloc_buf_phy
(pbi->bmmu_box,
MV_BUFFER_IDX(i), size,
if (hw->is_used_v4l && hw->eos) {
expires = jiffies + msecs_to_jiffies(2000);
while (INVALID_IDX == (index = v4l_get_free_fb(hw))) {
- if (time_after(jiffies, expires))
+ if (time_after(jiffies, expires) ||
+ v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx))
break;
}
}
pbi->dec_result = DEC_RESULT_NONE;
reset_process_time(pbi);
- dealloc_mv_bufs(pbi);
vp9_local_uninit(pbi);
if (vvp9_local_init(pbi) < 0)
vp9_print(pbi, 0, "%s local_init failed \r\n", __func__);