Xilinx V4L2 Demosaic driver

Table of Contents


The purpose of this page is to describe the Linux V4L2 driver for Xilinx Sensor Demosaic soft IP.
To understand more details about the Sensor Demosaic IP please see the Product Guide below.
The Linux V4L2 Demosaic driver is based on the V4L2 framework, and creates a subdev node(/dev/v4l-subdev*) which can be used to configure the Demosaic IP core.
The Xilinx V4L2 Demosaic driver is able to control the Sensor Demosaic Soft IP that can convert a Bayer video stream to RGB video stream.
The driver comes up with default color format on sink pad as MEDIA_BUS_FMT_SRGGB8_1X8 and on source pad as MEDIA_BUS_FMT_RBG888_1X24.
The Source Pad (output) media bus format cannot be changed through media-ctl. However, the Sink pad's (input) media bus format can be changed to any Bayer format.

IP / Driver Features

IP Feature2018.1 to 2018.32019.1 to 2020.2
IP version1.01.0
1 / 2 / 4 / 8 pixels per clock supportYesYes
8 / 10 / 12 / 16 bits per componentOnly 8 bpc supported8 / 10 / 12 / 16 bpc support
Resolutions from 64x64 to 8192x4320Yes*
Supports 4Kp60 in all supported device familiesYes
Two interpolation algorithms High resolution and Fringe tolerantNA for driver
Ability to remove horizontal zipper artifactsNA for driver
Use UltraRAM for line buffersNA for driver

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

Kernel Configuration


Device tree binding

The dts node should be defined with correct hardware configuration. How to define the DT node is documented here :

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. Then run yavta to capture the frame. View this frame in a viewer like yuvplayer.exe

The output looks as follows

Boards Supported

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

Known Issues

  • AR68769 - LogiCORE Sensor Demosaic - Release Notes and Known Issues for the Vivado 2017.3 tool and later versions




  • Summary
    • No changes


  • Summary
    • No changes


  • Summary
    • Adds support for 10,12,16 bpc RAW and RGB media bus formats.
    • Make max width and height properties mandatory
  • Commits
    • 6d7de7c v4l: xilinx-demosaic: Make max width and height properties mandatory
    • 899bb51 v4l: xilinx-demosaic: Add support for 10,12,16 bpc RAW and RGB bus formats


  • Summary
    • Added xlnx,max-width and xlnx,max-height dt properties
    • Added checks to set the correct default and max width and height from dt properties
  • Commits
    • 4d0d5f2 v4l: xilinx-demosaic: Correct default values when width, height dt property absent
    • 734e627 v4l: xilinx-demosaic: Add check for max width and height


  • Summary
    • No change


  • Summary
    • Remove the redundant output format register
  • Commits
    • 6170785 v4l: xilinx-demosaic: Remove Output Video format register


  • Summary
    • No change


  • Summary
    • Initial version added to master branch
  • Commits
    • 50dbfdb v4l: xilinx-demosaic: driver support for xilinx video demosaic

Related Links