NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

TI811X PSP VPSS VIDEO Driver User Guide

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

Video Driver

Contents

Read This First[edit]

This section show the major updates since last release, please review this section before any SW activities.

  • This User Guide is for PSP 04.07.00.02
  • Sharing buffer address is changed (from 0x9fd00000 to 0x9fb00000) from HDVPSS_01_00_01_44 release onwards. The correct address is available in installation guide and also in user guide.
  • Make sure that PIN8 of SW6 switch is turned on(to make off-chip HDMI display and EVm LCD display work)
  • ISS PLL provides clock to HDVPSS . Need to taken care of ISS PLL configuration if not HDVPSS crashes. At present uboot does ISS PLL configuration
  • off-Chip HDMI is working with only small lilliput display, samsung and philips TV.Board modification is required on REV C version - Remove R267 and R578, and populate R264 and R579 with 10K registers.
  • The build procedures are changed as below, the defconfig is up to which platform was used :
   $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- ti811x_evm_defconfig
   $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- uImage
  $make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- modules
  • The addresses of notifyk.vpssm3_sva and vpss.sbufaddr mentioned in this userguide apply only to the M3 firmware with PSP package. For the M3 firmware from TI SDK package, please check SDK document to get right address for notifyk.vpssm3_sva and vpss.sbufaddr
  • The usage of loading M3 firmware described in this userguide does not apply for M3 firmware coming from TI SDK packagae. Please check SDK document to get details information.


  • M3 firmware loader program is changed from procmgrapp to slaveloaer
 $ ./slaveloader startup VPSS-M3 ti811x_hdvpss.xem3
  • The following sysfs entries have been removed
 $ /sys/devices/platform/vpss/system/automode
$ /sys/devices/platform/vpss/system/pllclks
  • The following syfs entries have been modified to support polarity of the DE(ACT_VID)/FID/HS/VS signal
 $ /sys/devices/platform/vpss/display0/output
$ /sys/devices/platform/vpss/display1/output
  • cropping, positioning is supported at /dev/video3 node
  • V4L2 display nodes are /dev/video1, /dev/video2, /dev/video3
  • 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. JAMR2.1 Daughter card has only TVP5158

decoder, so V4l2 capture is not supported.

Installation Guide[edit]

Platform Buffer Address
VPSS-M3 Firmware Notify Buffer Default Value(notifyk.vpssm3_sva) Sharing Buffer Default Value(sbufaddr)
ti811x_hdvpss.xem3

0x9f900000

0x9fb00000 (HDVPSS_01_00_01_44 onwards)

0x9fd00000 (Till HDVPSS_01_00_01_43)

Introduction[edit]

