linux/drivers/media
Laurent Pinchart e5b6b07a1b media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices
The VIDIOC_ENUM_FMT ioctl enumerates all formats supported by a video
node. For MC-centric devices, its behaviour has always been ill-defined,
with drivers implementing one of the following behaviours:

- No support for VIDIOC_ENUM_FMT at all
- Enumerating all formats supported by the video node, regardless of the
  configuration of the pipeline
- Enumerating formats supported by the video node for the active
  configuration of the connected subdevice

The first behaviour is obviously useless for applications. The second
behaviour provides the most information, but doesn't offer a way to find
what formats are compatible with a given pipeline configuration. The
third behaviour fixes that, but with the drawback that applications
can't enumerate all supported formats anymore, and have to modify the
active configuration of the pipeline to enumerate formats.

The situation is messy as none of the implemented behaviours are ideal,
and userspace can't predict what will happen as the behaviour is
driver-specific.

To fix this, let's extend the VIDIOC_ENUM_FMT with a missing capability:
enumerating pixel formats for a given media bus code. The media bus code
is passed through the v4l2_fmtdesc structure in a new mbus_code field
(repurposed from the reserved fields). With this capability in place,
applications can enumerate pixel formats for a given media bus code
without modifying the active configuration of the device.

The current behaviour of the ioctl is preserved when the new mbus_code
field is set to 0, ensuring compatibility with existing userspace. The
API extension is documented as mandatory for MC-centric devices (as
advertised through the V4L2_CAP_IO_MC capability), allowing applications
and compliance tools to easily determine the availability of the
VIDIOC_ENUM_FMT extension.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-05-06 12:09:04 +02:00
..
cec media: cec: silence shift wrapping warning in __cec_s_log_addrs() 2020-05-05 17:27:03 +02:00
common media: dvb-usb: auto-select CYPRESS_FIRMWARE 2020-04-14 10:29:04 +02:00
dvb-core media: Kconfig: move DVB-specific options to dvb-core/Kconfig 2020-04-14 10:29:05 +02:00
dvb-frontends media: m88ds3103: error in set_frontend is swallowed and not reported 2020-04-29 11:58:27 +02:00
firewire media: Kconfig: mode firewire comment to firewire/Kconfig 2020-04-14 10:29:04 +02:00
i2c media: cx25840: Register labeling, chip specific correction 2020-04-21 16:51:27 +02:00
mc media: mc/Kconfig: remove staging dependency for request API 2020-04-17 08:57:39 +02:00
mmc media: Kconfig: move comment to siano include 2020-04-14 10:29:04 +02:00
pci media: pci: Fill v4l2_fmtdesc with designated initializers 2020-05-06 12:08:45 +02:00
platform media: sun8i: Fix an error handling path in 'deinterlace_runtime_resume()' 2020-05-05 17:26:26 +02:00
radio media: radio: don't use a menu just for wl128x driver 2020-04-16 10:34:57 +02:00
rc media: rc: no need for decoder state if decoder not enabled 2020-04-29 11:59:20 +02:00
spi media: i2c/Kconfig: use sub-menus for I2C support 2020-04-16 10:34:40 +02:00
test-drivers media: vimc: deb: Add support for {RGB,BGR,GBR}888 bus formats on source pad 2020-05-05 17:26:04 +02:00
tuners media: si2157: ensure wait_status is initialized 2020-04-29 11:59:57 +02:00
usb media: cx231xx: Remove unneeded semicolon 2020-05-05 17:09:04 +02:00
v4l2-core media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices 2020-05-06 12:09:04 +02:00
Kconfig media: media/test_drivers: rename to test-drivers 2020-04-16 10:38:31 +02:00
Makefile media: media/test_drivers: rename to test-drivers 2020-04-16 10:38:31 +02:00