Re: [PATCHv2] v4l2-common: add s_selection helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 04, 2016 at 04:11:55PM +0200, Hans Verkuil wrote:
> 
> 
> On 08/04/2016 04:03 PM, Sakari Ailus wrote:
> > Hi Hans,
> > 
> > On Mon, Aug 01, 2016 at 12:33:39PM +0200, Hans Verkuil wrote:
> >> Checking the selection constraint flags is often forgotten by drivers, especially
> >> if the selection code just clamps the rectangle to the minimum and maximum allowed
> >> rectangles.
> >>
> >> This patch adds a simple helper function that checks the adjusted rectangle against
> >> the constraint flags and either returns -ERANGE if it doesn't fit, or fills in the
> >> new rectangle and returns 0.
> >>
> >> It also adds a small helper function to v4l2-rect.h to check if one rectangle fits
> >> inside another.
> > 
> > I could have misunderstood the purpose of the patch but... these flags are
> > used by drivers in guidance in adjusting the rectangle in case there are
> > hardware limitations, to make it larger or smaller than requested if the
> > request can't be fulfillsed as such. The intent is *not* to return an error
> > back to the user. In this respect it works quite like e.g. S_FMT does in
> > cases an exact requested format can't be supported.
> > 
> > <URL:https://www.linuxtv.org/downloads/v4l-dvb-apis/apb.html#v4l2-selection-flags>
> > 
> > What can be done is rather driver specific.
> > 
> 
> That's not what the spec says:
> 
> https://hverkuil.home.xs4all.nl/spec/uapi/v4l/vidioc-g-selection.html
> 
> ERANGE
> It is not possible to adjust struct v4l2_rect r rectangle to satisfy all constraints given in the flags argument.
> 
> It's rather unambiguous, I think.
> 
> If you don't want an error, then just leave 'flags' to 0. That makes sense.

Does it? I can't imagine a use case for that.

The common section still defines these flags differently, and that's the
behaviour on V4L2 sub-device interface. Do we have a driver that implements
support for these flags as you described?

-- 
Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux