Xilinx V4L2 VPSS CSC driver

Table of Contents

Introduction

The purpose of this page is to describe the Linux V4L2 driver for Xilinx VPSS Color Space Converter (CSC) soft IP. VPSS refers to the Video Processing Sub System.
This driver is for the CSC only mode of operation in the VPSS, please see the Product Guide for more details on its functionality and features.
The Linux VPSS CSC driver (xilinx-vpss-csc.c) based on the V4L2 framework creates a subdev node(/dev/v4l-subdev*) which can be used to configure the VPSS CSC IP core. The VPSS CSC supports changing video properties through V4L Controls like Brightness, Contrast, Red Gain, Blue Gain and Green Gain. The driver is available at https://github.com/Xilinx/linux-xlnx/blob/master/drivers/media/platform/xilinx/xilinx-vpss-csc.c
The VPSS CSC driver supports only the following features are supported including:
  • Ability apply controls Brightness and Contrast.
  • Ability to apply controls Red, Green and Blue gains.
  • The CSC IP will look like the following when displayed through media-ctl

    entity 7: a0040000.csc (2 pads, 2 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev1
    pad0: Sink
    [fmt:RBG24/1280x720 field:none]
    <- "a0050000.gamma":1 [ENABLED]
    pad1: Source
    [fmt:RBG24/1280x720 field:none]
    -> "a0000000.scalar":0 [ENABLED]
  • yavta can be used to modify the control supported by the V4L2 VPSS CSC Driver

    root@plnx_aarch64:~# yavta --no-query -l /dev/v4l-subdev1
    Device /dev/v4l-subdev1 opened.
    --- User Controls (class 0x00980001) ---
    control 0x0098c9a1 `CSC Brightness' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a2 `CSC Contrast' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a3 `CSC Red Gain' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a4 `CSC Green Gain' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a5 `CSC Blue Gain' min 0 max 100 step 1 default 50 current 50.
    5 controls found.
    root@plnx_aarch64:~# yavta --no-query -w '0x0098c9a1 80' /dev/v4l-subdev1
    Device /dev/v4l-subdev1 opened.
    Control 0x0098c9a1 set to 80, is 80
    root@plnx_aarch64:~# yavta --no-query -l /dev/v4l-subdev1
    Device /dev/v4l-subdev1 opened.
    --- User Controls (class 0x00980001) ---
    control 0x0098c9a1 `CSC Brightness' min 0 max 100 step 1 default 50 current 80.
    control 0x0098c9a2 `CSC Contrast' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a3 `CSC Red Gain' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a4 `CSC Green Gain' min 0 max 100 step 1 default 50 current 50.
    control 0x0098c9a5 `CSC Blue Gain' min 0 max 100 step 1 default 50 current 50.
    5 controls found.
    

IP/Driver Features


IP features2018.1 to 2018.32019.1
One, two or four pixel-wide AXI4-Stream video interfaceYes
Video resolution support up to UHD at 60 fpsYes
Run-time color space support for RGB, YUV 4:4:4, YUV 4:2:2, YUV 4:2:0Yes
8, 10, 12, and 16 bits per component support

Driver supports only 8 and 10 bpc formats

using only 8 bpc MEDIA BUS formats.

Yes* Driver supports only 8 and 10 bpc formats

using 8 and 10 bpc media bus formats


Missing Features / Known Issues / Limitations in Driver


  • Works with fixed Vivado IP configuration as highlighted.
  • Demo Window is not supported

  • *Maximum color depth supported by the VPSS CSC soft IP driver is limited to 8 and 10 bpc.
  • *12 and 16 bpc color depth width is not supported.
  • Saturation Control is not supported
  • Pre-computed color conversion coefficient matrix used.
    • In future user supplied custom coefficients support may be added.

Video Processing Subsystem Release Notes and Known Issues

Kernel Configuration

CONFIG_VIDEO_XILINX_VPSS_CSC and CONFIG_VIDEO_XILINX should be enabled.

Device tree binding

The dts node should be defined with correct hardware configuration. How to define the node is documented here:
https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/media/xilinx/xlnx%2Cv-vpss-csc.txt

Testing Procedure

This driver is a V4L2 sub-device driver, which means it is designed to operate with a video device in it's graph. The driver has been tested with a Xilinx video device (a V4L2 capture device) that is backed by a DMA element (like Framebuffer Write IP). The V4L2 device driver for this IP cannot be tested in isolation by itself. The successful operation of the driver can be tested in two phases :
  • Successful Creation of a Media Device
  • Successful Frame Captures (or writing of buffers by the Frame-buffer Write IP)

Successful Creation of a Media Device

media-ctl is a Linux user space utility that can control media entities, it is a part of a larger set of V4L2 tools called v4l-utils
media-ctl allows you to print the topology of your media pipeline and specify input and output pad properties.

Successful Frame Captures

Please see the Test Approach section of the Frame Buffer Write Wiki for more details on how to capture frames.
The Red / Green / Blue gain values can be changed as shown in the Overview section and the captured images can be compared.
Test design

We need a ZCU102 Rev 1.0 board.  Enable TPG, VPSS CSC and Framebuffer Write in kernel defconfig.

The color format set in the TPG is what will propagate to CSC sink pad.

The color format set in the CSC source pad and the one set on video node (Framebuffer Write) in yavta should match.

The device tree also needs to be update. If we are using a 8 bit design then TPG output video-width, VPSS CSC input and output ports video-width should all be 8. 

For 10bpc design, the video-width is 10. The video-format for the TPG output port and VPSS CSC input port should match.


/* Use yavta to setup the color bar pattern */
#Set up the TPG output color format to RGB888
media-ctl -v -V '"a3c30000.tpg":0 [fmt:RBG888_1X24/1280x720 field:none]'
#Set up the Color Space convertor output to YUV 422
media-ctl -v -V '"a3c40000.csc":1 [fmt:UYVY8_1X16/1280x720 field:none]'
#Start capture
yavta -n3 -c15 -f YUYV -s1280x720 --skip 14 -F /dev/video0

View the captured files in some viewer like yuvplayer.exe.

Boards Supported

Driver has been tested on following boards:
  • ZCU102 Rev 1.0

Known Issues

  • AR65449 - LogiCORE IP Video Processing Subsystem(VPSS) - Release Notes and Known Issues for the Vivado 2015.3 tool and later versions

Change log

2023.2

  • No changes

2023.1 

  • No changes

2022.2

  • No changes

2022.1

  • No changes

2021.2

  • Summary
    • Update the SPDX license header
    • Preserve the control values on setting format
  • Commits

v4l: xilinx: vpss-csc: Update SPDX license header

2021.1

  • No changes

2020.2

2020.1

  • Summary
    • No changes

2019.2

  • Summary
    • Add support for missing RGB 10bpc media bus format
  • Commits
    • 2764687 v4l: xilinx: vpss-csc: Fix xcsc_set_format() for RBG 10 bpc

2019.1

  • Summary
    • Use 10 bit media codes
    • Make max-width and max-height as mandatory dt properties
  • Commits
    • 1ecec44 v4l: xilinx: vpss-csc: Use 10bit media bus codes

    • 7bc760b v4l: xilinx-vpss-csc: Make max width and height mandatory properties

2018.3

  • Summary
    • Add check for max width and height from dt
  • Commits
    • dddf225 v4l: xilinx-vpss-csc: Add check for max width and height

2018.2

  • Summary
    • No changes

2018.1

  • Summary
    • Support for any to any color space conversion
  • Commits
    • 3592a90 v4l: xilinx-vpss-csc: Support for any-to-any color space converison

2017.4

  • Summary
    • No changes

2017.3

  • Summary
    • Initial driver version added
  • Commits
    • 1437167 v4l: xilinx-vpss-csc: Any-to-any color space conversion
    • 2c171c6 v4l: xilinx-vpss-csc: driver support for xilinx vpss csc


© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy