V4L2-GFX

From OMAPpedia

Jump to: navigation, search

Contents

[edit] V4L2-GFX

This is a driver which allows a V4L2 aware components for e.g. a Gstreamer video decoder to propagate video buffer data to a texture stream aware GL application.

An overview of the current architecture is given here.

[edit] Software Components

[edit] V4L2-GFX driver

This is a linux kernel driver/module. The driver acts as a V4L2 video capture device and presents an ioctl API (largely) identical to the OMAP V4L2 interface to hardware overlays.

[edit] Source code

Currently the driver is in the kernel/omap staging area here: http://review.omapzoom.org/#change,7685

In the Android kernel the driver sources is located in {kernelroot}/drivers/media/video/omapgfx/


[edit] Video renderer

[edit] GStreamer

If you have a working Gstreamer setup which can decode video to overlay devices (e.g. /dev/video1) then broadly speaking all you need to do is use the V4L2-GFX device node /dev/video100.

[edit] V4L2-GFX unit test

v4l2_gfx_client is the unit test for the V4L2-GFX driver. The final part of the unit test involves copying raw NV12 video frames to the V4L2-GFX device so can simulate the activity of a render, although this will be less performant than h/w accelerated decoding because an ARM memcopy is involved.

Unfortunately we currently only distribute the v4l2_gfx_client as part of the DDK. The reason isn't technical or legal, it's just that we don't have a good place to distribute this code at the moment.

[edit] Texture streaming applications

In order to display the video frames captured by the V4L2-GFX driver you need an appropriate GL application which uses IMG's texture streaming extensions.

We have 2 apps as follows.

[edit] Gles1TexturePlayer

This app renders a flat video surface.

Note that on OMAP4/SGX DDK 3977 that this app causes an SGX crash which has been reported to IMG.

[edit] Gles2TexturePlayer

This app renders a rotating video surface.


[edit] Integrating the V4L2-GFX driver

[edit] Build

Prerequisites: You have a kernel (or patched the kernel) with the V4L2-GFX driver in it (See 'Source code').

; This worked on the Android Froyo 2.6.35 environment
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- 
; Where  is your hardware target e.g. android_4430_defconfig

Inspect your .config file and look for the CONFIG_VIDEO_OMAP_GFX entry:

CONFIG_VIDEO_OMAP_GFX=m

The above means V4L2-GFX will be built as a kernel module

To configure V4L2-GFX driver for e.g. build as part of the kernel:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

Select: Device Drivers ---> Multimedia support ---> Video capture adapters ---> OMAP V4L2-GFX driver

Alternatively, modify the board configuration file directly:

; Edit arch/arm/configs/android_4430_defconfig
vi arch/arm/configs/android_4430_defconfig
; V4L2-GFX in the kernel:
CONFIG_VIDEO_OMAP_GFX=y

The complete build sequence using a 4430SDP Android environment as an example:

make CROSS_COMPILE=arm-none-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- android_4430_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules

[edit] Configuration

If V4L2-GFX is built as part of the kernel you should see a device node:

/dev/video100

Ensure your application has the relevant permissions to access the device.

chmod 666 /dev/video100

(On Android, you may wish to do this chmod in the Android file-system init.rc, you'll typically see this done for other /dev/video device nodes on OMAP targets).

# change permissions for Overlay
chmod 0777 /dev/video1
chmod 0777 /dev/video2
chmod 0777 /dev/video3
; V4L2-GFX for texture streaming
chmod 0777 /dev/video100

[edit] Kernel modules

If built as a kernel module the built module will be here:

drivers/media/video/omapgfx/gfx_vout_mod.ko

You'll need to get that .ko onto the device file-system in whatever method you prefer.


[edit] Texture streaming demo with the v4l2_gfx_client unit test (Android)

Start the Gles2TexturePlayer application from the SGX DDK tests (icon).

Select 'Launch stream'

The application will prompt to start a video rendering to V4L2-GFX.

Start the v4l2_gfx_client application from an adb shell console.

You will see a constantly repeating series of frames rendered to the screen.

[edit] V4L2-GFX feature backlog

Title Description Status
tbd tbd tbd
Personal tools
Namespaces
Variants
Views
  • Read
  • Edit
  • View history
Actions
Navigation
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version