[libcamera-devel,v2,0/6] libcamera: imx8-isi: Remove pixelformat-2-media-bus map
mbox series

Message ID 20230313091944.9530-1-jacopo.mondi@ideasonboard.com
Headers show
Series
  • libcamera: imx8-isi: Remove pixelformat-2-media-bus map
Related show

Message

Jacopo Mondi March 13, 2023, 9:19 a.m. UTC
The ISI pipeline handler currently associates the output PixelFormat with the
media bus code that can produce it. This mapping is however limiting as
the ISI can produce any YUV/RGB format from any non-RAW media bus format.

Rework the format selection procedures in order to remove the association
between pixel formats and mbus codes by introducing 4 new functions.

This fixes the problem originally pointed out by Laurent that when used with
RAW sensors, the generated CameraConfiguration does not work as it assumes a
YUV media bus code is available.

Tested with ov5640 which can produce UYVY8, RGB565 and SBGGR8.

	$ cam -c1
	Selected sensor format: 1920x1080-UYVY8_1X16

	$ cam -c1 --stream role=raw
	Selected sensor format: 2592x1944-SBGGR8_1X8

	$ cam -c1 --stream pixelformat=RGB565
	Selected sensor format: 1920x1080-RGB565_

Tested with imx219 which can only produce SRGGB10

	$ cam -c1
	Selected sensor format: 3280x2464-SRGGB10_1X10

	$ cam -c1 --stream pixelformat=YUV
	WARN ISI imx8-isi.cpp:278 Cannot find a supported YUV/RGB format

	$ cam -c1 --stream role=viewfinder
	Selected sensor format: 3280x2464-SRGGB10_1X10

Also fix the available stream formats list for both YUV and RAW use cases.

v1->v2:
- Split out "libcamera: camera_sensor: Add tryFormat()"
- Fix resolution the generated format map for RAW configuration as we can't
  downscale
- Minor fixes

Jacopo Mondi (6):
  libcamera: imx8-isi: Break out RAW format selection
  libcamera: imx8-isi: Break out YUV format selection
  libcamera: imx8-isi: Automatically select media bus code
  libcamera: camera_sensor: Add tryFormat()
  libcamera: imx8-isi: Split Bayer/YUV config generation
  libcamera: imx8-isi: Remove mbusCode from formatsMap_

 include/libcamera/internal/camera_sensor.h   |   1 +
 src/libcamera/camera_sensor.cpp              |  17 +
 src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 612 +++++++++++--------
 3 files changed, 381 insertions(+), 249 deletions(-)

--
2.39.0