Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

TI811X PSP VIDEO CAPTURE Driver User Guide

From Texas Instruments Wiki
Jump to: navigation, search
TIBanner.png
TI811X PSP VIDEO CAPTURE Driver User Guide
Linux PSP

Video Capture Driver

Read This First

  • V4L2 capture is not supported for J5-Eco, V4l2 frame work doesnt dupport multi channel, on JAMR2.1

daughter card there is only TVP5158 decoder, which is multichannel.

  • The build procedures are changed as below:
   $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- ti811X_evm_defconfig
   $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- uImage
   $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- modules
  • Bootargs parameter is required to use notify driver in kernel. This address is valid for DM816X/AM389X platforms.
 $ notifyk.vpssm3_sva=0x9f900000


  • M3 firmware loader program is changed from procmgrapp to slaveloader
 $ ./slaveloader startup VPSS-M3 ti811x_hdvpss.xem3


  • V4L2 capture nodes are /dev/video0, /dev/video4, /dev/video5 and /dev/video6.
  • Above nodes are created only when ti81xxvo.ko is loaded followed by ti81xxvin.ko
  • V4L2 capture streaming is supported only on /dev/video0 node with TVP7002 as decoder.

Installation Guide

This is the TI81XX Linux VPSS(VPSS capture) Driver user installation guide. This documents the steps to get the VPSS Driver worked up on TI81XX based EVM(Simulator is not tested). This driver has the following dependencies outside of Kernel.

  • TI81XX PSP 04.07.00.02 release
  • Syslink_2.20.00.14 release (slaveloader)
  • HDVPSS 01.00.01.44 release

Note: Only the above mentioned version of the components are verified and tested.

Preliminary Work

  • Build the Linux Uboot and Kernel following the installation guide of TI811x PSP 04.07.00.02 release.
  • M3 BIOS VPSS Firmware(ti811x_hdvpss.xem3) is loaded by the slaveloader, which is the user space program from syslink and is part of PSP release package.

Build V4L2 capture driver

Though build dependency over syslink has been removed, VPSS driver still relies on the slaveloader to load M3 firmware, V4L2 Capture Driver supports dynamic build only. The pre-build uImage inside of PSP release package supports the pre-built V4L2 capture module.

NOTE:

  1. Applications are not required to rebuild the uImage or V4L2 capture module unless V4L2 drivers are changed.
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- ti811x_evm_defconfig
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- uImage
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- menuconfig
  • Enable V4L2 Capture Driver in Menuconfig

Select Device Drivers from the main menu.

...
    ...
    Kernel Features  --->
    Boot options  --->
    CPU Power Management  --->
    Floating point emulation  --->
    Userspace binary formats  --->
    Power management options  --->
[*] Networking support  --->
"   Device Drivers  --->"
    ...
    ...


Select Multimedia support from the menu.

    ...
    ...
    Sonics Silicon Backplane  --->
    Multifunction device drivers  --->
[*] Voltage and Current Regulator Support  --->
"<*> Multimedia support  --->"
    Graphics support  --->
<*> Sound card support  --->
[*] HID Devices  --->
[*] USB support  --->
    ...
    ...


Select Video For Linux from the menu.

    ...
    ...
    *** Multimedia core support ***
[ ]   Media Controller API (EXPERIMENTAL)
"<*>   Video For Linux"
[*]     Enable Video For Linux API 1 (DEPRECATED)
< >   DVB for Linux
    ...
    ...


Select Video capture adapters from the same menu. Press <ENTER> to enter the corresponding sub-menu.

    ...
    ...
[ ]   Customize analog and hybrid tuner modules to build  --->
"[*]   Video capture adapters  --->"
[ ]   Memory-to-memory multimedia devices  --->
[ ]   Radio Adapters  --->
    ...
    ...


Select TI81XX V4L2-Capture driver

[ ]   Autoselect pertinent encoders/decoders and other helper chi
      Encoders/decoders and other helper chips  --->
<>   TI81XX V4L2-Capture driver
"<M>   TI81XX V4L2-Capture driver"
< >   CPiA2 Video For Linux
< >   Philips SAA7134 support
  • Build module for the drivers
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-none-linux-gnueabi- modules
  • ti81xxvin.ko(VPSS V4L2 capture driver) is generated under drivers/media/video/ti81xx

Prerequisites