This is the TI811X Linux VPSS(Fbdev and V4L2 Display and 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 document details the steps in load syslink, M3 BIOS VPSS firmware and VPSS symbol.

Preliminary Work[edit]

  • Build the Linux Uboot and Kernel following the installation guide of TI811X 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.
  • M3 BIOS VPSS Firmware(ti811x_hdvpss.xem3) is the software running over the VPSS M3 Processor.

Build Linux VPSS, Fbdev, V4L2 Display and V4L2 Capture Drivers[edit]

Though build dependency over syslink has been removed, VPSS driver still relies on the slaveloader to load M3 firmware, VPSS, Fbdev, V4L2 Display and V4L2 capture Drivers supports dynamic build only. The pre-build uImage inside of PSP release package supports the prebuit VPSS/Fbdev/V4L2 modules.

NOTE:

  1. Applications are not required to rebuild the uImage or VPSS/FBDev/V4L2 module unless VPSS/FBDev/V4L2 drivers are changed.
  • Enable the notify in menuconfig(by default this option is on)
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- ti811x_evm_defconfig
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- uImage
$ make ARCH=arm CROSS_COMPILE=PATH_TO_TOOLCHAIN/bin/arm-arago-linux-gnueabi- menuconfig


select Device Drivers

   Userspace binary formats  --->
   Power management options  --->
   [*] Networking support  --->
 " Device Drivers  --->    "
   CBUS support  --->
   File systems  --->

Select Sys_Link

  [ ] Auxiliary Display support  --->
   < > Userspace I/O drivers  --->
  [ ] Staging drivers  --->
  "[*] Sys_Link  --->    "

Select SysLink Notify

 --- Sys_Link
" <*>   SysLink Notify  "
  • Enable the VPSS and Fbdev in menuconfig


select Device Drivers

   Userspace binary formats  --->
   Power management options  --->
   [*] Networking support  --->
 " Device Drivers  --->    "
   CBUS support  --->
   File systems  --->

select graphics support:

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

Select TI81XX Video Processing Subsystem (EXPERIMENTAL)

   < > Fujitsu MB862xx GDC support
   < > E-Ink Broadsheet/Epson S1D13521 controller support
   < > OMAP frame buffer support (EXPERIMENTAL)
 " <M> TI81XX Video Processing Subsystem (EXPERIMENTAL)  ---> "
   [ ] Backlight & LCD device support  --->

Setup the VPSS configuraiton.

 --- TI81XX Video Processing Subsystem (EXPERIMENTAL)
   (50)  VRAM size (MB)
   [*]   Debug support
    <>   TI81XX frame buffer support (EXPERIMENTAL)  --->

select TI81XX frame buffer support (EXPERIMENTAL)

 --- TI81XX Video Processing Subsystem (EXPERIMENTAL)
   (50)  VRAM size (MB)
   [*]   Debug support
   " <M>   TI81XX frame buffer support (EXPERIMENTAL)  ---> "


--- TI81XX frame buffer support (EXPERIMENTAL)
   [*]   Debug support for TI81XX FB
   (3)   Number of framebuffers
  • Enable V4L2 Display 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-Display driver

[ ]   Autoselect pertinent encoders/decoders and other helper chi
      Encoders/decoders and other helper chips  --->
"<M>   TI81XX V4L2-Display driver"
< >   CPiA2 Video For Linux
< >   Philips SAA7134 support


  • 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-arago-linux-gnueabi- modules
  • vpss.ko(VPSS library) is generated under drivers/video/ti81xx/vpss, ti81xxfb.ko(VPSS fbdev driver) is generated under drivers/video/ti81xx/ti81xxfb, ti81xxvo.ko(VSPSS V4L2 display driver) is generated under drivers/media/video/ti81xx and ti81xxvin.ko(VSPSS V4L2 capture driver) is generated under drivers/media/video/ti81xx

Prerequisites[edit]

The following files will be available after the above steps have been executed:

  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. FBDev kernel driver module, referred as "ti81xxfb.ko"
  6. V4L2 display kernel module, referred as "ti81xxvo.ko"

Note: Item 1-3 can be downloaded from PSP download Link.

Load VPSS, Fbdev, and V4L2 Display Driver Modules[edit]

  • From the u-boot prompt, set the recommended bootargs given below
$ setenv bootargs 'console=ttyO0,115200 n8 root=/dev/nfs nfsroot=nfs-server/home,nolock rw mem=245M earlyprintk ip=dhcp vram=128M notifyk.vpssm3_sva=notify_addr'
  • notify_addr can be obtained from the Platform Buffer Address table mentioned in the Installation Guide
  • After seeing Linux booting log at Hyper Terminal or Tera Term, type "root" to log int.
$ cd to the folder where those Prerequisites are stored in the NFS or RamDisk
  • Note:

The addresses of notifyk.vpssm3_sva and vpss.sbufaddr mentioned in this userguide apply only to the M3 firmware inside PSP package. For the M3 firmware from TI SDK package, please check SDK document to get right address for notifyk.vpssm3_sva and vpss.sbufaddr
The usage of loading M3 firmware described in this userguide does not apply for M3 firmware coming from TI SDK packagae. Please check SDK document to get details information.


  • Load Syslink Module


$ insmod syslink.ko
  • Load VPSS M3 Firmware(dependent on hardware platform)


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


 $ insmod vpss.ko sbufaddr=sbuf_addr
  • sbuf_addr can be obtained from the Platform Buffer Address table mentioned in the Installation Guide


  • Load FBDev Module


$ insmod ti81xxfb.ko vram=0:40M,1:40M,2:40M
  • Load V4L2 Display Module


$ insmod ti81xxvo.ko video1_numbuffers=3 video2_numbuffers=3 video1_bufsize=4149248 video2_bufsize=4149248
  • Load sii9022a Module


$ insmod sii9022a.ko
  • A delay of 2 seconds is needed between loading syslink and starting slaveloader application, when the above steps are done in a single script.
  • Now Fbdev, and V4L2 display module are loaded and application can be executed from here.

NOTE:

 Application need develop their own software component to support the external display device connected with DVO1 VENC.
Add debug=1 to enable the debug function of vpss.ko,ti81xxfb.ko, and ti81xxvo.ko
Application need assign the memroy size when loading ti81xxfb.ko if accessing /dev/fb1 and /dev/fb2 nodes
  $ insmod ti81xxfb.ko vram=0:XXM,1:YYM,2:ZZM


Configure Application Output to LCD Display[edit]

The following steps are required to properly output to an LCD display connected to base evm in TI811x. The native resolution of LCD is 800x480@60 with discrete sync RGB888 format

  • Disable DVO2 VENC
#echo 0 > /sys/devices/platform/vpss/display1/enabled
  • Set the new VENC timings and ouput
# echo 29232,800/40/40/48, 480/13/29/3,1/3 > /sys/devices/platform/vpss/display1/timings
  • Set Hsync polarity in the venc.
# echo triplediscrete,rgb888,0/0/1/0 > /sys/devices/platform/vpss/display1/output
  • Enable DVO2VENC
#echo 1 > /sys/devices/platform/vpss/display1/enabled
  • Before running any of the saFbdevDisplay applications, set frame buffer size according to LCD resolution for TI811X
#fbset -xres 800 -yres 480 -vxres 800 -vyres 480
  • Connect Grpx0 to DVO2 node
#echo 1:dvo2 > /sys/devices/platform/vpss/graphics0/nodes

With ti81xxfb.ko loaded and timings set as described, output of an applicaion, such as the sample application saFbdevDisplayPan, will output their content to the LCD.

Note: Before redirecting output to LCD, the above mentioned modules ( in section 2.5 ) should be loaded.

Load LCD Backlight Module[edit]

backlight of the LCD is controlled via tlc59108(applicable only for TI811x). tlc59108 must be loaded before using LCD as display interface.

  • Load LCD Backlight Module


$ insmod tlc59108.ko

Note: In order to avoid flickering effect on LCD (while configuring), insert the tlc59108.ko module after configuring the application to output to LCD display.

Introduction[edit]

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.


This section defines and describes the usage of user level interfaces of VPSS Driver.


References[edit]

  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[edit]

Display Driver: Acronyms
Acronym Definition
V4L2 Video for Linux Two
VPSS Vidoe Processing SubSystem
HDMI Hight Definition Multimedia Interface
HDCOMP High Definition Component
DVO Digital Video Output
VENC Video Encoder
NTSC National Television System Committee
PAL Phase Alternating Line
SD Standard Definition
SDK Software Development Kit
VCOMP Video Compositor
COMP Compsoitor
EDID Extended display identification data
VIP Video Input Port


Display Port and VENC name
Display Port Name Type VENC Name Port Num for Pin Sysfs Name
HDMI/DVO1 Digital HDMI VOUT1 Display0
DVO2 Digital DVO2 VOUT0 Display1
SD Analog SD N/A Display2

Hardware Overview[edit]

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

Features[edit]

The VPSS driver supports the following features:

  • Supports 3 Graphics pipelines through FBDev interface
  • Supports 3 Video pipelines through V4L2 interface
  • Supports 2 VIP capture instances of VPSS through V4L2 interface.
  • Each of the VIP capture instances can either behave as 2 8-bit port or 1 16/24 bit port.
  • Supported color formats on Graphics pipeline: RGB565, ARGB1555, RGBA5551, ARGB4444, RGBA4444, ARGB6666,RGBA6666,RGB888, ARGB8888 and RGBA8888, BMP 1/2/4/8.
  • Support Color formats on Video pipeline; 422 Interleave, 420 semi-planar and 422 semi-planar.
  • Supported color formats on VIP port are YUV422 interleaved, YUV422 semi-planar, YUV420 semi-planar and RGB888.
  • Supports cropping and scaling for YUV color formats on V4L2 capture driver. Only downscaling is supported.
  • Configuration of display parameters such as height and width of display graphics, position of the display graphics, bits-per-pixel etc.
  • Supports setting up of Graphics pipelines/Video pipelines and VENCs destination(HDMI,DVO2 or SD) through syfs interface.
  • Supports buffer management through memory mapped (mmaped) on both FBDev and V4l2.
  • Supports user pointer buffer exchange for application usage on V4L2 only.
  • Supports global alpha blending on RGB format, pixel alpha blending on ARGB/RGBA format and palette alpha blending on BMP formats.
  • Supports colorkeying on graphics pipelines through FBDev.
  • Supports boundbox on graphcis pipelines through FBDev
  • Supports display priority on graphics pipelines through FBDev
  • Supports scaling on graphics pipeline through FBDev
  • Supports stenciling on graphics pipeline through FBDev
  • supports global alpha blending on video pipeline through V4L2
  • Supports colorkeying on video pipeline through V4L2
  • Supports various display resolutions on HDMI VENCs through sysfs
  • Supports various Video PLL frequency through sysfs
  • Supports various VENC clock source through sysfs
  • Supports various output for VENC through sysfs.
  • Supports reshuffle display order through sysfs
  • Supports customized timing for VENC through sysfs

Architecture[edit]

This chapter describes the Driver Architecture and Design concepts

Driver Architecture[edit]

TI811X 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[edit]

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.

  • SYSFS interfaces

The SYSFS interfaces are mostly used as the control path for configuring the VPSS parameters which are common between FBDEV and V4L2 like the venc modes etc. It is also used for switching the output of the pipeline to different video compositors.

  • Frame Buffer Driver

This driver is registered with the FBDEV subsystem, and is responsible for managing the graphics layer frame buffer. Driver creates /dev/fb0, /dev/fb1 and /dev/fb2 as the device nodes. Application can open these device nodes to open the driver and negotiate parameters with the driver through frame buffer ioctls. Application maps driver allocated buffers in the application memory space and fills them for the driver to display.

  • 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[edit]

Opening and Closing of Driver[edit]

The device can be opened using open call from the application, with the device name and mode of operation as parameters. Application can open the driver only in blocking mode. Non-blocking mode of open is not supported.

  • FBDEV Driver

The driver will expose three software channels (/dev/fb0, /dev/fb1, /dev/fb2) for the graphics pipeline.

<syntaxhighlight lang='c'> /* Open a graphics Display logical channel in blocking mode */ fd = open ("/dev/fb0", O_RDWR); if (fd == -1) {

   perror("failed to open display device\n");
   return -1;

}

/* ... */

/* Closing of channels */ close (fd); </syntaxhighlight>


  • V4L2 Driver

The driver will expose three software channels (/dev/video1, /dev/video2 and /dev/video3), one for each video pipeline. All of these channels supports only blocking mode of operations.


<syntaxhighlight lang='c'> /* Open a video Display logical channel in blocking mode */ fd = open ("/dev/video1", O_RDWR); if (fd == -1) {

   perror("Failed to open display device\n");
   return -1;

} /* Closing of channel */ close (fd); </syntaxhighlight>

Command Line arguments[edit]

Command Line Arguments
Argument Description
vram Total framebuffer memory reserverd for the Fbdev driver


Following example shows how to specify total framebuffer size as boot time argument

setenv bootargs console=ttyO2,115200n8 mem=128M noinitrd root=/dev/nfs nfsroot=nfs-server/home,nolock ip=dhcp vram=50M


FBDEV Driver[edit]

FBDEV driver supports set of command line argument for size of vram and debug option. These argument are only specified at the time of inserting the driver since FBDev driver only supports dynamic build.


Below is the list of arguments which Fbdev driver supports -

Fbdev Driver Command Line Arguments
Argument Description
vram VRAM allocated memory for a framebuffer, user can individually configure VRAM buffers for each plane/device node
debug Enable Fbdev driver debug messaging

Following example shows how to specify size of framebuffer:

$ insmod ti81xxfb.ko vram=0:16M,1:16M,2:6M


Following example shows how to enable debug of Fbdev:

$ insmod ti81xxfb.ko debug=1

V4L2 Driver[edit]

V4L2 driver supports set of command line argument for default number of buffers, their buffer size, and debug option for both the video pipelines. These argument are only specified at the time of inserting the driver since V4L2 driver only supports dynamic build.



Below is the list of arguments which V4L2 driver supports -


V4L2 Driver Command Line Arguments
Argument Description
video1_numbuffers Number of buffers to be allocated at init time for Video1 device
video2_numbuffers Number of buffers to be allocated at init time for Video2 device
video3_numbuffers Number of buffers to be allocated at init time for Video3 device
video1_bufsize Size of the buffer to be allocated for video1 device, no bigger than 4MB
video2_bufsize Size of the buffer to be allocated for video2 device, no bigger than 4MB
video3_bufsize Size of the buffer to be allocated for video3 device, no bigger than 4MB
video3_memtype memory type for video 3 device(0:non-tiled memory, 1:tiled memory). video1 and video2 device supports non-tiled memory only
debug Enable debug messaging



Insert the dynamically built module with following parameters:

# insmod ti81xxvo.ko video1_numbuffers=3 video2_numbuffers=3 video1_bufsize=4149248 video2_bufsize=4149248


Following example shows how to enable debug of V4L2:

$ insmod ti81xxvo.ko debug=1


VPSS Driver[edit]

VPSS driver supports set of command line argument for mode, tied venc, venc clock source. These argument are only specified at the time of inserting the driver since VPSS only supports dynamic build.


Below is the list of arguments which VPSS driver supports -

VPSS Driver Command Line Arguments
Argument Description
clksrc clock source for hdmi/dvo2/hdcomp VENC. By default, hdmi and dvo2 VENC share the d clock input while hdcomp uses the a clock input.

hdmi:dclk/dclkdiv2/dclkdiff,hdcomp:dclk/dclkdiv2/dclkdiff/aclk/aclkdiv2/aclkdiff,dvo2:dclk/dclkdiv2/dclkdiff/aclk/aclkdiv2/aclkdiff

debug Enable VPSS Driver debug messaging
i2c_mode choose the control source for the external i2c-based video devices, by default it is A8. when i2c_mode is set to 1, M3 controls external i2c-based video devices and it requires a special M3 fimrware, which is not part of PSP release.
mode Default video mode for specified VENC(hdmi,dvo2,sd)

if mode is not assigned during the boot time, driver uses the following mode: hdmi: 1080p-60,dvo2:1080p-60, sd:ntsc

tiedvencs OR value of the VENCs(1:hdmi venc,4:dvo2 venc, 8:sd venc)
sbufaddr Physical DDR address of the sharing buffer between Processor A8 and M3. This sharing buffer is used as payload to store FVID2 structurs communicated bewteen A8 and M3. The buffer must be non-cacheable DDR from Ducati side and should not be accessed by any other software components.

This buffer should be predefined in the M3 Fimrware.

sbufsize Size of the sharing buffer between processor A8 and M3.
timeout timeout value(ms) to be set in driver to determine how long driver should wait the response from M3. If it is set to zero, driver waits infinitely. By default, this is set to 2000 ms



Following example shows how to specify HDMI VENC mode as module argument:

$ insmod vpss.ko mode=hdmi:1080p-60


Following example shows how to tie hdmi(1) venc and dvo2(4) venc together as module argument:

  • NOTE: Application should make sure the tied vencs have the same timing. VPSS driver does not check for this.
$ insmod vpss.ko tiedvencs=5


Following example shows how to set up the sharing buffer address

  • NOTE: If sbufaddr is not set, driver sets buffer base address to 0xA0200000 .
$insmod vpss.ko sbufaddr=0xA0200000



Following example shows how to set up the sharing buffer size. This size can not be over 2MB.

  • NOTE: If sbufsize is not set, driver sets buffer size equal to 2MB.
$insmod vpss.ko sbufsize=1024K


Below is the list of arguments of clksrc supports

VPSS Driver Clock Source Arguments
Argument Description
dclk clk1x/dvo1_clk/dvo2_clk/vbi_clk_hd uses hd_venc_d_clk as clock source
dclkdiv2 clk1x/dvo1_clk/dvo2_clk/vbi_clk_hd used hd_venc_d_clk/2 as clock source
dclkdiff clk1x uses hd_venc_d_clk/2 as clocksource, while dvo1_clk/dvo2_clk/vbi_clk_hd used hd_venc_d_clk as clock source
aclk clk1x/dvo2_clk/vbi_clk_hd uses hd_venc_a_clk as clock source
aclkdiv2 clk1x/dvo2_clk/vbi_clk_hd uses hd_venc_a_clk/2 as clock source
aclkdiff clk1x uses hd_vencc_a_clk/2 as clock source while dvo2_clk/vbi_clk_hd uses hd_venc_a_clk as clock source

Following example show how to choose a clock as the source clock of DVO2 VENC.

$ insmod vpss.ko clksrc=dvo2:aclk

Following example show how to enable debug of VPSS driver

$ insmod vpss.ko debug=1

Buffer Management[edit]


FBDEV Driver[edit]

Memory requirement for FBDEV driver
Driver FB0 FB1 FB2
Fbdev Driver A single buffer of size 1920*1080*4*2 bytes, can be changed through bootargs 0 bytes if app does not assign size for this node through bootargs 0 bytes if app does not assign size for this node through bootargs


FBDEV driver supports only memory mapped buffers. Driver allocates one physically contiguous buffers for each node, which can support up to 1920x1080 resolution 32 bpp format. By default, driver only allocates the memory for FB0(dev/fb0) node. Application need set the memory size if accessing /dev/fb1 and /dev/fb2 when loading FBDev modules.


Set Frame Buffer size for FB Nodes

$ insmod ti81xxfb.ko vram=0:XXM,1:YYM,2:ZZM

Following steps are required to map buffers in application memory space.


Getting fix screen information <syntaxhighlight lang='c'>FBIOGET_FSCREENINFO</syntaxhighlight> ioctl is used to get the not-changing screen information like physical address of the buffer, size of the buffer, line length.

<syntaxhighlight lang='c'> /* Getting fix screen information */ struct fb_fix_screeninfo fix;

ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix); if (ret < 0) {

   printf("FBIOGET_FSCREENINFO\n");
   close(fd);
   exit(0);

}

