Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Umang Jain <umang.jain@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH] media: imx283: drop CENTERED_RECTANGLE due to clang failure
Date: Fri, 14 Jun 2024 08:51:48 +0200	[thread overview]
Message-ID: <20240614085148.2bca27f5@coco.lan> (raw)
In-Reply-To: <171829240304.2248009.15616094068000525791@ping.linuxembedded.co.uk>

Em Thu, 13 Jun 2024 16:26:43 +0100
Kieran Bingham <kieran.bingham@ideasonboard.com> escreveu:

> Quoting Hans Verkuil (2024-06-13 16:19:08)
> > The CENTERED_RECTANGLE define fails to compile on clang and old gcc
> > versions. Just drop it and fill in the crop rectangles explicitly.  
> 
> So back when I was playing around with this I thought it would have got
> dropped during review / upstreaming before now - because I couldn't find
> a way to make sure the macro args were guaranteed to be used only once,
> by putting some locals in the macro (because of the initialisation).
> 
> So I'm not surprised that it needs to be removed, but I am surprised
> that it wasn't for the reason I expected ;-)
> 
> Anyway - maybe later I'll experiement with more common helpers perhaps -
> but not if it hits compile errors..

IMO, a helper just makes it worse for humans. I mean, just looking at:

	.crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648),

I can't tell what values for top/left would be used.

> I do recall using v4l2_rects to define the active area so they could be
> used collectively rather than initialising things as
> 	.width = WIDTH,
> 	.height = HEIGHT,

Using defines for the minimum/maximum visible area makes sense,
e. g. something similar to this:

               .crop = {
                      .top = MIN_VISIBLE_TOP,
                      .left = MIN_VISIBLE_LEFT,
                      .width = MAX_WIDTH,
                      .height = MAX_HEIGHT,
               },

would also be fine, as it would be clear that the crop region is
the one containing the hardware limits.

> So - perhaps this could be (if it compiles):
>	.crop = imx283_active_area,

This should equally work, but maybe you could do, instead:

	.crop = &imx283_active_area,	// e.g. using a pointer

to avoid duplicating for every supported mode.

Thanks,
Mauro

      parent reply	other threads:[~2024-06-14  6:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 15:19 [PATCH] media: imx283: drop CENTERED_RECTANGLE due to clang failure Hans Verkuil
2024-06-13 15:26 ` Kieran Bingham
2024-06-13 15:43   ` Sakari Ailus
2024-06-14  6:38     ` Mauro Carvalho Chehab
2024-06-14  6:51   ` Mauro Carvalho Chehab [this message]

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=20240614085148.2bca27f5@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=umang.jain@ideasonboard.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).