V4L2 capture driver requires following modules to be loaded for its functioning.

  1. syslink kernel driver module, referred as "syslink.ko"
  2. loader user space program, referred as "slaveloader"
  3. M3 BIOS Firmware binary, referred as "ti811x_hdvpss.xem3"
  4. VPSS kernel driver module, referred as "vpss.ko"
  5. TVP7002 decoder kernel module referred to as "tvp7002.ko"
  6. V4L2 capture kernel module, referred as "ti81xxvin.ko"

Load V4L2 capture and dependent modules

  • Load Syslink Module


$ insmod syslink.ko
  • Load VPSS M3 Firmware


$ ./slaveloader startup VPSS-M3 ti811x_hdvpss.xem3
  • Load VPSS Module


 $ insmod vpss.ko
  • Load TVP7002 kernel module


$ insmod tvp7002.ko
  • Load V4L2 Capture Module


$ insmod ti81xxvin.ko

Note: Some of the above modules are common between V4L2 capture, V4L2 display and FBDEV modules. These modules need to be loaded only once. tvp7002.ko must be loaded before ti81xxvin.ko.

Introduction

Video Processing Sub-System hardware integrates theee graphics pipeline, five video pipelines, two capture ports and 4 video compositors. Video compositors are connected to four VENCs to support various output format and mode.


The primary functionality of the VPSS driver is to provide interfaces to user level applications and management of Video Processing Sub-System hardware. Interfaces and features of the fbdev and v4l2 display driver are covered in video driver user guide. This document covers the software architecture, interfaces and features provided by the V4L2 capture driver.