printf("Line length = %d\n", fix.line_length); printf("Physical Address = %x\n", fix.smem_start); printf("Buffer Length = %d\n", fix.smem_len); </syntaxhighlight>


Getting Variable screen information <syntaxhighlight lang='c'>FBIOGET_VSCREENINFO</syntaxhighlight> ioctl is used to get the variable screen information like resolution, bits per pixel etc... <syntaxhighlight lang='c'> /* Getting fix screen information */ struct fb_var_screeninfo var;

if (ioctl(fd, FBIOGET_VSCREENINFO, &var) < 0) {

   printf("FBIOGET_VSCREENINFO\n");
   close(fd);
   exit(0);

}

printf("Resolution = %dx%d\n", var.xred, var.yres); printf("bites per pixel = %d\n", var.bpp); </syntaxhighlight>


Mapping Kernel space address to user space <syntaxhighlight lang='c'>mmap</syntaxhighlight> Mapping the kernel buffer to the user space can be done via mmap system call. <syntaxhighlight lang='c'> /* addr hold the user space address */ unsigned int addr, buffersize;

/* Get the fix screen info */

/* Get the variable screen information */

buffersize = fix.line_length * var.yres; addr = mmap(NULL, buffersize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); </syntaxhighlight>


V4L2 Driver[edit]

Memory requirement for V4L2 driver
Driver video1 video2 video3
V4L2 Driver three buffers of size 4MB each, can be changed by module parameters. three buffers of size 4MB each, can be changed by module parameters.. three buffers of size 720x576*2 bytes each, can be changed by module parameters.

Memory Mapped buffer mode and User pointer buffer mode are the two memory allocation modes supported by driver. In Memory map buffer mode, application can request memory from the driver by calling VIDIOC_REQBUFS ioctl. In this mode, maximum number of buffers is limited to VIDEO_MAX_FRAME (defined in driver header files) and is limited by the available memory in the kernel. If driver is not able to allocate the requested number of buffer, it will return the number of buffer it is able to allocate.

NOTE: Memoy Mapped buffer mode only support non-tiled memmory allocation with MAX size 4MB. User pointer buffer mode must be use if applicaiton want to use either tiled memory or buffer size bigger than 4MB.


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

  • Allocating Memory

<syntaxhighlight lang='c'>VIDIOC_REQBUFS</syntaxhighlight>

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 <syntaxhighlight lang='c'>v4l2_requestbuffers</syntaxhighlight> 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.

It can be called with zero number of buffers to free up all the buffers already allocated. It also frees allocated buffers when application changes buffer exchange mechanism. Driver always allocates buffers of maximum image size supported. If application wants to change buffer size, it can be done through video1_buffsize and video2_buffsize command line arguments.


<syntaxhighlight lang='c'> /* structure to store buffer request parameters */ struct v4l2_requestbuffers reqbuf; reqbuf.count = numbuffers; reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; reqbuf.memory = V4L2_MEMORY_MMAP; ret = ioctl(fd , VIDIOC_REQBUFS, &reqbuf); if(ret < 0) {

   printf("cannot allocate memory\n");
   close(fd);
   return -1;

} </syntaxhighlight>

  • Getting physical address

<syntaxhighlight lang='c'>VIDIOC_QUERYBUF</syntaxhighlight>

This ioctl is used to query buffer information like buffer size and buffer physical address. This physical address is used in m-mapping the buffers. This ioctl is necessary for driver buffer mode as it provides the physical address of buffers, which are used to mmap system call the buffers.

It takes a pointer to instance of v4l2_buffer structure as an argument. User has to specify the buffer type (V4L2_BUF_TYPE_VIDEO_OUTPUT), buffer index, and memory type (V4L2_MEMORY_MMAP)at the time of querying.


<syntaxhighlight lang='c'> /* allocate buffer by VIDIOC_REQBUFS */ /* structure to query the physical address of allocated buffer */ struct v4l2_buffer buffer; /* buffer index for querying -0 */ buffer.index = 0; buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; buffer.memory = V4L2_MEMORY_MMAP; if (ioctl(fd, VIDIOC_QUERYBUF, &buffer) < 0) {

   printf("buffer query error.\n");
   close(fd);
   exit(-1);

} /*The buffer.m.offset will contain the physical address returned from driver*/ </syntaxhighlight>


  • Mapping Kernel space address to user space

<syntaxhighlight lang='c'>mmap</syntaxhighlight>

Mapping the kernel buffer to the user space can be done via mmap. User can pass buffer size and physical address of buffer for getting the user space address


<syntaxhighlight lang='c'> /* allocate buffer by VIDIOC_REQBUFS */ /* query the buffer using VIDIOC_QUERYBUF */ /* addr hold the user space address */ unsigned int addr; addr = mmap(NULL, buffer.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buffer.m.offset); /* buffer.m.offset is same as returned from VIDIOC_QUERYBUF */

</syntaxhighlight>

Transparency Keying[edit]

The encoded pixel color value is compared to the application defined transparency color key(RGB888) based the LSB bits mask set by the application to determine whether the pixel is to be transparent or not. There are four types of the bit mask offered by the hardware: No Masking, whole pixel color value is compared to the transparency color key; Mask[0]: MSB[7:1] of the encoded pixel color value is compared to the corresponding 7 bits of transparency color key; MASK[1:0]: MSB[7:2] of the encoded pixel color value is compared to the corresponding bits of transparency color key; MAKS[2:0]: MSB[7:3] of the encoded pixel color value is compared to the corresponding bits of transparency color key.

User can enable/disable color key function, set color keying and mask type through Fbdev Driver private IOCTL interface, V4L2 IOCTL or Sysfs. FBDev is used to configure the transparency of graphics pipeline while V4L2/Syfs is used to configure the transparency of video pipeline.

Using fbdev IOCTL[edit]

  • Enable Transparency Keying:

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp;

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); }

/* Enable the Transparency Keying */ regp.transen = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>

  • Disable Transparency Keying:

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp;

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); }

/* Disable the Transparency Keying */ regp.transen = TI81XXFB_FEATURE_DISABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>

  • Set Transparency Keying Value(RGB888):

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; u8 key_rgb888; /*RGB888 format*/

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /* Set the Transparency Keying */ regp.transcolor = key_rgb888; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>

  • Set Transparency Keying Mask Type:

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; struct ti81xxfb_transparancy_type trans_type;

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); }

/* Set the Transparency Keying Mask type */ regp.transtype= trans_type; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>

Using V4L2 IOCTL[edit]

  • NOTE:: /dev/video3 does not support transparency.


  • Enable the transparency Keying

<syntaxhighlight lang='c'> struct v4l2_framebuffer framebuffer; ret = ioctl (fd, VIDIOC_G_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_G_FBUF");
   close(fd);
   exit(1);

} /* Set SRC_COLOR_KEYING if device supports that */ if(framebuffer.capability & V4L2_FBUF_CAP_SRC_CHROMAKEY) {

   framebuffer.flags |= V4L2_FBUF_FLAG_SRC_CHROMAKEY;
   framebuffer.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY;
   ret = ioctl (fd, VIDIOC_S_FBUF, &framebuffer);
   if (ret < 0) {
       perror ("VIDIOC_S_FBUF");
       close(fd);
       exit(1);
   }

} </syntaxhighlight>

  • Disabling the Transparency Keying:

<syntaxhighlight lang='c'> struct v4l2_framebuffer framebuffer; ret = ioctl (fd, VIDIOC_G_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_G_FBUF");
   close(fd);
   exit(1);

} if(framebuffer.capability & V4L2_FBUF_CAP_SRC_CHROMAKEY) {

   framebuffer.flags &= ~V4L2_FBUF_FLAG_SRC_CHROMAKEY;
   ret = ioctl (fd, VIDIOC_S_FBUF, &framebuffer);
   if (ret < 0) {
       perror ("VIDIOC_S_FBUF");
       close(fd);
       exit(1);
   }

} </syntaxhighlight>


  • Set the Transparency Keying value(RGB888,).

<syntaxhighlight lang='c'> struct v4l2_format fmt; u8 chromakey = R>>16 | G>>8 | B; /* Chromakey is RGB888 format */ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; ret = ioctl(fd, VIDIOC_G_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_G_FMT\n");
   close(fd);
   exit(0);

} fmt.fmt.win.chromakey = chromakey; ret = ioctl(fd, VIDIOC_S_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_G_FMT\n");
   close(fd);
   exit(0);

} </syntaxhighlight>

  • Get the Transparency Keying value.

<syntaxhighlight lang='c'> struct v4l2_format fmt; fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; ret = ioctl(fd, VIDIOC_G_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_G_FMT\n");
   close(fd);
   exit(0);

} printf("Croma value read is %d\n", fmt.fmt.win.chromakey); </syntaxhighlight>


Using Sysfs[edit]

Sysfs is only valid for video devices(not for graphcis devices).

  • NOTE: /dev/video3(/sys/devices/platform/vpss/video2) does not support transparency.
  • Enable/Disable the Transparency keying
echo 0/1 > /sys/devices/platform/vpss/video#/trans_key_enabled
       where 0/1: 0 - > disable, 1 - > enable
       #: 0-1 video device


  • Set the Transparency Keying Value (RGB888 format, hex only)
echo  0xRRBBGG> /sys/devices/platform/vpss/video#/trans_key_value
      where #: 0-1 video device
  • Set the Transparency Keying Mask type

number of LSB bits to maks when checking for pixel color keying

echo  0/1/2/3 > /sys/devices/platform/vpss/video#/trans_key_type
       where 0: no maksing, 1: mask 1 LSB bit,2: mask 2 LSB bits;3: mask 3 LSB bits
       #: 0-1 video device

Alpha Blending[edit]

Alpha blending is a process of blending a foreground color with a background color and producing a new blended color. New blended color depends on the transparency factor referred to as alpha factor of the foreground color. If the alpha factor is 100% then blended image will have only foreground color. If the alpha factor is 0% blended image will have only back ground color. Any value between 0 to 100% will blend the foreground and background color to produce new blended color depending upon the alpha factor.

Alpha blending with almost 50% transparency
Alpha blending with almost 100% transparency
Alpha blending with almost 0% transparency



Both Graphics pipelines and Video pipelines of the VPSS are capable of supporting alpha blending. Graphics pipeline supports three types of alpha blending, global, palette and pixel alpha blending while Video pipeline only support global blending. RGB formtas of graphics pipeline support global alpha blending, BMP formats of graphcis pipeline support palette alpha blending, ARGB and RGBA formats of graphics pipeline supports pixel based alpha blending. In which A represent the alpha value for each pixel. Thus, each pixel can have different alpha value. While global alpha is the constant alpha factor for the pipeline for all the pixels.


FBDev IOCTL[edit]

  • Disable alpha blending


