From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maurizio Casciano <mauriziocasciano7@gmail.com>
Cc: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Bingbu Cao <bingbu.cao@amd.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Nicholas Roth <nicholas@rothemail.net>,
Andy Shevchenko <andy@kernel.org>,
Hans de Goede <hansg@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jose Maria Martin <jmmartinf@hotmail.com>,
Uwe Kleine-Koenig <ukleinek@kernel.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 13/15] media: atomisp: Use struct v4l2_area for padding
Date: Mon, 31 Aug 2026 14:27:25 +0300 [thread overview]
Message-ID: <apVlHeS6OWlhkkPE@ashevche-desk.local> (raw)
In-Reply-To: <d75701c5a72daf6b36305297a44e925e5ed6b935.1787933456.git.mauriziocasciano7@gmail.com>
On Fri, Aug 28, 2026 at 06:14:55PM +0200, Maurizio Casciano wrote:
> The padding helper passes width and height as four separate scalar
> arguments even though they form two logical dimensions.
>
> Pass the requested size and returned padding as struct v4l2_area values.
> This makes the dimensions explicit and simplifies all three callers.
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
This is fine...
> Link: https://lore.kernel.org/linux-media/apCc_pt5dDxGJrei@ashevche-desk.local/
...but drop this one. No need to have it in the commit message even if
there is an accompanying Suggested-by tag.
...
> int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f,
> const struct atomisp_format_bridge *fmt, *snr_fmt;
> struct atomisp_sub_device *asd = &isp->asd;
> struct v4l2_mbus_framefmt ffmt = { };
> - u32 padding_w, padding_h;
> + struct v4l2_area padding;
> + struct v4l2_area size;
> int ret;
>
> fmt = atomisp_get_format_bridge(f->pixelformat);
> * resolution + padding. Add padding here and remove it again after
> * the set_fmt call, like atomisp_set_fmt_to_snr() does.
> */
> - atomisp_get_padding(isp, f->width, f->height, &padding_w, &padding_h);
> + size.width = f->width;
> + size.height = f->height;
> + atomisp_get_padding(isp, size, &padding);
> v4l2_fill_mbus_format(&ffmt, f, fmt->mbus_code);
> - ffmt.width += padding_w;
> - ffmt.height += padding_h;
> + ffmt.width += padding.width;
> + ffmt.height += padding.height;
Add a wrapper that takes struct v4l2_pix_format
static inline void atomisp_get_pix_padding(struct atomisp_device *isp,
struct v4l2_pix_format *f,
struct v4l2_area *pad)
{
struct v4l2_area size = { .width = f->width, .height = f->height };
atomisp_get_padding(isp, size, pad);
}
So it will become here as
atomisp_get_pix_padding(isp, f, &padding);
...
> if (atomisp_subdev_format_conversion(asd)) {
> - atomisp_get_padding(isp, f->fmt.pix.width, f->fmt.pix.height,
> - &asd->sink_pad_padding_w, &asd->sink_pad_padding_h);
> + size.width = f->fmt.pix.width;
> + size.height = f->fmt.pix.height;
> + atomisp_get_padding(isp, size, &padding);
> + asd->sink_pad_padding_w = padding.width;
> + asd->sink_pad_padding_h = padding.height;
And respectively here
atomisp_get_pix_padding(isp, &f->fmt.pix, &padding);
> } else {
> asd->sink_pad_padding_w = 0;
> asd->sink_pad_padding_h = 0;
Looking at this, I would also replace these two in asd to be struct v4l2_area.
There are only three users.
With that this becomes
if (atomisp_subdev_format_conversion(asd))
atomisp_get_pix_padding(isp, &f->fmt.pix, &asd->sink_pad_padding);
else
asd->sink_pad_padding = {};
...
> static int atomisp_enum_framesizes_crop_inner(struct atomisp_device *isp,
> { 800, 600 },
> { 640, 480 },
> };
> - u32 padding_w, padding_h;
> int i;
>
> for (i = 0; i < ARRAY_SIZE(frame_sizes); i++) {
> - atomisp_get_padding(isp, frame_sizes[i].width, frame_sizes[i].height,
> - &padding_w, &padding_h);
> + struct v4l2_area size = {
> + .width = frame_sizes[i].width,
> + .height = frame_sizes[i].height,
> + };
Just convert frame_sizes to be of struct v4l2_area type.
> + struct v4l2_area padding;
>
> - if ((frame_sizes[i].width + padding_w) > native->width ||
> - (frame_sizes[i].height + padding_h) > native->height)
> + atomisp_get_padding(isp, size, &padding);
> +
> + if ((frame_sizes[i].width + padding.width) > native->width ||
> + (frame_sizes[i].height + padding.height) > native->height)
> continue;
Then only fsize->discrete = frame_sizes[i]; will require the member-to-member
assignment.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-31 11:30 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 16:14 [PATCH v4 00/15] media: Add Lenovo Yoga Book YB1-X91 camera support Maurizio Casciano
2026-08-28 16:14 ` [PATCH v4 01/15] media: ov8858: Extract digital gain programming Maurizio Casciano
2026-08-31 9:32 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 02/15] media: ov8858: support 19.2 MHz clock and CHT gain setup Maurizio Casciano
2026-08-31 9:38 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 03/15] media: ov2740: Use C99 initializers for ACPI IDs Maurizio Casciano
2026-08-28 16:14 ` [PATCH v4 04/15] media: ov2740: Add OVTI2740 ACPI ID Maurizio Casciano
2026-08-31 9:39 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 05/15] media: ov8858: Add INT3477 " Maurizio Casciano
2026-08-31 9:40 ` Andy Shevchenko
2026-08-31 13:12 ` mauriziocasciano7
2026-08-31 13:29 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 06/15] media: intel: ipu-bridge: Add Yoga Book camera sensors Maurizio Casciano
2026-08-31 9:40 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 07/15] media: atomisp: Add Yoga Book camera configuration Maurizio Casciano
2026-08-31 9:42 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 08/15] media: ov2740: support 288 MHz link frequency Maurizio Casciano
2026-08-31 9:45 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 09/15] media: intel: ipu-bridge: allow sensor-specific link frequencies Maurizio Casciano
2026-08-31 9:52 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 10/15] media: atomisp: derive CSI-2 timing from sensor link frequency Maurizio Casciano
2026-08-31 9:56 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 11/15] media: atomisp: provide Yoga Book OV2740 " Maurizio Casciano
2026-08-31 9:58 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 12/15] media: ov2740: add manual white balance controls Maurizio Casciano
2026-08-31 10:03 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 13/15] media: atomisp: Use struct v4l2_area for padding Maurizio Casciano
2026-08-31 11:27 ` Andy Shevchenko [this message]
2026-08-28 16:14 ` [PATCH v4 14/15] media: atomisp: allow raw Bayer capture Maurizio Casciano
2026-08-31 11:40 ` Andy Shevchenko
2026-08-28 16:14 ` [PATCH v4 15/15] media: i2c: Add WV517S lens actuator driver Maurizio Casciano
2026-08-31 9:46 ` [PATCH v4 00/15] media: Add Lenovo Yoga Book YB1-X91 camera support Andy Shevchenko
2026-08-31 18:00 ` [PATCH v5 00/16] " Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 01/16] media: ov8858: Extract digital gain programming Maurizio Casciano
2026-09-01 11:29 ` Andy Shevchenko
2026-08-31 18:00 ` [PATCH v5 02/16] media: ov8858: support 19.2 MHz clock and CHT gain setup Maurizio Casciano
2026-09-01 11:24 ` Andy Shevchenko
2026-08-31 18:00 ` [PATCH v5 03/16] media: ov2740: Use C99 initializers for ACPI IDs Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 04/16] media: ov2740: Add OVTI2740 ACPI ID Maurizio Casciano
2026-09-01 11:18 ` Andy Shevchenko
2026-08-31 18:00 ` [PATCH v5 05/16] media: ov8858: Add INT3477 " Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 06/16] media: intel: ipu-bridge: Add Yoga Book camera sensors Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 07/16] media: atomisp: Add Yoga Book camera configuration Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 08/16] media: ov2740: support 288 MHz link frequency Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 09/16] media: intel: ipu-bridge: allow sensor-specific link frequencies Maurizio Casciano
2026-09-01 11:27 ` Andy Shevchenko
2026-08-31 18:00 ` [PATCH v5 10/16] media: atomisp: derive CSI-2 timing from sensor link frequency Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 11/16] media: atomisp: provide Yoga Book OV2740 " Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 12/16] media: ov2740: release group hold after gain write errors Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 13/16] media: ov2740: add manual white balance controls Maurizio Casciano
2026-08-31 18:00 ` [PATCH v5 14/16] media: atomisp: Use struct v4l2_area for padding Maurizio Casciano
2026-08-31 18:01 ` [PATCH v5 15/16] media: atomisp: allow raw Bayer capture Maurizio Casciano
2026-08-31 18:01 ` [PATCH v5 16/16] media: i2c: Add WV517S lens actuator driver Maurizio Casciano
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=apVlHeS6OWlhkkPE@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=bingbu.cao@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=jacopo.mondi@ideasonboard.com \
--cc=jmmartinf@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mauriziocasciano7@gmail.com \
--cc=mchehab@kernel.org \
--cc=nicholas@rothemail.net \
--cc=sakari.ailus@linux.intel.com \
--cc=ukleinek@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.