References

  1. Video for Linux Two Home Page [http://linux.bytesex.org/v4l2/]
  2. Video for Linux Two API Specification [[http://v4l2spec.bytesex.org/v4l2spec/v4l2.pdf]

Acronyms & Definitions

Acronym Definition
V4L2 Video for Linux Two
VPSS Vidoe Processing SubSystem
HDMI Hight Definition Multimedia Interface
NTSC National Television System Committee
PAL Phase Alternating Line
SD Standard Definition
SDK Software Development Kit
VIP Video Input Port

Hardware Overview

The video processing subsystem provides the functions to display a video frame from the memory frame buffer to external display device, such as LCD,TV; or capture a video frame from external camera to memory. The video processing subsystem integrates the following main elements


  • Graphics processing modules
  • Video Capture processing modules
  • Video display processing modules
  • Video Compositor modules

Software overview

V4L2 capture driver provides the application interface for the video capture processing modules of the VPSS. It allows the external decoders to be interfaced to VIP capture port of the VPSS through standard V4L2 sub device driver model. Current driver supports VIP 0 instance with TVP7002 decoder (This decoder is not present on TI811x board, JAMR2.1). It is possible to support other decoders on VIP 0 instance by adding the sub-device driver for required decoder(TI811x has TVP5158) and passing the board specific data through board file. Please refer to the application note on how to add different decoders to the V4L2 capture driver.

Features

V4L2 capture driver supports following features.

  • Supports VIP0 instance of the VPSS.
  • Supports TVP7002 standard Linux sub device driver.
  • Supports YUV422 interleaved, YUV422 semiplanar, YUV420 semiplanar and RGB888 color formats to memory.
  • Supports scaling and cropping for YUV formats (downscaling and progressive inputs only)
  • Supports 1080P60, 1080P30, 1080I60 and 720P60 input resolutions.
  • Supports user pointer buffer mechanism of the V4L2 driver interface.

Architecture

This chapter describes the Driver Architecture and Design concepts

Driver Architecture

TI81XX Video Processing hardware integrates three graphics pipeline, five video pipelines, 2 capture ports and 4 video compositors. Video compositors are connected to four VENCs to support various output format and mode.


The primary functionality of the VPSS driver is to provide interfaces to user level applications and management to video processing subsystem hardware.


This includes, but is not limited to:

  • GUI rendering through graphics pipelines.
  • Video rendering through video pipelines.
  • Connecting each of three graphics pipelines to four compositors so the display layer is presented on the selected output path.
  • Connecting each of three video pipelines to four compositors so the display layer is presented on the selected output path.
  • Image/Video processing( alpha blending, colorkeying, cropping )


Video Processing Subsystem Architecture


Software Design Interfaces

Above figure (Video Processing Subsystem Architecture) shows the major components that makes up the VPSS software sub-system

  • M3 VPSS Firmware

This is a firmware running over processor Cotex M3 controlling the Video Processing subsystem hardware.

  • Syslink Library

This is a funcional layer controlling the inter-processor communction between Cotex A8 and Cotex M3.

  • VPSS FVID2 Library

This is a HAL/functional layer controlling the Firmware running over the M3. It exposes the number of APIs controlling the video compositors, VENCs, graphics/video pipelines to the user interface drivers like V4L2 and FBDEV. It translates the V4L2/Fbdev data structures and ioctl to FVID2 data structures and command, and call the Linux Syslink IPC notify function to pass FVID2 data structures and commands to Firmware running over the M3 processor.

  • Video Applications & V4L2 subsystem

Video applications (camera, camcorder, image viewer, etc.) use the standard V4L2 APIs to render static images and video to the video layers, or capture/preview camera images.

Usage

Command Line arguments

V4L2 capture driver supports enabling debug option. Argument are only specified at the time of inserting the driver since V4L2 capture driver only supports dynamic build.


Below is the list of arguments which V4L2 driver supports -

V4L2 Driver Command Line Arguments
Argument Description
debug Enable debug messaging


Insert the dynamically built module with following parameters: Following example shows how to enable debug of V4L2:

$ insmod ti81xxvin.ko debug=1

Opening and Closing of Driver

Driver exposes four nodes corresponding to one VIP port. There are 2 instances of the VIP capture in VPSS. Each of the VIP instance can act as a single 16/24 bit port or two 8-bit ports. So overall 4 8-bit capture, or two 16 bit capture or one 16 bit and one 24 bit capture can be supported by VIP capture instances. As maximum of 4 videos can be captured, total four driver nodes are exposed to application. Based on the interface, all 4 nodes or less than that can be opened by application.

/* Open a video capture logical channel in blocking mode */
fd = open ("/dev/video0", O_RDWR);
if (fd == -1) {
    perror("Failed to open display device\n");
    return -1;
}
/* Closing of channel */
close (fd);


Setting input

V4L2 architecture supports number of decoders through standard V4L2 subdevice model. Number of different decoders can be supported for same V4L2 capture driver based on different boards. Different decoder supports different type of inputs like S-Video, Composite, Component, DVI, HDMI etc. Application can select one of the input from number of supported inputs. Following ioctl allows application to select specific input from supported inputs. V4L2 capture driver sets the input in the connected decoder as V4L2 capture driver is independent of the inputs.

int input_index = 0;
ioctl(fd, VIDIOC_S_INPUT, &input_index);
if (ret) {
         printf("%s: Setting Input failed\n", APP_NAME);
         printf("Return Value = %d\n", ret);
         exit(2);
}


Querying DV preset

DV preset is Digital video presets. It represents the current video resolution detected by the decoder. Once the input is connected to decoder, it can detect the resolution like 1080P60, 720P60 etc based on clock and control signals. This IOCTL allows application to detect the incoming video resolution. Again querying of the video resolution is a decoder feature and not of the V4L2 capture driver.

struct v4l2_dv_preset dv_preset;
dv_preset.preset = -1;
if (ioctl(fd, VIDIOC_QUERY_DV_PRESET, &dv_preset)) {
        printf("Querying DV Preset failed\n");
        exit(2);
}
switch (dv_preset.preset) {
case V4L2_DV_720P60:
        printf("%s:\n Mode set is 720P60\n", APP_NAME);
        break;
case V4L2_DV_1080I60:
        printf("%s:\n Mode set is 1080I60\n", APP_NAME);
        break;
case V4L2_DV_1080P60:
        printf("%s:\n Mode set is 1080P60\n", APP_NAME);
        break;
case V4L2_DV_1080P30:
        printf("%s:\n Mode set is 1080P30\n", APP_NAME);
        break;
default:
       printf("%s:\n Failed to query preset\n", APP_NAME);
}


Setting DV Preset

After querying for preset application to set the same preset. This is to ensure that all the registers of the decoder are set properly according the preset queried. This is a feature of decoder and not V4L2 capture driver. V4L2 capture driver simply passes the call to the respective V4L2 subdevices (decoders)driver. Following is the example code for setting up the dv preset.

struct v4l2_dv_preset dv_preset;
dv_preset.preset = -1;
if (ioctl(fd, VIDIOC_QUERY_DV_PRESET, &dv_preset)) {
        printf("Querying DV Preset failed\n");
        exit(2);
}
if (ioctl(capt.fd, VIDIOC_S_DV_PRESET, &capt.dv_preset)) {
        printf("Setting DV Preset failed\n");
        exit(2);
}


Cropping

The V4L2 Driver allows an application to define a rectangular portion of the image to be cropped via the VIDIOC_S_CROP Ioctl with the V4L2_BUF_TYPE_VIDEO_CAPTURE buffer type. When application calls VIDIOC_S_FMT ioctl, driver sets default cropping rectangle that is the largest rectangle no larger than the image size. All cropping dimensions are rounded down to even numbers. Cropping is done by the scalar module included with VIP capture instance.

Following example shows how to change crop size.

struct v4l2_crop crop;
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
crop.c.left = 0;
crop.c.top = 0;
crop.c.width = 320;
crop.c.height = 320;
ret = ioctl(fd, VIDIOC_S_CROP, &crop);
if (ret < 0) {
    perror("VIDIOC_S_CROP\n");
    close(fd);
    exit(0);
}
/* Image cropping rectangle is now changed */


Scaling

V4L2 capture driver supports scaling of the captured image. Only downscaling is supported on the captured image. Scaling dimensions are rounded to even numbers. Image can be scaled upto 1/8x in horizontal direction and vertical directions.

Following example show how to scale the input image.


capt.fmt_win.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
capt.fmt_win.fmt.win.w.left = 0;
capt.fmt_win.fmt.win.w.top = 0;
capt.fmt_win.fmt.win.w.width = 720;
capt.fmt_win.fmt.win.w.height = 480;

if (ioctl(capt.fd, VIDIOC_S_FMT, &capt.fmt_win)) {
        printf("Setting window failed\n");
        exit(2);
}


Buffer Format

Buffer format describes various buffer parameters like pixel format, memory organization for each color component and for interlaced capture memory organization for each field. It also describes the size and pitch of the buffer. V4L2 capture driver and hardware supports following buffer formats: V4L2_PIX_FMT_YUYV (YUV422 interleaved), V4L2_PIX_FMT_NV12 (YUV420 semi-planar), V4L2_PIX_FMT_NV16 (YUV422 semi-planar)and V4L2_PIX_FMT_RGB24 (RGB888 packed). Buffer format can be changed using VIDIOC_S_FMT ioctl with type as V4L2_BUF_TYPE_VIDEO_CAPTURE.


/* Get the default format */
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd, VIDIOC_G_FMT, &fmt)) {
        printf("Getting format failed");
        exit(2);
}
/* Change required parameters and set the format */
fmt.fmt.pix.width = 1920;
fmt.fmt.pix.height = 1080;
fmt.fmt.pix.bytesperline = fmt.fmt.pix.width * 2u;
fmt.fmt.pix.sizeimage = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;
fmt.fmt.pix.colorspace = V4L2_COLORSPACE_REC709;

fmt.fmt.pix.field = V4L2_FIELD_ANY;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;

fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd, VIDIOC_S_FMT, &fmt)) {
        printf("Setting format failed\n");
        exit(2);
}


