mbox series

[0/6] media: mediatek: vcodec: Fix decoder under flow and plt test fails randomly

Message ID 20230417054816.17097-1-yunfei.dong@mediatek.com
Headers show
Series media: mediatek: vcodec: Fix decoder under flow and plt test fails randomly | expand

Message

Yunfei Dong April 17, 2023, 5:48 a.m. UTC
1: Getting decoder under flow error randomly when do stress test with youtube;
2: Video display black when do plt test with one night.

patch 1 can't regard getting lat buffer as fail.
patch 2 ~ 3 using decoder status instead of core work count.
patch 4 ~ 6 using empty lat buffer as the last one to flush decoder.
---
Yunfei Dong (6):
  media: mediatek: vcodec: can`t regard getting lat buffer fail as error
  media: mediatek: vcodec: add the definition of decoder status
  media: mediatek: vcodec: using decoder status instead of core work
    count
  media: mediatek: vcodec: add one empty lat buffer as the last one to
    decode
  media: mediatek: vcodec: move core context from device to each
    instance
  media: mediatek: vcodec: using empty lat buffer as the last one

 .../mediatek/vcodec/mtk_vcodec_dec_drv.c      |   1 -
 .../vcodec/mtk_vcodec_dec_stateless.c         |   2 +-
 .../platform/mediatek/vcodec/mtk_vcodec_drv.h |   2 -
 .../vcodec/vdec/vdec_h264_req_multi_if.c      |   6 +-
 .../vcodec/vdec/vdec_vp9_req_lat_if.c         |   4 +-
 .../platform/mediatek/vcodec/vdec_msg_queue.c | 105 ++++++++----------
 .../platform/mediatek/vcodec/vdec_msg_queue.h |  23 +++-
 7 files changed, 69 insertions(+), 74 deletions(-)

Comments

AngeloGioacchino Del Regno April 17, 2023, 9:35 a.m. UTC | #1
Il 17/04/23 07:48, Yunfei Dong ha scritto:
> There are so many lat buffer in core context list, some instances
> maybe be scheduled for a very long time. Moving the core context to
> each instance, it only be used to control lat buffer of each instance.
> And the core work queue of each instance is scheduled by system.
> 
> Fixes: 2cfca6c1bf80 ("media: mediatek: vcodec: move lat_buf to the top of core list")
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
>   .../mediatek/vcodec/mtk_vcodec_dec_drv.c      |  1 -
>   .../platform/mediatek/vcodec/mtk_vcodec_drv.h |  2 -
>   .../vcodec/vdec/vdec_h264_req_multi_if.c      |  4 +-
>   .../vcodec/vdec/vdec_vp9_req_lat_if.c         |  2 +-
>   .../platform/mediatek/vcodec/vdec_msg_queue.c | 53 +++++++------------
>   .../platform/mediatek/vcodec/vdec_msg_queue.h |  6 ++-
>   6 files changed, 25 insertions(+), 43 deletions(-)
> 

..snip..

> diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> index a80b9853cec9..ae37d020a1bd 100644
> --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> @@ -83,10 +83,11 @@ struct vdec_lat_buf {
>    * @wdma_wptr_addr: ube write point
>    * @core_work: core hardware work
>    * @lat_ctx: used to store lat buffer list
> - * @ctx: point to mtk_vcodec_ctx
> + * @core_ctx: used to store core buffer list
>    *
>    * @lat_list_cnt: used to record each instance lat list count
>    * @core_list_cnt: used to record each instance core list count
> + * @flush_done: core flush done status
>    * @empty_lat_buf: the last lat buf used to flush decode
>    * @core_dec_done: core work queue decode done event
>    * @status: current context decode status for core hardware
> @@ -100,10 +101,11 @@ struct vdec_msg_queue {
>   
>   	struct work_struct core_work;
>   	struct vdec_msg_queue_ctx lat_ctx;
> -	struct mtk_vcodec_ctx *ctx;
> +	struct vdec_msg_queue_ctx core_ctx;
>   
>   	atomic_t lat_list_cnt;
>   	atomic_t core_list_cnt;
> +	bool flush_done;

flush_done is used in patch [6/6]: this does not belong to this patch,
please move the addition of this member in the same patch where you use it.

Regards,
Angelo
AngeloGioacchino Del Regno April 17, 2023, 9:35 a.m. UTC | #2
Il 17/04/23 07:48, Yunfei Dong ha scritto:
> Adding one empty lat buffer with the parameter 'is_empty_flag = true' used
> to flush core work queue decode.
> 
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>

Since commit [6/6] depends on this one, you should either squash this with [6/6]
or add the same Fixes tag to this.

I think that the most sensible option is to squash it.


Regards,
Angelo
Yunfei Dong April 17, 2023, 12:10 p.m. UTC | #3
Hi AngeloGioacchino,

Thanks for your suggestion.

On Mon, 2023-04-17 at 11:26 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 17/04/23 07:48, Yunfei Dong ha scritto:
> > Adding the status used to separate different decoder period for
> > core hardware.
> > 
> > Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> > ---
> >   drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h | 7
> > +++++++
> >   1 file changed, 7 insertions(+)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> > b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> > index a5d44bc97c16..19508be08566 100644
> > --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> > +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h
> > @@ -21,6 +21,13 @@ struct mtk_vcodec_ctx;
> >   struct mtk_vcodec_dev;
> >   typedef int (*core_decode_cb_t)(struct vdec_lat_buf *lat_buf);
> > 
> > +/* current context isn't work */
> > +#define CONTEXT_LIST_EMPTY           (0)
> > +/* queued to the core work list */
> > +#define CONTEXT_LIST_QUEUED          (1)
> > +/* context decode done */
> > +#define CONTEXT_LIST_DEC_DONE        (2)
> 
> I would prefer an enumeration instead; you can keep the documentation
> for those
> status signals with kerneldoc on the new enum.
> 
> /**
>   * enum core_ctx_status - Context decode status for core hardware
>   * @CONTEXT_LIST_EMPTY:    No buffer queued on Core HW (must always
> be 0)
>   * @CONTEXT_LIST_QUEUED:   Buffer queued to the core work list
>   * @CONTEXT_LIST_DEC_DONE: Context decode done
>   */
> enum core_ctx_status {
>         CONTEXT_LIST_EMPTY = 0,
>         CONTEXT_LIST_QUEUED,
>         CONTEXT_LIST_DEC_DONE,
> }
> 
> Moreover, since this is a rather simple addition, please squash this
> commit with
> patch [3/6] where you actually also introduce the actual usage of the
> new enum.
> 
Fixed in patch v2.

Best Regards,
Yunfei Dong
> Cheers,
> Angelo
>