linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kyrie.wu <kyrie.wu@mediatek.com>
To: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"Tzung-Bi Shih" <tzungbi@chromium.org>
Cc: <Project_Global_Chrome_Upstream_Group@mediatek.com>,
	<linux-media@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>, <xia.jiang@mediatek.com>,
	<maoguang.meng@mediatek.com>, <srv_heupstream@mediatek.com>,
	<irui.wang@mediatek.com>
Subject: Re: [PATCH V1, 5/6] media: mtk-jpegdec: add output pic reorder interface
Date: Mon, 21 Feb 2022 10:28:44 +0800	[thread overview]
Message-ID: <0f750dcb3bf2b4703c23357b814f50c365739e3d.camel@mediatek.com> (raw)
In-Reply-To: <d305aefa-7cdf-3221-2883-9381785e335d@collabora.com>

On Mon, 2022-02-07 at 15:50 +0100, AngeloGioacchino Del Regno wrote:
> Il 03/12/21 06:34, kyrie.wu ha scritto:
> > add output reorder func to reorder the output images
> > to ensure the output pic is consistent with the input images.
> > 
> > Signed-off-by: kyrie.wu <kyrie.wu@mediatek.com>
> > ---
> >   drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c | 50
> > +++++++++++++++++++++--
> >   1 file changed, 46 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c
> > b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c
> > index 9138ecb..fad5bf1c 100644
> > --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c
> > +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_dec_hw.c
> > @@ -443,6 +443,49 @@ void mtk_jpeg_dec_set_config(void __iomem
> > *base,
> >   	mtk_jpeg_dec_set_pause_mcu_idx(base, config->total_mcu);
> >   }
> >   
> > +void mtk_jpegdec_put_buf(struct mtk_jpegdec_comp_dev *jpeg)
> 
> This function is used only in this file, hence it should be static.
Thanks. I will fix it.
> 
> > +{
> > +	struct mtk_jpeg_src_buf *dst_done_buf, *tmp_dst_done_buf;
> > +	struct vb2_v4l2_buffer *dst_buffer;
> > +	struct list_head *temp_entry;
> > +	struct list_head *pos = NULL;
> > +	struct mtk_jpeg_ctx *ctx;
> > +	unsigned long flags;
> > +
> > +	ctx = jpeg->hw_param.curr_ctx;
> > +	if (!ctx) {
> > +		dev_err(jpeg->dev, "comp_jpeg ctx fail !!!\n");
> 
> Since this is unlikely to happen (or should be unlikely anyway!!),
> this print
> should then be a dev_dbg()
Thanks. I will consider your suggestion.
> 
> > +		return;
> > +	}
> > +
> > +	dst_buffer = jpeg->hw_param.dst_buffer;
> > +	if (!dst_buffer) {
> > +		dev_err(jpeg->dev, "comp_jpeg dst_buffer fail !!!\n");
> > +		return;
> > +	}
> > +
> > +	dst_done_buf = container_of(dst_buffer, struct
> > mtk_jpeg_src_buf, b);
> > +
> > +	spin_lock_irqsave(&ctx->done_queue_lock, flags);
> > +	list_add_tail(&dst_done_buf->list, &ctx->dst_done_queue);
> > +	while (!list_empty(&ctx->dst_done_queue) &&
> > +		(pos != &ctx->dst_done_queue)) {
> > +		list_for_each_prev_safe(pos, temp_entry,
> > +			(&ctx->dst_done_queue)) {
> > +			tmp_dst_done_buf = list_entry(pos,
> > +				struct mtk_jpeg_src_buf, list);
> > +			if (tmp_dst_done_buf->frame_num ==
> > +				ctx->last_done_frame_num) {
> > +				list_del(&tmp_dst_done_buf->list);
> > +				v4l2_m2m_buf_done(&tmp_dst_done_buf->b,
> > +					VB2_BUF_STATE_DONE);
> > +				ctx->last_done_frame_num++;
> > +			}
> > +		}
> > +	}
> > +	spin_unlock_irqrestore(&ctx->done_queue_lock, flags);
> > +}
> > +
> >   static void mtk_jpegdec_timeout_work(struct work_struct *work)
> >   {
> >   	enum vb2_buffer_state buf_state = VB2_BUF_STATE_ERROR;
> > @@ -450,10 +493,9 @@ static void mtk_jpegdec_timeout_work(struct
> > work_struct *work)
> >   		container_of(work, struct mtk_jpegdec_comp_dev,
> >   		job_timeout_work.work);
> >   	struct mtk_jpeg_dev *master_jpeg = cjpeg->master_dev;
> > -	struct vb2_v4l2_buffer *src_buf, *dst_buf;
> > +	struct vb2_v4l2_buffer *src_buf;
> >   
> >   	src_buf = cjpeg->hw_param.src_buffer;
> > -	dst_buf = cjpeg->hw_param.dst_buffer;
> >   
> >   	mtk_jpeg_dec_reset(cjpeg->reg_base);
> >   	clk_disable_unprepare(cjpeg->pm.dec_clk.clk_info->jpegdec_clk);
> > @@ -462,7 +504,7 @@ static void mtk_jpegdec_timeout_work(struct
> > work_struct *work)
> >   	atomic_inc(&cjpeg->hw_rdy);
> >   	wake_up(&master_jpeg->dec_hw_wq);
> >   	v4l2_m2m_buf_done(src_buf, buf_state);
> > -	v4l2_m2m_buf_done(dst_buf, buf_state);
> > +	mtk_jpegdec_put_buf(cjpeg);
> >   }
> >   
> >   int mtk_jpegdec_init_pm(struct mtk_jpegdec_comp_dev *mtkdev)
> > @@ -559,7 +601,7 @@ static irqreturn_t
> > mtk_jpegdec_hw_irq_handler(int irq, void *priv)
> >   
> >   dec_end:
> >   	v4l2_m2m_buf_done(src_buf, buf_state);
> > -	v4l2_m2m_buf_done(dst_buf, buf_state);
> > +	mtk_jpegdec_put_buf(jpeg);
> >   	v4l2_m2m_job_finish(master_jpeg->m2m_dev, ctx->fh.m2m_ctx);
> >   	clk_disable_unprepare(jpeg->pm.dec_clk.clk_info->jpegdec_clk);
> >   	pm_runtime_put(ctx->jpeg->dev);
> 
> 
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-02-21  2:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  5:34 [PATCH V1, 0/6] Support multi-hardware jpeg decoding using of_platform_populate kyrie.wu
2021-12-03  5:34 ` [PATCH V1, 1/6] dt-bindings: mediatek: Add mediatek, mt8195-jpgdec compatible kyrie.wu
2021-12-03  5:34 ` [PATCH V1, 2/6] media: mtk-jpegdec: manage jpegdec multi-hardware kyrie.wu
2022-02-07 14:50   ` AngeloGioacchino Del Regno
2022-02-21  2:19     ` kyrie.wu
2021-12-03  5:34 ` [PATCH V1, 3/6] media: mtk-jpegdec: add jpegdec timeout func interface kyrie.wu
2021-12-03  5:34 ` [PATCH V1, 4/6] media: mtk-jpegdec: add jpeg decode worker interface kyrie.wu
2021-12-03 13:10   ` Ricardo Ribalda
2021-12-06 16:26   ` AngeloGioacchino Del Regno
2022-01-06  6:52     ` kyrie.wu
2021-12-03  5:34 ` [PATCH V1, 5/6] media: mtk-jpegdec: add output pic reorder interface kyrie.wu
2021-12-03 13:11   ` Ricardo Ribalda
2022-02-07 14:50   ` AngeloGioacchino Del Regno
2022-02-21  2:28     ` kyrie.wu [this message]
2021-12-03  5:34 ` [PATCH V1, 6/6] media: mtk-jpegdec: refactor jpegdec func interface kyrie.wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f750dcb3bf2b4703c23357b814f50c365739e3d.camel@mediatek.com \
    --to=kyrie.wu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=irui.wang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maoguang.meng@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=tzungbi@chromium.org \
    --cc=xia.jiang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).