Buffer Formats

  • YUYV422 Interleaved Format

YUYV422 is expected to be packed with Y0 in the lowest byte followed by U(Cb) followed by Y1 finally V(Cr) in the upper most byte.

YUYV422 Interleaved Data Memory Organization
  • YUV422 Semi-planar Format

Y and UV are stored separately. UV is expected to be packed with U(Cb) in the lower byte and V(Cr) in the upper byte.

YUV422 semi-planar Data Memory Organization
  • YUV420 Semi-planar Format

Y and UV are stored separately. UV is expected to be packed with U(Cb) in the lower byte and V(Cr) in the upper byte.

YUV420 semi-planar Data Memory Organization
  • RGB24 Format

Red, Blue and Green components needs to be packed in memory.

RGB888 Data Memory Organization

Buffer Management

User pointer buffer are supported by driver. Memory mapped buffers are not supported by driver because its almost impossible to get HD size buffer from the kernel. Minimum number of buffers application should allocate and prime for no frame drops is 4. Frame drops will be observed if application primes less than 4 buffers.


The main steps that the application must perform for buffer allocation are:

  • Allocating V4L2 buffer descriptor Memory
VIDIOC_REQBUFS

This is a necessary ioctl for streaming IO. It has to be called for both drivers buffer mode and user buffer mode. Using this ioctl, driver will identify whether driver buffer mode or user buffer mode will be used.

It takes a pointer to instance of the
v4l2_requestbuffers
structure as an argument.

User can specify the buffer type (V4L2_BUF_TYPE_VIDEO_OUTPUT), number of buffers, and memory type (V4L2_MEMORY_MMAP, V4L2_MEMORY_USERPTR)at the time of buffer allocation. In case of driver buffer mode, this ioctl also returns the actual number of buffers allocated in count member of v4l2_requestbuffer structure.