<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /*Disable Alpha Blending*/ regp.blendtype = TI81XXFB_BLENDING_NO; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>


  • Global Alpha blending

User can configure global alpha value either through FBDEV ioctl.

Below programlisting shows how to set the global alpha value for graphics pipeline.


<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; u8 alpha; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /*Set Global Alpha Blending*/ regp.blendtype = TI81XXFB_BLENDING_GLOBAL; regp.blendalpha = alpha; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>


  • Pixel Based Alpha blending

FBDEV driver supports alpha blending through ARGB/RGBA pixel format

Below programlisting shows how to set the pxiel alpha value for graphics pipeline.


<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /*Set Pixel Alpha Blending*/ regp.blendtype = TI81XXFB_BLENDING_PIXEL; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>


  • Palette Based Alpha blending

FBDEV driver supports alpha blending through CLUT data, data must be BMP format.

Below programlisting shows how to set the palette alpha value for graphics pipeline.


<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /*Set Palette Alpha Blending*/ regp.blendtype = TI81XXFB_BLENDING_PALETTE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS.\n");
   close(fd);
   exit(1);

} </syntaxhighlight>

V4L2 IOCTLs[edit]

  • NOTE:: /dev/video3 does not support alpha blending.


  • Eenable alpha blending

<syntaxhighlight lang='c'> struct v4l2_framebuffer framebuffer; ret = ioctl (fd, VIDIOC_G_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_S_FBUF");
   close(fd);
   return 0;

} framebuffer.flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA; ret = ioctl (fd, VIDIOC_S_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_S_FBUF");
   close(fd);
   return 0;

} </syntaxhighlight>


  • Disable alpha blending

<syntaxhighlight lang='c'> struct v4l2_framebuffer framebuffer; ret = ioctl (fd, VIDIOC_G_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_S_FBUF");
   close(fd);
   return 0;

} framebuffer.flags &= ~V4L2_FBUF_FLAG_LOCAL_ALPHA; ret = ioctl (fd, VIDIOC_S_FBUF, &framebuffer); if (ret < 0) {

   perror ("VIDIOC_S_FBUF");
   close(fd);
   return 0;

} </syntaxhighlight>


  • Set the global alpha value

<syntaxhighlight lang='c'> struct v4l2_format fmt; u8 global_alpha = 128; fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; ret = ioctl(fd, VIDIOC_G_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_G_FMT\n");
   close(fd);
   exit(0);

} fmt.fmt.win.global_alpha = global_alpha; ret = ioctl(fd, VIDIOC_S_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_G_FMT\n");
   close(fd);
   exit(0);

} </syntaxhighlight>

Using Sysfs [edit]

This section is for video device only(not for graphics device)

  • NOTE: /dev/video3(/sys/devices/platform/vpss/video2) does not support alpha blending.
  • Enable/disable alpha blending
# echo 0/1 > /sys/devices/platform/vpssss/video#/alpha_blending_enabled

Where,
      0/1   => 0 - Disable, 1 - Enable.
      #: 0-1 Video device


  • Set the global alpha value
# echo 0-255> /sys/devices/platform/vpss/video#/global_alpha

Where,
      #: 0-1 Video device

Scaling [edit]

FBDEV IOCTL[edit]

Graphics pipelines support 0.25x-4x scaling with a step size of 0.01. The scalar has 5tap/8phase polyphase horizontal filter and 4taps/8phase polyphase vertical filter. Meanwhile, When the target display of the graphics pipeline conncted to is in a interlaced scan mode, graphics pipeline could also performs anti-flicker filtering using the including scalar. This can be achieved by seting scaling ratio 1.

Below shows how to enable the scaling feature

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); }

regp.scalaren = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

Below shows how to disable the scaling feature

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } regp.scalaren = TI81XXFB_FEATURE_DISABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

NOTE
TIFB_SET_SCINFO ioctl must be called before enabling the scaling feature. See Custom_IOCTLs[1] for details.

V4L2 IOCTL[edit]

This function is not available for V4L2 Driver.

Stenciling[edit]

Graphics pipelines supports a 1-bit for each pixel of a image that has "stenciling" feature enabled. This bit is used to force the alpha value of the pixel to ZERO in order to "mask"-off the pixel(such as transparent).

Video pipelines do not support stenciling function. Below shows how to enable the stenciling feature

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } regp.stencilingen = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

Below show how to disable the stenciling feature

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } regp.stencilingen = TI81XXFB_FEATURE_DISABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

NOTE
TIFB_ALLOC and TIFB_SET_STENC ioctl must be called before enabling the scaling feature. See Section 5.1.3 for details.

Bound Box Blending[edit]

Graphics piplelines support overwriting alpha values of piels that make up a 1-pixel wide boundary box of a image with a semi-transparnt value(0x80,default) so the flickering around the edges can be minimized.

Video pipelines does not support bound box function.

Below shows how to enable boundbox feature and change the bound box alpha value <syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } regp.bbalpha = 0x40; regp.bben = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

Below shows how to disable boundbox feature <syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } regp.bben = TI81XXFB_FEATURE_DISABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) { perror("TIFB_SET_PARAMS\n");

       close(fd);

exit(1); } </syntaxhighlight>

Buffer Format[edit]

Buffer format describes the pixel format in the image. It also describes the memory organization of each color component within the pixel format.


FBDEV Driver[edit]

In all buffer formats, blue value is always stored in least significant bits, then green value and then red value. The alpha value stored is up to the RGBA or ARGB format.


Graphics pipeline supports following buffer format: RGB565, ARGB1555, RGBA5551, ARGB4444,RGBA4444, ARGB6666, RGBA6666, RGB888, ARGB8888 and RGBA8888. Moreover graphics pipeline supports 1/2/4/8 BMP format. Buffer format can be changed in FBDEV driver by using bpp, red, green, ,blue and transparency fields of fb_vscreeninfo structure and ioctl FBIOPUT_VSCREENINFO. Application needs to specify bits per pixel and length and offset of red, green, blue and transparnecy component to let driver know the right pixel format.


Extra care must be taken by the application when dealing with 1/2/4 BMP format. Graphis pipeline support 8 different 1b BMP formats, 4 different 2b BMP formats and 2 different 4b BMP formats. By default, if bits_per_pixel was assigned to 1, TI81XXFB_BMP1_OFF0 format will be used by the driver. if bits_per_pixel was assigned to 2, TI81XXFB_BMP2_OFF0 will be used by the driver. If bits_per_pixel was assigend to 4, TI81XXFB_BMP1_L will be used by the driver. If default value is not meeting application's requirements, please use nonstd filed in the fb_vscreeninfo structure to set the right 1/2/4 BMP format. Do not forget to set nonstd to 0 when switching to different pixel format.

Following example shows how to ARGB666 bits per pixels.

<syntaxhighlight lang='c'> struct fb_varscreeninfo var; if (ioctl(fd, FBIOGET_VSCREENINFO, &var) < 0) {

   perror("FBIOGET_VSCREENINFO\n");
   close(fd);
   exit(0);

} var.bpp = 24; var.red.length = var.green.length = var.blue.length = var.transp.length = 4; var.transp.offset = 18; var.red.offset = 12; var.green.offset = 6; var.blue.offset = 0; if (ioctl(fd, FBIOPUT_VSCREENINFO, &var) < 0) {

   perror("FBIOPUT_VSCREENINFO\n");
   close(fd);
   exit(0);

} </syntaxhighlight>


Buffer Formats

RGB565 Data Memory Organization
ARGB1555 Data Memory Organization
ARGB444 Data Memory Organization
RGBA5551 Data Memory Organization
RGBA4444 Data Memory Organization
RGB888 Data Memory Organization
ARGB6666 Data Memory Organization
RGBA6666 Data Memory Organization
ARGB8888 Data Memory Organization
RGBA8888 Data Memory Organization
BPP8 Data Memory Organization
BPP4 LOWER Data Memory Organization
BPP4 UPPER Data Memory Organization
BPP2 OFFSET0 Data Memory Organization
BPP2 OFFSET1 Data Memory Organization
BPP2 OFFSET2 Data Memory Organization
BPP2 OFFSET3 Data Memory Organization
BPP1 OFFSET0 Data Memory Organization
BPP1 OFFSET1 Data Memory Organization
BPP1 OFFSET2 Data Memory Organization
BPP1 OFFSET3 Data Memory Organization
BPP1 OFFSET4 Data Memory Organization
BPP1 OFFSET5 Data Memory Organization
BPP1 OFFSET6 Data Memory Organization
BPP1 OFFSET7 Data Memory Organization



V4L2 Driver[edit]

video layer supports following buffer format: YUYV and Y/UV. The corresponding v4l2 defines for pixel format are V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_NV12, V4L2_PIX_FMT_NV16. Buffer format can be changed using VIDIOC_S_FMT ioctl with type as V4L2_BUF_TYPE_VIDEO_OUTPUT and appropriate pixel format type.

Video Deviceo Buffer Format
Buffer Format /dev/video1 /dev/video2 /dev/video3
V4L2_PIX_FMT_YUYV Y Y Y
V4L2_PIX_FMT_NV12 N N Y
V4L2_PIX_FMT_NV16 N N Y
  • NOTE:: For the NV12/NV16 format, even the Y and UV(CbCr) components are stored separated, the buffer address of Y and UV(CbCr) component should be continuous or driver can not handle these two formats.

Following example shows how to change pixel format to YUYV


struct v4l2_format fmt;
fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
ret = ioctl(fd, VIDIOC_S_FMT, &fmt);
if (ret < 0) {
    perror("VIDIOC_S_FMT\n");
    close(fd);
    exit(0);
}


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

Display Position of Graphics[edit]

FBDev IOCTL[edit]

The display position of graphics pipeline is able to changed within the resolution defined by the VENCs which graphics pipiline is connected.

Following example shows how to change display position graphics.

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) { perror("TIFB_GET_PARAMS\n");

       close(fd);

exit(1); } /*Set the Display position*/ regp.pos_x = 10; regp.pos_y = 20; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

   perror ("TIFB_SET_PARAMS\n");
   close(fd);
   exit(1);

} </syntaxhighlight>


V4L2 IOCTL[edit]

The video pipelines can be connected to various output interface through SYSFS interface. Although the display Driver computes a default display window whenever the image size or cropping is changed, an application should position the display window via the VIDIOC_S_FMT I/O control with the V4L2_BUF_TYPE_VIDEO_OVERLAY buffer type. When a switch from one display interface to the onther happens, an application is expected to adjust the display window. V4L2 driver only supports change of display window.

Following example shows how to change display window size.

<syntaxhighlight lang='c'> struct v4l2_format fmt; Fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; fmt.fmt.win.w.left = 0; fmt.fmt.win.w.top = 0; fmt.fmt.win.w.width = 200; fmt.fmt.win.w.height = 200; ret = ioctl(fd, VIDIOC_S_FMT, &fmt); if (ret < 0) {

   perror("VIDIOC_S_FMT\n");
   close(fd);
   exit(0);

} /* Display window size and position is changed now */ </syntaxhighlight>

  • NOTE:: the width and height should match the width and height of the VIDIOC_S_FMT I/O control with the V4L2_BUF_TYPE_VIDEO buffer type if cropping is no used; the width and height should match the width and height of the VIDIOC_S_CROP I/O control with V4L2_BUF_TYPE_VIDEO buffer type if cropping is used, otherwise driver reports error back to caller.


