From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "Yunfei Dong" <yunfei.dong@mediatek.com>,
"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
"Sebastian Fricke" <sebastian.fricke@collabora.com>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
"Nathan Hebert" <nhebert@chromium.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Chen-Yu Tsai <wenst@chromium.org>,
Fritz Koenig <frkoenig@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>,
Steve Cho <stevecho@chromium.org>,
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,
Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v3 2/3] media: mediatek: vcodec: support extended h264 decode
Date: Thu, 7 Nov 2024 11:52:49 +0100 [thread overview]
Message-ID: <90fe898c-0352-46da-aee3-898cdf2b5d26@collabora.com> (raw)
In-Reply-To: <20241107074603.31998-3-yunfei.dong@mediatek.com>
Il 07/11/24 08:45, Yunfei Dong ha scritto:
> The address end of working buffer can't be calculated directly with buffer
> size in kernel for some special architecture. Adding new extend vsi_ex to
> calculate the address end in firmware.
> Adding capability to separate extend and non extend driver for different
> platform.
> At last, hardware can parse the syntax to get nal information in firmware
> for extend architecture, needn't to parse it again in kernel.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
> .../vcodec/decoder/mtk_vcodec_dec_drv.h | 2 +
> .../decoder/vdec/vdec_h264_req_multi_if.c | 487 +++++++++++++++++-
> 2 files changed, 472 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
> index 886fa385e2e6..1e697bc810b0 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
> @@ -17,6 +17,7 @@
>
> #define IS_VDEC_LAT_ARCH(hw_arch) ((hw_arch) >= MTK_VDEC_LAT_SINGLE_CORE)
> #define IS_VDEC_INNER_RACING(capability) ((capability) & MTK_VCODEC_INNER_RACING)
> +#define IS_VDEC_SUPPORT_EX(capability) ((capability) & MTK_VDEC_IS_SUPPORT_EX)
>
> enum mtk_vcodec_dec_chip_name {
> MTK_VDEC_INVAL = 0,
> @@ -42,6 +43,7 @@ enum mtk_vdec_format_types {
> MTK_VDEC_FORMAT_HEVC_FRAME = 0x1000,
> MTK_VCODEC_INNER_RACING = 0x20000,
> MTK_VDEC_IS_SUPPORT_10BIT = 0x40000,
> + MTK_VDEC_IS_SUPPORT_EX = 0x80000,
> };
>
> /*
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
> index 851a8490b828..d0aecd9621d9 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c
..snip..
> inst->vsi_ctx.dec.y_fb_dma = y_fb_dma;
> @@ -816,8 +1260,17 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
> if (!h_vdec)
> return -EINVAL;
>
> - if (inst->ctx->dev->vdec_pdata->hw_arch == MTK_VDEC_PURE_SINGLE_CORE)
> - ret = vdec_h264_slice_single_decode(h_vdec, bs, unused, res_chg);
> + if (inst->ctx->dev->vdec_pdata->hw_arch == MTK_VDEC_PURE_SINGLE_CORE) {
> + if (IS_VDEC_SUPPORT_EX(inst->ctx->dev->dec_capability))
> + ret = vdec_h264_slice_single_decode_ex(h_vdec, bs, unused, res_chg);
I wonder if we can use function pointers here, as I feel like vcodec is becoming
a bit "full of branches here and there"...
The rough idea is:
/* there, or somewhere that's called only once in the driver lifetime anyway */
static int vdec_h264_slice_init(.....)
{
........
if (hw_arch == MTK_VDEC_PURE_SINGLE_CORE) {
if (inst->ctx->dev->dec_capability & MTK_VDEC_IS_SUPPORT_EX)
inst->decode = vdec_h264_slice_single_decode_ex;
else
inst->decode = vdec_h264_slice_single_decode;
} else {
if (inst->ctx->dev->dec_capability & MTK_VDEC_IS_SUPPORT_EX)
inst->decode = vdec_h264_slice_lat_decode_ex;
else
inst->decode = vdec_h264_slice_lat_decode;
}
......
}
static int vdec_h264_slice_decode(...)
{
if (!inst)
return -EINVAL;
return inst->decode( .... )
}
...less branches during decoding *of each frame* :-)
Cheers,
Angelo
next prev parent reply other threads:[~2024-11-07 10:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 7:45 [PATCH v3 0/6] media: mediatek: vcodec: support h264 extend vsi Yunfei Dong
2024-11-07 7:45 ` [PATCH v3 1/3] media: mediatek: vcodec: remove vsi operation in common interface Yunfei Dong
2024-11-07 7:45 ` [PATCH v3 2/3] media: mediatek: vcodec: support extended h264 decode Yunfei Dong
2024-11-07 10:52 ` AngeloGioacchino Del Regno [this message]
2024-11-07 7:45 ` [PATCH v3 3/3] media: mediatek: vcodec: add description for vsi struct Yunfei Dong
2024-11-07 7:49 ` Chen-Yu Tsai
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=90fe898c-0352-46da-aee3-898cdf2b5d26@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=frkoenig@chromium.org \
--cc=hsinyi@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--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=nfraprado@collabora.com \
--cc=nhebert@chromium.org \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.com \
--cc=stevecho@chromium.org \
--cc=wenst@chromium.org \
--cc=yunfei.dong@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
all inboxes | Powered by JetHome®