public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
	Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	Dikshita Agarwal <dikshita.agarwal@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 4/7] media: qcom: iris: vdec: update size and stride calculations for 10bit formats
Date: Fri, 10 Apr 2026 13:59:22 +0200	[thread overview]
Message-ID: <0301bf82-0859-44cd-99df-3de997e2cff4@linaro.org> (raw)
In-Reply-To: <99eb55a8-6370-bf7b-f9de-e88231454b0e@oss.qualcomm.com>

On 4/10/26 12:10, Vishnu Reddy wrote:
> 
> On 4/8/2026 10:13 PM, Neil Armstrong wrote:
>> Update the gen2 response and vdec s_fmt code to take in account
>> the P010 and QC010 when calculating the width, height and stride.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>>   .../platform/qcom/iris/iris_hfi_gen2_response.c     | 19 ++++++++++++++++---
>>   drivers/media/platform/qcom/iris/iris_vdec.c        | 21 ++++++++++++++++++---
>>   2 files changed, 34 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
>> index 8e19f61bbbf9..d268149191ea 100644
>> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
>> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
>> @@ -542,9 +542,22 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst)
>>       pixmp_ip->width = width;
>>       pixmp_ip->height = height;
>> -    pixmp_op->width = ALIGN(width, 128);
>> -    pixmp_op->height = ALIGN(height, 32);
>> -    pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128);
>> +    pixmp_op->width = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ?
>> +        ALIGN(width, 192) : ALIGN(width, 128);
>> +    pixmp_op->height = pixmp_op->pixelformat == V4L2_PIX_FMT_QC10C ?
>> +        ALIGN(height, 16) : ALIGN(height, 32);
>> +    switch (pixmp_op->pixelformat) {
>> +    case V4L2_PIX_FMT_P010:
>> +        pixmp_op->plane_fmt[0].bytesperline = ALIGN(width * 2, 256);
>> +        break;
>> +    case V4L2_PIX_FMT_QC10C:
>> +        pixmp_op->plane_fmt[0].bytesperline = ALIGN(ALIGN(width, 192) * 4 / 3, 256);
>> +        break;
>> +    case V4L2_PIX_FMT_NV12:
>> +    case V4L2_PIX_FMT_QC08C:
>> +        pixmp_op->plane_fmt[0].bytesperline = ALIGN(width, 128);
>> +        break;
>> +    }
>>       pixmp_op->plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT);
>>       matrix_coeff = subsc_params.color_info & 0xFF;
>> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
>> index 719217399a30..ca0518c27834 100644
>> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
>> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
>> @@ -272,10 +272,25 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f)
>>           fmt = inst->fmt_dst;
>>           fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
>>           fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
>> -        fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, 128);
>> -        fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 32);
>> +        codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128;
>> +        fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align);
>> +        codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 16 : 32;
>> +        fmt->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, codec_align);
>>           fmt->fmt.pix_mp.num_planes = 1;
>> -        fmt->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(f->fmt.pix_mp.width, 128);
>> +        switch (f->fmt.pix_mp.pixelformat) {
>> +        case V4L2_PIX_FMT_P010:
>> +            fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
>> +                ALIGN(f->fmt.pix_mp.width * 2, 256);
>> +            break;
>> +        case V4L2_PIX_FMT_QC10C:
>> +            fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
>> +                ALIGN(f->fmt.pix_mp.width * 4 / 3, 256);
>> +            break;
>> +        case V4L2_PIX_FMT_NV12:
>> +        case V4L2_PIX_FMT_QC08C:
>> +            fmt->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width;
> In the removed code, bytesperline for NV12 and QC08C was aligned to 128 bytes.
> In the new code, Is that alignment missed or not required?

The alignment is done right before:
	codec_align = f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_QC10C ? 192 : 128;
	fmt->fmt.pix_mp.width = ALIGN(f->fmt.pix_mp.width, codec_align);

calling ALIGN(f->fmt.pix_mp.width, 128) again is a no-op.

Thanks,
Neil

>> +            break;
>> +        }
>>           fmt->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT);
>>           inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT);
>>           inst->buffers[BUF_OUTPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage;
>>


  reply	other threads:[~2026-04-10 11:59 UTC|newest]

Thread overview: 34+ 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
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-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 [this message]
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=0301bf82-0859-44cd-99df-3de997e2cff4@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=busanna.reddy@oss.qualcomm.com \
    --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