Cropping[edit]

The V4L2 Driver allows an application to define a rectangular portion of the image to be rendered via the VIDIOC_S_CROP Ioctl with the V4L2_BUF_TYPE_VIDEO_OUTPUT 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 and display windows size. The default cropping rectangle is centered in the image. All cropping dimensions are rounded down to even numbers. Changing the size of the cropping rectangle will in general also result in a new default display window. As stated above, an application must adjust the display window accordingly.

Following example shows how to change crop size.

<syntaxhighlight lang='c'> struct v4l2_crop crop; crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 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 */ </syntaxhighlight>


Color look table[edit]

The graphics pipeline supports the color look up table. The CLUT mode uses the encoded pixel values from the input image as pointers to index the 32-bit-wide CLUT value: 1-BPP pixels address 2 entries, 2-BPP pixels address 4 entries, 4-BPP pixels address 16 entries, and 8-BPP pixels address 256 entries.

Driver supports 1, 2, 4 and 8 bits per pixel image format using color lookup table. FBIOPUTCMAP and FBIOGETCMAP can be used to set and get the color map table. When CLUT is set, the driver makes the hardware to reload the CLUT.

Following example shows how to change CLUT.

<syntaxhighlight lang='c'> struct fb_cmap cmap; unsigned short r[256]={0xFF, 0x00, 0x00, 0xFF}; unsigned short g[256]={0x00, 0xFF, 0x00, 0xFF}; unsigned short b[256]={0x00, 0x00, 0xFF, 0x00}; unsigned short t[256]={0xFF, 0xFF, 0xFF, 0xFF}; cmap.len = 256; cmap.red = r; cmap.green = g; cmap.blue = b; cmap.transp = t; if (ioctl(fd, FBIOPUTCMAP, &cmap)) {

   perror("FBIOPUTCMAP\n");
   close(fd);
   exit(3);

} </syntaxhighlight>


Streaming[edit]

V4L2 driver supports the streaming of the buffer. To do streaming minimum of three buffers should be requested by the application by using VIDIOC_REQBUFS ioctl. Once driver allocates the requested buffers application should call VIDIOC_QUERYBUF and mmap to get the physical address of the buffers and map the kernel memory to user space as explained earlier. Following are the steps to enable streaming.


  1. Fill the buffers with the image to be displayed in the proper format
  2. Queue buffers to the driver queue using VIDIOC_QBUF ioctl
  3. Start streaming using VIDIOC_STREAMON ioctl
  4. Call VIDIOC_DQBUF to get the displayed buffer
  5. Repeat steps 1, 2, 4 and 5 in a loop for the frame count to be displayed
  6. Call VIDIOC_STREAMOFF ioctl to stop streaming


Following example shows how to do streaming with V4l2 driver

<syntaxhighlight lang='c'> /* Initially fill the buffer */ struct v4l2_requestbuffers req; struct v4l2_buffer buf; struct v4l2_format fmt; /* Fill the buffers with the image */ /* Enqueue buffers */ for (i = 0; i < req.count; i++) {

   buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
   buf.index = i;
   buf.memory = V4L2_MEMORY_MMAP;
   ret = ioctl(fd, VIDIOC_QBUF, &buf);
   if (ret < 0) {
       perror("VIDIOC_QBUF\n");
       for (j = 0; j < req.count; j++){
           /* Unmap all the buffers if call fails */
           exit(0);
       }
       printf("VIDIOC_QBUF = %d\n",i);
   }

} /* Start streaming */ a = 0; ret = ioctl(fd, VIDIOC_STREAMON, &a); if (ret < 0) {

   perror("VIDIOC_STREAMON\n");
   for (i = 0; i < req.count; i++)
       /* Unmap all the buffers if call fails */
   exit(0);

} /* loop for streaming with 500 Frames*/ for(i = 0 ;i < LOOPCOUNT ;i ++) {

   ret = ioctl(fd, VIDIOC_DQBUF, &buf);
   if(ret < 0){
       perror("VIDIOC_DQBUF\n");
       for (j = 0; j < req.count; j++){
           /* Unmap all the buffers if call fails */
       }
       exit(0);
   }
   /* Fill the buffer with new data
   fill(buff_info[buf.index].start, fmt.fmt.pix.width, fmt.fmt.pix.height,0);
   /Queue the buffer again */
   ret = ioctl(fd, VIDIOC_QBUF, &buf);
   if(ret < 0){
       perror("VIDIOC_QBUF\n");
       for (j = 0; j < req.count; j++){
            /* Unmap all the buffers if call fails */
       }
       exit(0);
   }

} /* Streaming off */ ret = ioctl(fd, VIDIOC_STREAMOFF, &a); if (ret < 0) {

   perror("VIDIOC_STREAMOFF\n");
   for (i = 0; i < req.count; i++){
       /* Unmap all the buffers if call fails */
   exit(0);

} </syntaxhighlight>


Software Interfaces[edit]

Frame-Buffer Driver Interface[edit]

Application Interface[edit]

open ()
To open a framebuffer device
close ()
To close a framebuffer device
ioctl ()
To send ioctl commands to the framebuffer driver.
mmap ()
To obtain the framebuffer region as mmap'ed area in user space.

Supported Standard IOCTLs[edit]

FBIOGET_VSCREENINFO, FBIOPUT_VSCREENINFO
These I/O controls are used to query and set the so-called variable screen info. This allows an application to query or change the display mode, including the color depth, resolution, timing etc. These I/O controls accept a pointer to a struct fb_var_screeninfo structure. The video mode data supplied in the fb_var_screeninfo struct is translated to values loaded into the display controller registers.


FBIOGET_FSCREENINFO
This I/O control can be used by applications to get the fixed properties of the display, e.g. the start address of the framebuffer memory. This I/O control accepts a pointer to a struct fb_fix_screeninfo.


FBIOGETCMAP, FBIOPUTCMAP
These I/O controls are used to get and set the color-map for the framebuffer. These I/O controls accept a pointer to a struct fb_cmap structure. TI81XX supports 256*32(RGBT) color-map, so the len of the fb_cmap should be 256, or driver returns error.


FBIO_BLANK
This I/O control is used to blank or unblank the framebuffer console.


FBIO_WAITFORVSYNC
This I/O control is used to put an application to sleep until next vertical sync interval of the display.


Supported Custom IOCTLs[edit]

TIFB_GET_PARAMS
Ioctl returns the parameters of the current graphics features.

Data Structure: <syntaxhighlight lang='c'> enum ti81xxfb_status {

TI81XXFB_FEATURE_DISABLE = 0,
TI81XXFB_FEATURE_ENABLE

};

enum ti81xxfb_blending_type {

/*alpha blending disable*/
TI81XXFB_BLENDING_NO = 0,
/* global alpha blending*/
TI81XXFB_BLENDING_GLOBAL,
/* PALETTE alpha blending, the alpha value in CLUT is used for blending*/
TI81XXFB_BLENDING_PALETTE,
 /*PIXEL alpha blending, valid for ARGB/RGBA format only, the embedded alpha value is used*/
TI81XXFB_BLENDING_PIXEL

};

enum ti81xxfb_transparancy_type {

/*when performing color comparison, no MASK*/
TI81XXFB_TRANSP_LSPMASK_NO = 0,
/*MASK the LSB bit0 for each color component*/
TI81XXFB_TRANSP_LSPMASK_1,
/*MASK the LSB bit[1:0] for each color component*/
TI81XXFB_TRANSP_LSPMASK_2,
/*MASK the LSB bit[2:0] for each color component*/
TI81XXFB_TRANSP_LSMMASK_3

};

struct ti81xxfb_region_params {

__u16 				ridx;
__u16 				pos_x;
__u16 				pos_y;
__u16 				priority;
/*enum ti81xxfb_status*/
__u32		  		firstregion;
/*enum ti81xxfb_status*/
__u32				lastregion;
/*enum ti81xxfb_status*/
__u32		  		scalaren;
/*enum ti81xxfb_status*/
__u32		  		stencilingen;
/*enum ti81xxfb_status*/
__u32				bben;
/*enum ti81xxfb_status*/
__u32		  		transen;
/*enum ti81xxfb_blending_type*/
__u32				blendtype;
/*enum ti81xxfb_transparancy_type*/
__u32 				transtype;
__u32  			transcolor;
__u8  				bbalpha;
__u8   			blendalpha;
__u8				reserved[2];

}; </syntaxhighlight>

  • NOTE: firstregion and lastregion must be set to 1, these two fields are reserved for future usages.

Usage: <syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>
TIFB_SET_PARAMS
Ioctl set the current graphics features.

Data Structure: <syntaxhighlight lang='c'> enum ti81xxfb_status {

TI81XXFB_FEATURE_DISABLE = 0,
TI81XXFB_FEATURE_ENABLE

};

enum ti81xxfb_blending_type {

/*alpha blending disable*/
TI81XXFB_BLENDING_NO = 0,
/* global alpha blending*/
TI81XXFB_BLENDING_GLOBAL,
/* PALETTE alpha blending, the alpha value in CLUT is used for blending*/
TI81XXFB_BLENDING_PALETTE,
 /*PIXEL alpha blending, valid for ARGB/RGBA format only, the embedded alpha value is used*/
TI81XXFB_BLENDING_PIXEL

};

enum ti81xxfb_transparancy_type {

/*when performing color comparison, no MASK*/
TI81XXFB_TRANSP_LSPMASK_NO = 0,
/*MASK the LSB bit0 for each color component*/
TI81XXFB_TRANSP_LSPMASK_1,
/*MASK the LSB bit[1:0] for each color component*/
TI81XXFB_TRANSP_LSPMASK_2,
/*MASK the LSB bit[2:0] for each color component*/
TI81XXFB_TRANSP_LSMMASK_3

};

struct ti81xxfb_region_params {

__u16 				ridx;
__u16 				pos_x;
__u16 				pos_y;
__u16 				priority;
/*enum ti81xxfb_status*/
__u32		  		firstregion;
/*enum ti81xxfb_status*/
__u32				lastregion;
/*enum ti81xxfb_status*/
__u32		  		scalaren;
/*enum ti81xxfb_status*/
__u32		  		stencilingen;
/*enum ti81xxfb_status*/
__u32				bben;
/*enum ti81xxfb_status*/
__u32		  		transen;
/*enum ti81xxfb_blending_type*/
__u32				blendtype;
/*enum ti81xxfb_transparancy_type*/
__u32 				transtype;
__u32  			transcolor;
__u8  				bbalpha;
__u8   			blendalpha;
__u8				reserved[2];

}; </syntaxhighlight>

  • NOTE: firstregion and lastregion must be set to 1, these two fields are reserved for future usages.

Usage:

  • Enable Global Alpha Blending with alpha value (0x40)

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

} regp.blendtype = TI81XXFB_BLENDING_GLOBAL; regp.blendalpha = 0x40; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>

  • Enable Transparency without masking, the RGB color key is 0x123456

