From: Neil Armstrong <neil.armstrong@linaro.org>
To: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations
Date: Fri, 17 Apr 2026 10:03:41 +0200 [thread overview]
Message-ID: <858eba40-5e7a-4dc2-89cc-a6cd81ac189c@linaro.org> (raw)
In-Reply-To: <0afa05c9-1cbe-88b6-32d6-f65813391817@oss.qualcomm.com>
On 4/17/26 08:47, Dikshita Agarwal wrote:
>
>
> On 4/8/2026 10:13 PM, Neil Armstrong wrote:
>> The P010 (YUV format with 16-bits per pixel with interleaved UV)
>> and QC10C (P010 compressed mode similar to QC08C) requires specific
>> buffer calculations to allocate the right buffer size for DPB frames
>> and frames consumed by userspace.
>>
>> Similar to 8bit, the 10bit DPB frames uses QC10C format.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>> drivers/media/platform/qcom/iris/iris_buffer.c | 81 +++++++++++++++++++++++++-
>> 1 file changed, 80 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c
>> index 9151f43bc6b9..a0e31bff8f26 100644
>> --- a/drivers/media/platform/qcom/iris/iris_buffer.c
>> +++ b/drivers/media/platform/qcom/iris/iris_buffer.c
>> @@ -15,7 +15,9 @@
>> #define MAX_WIDTH 4096
>> #define MAX_HEIGHT 2304
>> #define Y_STRIDE_ALIGN 128
>> +#define Y_STRIDE_ALIGN_P010 256
>> #define UV_STRIDE_ALIGN 128
>> +#define UV_STRIDE_ALIGN_P010 256
>> #define Y_SCANLINE_ALIGN 32
>> #define UV_SCANLINE_ALIGN 16
>> #define UV_SCANLINE_ALIGN_QC08C 32
>> @@ -80,6 +82,26 @@ static u32 iris_yuv_buffer_size_nv12(struct iris_inst *inst)
>> return ALIGN(y_plane + uv_plane, PIXELS_4K);
>> }
>>
>> +static u32 iris_yuv_buffer_size_p010(struct iris_inst *inst)
>> +{
>> + u32 y_plane, uv_plane, y_stride, uv_stride, y_scanlines, uv_scanlines;
>> + struct v4l2_format *f;
>> +
>> + if (inst->domain == DECODER)
>> + f = inst->fmt_dst;
>> + else
>> + f = inst->fmt_src;
>> +
>> + y_stride = ALIGN(f->fmt.pix_mp.width * 2, Y_STRIDE_ALIGN_P010);
>> + uv_stride = ALIGN(f->fmt.pix_mp.width * 2, UV_STRIDE_ALIGN_P010);
>> + y_scanlines = ALIGN(f->fmt.pix_mp.height, Y_SCANLINE_ALIGN);
>> + uv_scanlines = ALIGN((f->fmt.pix_mp.height + 1) >> 1, UV_SCANLINE_ALIGN);
>> + y_plane = y_stride * y_scanlines;
>> + uv_plane = uv_stride * uv_scanlines;
>> +
>> + return ALIGN(y_plane + uv_plane, PIXELS_4K);
>> +}
>> +
>> /*
>> * QC08C:
>> * Compressed Macro-tile format for NV12.
>> @@ -204,6 +226,55 @@ static u32 iris_yuv_buffer_size_qc08c(struct iris_inst *inst)
>> return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K);
>> }
>>
>> +/*
>> + * QC10C:
>> + * Compressed Macro-tile format for TP10.
>> + */
>> +static u32 iris_yuv_buffer_size_qc10c(struct iris_inst *inst)
>> +{
>> + u32 y_stride, y_buf_height;
>> + u32 uv_stride, uv_buf_height;
>> + u32 y_md_stride, y_md_height;
>> + u32 uv_md_stride, uv_md_height;
>> + u32 y_data_size, uv_data_size;
>> + u32 y_md_size, uv_md_size;
>> + struct v4l2_format *f = NULL;
>> +
>> + if (inst->domain == DECODER)
>> + f = inst->fmt_dst;
>> + else
>> + f = inst->fmt_src;
>> +
>> + y_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3,
>> + Y_STRIDE_ALIGN_P010);
>
> Y_STRIDE_ALIGN_P010 is being used for both P010 and QC10C, lets keep it
> Y_STRIDE_ALIGN_10_BIT ? or something similar ?
>
>> + y_buf_height = ALIGN(f->fmt.pix_mp.height, UV_SCANLINE_ALIGN);
>
> why not call it y_scanlines only?
>
>> +
>> + y_data_size = ALIGN(y_stride * y_buf_height, PIXELS_4K);
>
> s/y_data_size/y_plane ?
>
>> +
>> + uv_stride = ALIGN(ALIGN(f->fmt.pix_mp.width, 192) * 4 / 3,
>> + UV_STRIDE_ALIGN_P010);
>> + uv_buf_height = ALIGN((f->fmt.pix_mp.height + 1) / 2,
>> + UV_SCANLINE_ALIGN);
>
> s/uv_buf_height/uv_scanline?
>
>> +
>> + uv_data_size = ALIGN(uv_stride * uv_buf_height, PIXELS_4K);
>
> s/uv_data_size/uv_plane?
>
> Pls keep all these names consistent with other functions, applies to below
> variables as well.
>
>
> Thanks,
> Dikshita
>
>> +
>> + y_md_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width, 48),
>> + META_STRIDE_ALIGNED);
>> + y_md_height = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height, 4),
>> + META_SCANLINE_ALIGNED);
>> +
>> + y_md_size = ALIGN(y_md_stride * y_md_height, PIXELS_4K);
>> +
>> + uv_md_stride = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.width + 1) / 2, 24),
>> + META_STRIDE_ALIGNED);
>> + uv_md_height = ALIGN(DIV_ROUND_UP((f->fmt.pix_mp.height + 1) / 2, 4),
>> + META_SCANLINE_ALIGNED);
>> +
>> + uv_md_size = ALIGN(uv_md_stride * uv_md_height, PIXELS_4K);
>> +
>> + return y_data_size + uv_data_size + y_md_size + uv_md_size;
>> +}
>> +
>> static u32 iris_dec_bitstream_buffer_size(struct iris_inst *inst)
>> {
>> struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps;
>> @@ -268,10 +339,18 @@ int iris_get_buffer_size(struct iris_inst *inst,
>> case BUF_OUTPUT:
>> if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC08C)
>> return iris_yuv_buffer_size_qc08c(inst);
>> + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C)
>> + return iris_yuv_buffer_size_qc10c(inst);
>> + else if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010)
>> + return iris_yuv_buffer_size_p010(inst);
>> else
>> return iris_yuv_buffer_size_nv12(inst);
>> case BUF_DPB:
>> - return iris_yuv_buffer_size_qc08c(inst);
>> + if (inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ||
>> + inst->fmt_dst->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_P010)
>
> Please introduce one API, is_10bit_format and use that here instead.
Ack
>
> Thanks,
> Dikshita
>> + return iris_yuv_buffer_size_qc10c(inst);
>> + else
>> + return iris_yuv_buffer_size_qc08c(inst);
>> default:
>> return 0;
>> }
>>
next prev parent reply other threads:[~2026-04-17 8:03 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 16:43 [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Neil Armstrong
2026-04-08 16:43 ` [PATCH RFC 1/7] media: qcom: iris: add QC10C & P010 buffer size calculations Neil Armstrong
2026-04-08 23:59 ` Dmitry Baryshkov
2026-04-09 7:25 ` Neil Armstrong
2026-04-11 16:13 ` Dmitry Baryshkov
2026-04-17 6:47 ` Dikshita Agarwal
2026-04-17 8:03 ` Neil Armstrong [this message]
2026-04-08 16:43 ` [PATCH RFC 2/7] media: qcom: iris: gen2: add support for 10bit decoding Neil Armstrong
2026-04-17 7:22 ` Dikshita Agarwal
2026-04-17 8:03 ` Neil Armstrong
2026-04-21 5:24 ` Dikshita Agarwal
2026-04-21 7:42 ` Neil Armstrong
2026-04-08 16:43 ` [PATCH RFC 3/7] media: qcom: iris: add helpers for 8bit and 10bit formats Neil Armstrong
2026-04-17 7:23 ` Dikshita Agarwal
2026-04-17 8:03 ` Neil Armstrong
2026-04-08 16:43 ` [PATCH RFC 4/7] media: qcom: iris: vdec: update size and stride calculations for " Neil Armstrong
2026-04-10 10:10 ` Vishnu Reddy
2026-04-10 11:59 ` Neil Armstrong
2026-04-10 12:57 ` Vishnu Reddy
2026-04-10 13:47 ` Neil Armstrong
2026-04-14 23:39 ` Nicolas Dufresne
2026-04-08 16:43 ` [PATCH RFC 5/7] media: qcom: iris: vdec: forbid g_fmt while waiting for first source change Neil Armstrong
2026-04-08 16:43 ` [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Neil Armstrong
2026-04-15 6:39 ` Vishnu Reddy
2026-04-15 7:35 ` Neil Armstrong
2026-04-08 16:44 ` [PATCH RFC 7/7] media: qcom: iris: vdec: allow decoding into 10bit format Neil Armstrong
2026-04-09 0:02 ` [PATCH RFC 0/7] media: qcom: iris: add support for decoding 10bit formats Dmitry Baryshkov
2026-04-09 1:04 ` Nicolas Dufresne
2026-04-09 1:40 ` Dmitry Baryshkov
2026-04-09 7:43 ` Neil Armstrong
2026-04-09 7:36 ` Neil Armstrong
2026-04-09 13:19 ` Nicolas Dufresne
2026-04-10 12:00 ` Neil Armstrong
2026-04-10 16:25 ` Neil Armstrong
2026-04-11 17:10 ` Dmitry Baryshkov
2026-04-14 15:35 ` Neil Armstrong
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=858eba40-5e7a-4dc2-89cc-a6cd81ac189c@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=vikash.garodia@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