Xilinx V4L2 Gamma Correction LUT driver

Table of Contents

Introduction

The purpose of this page is to describe the Linux V4L2 driver for Xilinx Gamma Correction LUT soft IP.

To understand more details about this IP and its functionality please see the Product Guide (below).

The Xilinx V4L2 Gamma LUT driver (xilinx-gamma.c) is based on the V4L2 framework and creates a subdev node(/dev/v4l-subdev*)
which can be used to configure the the Look Up Table (LUT) for Red, Green and Blue gamma correction components.
The LUT is applied to the incoming video stream by the Gamma Correction LUT soft IP.
The Gamma Correction LUT soft IP provides a way to apply correction to each Red, Green and Blue components.
  • Exposes a V4L2 control to program Red, Green and Blue gamma values.
    • A gamma of 0.1 is achieved by setting a value of 1 (minumum)
    • A gamma of 1.0 is achieved by setting a value of 10 (default)
    • A gamma of 4.0 is achieved by setting a value of 40 (maximum)
  • media-ctl will show an entry as follows that represents the Gamma LUT V4L2 sub-device. :

  • yavta can display the three controls as follows :

IP/Driver Features

IP Features2018.1 and on wards
IP version1.0
Programmable gamma table supports gamma correction or any user defined functionYes*
Three channel independent look-up table structureYes*
One, two, four or eight pixel-wide AXI4-Stream video interfaceYes
8 and 10 bits per component supportYes**
Supports spatial resolutions from 64 x 64 up to 8192 x 4320Yes***
Supports 4K60 in all supported device familiesNA

*Pre-computed coefficients table used.

**Media bus format supported is MEDIA_BUS_FMT_RBG888_1X24 for both 8 and 10bpc

***Tested for 8192x4320, 3840x2160, 1920x1080, 1280x720


Kernel Configuration

CONFIG_VIDEO_XILINX_GAMMA and CONFIG_VIDEO_XILINX should be enabled.

Device Tree Binding

The device tree 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-gamma-lut.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.
Test design

We need a ZCU102 Rev 1.0 board.  Enable TPG, Demosaic, Gamma LUT and Framebuffer Write in kernel defconfig.

Modify the demosaic driver as below as TPG output is RGB type and Demosaic requires SRGGB type.

  • Setup the TPG to generate a pattern.
  • Setup the Gamma brightness as shown above.
  • Now capture image using yavta


View the captured image using a viewer like yuvplayer.exe

Boards Supported

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

Known Issues

  • AR68768 - LogiCORE Gamma LUT - Release Notes and Known Issues for the Vivado 2017.3 tool and later versions

Changelog

2020.2

2020.1

  • Summary
    • No changes

2019.2

  • Summary
    • No changes

2019.1

  • Summary
    • Make max-width and max-height mandatory dt properties
  • Commits
    • 489fb29 v4l: xilinx-gamma: Make max-width and max-height mandatory dt properties

2018.3

  • Summary
    • Added xlnx,max-width and xlnx,max-height dt properties
    • Added checks to set the correct default, min and max width and height from dt properties
  • Commits
    • da376b3 v4l: xilinx-gamma: Add check for max width and height
    • 032026f v4l: xilinx-gamma: Correct default values when max width, height dt property absent

2018.2

  • Summary
    • No changes

2018.1

  • Summary
    • Added 10-bit support and kernel documentation
    • Fixed debug mode compile error
  • Commits
    • 1d34b87 v4l: xilinx-gamma: Fix compile error in debug mode
    • ada9c6a v4l: xilinx-gamma: Add kernel-doc for xgamma_dev struct
    • ae6e1f0 v4l: xilinx-gamma: Add 10-bit IP support for Video Gammma IP.

2017.4

  • Summary
    • No changes

2017.3

  • Summary
    • Initial revision added to master branch
  • Commits
    • ea3529b v4l: xilinx-gamma: Correct return value checking
    • 4e91c3f v4l: xilinx-gamma: initial driver support for xilinx video gamma lut ip