<syntaxhighlight lang='c'> struct ti81xxfb_region_params regp; if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

} regp.transen = TI81XXFB_FEATURE_ENABLE; regp.transtype = TI81XXFB_TRANSP_LSPMASK_NO; regp.transcolor = 0x123456; if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>



TIFB_QUERY_MEMINFO
Returns the size and type of the frame buffer

Data Structure: <syntaxhighlight lang='c'> enum ti81xxfb_mem_mode {

TI81XXFB_MEM_NONTILER = 0,
TI81XXFB_MEM_TILER_PAGE ,
TI81XXFB_MEM_TILER_8,
TI81XXFB_MEM_TILER_16,
TI81XXFB_MEM_TILER_32

}; struct ti81xxfb_mem_info {

__u32 size;
/*ti81xxfb_mem_mode*/
__u32  type;

}; </syntaxhighlight>
NOTE: Only TI81XXFB_MEM_NONTILER is supported currently.

Usage: <syntaxhighlight lang='c'> struct ti81xxfb_mem_info mi; if (ioctl(fb, TIFB_QUERY_MEM, &mi)) {

perror("TIFB_QUERY_MEM.\n");
close(fd);
exit(1);

} </syntaxhighlight>


TI81XX_SETUP_MEM
Allows user to setup the frame buffer memory, like size and type.

Data Structure:

<syntaxhighlight lang='c'> enum ti81xxfb_mem_mode {

TI81XXFB_MEM_NONTILER = 0,
TI81XXFB_MEM_TILER_PAGE ,
TI81XXFB_MEM_TILER_8,
TI81XXFB_MEM_TILER_16,
TI81XXFB_MEM_TILER_32

}; struct ti81xxfb_mem_info {

__u32 size;
/*ti81xxfb_mem_mode*/
__u32  type;

}; </syntaxhighlight>
NOTE: Only TI81XXFB_MEM_NONTILER is supported currently.

Usage: <syntaxhighlight lang='c'> struct ti81xxfb_mem_info mi; if (ioctl(fb, TIFB_QUERY_MEM, &mi)) {

perror("TIFB_QUERY_MEM.\n");
close(fd);
exit(1);

}

mi.size = <Expected size of buffer> mi.type = <Expected type of buffer> if (ioctl(fb, TIFB_SETUP_MEM, &mi)) {

perror("TIFB_SETUP_MEM.\n");
close(fd);
exit(1);

} </syntaxhighlight>



TIFB_SET_SCINFO


Allow users to config the scalar ratio

Data Structure:

<syntaxhighlight lang='c'>

struct ti81xxfb_coeff {

__u16     horcoeff[TI81XXFB_COEFF_HOR_TAP][TI81XXFB_COEFF_PHASE];
__u16     vercoeff[TI81XXFB_COEFF_VER_TAP][TI81XXFB_COEFF_PHASE];

}; </syntaxhighlight> NOTE:
each coefficient is 10 bit wide, so MSB[15:10] will be truncated by the driver.

<syntaxhighlight lang='c'> struct ti81xxfb_scparams {

__u16                  inwidth;
__u16                  inheight;
__u16                  outwidth;
__u16                  outheight;
struct ti81xxfb_coeff  *coeff

}; </syntaxhighlight> NOTE:

  • 0.25x-4x scaling is supported for both horizontal and vertical direction.
  • if 1.0 is selected, hardware performs anti-flicker filtering.
  • If app wants to use preloaded coefficients, please set coeff = NULL.

Usage: scale input image to 2x(horizontal) and 1.5x(vertical) with app's own coefficients <syntaxhighlight lang='c'> struct ti81xxfb_scparams scprms; struct ti81xxfb_coeff coeff; struct ti81xxfb_region_params regp;

scprms.inwidth = x; scprms.inheight = y; scprms.outwidth = 2*x; scprms.outheight = 1.5*y, scprms.coeff = &coeff;

if (ioctl(fd, TIFB_SET_SCINFO, &scprms) < 0) {

perror("TIFB_SET_SCINFO.\n");
close(fd);
exit(1);

}

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

regp.scalaren = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp)< 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>

Usage: scale input image to 2x(horizontal) and 1.5x(vertical) with preloaded coefficients <syntaxhighlight lang='c'> struct ti81xxfb_scparams scprms; struct ti81xxfb_region_params regp;

scprms.inwidth = x; scprms.inheight = y; scprms.outwidth = 2 * x; scprms.outheight = 1.5 * y, scprms.coeff = NULL;

if (ioctl(fd, TIFB_SET_SCINFO, &scprms) < 0) {

perror("TIFB_SET_SCINFO.\n");
close(fd);
exit(1);

} if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

regp.scalaren = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp)< 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}


</syntaxhighlight>

Usage: Anti-Flicker Implementation

<syntaxhighlight lang='c'> struct ti81xxfb_scparams scprms; struct ti81xxfb_region_params regp;

scprms.inwidth = x; scprms.inheight = y; scprms.outwidth = x; scprms.outheight = y, scprms.coeff = NULL;

if (ioctl(fd, TIFB_SET_SCINFO, &scprms) < 0) {

perror("TIFB_SET_SCINFO.\n");
close(fd);
exit(1);

}

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

regp.scalaren = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp)< 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>


TIFB_GET_SCINFO
Allow users to get current scalar ratio

Data Structure:

<syntaxhighlight lang='c'> struct ti81xxfb_scparams {

__u16                  inwidth;
__u16                  inheight;
__u16                  outwidth;
__u16                  outheight;
struct ti81xxfb_coeff  *coeff;

}; </syntaxhighlight> NOTE:
coeff is not used when called TIFB_GET_SCINFO ioctl.

