On Mon, Dec 07, 2020 at 03:42:58PM +0200, Sakari Ailus wrote: > Hi Hans, > > On Mon, Dec 07, 2020 at 02:16:39PM +0100, Hans Verkuil wrote: > > On 07/12/2020 13:46, Sakari Ailus wrote: > > > Hi Hans, > > > > > > Thanks for the patch. > > > > > > On Mon, Dec 07, 2020 at 12:18:55PM +0100, Hans Verkuil wrote: > > >> This driver does not support composition, only cropping. > > >> Composition means that the sensor can output e.g. 1920x1080, > > >> but can compose a cropped 1280x720 image in the middle of the > > >> 1920x1080 canvas, filling in the unused area with a background > > >> color. > > > > > > That's how this would work on V4L2 video nodes... > > > > > >> > > >> That's not supported at all. So drop the bogus composition support. > > > > > > But this is a sub-device driver. On sub-devices the COMPOSE target is used > > > for configuring scaling, binning and sub-sampling. I don't know about the > > > capabilities of this particular driver but the code > > > (__imx274_change_compose function in particular) looks very much such that > > > it does support binning. > > > > > > > That should be done via set_fmt. There you select the output width and height. > > > > So if set_fmt sets 1920x1080, and the crop is 960x540, then you scale (or > > do binning/sub-sampling). Compose means composing the image into a larger > > canvas. For this driver the compose rectangle is always equal to the > > format, so set_selection(COMPOSE) is identical to set_fmt(). > > > > If it was real composition, then there would have to be a try_compose as > > well, just as there is a try_crop. Instead set_selection(COMPOSE) fills in > > On sub-devices there's a try context that's file handle specific. > > > try_fmt. Clearly wrong. > > Not more than using set_fmt if you look at the documentation: > > <URL:https://hverkuil.home.xs4all.nl/spec/userspace-api/v4l/dev-subdev.html#order-of-configuration-and-format-propagation> > > In this case it's just on the sink pad, as the sub-device exports no source > pads. I think there are probably a few such drivers around. > > Which sub-device drivers configure scaling based on set_fmt? I'm only aware > of omap3isp which pre-dates the selection API. That said, there are a lot of drivers that pick the entire configuration (cropping (digital and analogue), binning, scaling and sub-samplink) just based on set_fmt. It's what drivers to as there are no good solutions for the current API, but for the user it's pretty awful. -- Sakari Ailus