mbox series

[0/6] media: renesas: vsp1: Add colorspace support

Message ID 20250409003815.10253-1-laurent.pinchart+renesas@ideasonboard.com
Headers show
Series media: renesas: vsp1: Add colorspace support | expand

Message

Laurent Pinchart April 9, 2025, 12:38 a.m. UTC
Hello,

This patch series extends the VSP1 driver with colorspace support. It
turns out that the VSP RPF and WPF entities can convert between RGB and
YUV, a feature that we have failed to test so far. The hardware support
BT.601 and BT.709, in both limited and full range. Proper configuration
of colorspace is crucial for accurate image rendering.

Patch 1/6 starts by implementing pixel format enumeration in the driver,
a feature that was surprisingly missing. Patch 2/6 then continues with
another fix, restricting the creation of the HSI and HST entities to VSP
instances that include them. Following with another fix, patch 3/6
addresses format setting on the RPF and WPF source pad to disable HSV
<-> { RGB, YUV } conversion, a feature *not* supported by the hardware.

After those initial fixes, patch 5/6 starts implementing colorspace
support by reporting the related information to userspace. The driver
currently hardcodes limited range BT.601 when programming the hardware,
so that is the value that the patch reports to userspace for YUV
formats. Patch 6/6 finally makes the YCbCr encoding and quantization
configurable.

The series has been tested with the vsp-tests suite. Patches that add
CSC support to the test suite will be posted soon, in the meantime you
will need to use the csc branch ([1]). Updates to media-ctl and yavta to
support setting colorspace on video capture devices and on subdev source
pads are also needed. The corresponding patches have been posted to [2]
and [3] respectively, I expect them to be merged soon.

The series has also been tested with the latest v4l2-compliance. The bad
news is that the test flags 56 errors when run on a Renesas Salvator-X
2nd version board based on r8a77965:

Grand Total for vsp1 device /dev/media1: 757, Succeeded: 701, Failed: 56, Warnings: 0

The good news is that none of those are regressions, quite the contrary:
without this series applied, the total number of failures is 95, and the
diff shows no new error. I will therefore address those issues
separately.

[1] https://git.ideasonboard.com/renesas/vsp-tests.git/log/?h=csc
[2] https://lore.kernel.org/linux-media/20250408161051.10472-1-laurent.pinchart@ideasonboard.com/T/#u
[3] https://lore.kernel.org/linux-media/20250408233323.7650-1-laurent.pinchart@ideasonboard.com/T/#t

Laurent Pinchart (6):
  media: renesas: vsp1: Implement pixel format enumeration
  media: renesas: vsp1: Make HSI and HST modules optional
  media: renesas: vsp1: Fix HSV format enumeration
  media: renesas: vsp1: Fix media bus code setup on RWPF source pad
  media: renesas: vsp1: Report colour space information to userspace
  media: renesas: vsp1: Allow setting encoding and quantization

 drivers/media/platform/renesas/vsp1/vsp1.h    |   1 +
 .../media/platform/renesas/vsp1/vsp1_brx.c    |   9 +-
 .../media/platform/renesas/vsp1/vsp1_drv.c    |  59 +++---
 .../media/platform/renesas/vsp1/vsp1_entity.c |  22 +-
 .../media/platform/renesas/vsp1/vsp1_entity.h |   2 +
 .../media/platform/renesas/vsp1/vsp1_hsit.c   |  11 +-
 .../media/platform/renesas/vsp1/vsp1_pipe.c   | 188 ++++++++++++++++--
 .../media/platform/renesas/vsp1/vsp1_pipe.h   |   5 +
 .../media/platform/renesas/vsp1/vsp1_rpf.c    |  29 ++-
 .../media/platform/renesas/vsp1/vsp1_rwpf.c   |  53 ++++-
 .../media/platform/renesas/vsp1/vsp1_sru.c    |   9 +-
 .../media/platform/renesas/vsp1/vsp1_uds.c    |   9 +-
 .../media/platform/renesas/vsp1/vsp1_video.c  |  50 ++++-
 .../media/platform/renesas/vsp1/vsp1_wpf.c    |  29 ++-
 14 files changed, 407 insertions(+), 69 deletions(-)


base-commit: 9ddc3d6c16ea2587898a315f20f7b8fbd791dc1b