Usage: <syntaxhighlight lang='c'> struct ti81xxfb_scparams scprms; if (ioctl(fd, TIFB_GET_SCINFO, &scprms) {

perror("TIFB_GET_SCINFO.\n");
close(fd);
exit(1);

} </syntaxhighlight>


TIFB_ALLOC
This ioctl is used to allocate a memory from reserved pool and return the physical addres back to app. This memory can be used by the stenciling data buffer.

USAGE: allocate a buffer <syntaxhighlight lang='c'> unsigned long size; unsigned long phy_addr; unsigned long temp;

size = 8*1024; temp = size; if(ioctl(fd, TIFB_ALLOC, &size)) {

perror(“TIFB_ALLOC.\n");
close(fd);
exit(1);

} phy_addr = size; </syntaxhighlight>


TIFB_FREE
This ioctl is to free a memory allocated by the TIFB_ALLOC.

USAGE <syntaxhighlight lang='c'> unsigned long phy_addr; void virt_addr; unsigned long size;

munmap(virt_addr, stensize); if (ioctl(fd,TIFB_FREE, &phy_addr)) {

perror(" TIFB_FREE.\n");
close(fd);
exit(1);

} </syntaxhighlight> NOTE:
If the memory is used by the stenciling, please disable stenciling feature before freeing it.


TIFB_SET_STENC
Allow user to config stenciling.

Data Structure: <syntaxhighlight lang='c'> struct ti81xxfb_stenciling_params {

__u32               pitch;
__u32               paddr;

}; </syntaxhighlight> NOTE:
pitch must be 16 byte alignment.

USAGE: how to enable the stenciling feature <syntaxhighlight lang='c'> struct ti81xxfb_stenciling_params stenprms; struct fb_var_screeninfo var; struct ti81xxfb_region_params regp; unsigned long size; unsigned long temp;

if (ioctl(fd, FBIOGET_VSCREENINFO, &var)) {

perror("FBIOGET_VSCREENINFO.\n");
close(fd);
exit(1);

}

stenprms.pitch = var.xres >> 3; if (stenprms.pitch & 0xF)

   stenprms.pitch += 0xF - (stenprms.pitch & 0xF);

size = stenprms.pitch * var.yres;

temp = size; if(ioctl(fd, TIFB_ALLOC, &size)) {

perror("TIFB_ALLOC.\n");
close(fd);
exit(1);

}

stenprms.paddr = size; size = temp;

virt_addr = (unsigned char *)mmap(0, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, stenprms.paddr); if ((int)stenbuf == -1) {

perror("sten MMAP failed.\n");
close(fd);
exit(1);

}

if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

regp.stencilingen = TI81XXFB_FEATURE_ENABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp)< 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

</syntaxhighlight>

USAGE: how to disable the stenciling feature <syntaxhighlight lang='c'> struct ti81xxfb_stenciling_params stenprms; struct ti81xxfb_region_params regp; unsigned long size;

if (ioctl(fd, FBIOGET_VSCREENINFO, &var)) {

perror("FBIOGET_VSCREENINFO.\n");
close(fd);
exit(1);

}

stenprms.pitch = var.xres >> 3; if (stenprms.pitch & 0xF)

   stenprms.pitch += 0xF - (stenprms.pitch & 0xF);

size = stenprms.pitch * var.yres;


if (ioctl(fd, TIFB_GET_PARAMS, &regp) < 0) {

perror("TIFB_GET_PARAMS\n");
close(fd);
exit(1);

}

regp.stencilingen = TI81XXFB_FEATURE_DISABLE; if (ioctl(fd, TIFB_SET_PARAMS, &regp)< 0) {

perror("TIFB_SET_PARAMS\n");
close(fd);
exit(1);

}

munmap(virt_addr, size); if (ioctl(fd,TIFB_FREE, &stenprms.paddr)) {

perror(" Failed to free memory.\n");
close(fd);
exit(1);

}


</syntaxhighlight>


OMAPFB Compatible IOCTLS[edit]

TI81XX Fbdev driver also supports the following OMAPFB IOCTLs.


OMAPFB_SETUP_MEM
check OMAPFB userguide for the usage


OMAPFB_QUERY_MEM
check OMAPFB userguide for the usage


OMAPFB_SETUP_PLANE
Data Structure: <syntaxhighlight lang='c'> struct omapfb_plane_info { __u32 pos_x; __u32 pos_y; __u8 enabled; __u8 channel_out; __u8 mirror; __u8 reserved1; __u32 out_width; __u32 out_height; __u32 reserved2[12]; }; </syntaxhighlight>

Usage:
Only pos_x/pos_y/enabled/out_width/out_height are valid for this ioctl. pos_x/pos_y change the display starting location. enabled bit enable/disable the corresponding graphcis port. out_width/out_height enable the scaling feature of the graphics ports. if both out_width/out_height are set to zero, driver treat is as non-scaling case.

NOTE:
application need make sure the pos_x/pos_y and out_width/out_height do not out of the current display frame boundary.


OMAPFB_QUERY_PLANE


OMAPFB_GET_VRAM_INFO
check OMAPFB userguide for the usage

Data Structures[edit]

fb_var_screeninfo
This structure is used to query and set the so-called variable screen information. This allows an application to query or change the display mode, including the color depth, resolution, timing etc.


fb_fix_screeninfo
This structure is used by applications to get the fixed properties of the display, e.g. the start address of the framebuffer memory, framebuffer length etc.


fb_cmap
This structure is used to get/set the color-map for the framebuffer.


V4L2 Driver Interface[edit]

Application Interface[edit]

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[edit]

This section describes the standard V4L2 IOCTLs supported by the Display 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.


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.


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_S_CTRL, VIDIOC_G_CTRL, VIDIOC_QUERYCTRL
These ioctls are used to set/get and query various V4L2 controls like rotation, mirror and background color. Currently only rotation is supported.


VIDIOC_STREAMOFF
This is used to turn off streaming.


SYSFS Software Interfaces[edit]

User can control all dynamic configuration of VPSS, Fbdev and V4L2 Display functionality thorugh SYSFS interface.

Frame-buffer Driver sysfs attributes[edit]

Following attributes are available for user control.

#
# ls -1 /sys/class/graphics/fb0/
bits_per_pixel
blank
console
cursor
dev
device
mode
modes
name
rotate
pan
phys_addr
rotate
size
state
stride
subsystem
uevent
virt_addr
virtual_size
#


Frame-buffer Driver sysfs attributes
Acronym Definition
bits_per_pixel Allows user to control bits per pixel configuration, currently the supported values are 1, 2, 4, 8, 16, 24 and 32.
# echo 1/2/4/8/16/24/32 > /sys/class/graphics/fb0/ bits_per_pixel
blank Allows user to control lcd display blanking configuration independently.
# echo 0/1  > /sys/class/graphics/fb0/blank

Values only 0(FB_BLANK_UNBLANK) and 4(FB_BLANK_NORMAL) is supported
virtual_size Allows user to configure xres_virtual and yres_virtual parameters of frame-buffer,
# cat /sys/class/graphics/fb0/virtual_size
480,640
virt_addr Readonly entry, displays virtual address of the frame-buffer memory.
phys_addr Readonly entry, displays physical address of the frame-buffer memory.

VPSS Library sysfs attributes[edit]

VPSS library provides/exports following attributes, which explained in detail below -

#
# ls -1 /sys/devices/platform/vpss/
display0
display1
display2
display3
graphics0
graphics1
graphics2
modalias
subsystem
system
uevent
#

Note: display3 is not available on DM814X/AM387X Platform

VPSS Library: system [edit]

Config Display Controller

#
# ls -1 /sys/devices/platform/vpss/system/
tiedvencs
#
VPSS Library-system: sysfs attributes
Acronym Definition
tiedvencs tie multiple vencs together: hdmi id = 1,dvo2 id = 4, sd id = 8
# echo XX > /sys/devices/platform/vpss/system/tiedvencs

where XX: OR value of the venc id.

NOTE:

  • By Default, VPSS driver automatically configures the PLL clock based on the display mode setuped by the application for individual VENC without considering the PLL clock is shared or not with other VENC. So it is application's responsiblity to make sure that PLL clock and clock source of VENC are coupled well to supported the desired display mode.


VPSS Library: display[edit]

display Output
Arguments Definition
single An 10-bit wide, single channel CCIR656 video stream
double Two 10-bit wide video streams in CCIR656 format. The video data is YUV422 format
triple Three channel 10-bit video streams with embedded sync SAV/EAV. The video format can be YCbCr 444 or RGB
doublediscrete Two channel 10-bit video streams with dedicated HS/VS/FID/ACTVID sync signals.

The video data format is YUV 422. The first channel is Y; and CbCr are multiplexed on the second channel

triplediscrete Three channel 10-bit video streams with dedicated HS/VS/FID/ACTVID sync signals. The three channel component digital video can be RGB or YUV 444 format
VPSS Library: display0[edit]

Configure the HDMI VENC, which is connected to the on-chip HDMI module.

#
# ls -1 /sys/devices/platform/vpss/display0/
clksrc
edid
enabled
mode
order
output
timings
#
VPSS Library-display0: sysfs attributes
Acronym Definition
clksrc Set the right clock source for the VENC
echo dclk/dclkdiv2/dclkdiff > /sys/devices/platform/vpss/display0/clksrc
edid read EDID information only.
enabled Enable/Disable the VENC.
# echo 0/1 > /sys/devices/platform/vpss/display0/enabled
mode Set the right VENC mode,default 1080p-60.Check drivers/video/ti81xx/vpss/sysfs.h to get name of the supported modes
# echo mode_name > /sys/devices/platform/vpss/display0/mode
order reshuffle display order
echo A,B/C/D/E > /sys/devices/platform/vpss/display0/order
A: enable(1)/disable(0) global reorder. if 0 is set, then only B value is required, C,D and E should not be used.
B: 0-3: display order of video(0:lowest, 3:highest)
C: 0-3: display order of graphics0
D: 0-3: display order of graphics1
E: 0-3: display order of graphics2
output Set the right VENC output
echo single/double/doublediscrete/triple/triplediscrete,rgb888/yuv444p/yuv422spuv,(0/1)/(0/1)/(0/1)/(0/1) > /sys/devices/platform/vpss/display0/output

the first part is the sync mode, the second part is output data format, the last part is the polarity of the DE/FID/HS/VS, 1: ACTIVE_LOW(inverted),0:ACTIVE_HIGH(non_inverted).

timings Displays the timing configuration.
echo 148500,1920/88/148/44,1080/4/36/5,1 > /sys/devices/platform/vpss/display0/timings
where:
148500: display pixel clock(KHz)
1920: display width
88: horizontal front porch
148: horizontal back porch
44: horizontal sync width
1080: display height
4: vertical front porch
36: vertical back porch
5: vertical sync width
1: progressive output
VPSS Library: display1[edit]

Configure DVO2 VENC, which is able to connect to exteral display device, such as LCD pannel, HDMI Transmitter etc. This document does not cover any such information related to the external display device.

#
# ls -1 /sys/devices/platform/vpss/display1/
clksrc
enabled
mode
output
timings
#
VPSS Library-display1: sysfs attributes
Acronym Definition
clksrc Set the right clock source for the VENC
echo aclk/aclkdiv2/aclkdiff/dclk/dclkdiv2/dclkdiff > /sys/devices/platform/vpss/display1/clksrc

DM814X/AM387X Platform

echo aclk/aclkdiv2/aclkdiff > /sys/devices/platform/vpss/display1/clksrc
enabled Enable/Disable the VENC.
# echo 0/1 > /sys/devices/platform/vpss/display1/enabled
mode Set the right VENC mode, default 1080p-60.Check drivers/video/ti81xx/vpss/sysfs.h to get name of the supported modes
# echo mode_name > /sys/devices/platform/vpss/display1/mode
order reshuffle display order
echo A,B/C/D/E > /sys/devices/platform/vpss/display1/order
A: enable(1)/disable(0) global reorder. if 0 is set, then only B value is required, C,D and E should not be used.
B: 0-3: display order of video(0:lowest, 3:highest)
C: 0-3: display order of graphics0
D: 0-3: display order of graphics1
E: 0-3: display order of graphics2
output Set the right VENC output
echo single/double/doublediscrete/triple/triplediscrete,rgb888/yuv444p/yuv422spuv,(0/1)/(0/1)/(0/1)/(0/1) > /sys/devices/platform/vpss/display1/output

the first part is the sync mode, the second part is output data format, the last part is the polarity of the DE/FID/HS/VS, 1: ACTIVE_LOW(inverted),0:ACTIVE_HIGH(non_inverted).

timings Displays the timing configuration.
echo 148500,1920/88/148/44,1080/4/36/5,1 > /sys/devices/platform/vpss/display1/timings
where:
148500: display pixel clock(KHz)
1920: display width
88: horizontal front porch
148: horizontal back porch
44: horizontal sync width
1080: display height
4: vertical front porch
36: vertical back porch
5: vertical sync width
1: progressive output
VPSS Library: display2[edit]

Configure the SD VENC(Composite output)

#
# ls -1 /sys/devices/platform/vpss/display2/
clksrc
enabled
mode
name
order
output
timings
#
VPSS Library-display2: sysfs attributes
Acronym Definition
clksrc not supported
enabled Enable/Disable the VENC.
# echo 0/1 > /sys/devices/platform/vpss/display2/enabled
mode Set the right VENC mode:ntsc/pal are supported (default ntsc).
# echo ntsc/pal > /sys/devices/platform/vpss/display2/mode
order reshuffle display order
echo A,B/C/D/E > /sys/devices/platform/vpss/display2/order
A: enable(1)/disable(0) global reorder. if 0 is set, then only B value is required, C,D and E should not be used.
B: 0-3: display order of video(0:lowest, 3:highest)
C: 0-3: display order of graphics0
D: 0-3: display order of graphics1
E: 0-3: display order of graphics2
output set the output for SD VENC
echo composite/svideo > /sys/devices/platform/vpss/display2/output
timings Displays the timing configuration.(Not available now)


VPSS Library: graphics0/1/2[edit]

In all total 3 graphics pipelines are supported on hardware,

#
# ls -1 /sys/devices/platform/vpss/graphics0/
enabled
nodes
#
VPSS Library-graphics0/1/2: sysfs attributes
Acronym Definition
enabled User can enable/disable overlay through this entry.
# echo 0/1 > /sys/devices/platform/vpss/graphics0/enabled
nodes User can configure which vencs(hdmi/dvo2/sd) this graphics pipeline connected to.
One graphics pipeline can be connected to multiple video compositor as long
as those VENCs associated with video compositor are in the same timing.
# echo XX:outputs > /sys/devices/platform/vpss/graphics0/nodes

where XX: 1-4 number of vencs connected, outputs: see below table.

Graphics Notes input/output table
device
output
fb0 hdmi(display0)
dvo2(display1)
sd(display2)
fb1 hdmi(display0)
dvo2(display1)
sd(display2)
N/A hdmi(display0)
dvo2(display1)
sd(display2)

VPSS Library: Video0/1/2[edit]

In all total 3 video pipelines are supported on hardware,

#
# ls -1 /sys/devices/platform/vpss/video0/
alpha_blending_enabled
default_color
enabled
global_alpha
nodes
trans_key_enabled
trans_key_type
trans_key_value
#
VPSS Library-video0/1/2: sysfs attributes
Acronym Definition
alpha_blending_enabled User can enable/disable alpha blending for the video pipeline. Not available for video2.
echo 0/1 > /sys/devices/platform/vpss/video0/alpha_blending_enabled
     where 0/1: 0 -> disable, 1 -> enable
default_color Not available
enabled Not available
global_alpha User can set the global alpha blending value for the video pipeline. Not available for video2.
echo 0-255 > /sys/devices/platform/vpss/video0/global_alpha
nodes User can configure how many vencs(hdmi/dvo2/sd) this video pipeline connected to.
One video pipeline can be connected to multiple video VENCs as long
as those VENCs associated with video compositor are in the same timing.
# echo input:output1,output2,output3 > /sys/devices/platform/vpss/video0/nodes

see below table for details

trans_key_enabled User can enable/disable transparency keying for the video pipeline. Not available for video2.
echo 0/1 > /sys/devices/platform/vpss/graphics0/trans_key_enabled
     where 0/1: 0 -> disable, 1 -> enable
trans_key_type User can set transparency keying mask type for the video pipeline. Not available for video2.
echo 0/1/2/3 > /sys/devices/platform/vpss/graphics0/trans_key_enabled
     where 0/1/2/3 defines how many LSB bit to be masking when performing keying
trans_key_value User can set transparency keying value(RGB888, hex value only) for the video pipeline. Not available for video2.
echo 0xRRGGBB > /sys/devices/platform/vpss/graphics0/trans_key_value
     where 0xRRGGBB: R in the upper byte, B in the lower byte.
Video Notes input/output table
device
input
vcompmux hdcompmux sdmux
video0 (/dev/video1) hdmi(display0)
dvo2(display1)
hdmi(display0)
dvo2(display1)
sd(display2)
video1(/dev/video2) hdmi(display0)
dvo2(display1)
hdmi(display0)
dvo2(display1)
sd(display2)
video2(/dev/video3) N/A N/A sd(display2)

Miscellaneous Configurations[edit]

The default setup/configuration is -


fb0  -- => graphics0 - - => hdmi_venc(display0)->on_chip_hdmi output

fb1  -- => graphics1 - - => dvo2_venc(display1) -> LCD pannel or external display device

fb2  -- => graphics2 - - => sd_venc(display2)->composite ouput


/dev/video1  -- => video0 -- => vcompmux  -- => hdmi_venc(display0)->on_chip_hdmi output

/dev/video2  -- => video1 -- => hdcompmux -- => dvo2_venc(display1)-> LCD Pannel or external dispaly device

/dev/video3  -- => video2 -- =>   sdmux   -- => sd_venc(display2)->composite ouput


User can control/configure the various graphics/video pipelines to different video compositors and VENCs. This section demonstrate/explains the switching of output using above interfaces.


NOTE:
The connections between fb nodes and graphics pipelines are fixed and not able to change.
The connections between /dev/video nodes and video pipelines are fixed and not able to change.

Switching fb0(graphics0) output from HDMI VEVC(display0) to DVO2 VENC(display1)[edit]

Follow the steps below to switch graphics0(fb0)output from HDMI to DVO2 VENC

    • Switch output VENC
# echo 1:dvo2 > /sys/devices/platform/vpss/graphics0/nodes

NOTE:
Application must make sure /dev/fb0 is close when perform this command. Similar steps must be followed for switching other graphcis pipeline to different compositors and VENCs.

Switching /dev/video1(video0) from vcompmux - HDMI VEVC(display0) to vcompmux - DVO2 VENC(display1)[edit]

# echo vcompmux:dvo2 > /sys/devices/platform/vpss/video0/nodes
  • NOTE:

Application should make sure /dev/video1 device node is closed when performing the above step
Similar steps must be followed for switching other video pipeline to different input/output configurations.

Switching /dev/video1(video0) from vcompmux - HDMI VEVC(display0) to hdcompmux - DVO2 VENC(display1)[edit]

# echo hdcompmux:dvo2 > /sys/devices/platform/vpss/video0/nodes
  • NOTE:

Application should make sure /dev/video1 device node is closed when performing the above step
Similar steps must be followed for switching other video pipeline to different input/output configurations.

Cloning fb0(graphics0) output to both HDMI VENC(display0) and DVO2 VENC(display1)[edit]

Follow below steps to clone GFX overlay output to both HDMI and DVO2 VENC.

NOTE:
Appliation should make sure that both VENCs have the same timing.
If one graphics plane is connected to multiple vencs, those vencs must tied.
The similar steps must be following when cloning other graphics pipeline to multiple VENCs

  • Close /dev/fb0 first
  • Disable hdmi VENC
#echo 0 > /sys/devices/platform/vpss/display0/enabled
  • Disable dvo2 venc
#echo 0 > /sys/devices/platform/vpss/display1/enabled
  • Tited the VENCs
# echo 5 > /sys/devices/platform/vpss/system/tiedvenc
  • Switch the both HDMI and DVO2 VENCs
# echo 2:hdmi,dvo2 > /sys/devices/platform/vpss/graphics0/nodes
  • reopen /dev/fb0

Cloning /dev/video1(video0) output to both vcompmux-HDMI VENC(display0) and vcompmux-DVO2 VENC(display1)[edit]

Follow below steps to clone video0 output to both HDMI and DVO2 VENC through vcompmux.

NOTE:
Appliation should make sure that both VENC has the same timing.
If one video pipeline is connected to multiple vencs, those vencs must tied.

  • Disable hdmi VENC
#echo 0 > /sys/devices/platform/vpss/display0/enabled
  • Disable dvo2 venc
#echo 0 > /sys/devices/platform/vpss/display1/enabled
  • Tited the VENCs
# echo 5 > /sys/devices/platform/vpss/system/tiedvenc
  • Switch the both HDMI and DVO2 VENCs
# echo vcompmux:hdmi,dvo2 > /sys/devices/platform/vpss/video0/nodes

NOTE: Application must make sure that /dev/video0 is closed when performing above steps.
The similar stpes must be following when cloning other video pipelines to multiple VENCs

Change the mode on HDMI VENC(display0)[edit]

Follow below steps to change the VENC mode on HDMI, assuming that Graphics0(fb0) is connected to HDMI

  • Disable graphics0 pipeline
#echo 0 > /sys/devices/platform/vpss/graphics0/enabled
  • Disable hdmi VENC
#echo 0 > /sys/devices/platform/vpss/display0/enabled
  • Set the new VENC mode
#echo 720p-60 > /sys/devices/platform/vpss/display0/mode
  • Enable hdmi VENC
#echo 1 > /sys/devices/platform/vpss/display0/enabled
  • Enable graphics0 pipeline
#echo 1 > /sys/devices/platform/vpss/graphics0/enabled

NOTE:
The similar stpes must be following when change mode of other VENCs.
application should disable all the pipeline connected to the HDMI venc before performing the above steps.

Change display timing on DVO2 VENC(display1)[edit]

Follow below steps to change the display timing on DVO2 VENC

  • Disable DVO2 VENC
#echo 0 > /sys/devices/platform/vpss/display1/enabled
  • set new display timings
#echo 74250,1280/110/220/40,720/5/20/5,1/3 > /sys/devices/platform/vpss/dvo2/timings
  • Enable DVO2 VENC
#echo 1 > /sys/devices/platform/vpss/display1/enabled

NOTE:
The similar stpes must be followed when change mode of other VENCs.
application should disable all the pipeline connected to the HDMI venc before performing the above steps.

Reshuffle display order on HDMI VENC(display0)[edit]

Follow below steps to reshuffle the display order on HDMI VENC

  • set up new display order(graphics0 has higher displar order than graphics1 & graphics2)
echo 1:0/3/1/1 > /sys/devices/platform/vpss/display0/order

NOTE:
The similar stpes must be followed when change order of other VENCs.
Reshuffling order is runing time parameter operation.

Change the clock source on HDMI VENC(display0)[edit]

Follow below steps to change the clock source on HDMI.

  • Disable hdmi VENC
#echo 0 > /sys/devices/platform/vpss/display0/enabled
  • Set the new clock source
#echo dclkdiff > /sys/devices/platform/vpss/display0/clksrc
  • Enable hdmi VENC
#echo 1 > /sys/devices/platform/vpss/display0/enabled

NOTE:
The similar stpes must be following when change mode of other VENCs.
application should disable all the pipeline connected to the HDMI venc before performing the above steps.

Change the OUTPUT of HDMI VENC(display0)[edit]

Follow below steps to change the OUTPUT of HDMI VENC.

  • Disable hdmi VENC
#echo 0 > /sys/devices/platform/vpss/display0/enabled
  • Set the new digital sync format double embedded sync
#echo double > /sys/devices/platform/vpss/display0/output
  • Enable hdmi VENC
#echo 1 > /sys/devices/platform/vpss/display0/enabled

NOTE:
The similar stpes must be following when change mode of other VENCs.
application should disable all the pipeline connected to the HDMI venc before performing the above steps.

Driver Configuration[edit]

Framebuffer driver[edit]

$ make ARCH=arm CROSS_COMPILE=$(PATH_TO_TOOLCHAIN)/bin/arm-arago-linux-gnueabi- 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 Graphics 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 Support for frame buffer devices from the menu.
    ...
    ...
<M> Lowlevel video output switch controls
<*> Support for frame buffer devices  --->
< > E-Ink Broadsheet/Epson S1D13521 controller support
<M> TI81XX Viddeo Processing Subsystem support (EXPERIMENTAL)  --->
[ ] Backlight & LCD device support  --->
    ...
    ...


  • Select TI81XX Viddeo Processing Subsystem support (EXPERIMENTAL) from the same menu.
    ...
    ...
<*> Support for frame buffer devices  --->
(50)   VRAM size (MB)
[*]   Debug support
<M> TI81XX frame buffer support (EXPERIMENTAL)  --->


  • Configure default VRAM size to the required/expected size of buffer, the default is 50MB.
    ...
    ...
--- Select TI81XX Viddeo Processing Subsystem support (EXPERIMENTAL)
"(50)   VRAM size (MB)"
[*]   Debug support
    ...
    ...


  • Enable/Disable Debug function of VPSS
[*]   Debug support


  • Select TI81XX frame buffer support (EXPERIMENTAL) from the same menu. Press <ENTER> to enter the corresponding sub-menu.
    ...
    ...
[*]   Debug support for TI81XXFB
"(3)   Number of framebuffers"
    ...
    ...

NOTE: If this value is set as 1, only fb0(graphics0) is availabe in the fbdev.
If this value is set as 2, then graphics0(fb0) and graphics1(fb1) pipeline are available in FBDEV.
If this value is set as 3, all 3 graphics0/1/2(fb0/1/2) pipelines are available the FBDEV interface.

V4L2 video driver[edit]

$ make ARCH=arm CROSS_COMPILE=$(PATH_TO_TOOLCHAIN)/bin/arm-arago-linux-gnueabi- 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-Display driver
[ ]   Autoselect pertinent encoders/decoders and other helper chi
      Encoders/decoders and other helper chips  --->
"<M>   TI81XX V4L2-Display driver"
< >   CPiA2 Video For Linux
< >   Philips SAA7134 support

Sample Application[edit]

Following are the sample applications packaged with the PSP release.

Applications
Application Name On HDMI display On LCD display
saFbdevDisplay Supported Not supported
saFbdevDisplayPan Supported Supported
saFbdevMovingDisplay Supported Not supported
saFbdevScalingDisplay Supported Not supported
saLoopBack Not supported Not supported
saLoopBackFbdev Not supported Not supported
saLoopBackScale Not supported Not supported
saFbdevHdmiDisplay Supported Not supported
saMmapDisplay Supported Not supported
saUserptrDisplay Supported Not supported


In order to run the sample applications on the HDMI display, follow the steps described in section 2.5 and then run the application. For running the sample applications on LCD, in addition to steps in 2.5, we have to follow the steps in section 2.6 and 2.7 sequentially. Please note that sample applications works with the default configuration ( default resolution for HDMI display - 1080P) only.

The flow of sample applications using the V4l2 and FBDEV drivers are shown below.

Fbdev-Display Application Flow[edit]


Application for FBDEV driver


V4L2-Display Application Flow[edit]


Application for v4l2 driver


E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI811X PSP VPSS VIDEO Driver User Guide here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI811X PSP VPSS VIDEO Driver User Guide here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article TI811X PSP VPSS VIDEO Driver User Guide here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity