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.

Regards,

        Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to