/* structure to store buffer request parameters */
struct v4l2_requestbuffers reqbuf;
reqbuf.count = numbuffers;
reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqbuf.memory = V4L2_MEMORY_USERPTR;
ret = ioctl(fd , VIDIOC_REQBUFS, &reqbuf);
if(ret < 0) {
    printf("cannot allocate memory\n");
    close(fd);
    return -1;
}


Streaming

V4L2 driver supports the streaming of the buffer. To do streaming minimum of fourbuffers should be requested by the application by using VIDIOC_REQBUFS ioctl. V4L2 capture driver support user pointer buffers only. Mmapped buffers are not supported.


        /* Request buffers. We are operating in userPtr mode */
        capt.reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        capt.reqbuf.count = MAX_BUFFER;
        capt.reqbuf.memory = V4L2_MEMORY_USERPTR;
        ret = ioctl(capt.fd, VIDIOC_REQBUFS, &capt.reqbuf);
        if (ret<0) {
                printf("Could not allocate the buffers\n");
                return -1;
        }

        /* Prime buffers */
        int ret, i;
        for (i = 0; i < (MAX_BUFFER; i++) {
                capt.buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                capt.buf.memory = V4L2_MEMORY_USERPTR;
                capt.buf.index = i;
                capt.buf.m.userptr = (unsigned long)buffer_addr[capt.buf.index];
                capt.buf.length = capt.fmt.fmt.pix.sizeimage;
                ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
                if (ret < 0) {
                        perror("VIDIOC_QBUF\n");
                        return -1;
                }
        }
        /* Start streaming */
        int a = V4L2_BUF_TYPE_VIDEO_CAPTURE, ret;
        ret = ioctl(capt.fd, VIDIOC_STREAMON, &a);
        if (ret < 0) {
                perror("VIDIOC_STREAMON\n");
                return -1;
        }
        /* Start the loop of capture */
        for (i = 0; i < MAXLOOPCOUNT; i++) {
        /* Dequeue the captured buffer */
                ret = ioctl(capt.fd, VIDIOC_DQBUF, &capt.buf);
                if (ret < 0) {
                        perror("VIDIOC_DQBUF\n");
                        return -1;
                }
                /* Process the buffer here */


                /* Queue the buffer after processing is done */
                ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
                if (ret < 0) {
                         perror("VIDIOC_QBUF\n");
                         return -1;
                }
        }
        /* Stop streaming */
        int a = V4L2_BUF_TYPE_VIDEO_CAPTURE, ret;
        ret = ioctl(capt.fd, VIDIOC_STREAMOFF, &a);
        if (ret < 0) {
                perror("VIDIOC_STREAMOFF\n");
                return -1;
        }


V4L2 Capture Driver Interface

Application Interface

open()
To open a video device


close()
To close a video device


ioctl()
To send ioctl commands to the display driver.


mmap()
To memory map a driver allocated buffer to user space

Supported Standard IOCTLs

This section describes the standard V4L2 IOCTLs supported by the Capture Driver.
NOTE: Standard IOCTLs that are not listed here are not supported. The Display Driver handles the unsupported ones by returning EINVALerror code.


VIDIOC_QUERYCAP
This is used to query the driver's capability. The video driver fills a v4l2_capability struct indicating the driver is capable of output and streaming.


VIDIOC_ENUM_FMT
This is used to enumerate the image formats that are supported by the driver. The driver fills a v4l2_fmtdesc struct.


VIDIOC_G_FMT
This is used to get the current image format or display window depending on the buffer type. The driver fills the information to a v4l2_format struct. It also used to get the scaling ratio with v4l2_buf_type as V4L2_BUF_TYPE_VIDEO_OVERLAY


VIDIOC_TRY_FMT
This is used to validate a new image format or a new display window depending on the buffer type. The driver may change the passed values if they are not supported. Application should check what is granted.


VIDIOC_S_FMT
This is used to set a new image format or a new display window depending on the buffer type. The driver may change the passed values if they are not supported. Application should check what is granted if VIDIOC_TRY_FMT is not used first. It is also used to set the scaling parameters with v4l2_buf_type as V4L2_BUF_TYPE_VIDEO_OVERLAY


VIDIOC_CROPCAP
This is used to get the default cropping rectangle based on the current image size and the current display panel size. The driver fills a v4l2_cropcap struct.


VIDIOC_G_CROP
This is used to get the current cropping rectangle. The driver fills a v4l2_crop struct.


VIDIOC_S_CROP
This is used to set a new cropping rectangle. The driver fills a v4l2_crop struct. Application should check what is granted.


VIDIOC_REQBUFS
This is used to request a number of buffers that can later be memory mapped. The driver fills a v4l2_request buffers struct. Application should check how many buffers are granted.


VIDIOC_QUERYBUF
This is used to get a buffer's information so mmap can be called for that buffer. The driver fills a v4l2_buffer struct.


VIDIOC_QBUF
This is used to queue a buffer by passing a v4l2_buffer struct associated to that buffer.


VIDIOC_DQBUF
This is used to dequeue a buffer by passing a v4l2_buffer struct associated to that buffer.


VIDIOC_STREAMON
This is used to turn on streaming. After that, any VIDIOC_QBUF results in an image being rendered.


VIDIOC_STREAMOFF
This is used to turn off streaming.


VIDIOC_ENUMINPUT
This is used to enumerate number of inputs supported by various decoders.


VIDIOC_S_INPUT
This is used to set one of inputs, from the number of inputs supported by decoders


VIDIOC_G_INPUT
This is used to get the currently set input


VIDIOC_QUERY_DV_PRESET
This is used to detect the preset. Decoders can generally detect the incoming digital video preset. This is used to detect it and configure the master driver according to detected preset.


VIDIOC_G_DV_PRESET
This is used to get the current preset.


VIDIOC_S_DV_PRESET
This is used to set the preset. After querying the preset, application needs to set the queried preset


VIDIOC_ENUM_DV_PRESETS
This is used to enumerate all the DV presets supported by decoder

Sample Application Flow

This chapter describes the application flow using the V4l2 driver.


Application for v4l2 driver

Sample Applications

Sample applications are provided with the PSP package to demonstrate various feature of the driver like scaling, cropping, different formats etc.

Read This First

All the sample applications of V4L2 capture driver uses FBDEV buffer as the user pointer buffers. FBDEV needs to be loaded with following arguments to make all sample applications work successfully insmod ti81xxfb.ko vram=0:40M,1:1M,2:1M. This is to ensure that fbdev has enough memory for using it with V4L2 capture driver. ti81xxvo.ko must loaded before ti81xxvin.ko, which is to ensure that /dev/video1-3 are created for display function. Capture source must be connected to the component input of IO EXPANSION board before run the sample application, otherwise the sample application reports error.

Following is the list of applications for the V4L2 capture driver.

  • saLoopBack
  • saLoopBackFbdev
  • saLoopBackScale

saLoopBack

This application demonstrates simple loop back from capture to display. Application takes input through TVP7002 decoder on VPSS VIP port. Capture buffers are displayed using V4L2 display driver. Sample application uses user pointer buffer mechanism for both capture and display driver. User pointer buffers are taken from FBDEV driver. V4L2 capture driver outputs YUV422 (y and cbcr interleaved) data to memory and display driver displays the same format from memory. Capture driver detects the incoming resolution, configures capture and display driver for same resolution. For e.g. For 1080P60 input resolution, Application sets the buffer size to 1920*1080*2 for both display and capture. Application changes the display resolution to 1080P60 on display using the sysfs entry.

saLoopBackFbdev

This application demonstrates simple loop back from capture to fbdev display driver. Application takes input through TVP7002 decoder on VPSS VIP port. Captured buffers are displayed using FBDEV driver. Sample application uses user pointer buffer mechanism for capture driver, and mmapped buffers for fbdev. FBDEV buffers are used as userpointer buffer for V4L2 capture. Capture driver takes YUV422 as input, converts it to RGB888 using color space converter of VIP port. Capture driver detects incoming resolution and configures capture and display driver for same resolution. For e.g. for 720P60 input resolution, Application sets the buffer size to 1280*720*3 for capture, and set the fbdev driver for RGB888 display. Application changes the display resolution to 720P60 using the sysfs entry.

saLoopBackScale

This application demonstrates the scaling and cropping feature of the V4L2 capture driver. Application takes the input through TVP7002 decoder on VPSS VIP port. Capture buffers are displayed using V4L2 display driver. Sample application uses user pointer buffer mechanism for both capture and display drivers. Capture driver crops the image to the same original input resolution. It then scales it to VGA(640X480) resolution and displays it through display driver.


Technical Support and Product Updates =

For further information or to report any problems, contact http://community.ti.com or http://support.ti.com.

OMAP Linux Mailing List: http://vger.kernel.org/vger-lists.html#linux-omap