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. -- Regards, 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