public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
To: Xiaoyong Lu <xiaoyong.lu@mediatek.com>,
	Yunfei Dong <yunfei.dong@mediatek.com>,
	Alexandre Courbot <acourbot@chromium.org>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Tomasz Figa <tfiga@google.com>
Cc: George Sun <george.sun@mediatek.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Fritz Koenig <frkoenig@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Irui Wang <irui.wang@mediatek.com>,
	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,
	srv_heupstream@mediatek.com, linux-mediatek@lists.infradead.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [RFC PATCH v6] media: mediatek: vcodec: support stateless AV1 decoder
Date: Fri, 18 Nov 2022 13:26:25 +0100	[thread overview]
Message-ID: <64f08478-16a7-1d33-e520-9f0fbcab47b9@collabora.com> (raw)
In-Reply-To: <0672e801-1489-f222-2143-e0e7317d7eaf@collabora.com>

Hi again,

W dniu 17.11.2022 o 13:42, Andrzej Pietrasiewicz pisze:
> Hi Xiaoyong Lu,
> 
> Sorry about chiming in only at v6. Please see inline below.
> 
> Andrzej
> 
> W dniu 17.11.2022 o 07:17, Xiaoyong Lu pisze:
>> Add mediatek av1 decoder linux driver which use the stateless API in
>> MT8195.
>>
>> Signed-off-by: Xiaoyong Lu<xiaoyong.lu@mediatek.com>
>> ---
>> Changes from v5:
>>
>> - change av1 PROFILE and LEVEL cfg
>> - test by av1 fluster, result is 173/239
>>
>> Changes from v4:
>>
>> - convert vb2_find_timestamp to vb2_find_buffer
>> - test by av1 fluster, result is 173/239
>>
>> Changes from v3:
>>
>> - modify comment for struct vdec_av1_slice_slot
>> - add define SEG_LVL_ALT_Q
>> - change use_lr/use_chroma_lr parse from av1 spec
>> - use ARRAY_SIZE to replace size for loop_filter_level and 
>> loop_filter_mode_deltas
>> - change array size of loop_filter_mode_deltas from 4 to 2
>> - add define SECONDARY_FILTER_STRENGTH_NUM_BITS
>> - change some hex values from upper case to lower case
>> - change *dpb_sz equal to V4L2_AV1_TOTAL_REFS_PER_FRAME + 1
>> - test by av1 fluster, result is 173/239
>>
>> Changes from v2:
>>
>> - Match with av1 uapi v3 modify
>> - test by av1 fluster, result is 173/239
>>
>> ---
>> Reference series:
>> [1]: v3 of this series is presend by Daniel Almeida.
>>       message-id: 20220825225312.564619-1-daniel.almeida@collabora.com
>>
>>   .../media/platform/mediatek/vcodec/Makefile   |    1 +
>>   .../vcodec/mtk_vcodec_dec_stateless.c         |   47 +-
>>   .../platform/mediatek/vcodec/mtk_vcodec_drv.h |    1 +
>>   .../vcodec/vdec/vdec_av1_req_lat_if.c         | 2234 +++++++++++++++++
>>   .../platform/mediatek/vcodec/vdec_drv_if.c    |    4 +
>>   .../platform/mediatek/vcodec/vdec_drv_if.h    |    1 +
>>   .../platform/mediatek/vcodec/vdec_msg_queue.c |   27 +
>>   .../platform/mediatek/vcodec/vdec_msg_queue.h |    4 +
>>   8 files changed, 2318 insertions(+), 1 deletion(-)
>>   create mode 100644 
>> drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c
>>

<snip>

>> +
>> +static void *vdec_av1_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)
>> +{
>> +    struct v4l2_ctrl *ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, id);
>> +
>> +    if (!ctrl)
>> +        return ERR_PTR(-EINVAL);
>> +
>> +    return ctrl->p_cur.p;
>> +}
> 
> I see we keep repeating this kind of a v4l2_ctrl_find() wrapper in drivers.
> The only reason this code cannot be factored out is the "context" struct pointer
> pointing at structs of different types. Maybe we could
> 
> #define v4l2_get_ctrl_ptr(ctx, member, id) \
>      __v4l2_get_ctrl_ptr((ctx), offsetof(typeof(*ctx), (member)), (id))
> 
> void *__v4l2_get_ctrl_ptr(void *ctx, size_t offset, u32 id)
> {
>      struct v4l2_ctrl_handler *hdl = (struct v4l2_ctrl_handler *)(ctx + offset);
>      struct v4l2_ctrl *ctrl = v4l2_ctrl_find(hdl, id);
> 
>      if (!ctrl)
>          return ERR_PTR(-EINVAL);
> 
>      return ctrl->p_cur.p;
> }
> 
> and reuse v4l2_get_ctrl_ptr() in drivers?
> 
> A similar kind of void* arithmetic happens in container_of, only with '-'.
> 

When I think of it it seems a bit over-engineered to me now, it would
be better to give up the macro and simply pass struct v4l2_ctrl_handler *hdl.

Another second thought is that including such a wrapper in this patch
would make it too noisy if all potential users were to be updated.
A separate series would make more sense.

Regards,

Andrzej



  reply	other threads:[~2022-11-18 12:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  6:17 [RFC PATCH v6] media: mediatek: vcodec: support stateless AV1 decoder Xiaoyong Lu
2022-11-17 12:42 ` Andrzej Pietrasiewicz
2022-11-18 12:26   ` Andrzej Pietrasiewicz [this message]
2022-11-29 11:50   ` Xiaoyong Lu (卢小勇)
2022-11-29 13:31     ` Andrzej Pietrasiewicz
2023-01-03  7:57       ` Xiaoyong Lu (卢小勇)

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=64f08478-16a7-1d33-e520-9f0fbcab47b9@collabora.com \
    --to=andrzej.p@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=acourbot@chromium.org \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frkoenig@chromium.org \
    --cc=george.sun@mediatek.com \
    --cc=hsinyi@chromium.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=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=stevecho@chromium.org \
    --cc=tfiga@google.com \
    --cc=tiffany.lin@mediatek.com \
    --cc=xiaoyong.lu@mediatek.com \
    --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