From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"Moudy Ho (何宗原)" <Moudy.Ho@mediatek.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v4 2/3] media: platform: mtk-mdp3: Use cmdq_pkt_create() and cmdq_pkt_destroy()
Date: Tue, 3 Sep 2024 09:39:25 +0000 [thread overview]
Message-ID: <d5c512d06e013555397722137d5790dc8a627bfd.camel@mediatek.com> (raw)
In-Reply-To: <1d4e9e86-aaaf-4d19-b89f-6f7207ab72d8@gmail.com>
Hi, Matthias:
On Mon, 2024-09-02 at 17:31 +0200, Matthias Brugger wrote:
>
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> On 01/09/2024 16:32, Chun-Kuang Hu wrote:
> > Use cmdq_pkt_create() and cmdq_pkt_destroy() common function
> > instead of implementing mdp3 version.
> >
> > Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > ---
> > .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 46 ++-----------------
> > .../platform/mediatek/mdp3/mtk-mdp3-cmdq.h | 1 +
> > 2 files changed, 6 insertions(+), 41 deletions(-)
> >
> > diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> > index ef5dade35fd3..740a484c8eb4 100644
> > --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> > +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> > @@ -471,43 +471,6 @@ static int mdp_path_config(struct mdp_dev *mdp, struct mdp_cmdq_cmd *cmd,
> > return 0;
> > }
> >
> > -static int mdp_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt,
> > - size_t size)
> > -{
> > -struct device *dev;
> > -dma_addr_t dma_addr;
> > -
> > -pkt->va_base = kzalloc(size, GFP_KERNEL);
> > -if (!pkt->va_base)
> > -return -ENOMEM;
> > -
> > -pkt->buf_size = size;
> > -pkt->cl = (void *)client;
>
> cmdq_pkt_create does not set the callback. Why doesn't that break things?
> Same holds for the crtc driver that is already in linux-next.
This series is to remove pkt->cl.
For the helper function whick need pkt->cl, add parameter to pass the cmdq_client information.
Up to now, only cmdq_pkt_finalize() use pkt->cl, but it is replaced by cmdq_pkt_eoc() and cmdq_pkt_jump_rel() in [PATCH v4 1/3].
So this would not break any thing.
Regards,
CK
>
> Regards,
> Matthias
>
> > -
> > -dev = client->chan->mbox->dev;
> > -dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size,
> > - DMA_TO_DEVICE);
> > -if (dma_mapping_error(dev, dma_addr)) {
> > -dev_err(dev, "dma map failed, size=%u\n", (u32)(u64)size);
> > -kfree(pkt->va_base);
> > -return -ENOMEM;
> > -}
> > -
> > -pkt->pa_base = dma_addr;
> > -
> > -return 0;
> > -}
> > -
> > -static void mdp_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
> > -{
> > -struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
> > -
> > -dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
> > - DMA_TO_DEVICE);
> > -kfree(pkt->va_base);
> > -pkt->va_base = NULL;
> > -}
> > -
> > static void mdp_auto_release_work(struct work_struct *work)
> > {
> > struct mdp_cmdq_cmd *cmd;
> > @@ -538,7 +501,7 @@ static void mdp_auto_release_work(struct work_struct *work)
> > wake_up(&mdp->callback_wq);
> > }
> >
> > -mdp_cmdq_pkt_destroy(&cmd->pkt);
> > +cmdq_pkt_destroy(mdp->cmdq_clt[cmd->pp_idx], &cmd->pkt);
> > kfree(cmd->comps);
> > cmd->comps = NULL;
> > kfree(cmd);
> > @@ -578,7 +541,7 @@ static void mdp_handle_cmdq_callback(struct mbox_client *cl, void *mssg)
> > if (refcount_dec_and_test(&mdp->job_count))
> > wake_up(&mdp->callback_wq);
> >
> > -mdp_cmdq_pkt_destroy(&cmd->pkt);
> > +cmdq_pkt_destroy(mdp->cmdq_clt[cmd->pp_idx], &cmd->pkt);
> > kfree(cmd->comps);
> > cmd->comps = NULL;
> > kfree(cmd);
> > @@ -620,7 +583,7 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
> > goto err_uninit;
> > }
> >
> > -ret = mdp_cmdq_pkt_create(mdp->cmdq_clt[pp_idx], &cmd->pkt, SZ_16K);
> > +ret = cmdq_pkt_create(mdp->cmdq_clt[pp_idx], &cmd->pkt, SZ_16K);
> > if (ret)
> > goto err_free_cmd;
> >
> > @@ -700,6 +663,7 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
> > cmd->comps = comps;
> > cmd->num_comps = num_comp;
> > cmd->mdp_ctx = param->mdp_ctx;
> > +cmd->pp_idx = pp_idx;
> >
> > kfree(path);
> > return cmd;
> > @@ -711,7 +675,7 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp,
> > err_free_comps:
> > kfree(comps);
> > err_destroy_pkt:
> > -mdp_cmdq_pkt_destroy(&cmd->pkt);
> > +cmdq_pkt_destroy(mdp->cmdq_clt[pp_idx], &cmd->pkt);
> > err_free_cmd:
> > kfree(cmd);
> > err_uninit:
> > diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.h
> > index 53a30ad7e0b0..935ae9825728 100644
> > --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.h
> > +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.h
> > @@ -35,6 +35,7 @@ struct mdp_cmdq_cmd {
> > struct mdp_comp *comps;
> > void *mdp_ctx;
> > u8 num_comps;
> > +u8 pp_idx;
> > };
> >
> > struct mdp_dev;
next prev parent reply other threads:[~2024-09-03 9:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-01 14:32 [PATCH v4 0/3] Remove cl in struct cmdq_pkt Chun-Kuang Hu
2024-09-01 14:32 ` [PATCH v4 1/3] media: platform: mtk-mdp3: Get fine-grain control of cmdq_pkt_finalize() Chun-Kuang Hu
2024-09-02 15:11 ` Matthias Brugger
2024-09-06 8:15 ` AngeloGioacchino Del Regno
2024-09-01 14:32 ` [PATCH v4 2/3] media: platform: mtk-mdp3: Use cmdq_pkt_create() and cmdq_pkt_destroy() Chun-Kuang Hu
2024-09-02 15:31 ` Matthias Brugger
2024-09-03 9:39 ` CK Hu (胡俊光) [this message]
2024-09-04 8:42 ` Matthias Brugger
2024-09-06 8:15 ` AngeloGioacchino Del Regno
2024-09-01 14:32 ` [PATCH v4 3/3] soc: mediatek: cmdq: Remove cmdq_pkt_finalize() helper function Chun-Kuang Hu
2024-09-02 15:31 ` Matthias Brugger
2024-09-06 8:17 ` AngeloGioacchino Del Regno
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=d5c512d06e013555397722137d5790dc8a627bfd.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Jason-JH.Lin@mediatek.com \
--cc=Moudy.Ho@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--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=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
/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