Project import generated by Copybara. GitOrigin-RevId: e1a295800b4c012273cda8d4fdcda2c9a12ac4f1
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c index 2bbfb6e..f40d3fd 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec.c +++ b/drivers/amvdec_ports/aml_vcodec_dec.c
@@ -1935,7 +1935,8 @@ if (ctx->vpp_cfg.fmt == 0) ctx->vpp_cfg.fmt = ctx->cap_pix_fmt; - if (ctx->vpp == NULL) + if (ctx->vpp == NULL && + vdec_get_instance_num() <= max_di_instance) aml_wait_resource(ctx); if ((atomic_read(&ctx->dev->vpp_count) < max_di_instance) || @@ -3336,6 +3337,20 @@ } } +void aml_v4l_vpp_release_early(struct aml_vcodec_ctx * ctx) +{ + if (ctx->vpp && !(ctx->vpp_cfg.enable_nr && + atomic_read(&ctx->vpp->local_buf_out))) { + aml_v4l2_vpp_destroy(ctx->vpp); + atomic_dec(&ctx->dev->vpp_count); + ctx->vpp = NULL; + + v4l_dbg(ctx, V4L_DEBUG_CODEC_PRINFO, + "vpp destroy inst count:%d.\n", + atomic_read(&ctx->dev->vpp_count)); + } +} + void aml_v4l_ctx_release(struct kref *kref) { struct aml_vcodec_ctx * ctx; @@ -3345,6 +3360,7 @@ if (ctx->vpp) { atomic_dec(&ctx->dev->vpp_count); aml_v4l2_vpp_destroy(ctx->vpp); + ctx->vpp = NULL; v4l_dbg(ctx, V4L_DEBUG_CODEC_PRINFO, "vpp destory inst count:%d.\n",
diff --git a/drivers/amvdec_ports/aml_vcodec_dec.h b/drivers/amvdec_ports/aml_vcodec_dec.h index a23522c..649c977 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec.h +++ b/drivers/amvdec_ports/aml_vcodec_dec.h
@@ -134,6 +134,7 @@ void vdec_frame_buffer_release(void *data); void aml_vdec_dispatch_event(struct aml_vcodec_ctx *ctx, u32 changes); void* v4l_get_vf_handle(int fd); +void aml_v4l_vpp_release_early(struct aml_vcodec_ctx * ctx); void aml_v4l_ctx_release(struct kref *kref); void dmabuff_recycle_worker(struct work_struct *work); void aml_buffer_status(struct aml_vcodec_ctx *ctx);
diff --git a/drivers/amvdec_ports/aml_vcodec_dec_drv.c b/drivers/amvdec_ports/aml_vcodec_dec_drv.c index 18f0254..f92f4a8 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec_drv.c +++ b/drivers/amvdec_ports/aml_vcodec_dec_drv.c
@@ -197,6 +197,7 @@ list_del_init(&ctx->list); kfree(ctx->empty_flush_buf); + aml_v4l_vpp_release_early(ctx); kref_put(&ctx->ctx_ref, aml_v4l_ctx_release); mutex_unlock(&dev->dev_mutex); return 0;
diff --git a/drivers/amvdec_ports/aml_vcodec_vpp.c b/drivers/amvdec_ports/aml_vcodec_vpp.c index 9f4e960..5a86c1f 100644 --- a/drivers/amvdec_ports/aml_vcodec_vpp.c +++ b/drivers/amvdec_ports/aml_vcodec_vpp.c
@@ -214,6 +214,7 @@ vpp_buf->di_local_buf = buf; vpp_buf->di_buf.vf->vf_ext = buf->vf; vpp_buf->di_buf.vf->flag |= VFRAME_FLAG_CONTAIN_POST_FRAME; + atomic_set(&vpp->local_buf_out, 1); } kfifo_put(&vpp->out_done_q, vpp_buf); @@ -890,6 +891,7 @@ mutex_init(&vpp->output_lock); sema_init(&vpp->sem_in, 0); sema_init(&vpp->sem_out, 0); + atomic_set(&vpp->local_buf_out, 0); vpp->running = true; vpp->task = kthread_run(aml_v4l2_vpp_thread, vpp, @@ -947,6 +949,7 @@ { v4l_dbg(vpp->ctx, V4L_DEBUG_VPP_DETAIL, "vpp destroy begin\n"); + atomic_set(&vpp->local_buf_out, 0); vpp->running = false; up(&vpp->sem_in); up(&vpp->sem_out);
diff --git a/drivers/amvdec_ports/aml_vcodec_vpp.h b/drivers/amvdec_ports/aml_vcodec_vpp.h index 7a5771d..27ffbe6 100644 --- a/drivers/amvdec_ports/aml_vcodec_vpp.h +++ b/drivers/amvdec_ports/aml_vcodec_vpp.h
@@ -87,6 +87,7 @@ bool is_bypass_p; int di_ibuf_num; int di_obuf_num; + atomic_t local_buf_out; }; struct task_ops_s *get_vpp_ops(void);
diff --git a/drivers/frame_provider/decoder_v4l/vav1/vav1.c b/drivers/frame_provider/decoder_v4l/vav1/vav1.c old mode 100755 new mode 100644 index 132341b..b804bc5 --- a/drivers/frame_provider/decoder_v4l/vav1/vav1.c +++ b/drivers/frame_provider/decoder_v4l/vav1/vav1.c
@@ -484,7 +484,7 @@ static u32 dv_toggle_prov_name; #endif -static u32 run_ready_min_buf_num = 2; +static u32 run_ready_min_buf_num = 1; #ifdef DEBUG_CRC_ERROR /* bit[4] fill zero in header before starting