From: Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>
To: Bryan O'Donoghue <bod@kernel.org>,
Wangao Wang <wangao.wang@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] media: iris: add AV1 decode buffer size support for vpu4x
Date: Tue, 15 Sep 2026 17:40:05 -0700 [thread overview]
Message-ID: <b71a5f7a-bc56-4b56-a656-e6f592f69936@oss.qualcomm.com> (raw)
In-Reply-To: <d8c1d02b-d03f-4b3b-914d-a0849936f24d@kernel.org>
On 9/14/2026 12:42 PM, Bryan O'Donoghue wrote:
> On 14/09/2026 14:00, Wangao Wang wrote:
>> Add necessary buffer size calculation to support AV1 decode for vpu4x
>>
>> - wire AV1 into iris_vpu4x_dec_line_size() via hfi_buffer_line_av1d()
>> - add hfi_vpu4x_buffer_persist_av1d() for the vpu4x's persist buffer
>> size calculation
>> - add BUF_PARTIAL to the vpu4x decoder dispatch table, which AV1D
>> requires
>>
>> Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
>> ---
>> drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 35
>> ++++++++++++++++++++--
>> drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 1 +
>> 2 files changed, 33 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
>> b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
>> index
>> faebb54728660cc621f8822dabf2e44ce8c55c58..55996fd0d14c385ee63d2577b3e6d71b51d9e541
>> 100644
>> --- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
>> +++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
>> @@ -1833,6 +1833,8 @@ static u32 iris_vpu4x_dec_line_size(struct
>> iris_inst *inst)
>> else if (inst->codec == V4L2_PIX_FMT_VP9)
>> return hfi_vpu4x_buffer_line_vp9d(width, height,
>> out_min_count, is_opb,
>> num_vpp_pipes);
>> + else if (inst->codec == V4L2_PIX_FMT_AV1)
>> + return hfi_buffer_line_av1d(width, height, is_opb,
>> num_vpp_pipes);
>>
This needs to be updated to hfi_vpu4x_buffer_line_av1d - The line buffer
calculation differs for iris4 av1d
and is lut based. Without it firmware session error should be seen.
>> return 0;
>> }
>> @@ -1856,14 +1858,40 @@ static u32 hfi_vpu4x_buffer_persist_vp9d(void)
>> HDR10_HIST_EXTRADATA_SIZE;
>> }
>>
>> +static u32 hfi_vpu4x_buffer_persist_av1d(u32 max_width, u32 max_height,
>> + u32 total_ref_count, u32 rpu_enabled)
>> +{
>> + u32 comv_size, size;
>> +
>> + comv_size = hfi_buffer_comv_av1d(max_width, max_height,
>> total_ref_count);
>
>> + size = (SIZE_AV1D_SEQUENCE_HEADER * 2 + SIZE_AV1D_METADATA +
>> + AV1D_NUM_HW_PIC_BUF * (SIZE_AV1D_TILE_OFFSET + SIZE_AV1D_QM +
>> SIZE_AV1D_ARP) +
>> + AV1D_NUM_FRAME_HEADERS * (SIZE_AV1D_FRAME_HEADER +
>> + 2 * SIZE_AV1D_PROB_TABLE) + comv_size + HDR10_HIST_EXTRADATA_SIZE +
>> + SIZE_AV1D_METADATA * AV1D_NUM_HW_PIC_BUF) +
>> + rpu_enabled * NUM_HW_PIC_BUF * SIZE_DOLBY_RPU_METADATA;
>
> Ah come on.
>
> A routine, a macro can't accept something like that. You have two
> variables and a ton of constants.
>
> Plus the logic that gives you this clause may make sense to you but, I
> don't see how.
>
> For some of these defines - it looks like they pertain to headers,
> footers, offsets etc they can be reduced down to some sort of packet
> header type thing.
>
> I've asked for this type of reduction of clause complexity before.
>
> Please take heed.
>
>> +
>> + return ALIGN(size, DMA_ALIGNMENT);
>> +}
>> +
>> static u32 iris_vpu4x_dec_persist_size(struct iris_inst *inst)
>> {
>> - if (inst->codec == V4L2_PIX_FMT_H264)
>> + struct platform_inst_caps *caps;
>> +
>> + if (inst->codec == V4L2_PIX_FMT_H264) {
>> return hfi_buffer_persist_h264d();
>> - else if (inst->codec == V4L2_PIX_FMT_HEVC)
>> + } else if (inst->codec == V4L2_PIX_FMT_HEVC) {
>> return hfi_vpu4x_buffer_persist_h265d(0);
>> - else if (inst->codec == V4L2_PIX_FMT_VP9)
>> + } else if (inst->codec == V4L2_PIX_FMT_VP9) {
>> return hfi_vpu4x_buffer_persist_vp9d();
>> + } else if (inst->codec == V4L2_PIX_FMT_AV1) {
>> + caps = inst->core->iris_platform_data->inst_caps;
>> + if (inst->fw_caps[DRAP].value)
>> + return hfi_vpu4x_buffer_persist_av1d(caps->max_frame_width,
>> + caps->max_frame_height, 16, 0);
>> + else
>> + return hfi_vpu4x_buffer_persist_av1d(0, 0, 0, 0);
>> + }
>>
>> return 0;
>> }
>> @@ -2163,6 +2191,7 @@ u32 iris_vpu4x_buf_size(struct iris_inst *inst,
>> enum iris_buffer_type buffer_typ
>> {BUF_PERSIST, iris_vpu4x_dec_persist_size },
>> {BUF_DPB, iris_vpu_dec_dpb_size },
>> {BUF_SCRATCH_1, iris_vpu_dec_scratch1_size },
>> + {BUF_PARTIAL, iris_vpu_dec_partial_size },
>> };
>>
>> static const struct iris_vpu_buf_type_handle
>> enc_internal_buf_type_handle[] = {
>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
>> b/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
>> index
>> 8c0d6b7b5de85f7d7aaa8fc36218e8d095419569..c7020931a642f0484b6f84af7ab51242e1845458
>> 100644
>> --- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
>> +++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.h
>> @@ -116,6 +116,7 @@ struct iris_inst;
>> #define SIZE_AV1D_TILE_OFFSET 65536
>> #define SIZE_AV1D_QM 3328
>> #define SIZE_AV1D_PROB_TABLE 22784
>> +#define SIZE_AV1D_ARP 9728
>>
>> #define SIZE_SLICE_CMD_BUFFER (ALIGN(20480, 256))
>> #define SIZE_SPS_PPS_SLICE_HDR (2048 + 4096)
>>
>> --
>> 2.43.0
>>
>
next prev parent reply other threads:[~2026-09-16 0:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 13:00 [PATCH 0/5] media: iris: add support for maili platform Wangao Wang
2026-09-14 13:00 ` [PATCH 1/5] dt-bindings: media: venus,common: Extend clocks and power domains Wangao Wang
2026-09-15 7:16 ` Krzysztof Kozlowski
2026-09-14 13:00 ` [PATCH 2/5] dt-bindings: media: qcom,maili-iris: Add maili video codec binding Wangao Wang
2026-09-15 7:33 ` Krzysztof Kozlowski
2026-09-14 13:00 ` [PATCH 3/5] media: iris: add AV1 decode buffer size support for vpu4x Wangao Wang
2026-09-14 19:42 ` Bryan O'Donoghue
2026-09-16 0:40 ` Deepa Guthyappa Madivalara [this message]
2026-09-14 13:00 ` [PATCH 4/5] media: iris: fix VPU4x encoder line buffer size calculations Wangao Wang
2026-09-14 19:49 ` Bryan O'Donoghue
2026-09-14 13:00 ` [PATCH 5/5] media: iris: add maili platform data Wangao Wang
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=b71a5f7a-bc56-4b56-a656-e6f592f69936@oss.qualcomm.com \
--to=deepa.madivalara@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=busanna.reddy@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=hverkuil+cisco@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=stanimir.k.varbanov@gmail.com \
--cc=vikash.garodia@oss.qualcomm.com \
--cc=wangao.wang@oss.qualcomm.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®