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.
Dual Frame Buffer on OMAP35x
This page illustrates how to enable dual frame buffer on OMAP35x with versions of the Linux kernel that include the DSS2 driver architecture.
Introduction[edit]
OMAP35x DSS integrates one graphics pipeline, and two video pipelines. By default, the graphics pipeline is controlled by the FBDEV driver, the video pipelines are controlled by the V4L2 driver.
Dual Frame Buffer means allowing one of the video layer to be controlled by FBDEV driver. This is a new feature in DSS2 driver architecture for OMAP3. Obviously, both the two video layers could be controlled by the FBDEV driver to form Triple Frame Buffer.
This is a useful feature for some projects, which use multiple opensource/proprietary frameworks to manipulate the individual layer via FBDEV driver, since some of the frameworks only work on top of frame buffer devices instead of V4L2 devices, such as X-server, Qt for Embedded Linux.
Build Kernel & Setup u-boot[edit]
To enable dual frame buffer, change the Number of framebuffers menuconfig option below to 2 to allow the graphics layer and video1 layer to be controlled by the FBDEV driver. Please refer to PSP UserGuide for details on this option.
Device Driver ---> Graphics support ---> (2) Number of framebuffers
The .config file should have the configuration below after leave menuconfig.
CONFIG_FB_OMAP2_NUM_FBS=2
With the customized uImage, you will find /dev/fb0 and /dev/fb1 nodes after the kernel boots up.
By default, the frame buffer is only allocated for /dev/fb0. Option vram should be specified in u-boot bootargs variable to allocate frame buffer for /dev/fb1. For example:
vram=8M omapfb.vram=4M,4M
Overlay Interface[edit]
DSS2 provides a sysfs interface to manipulate the Overlay manager. This interface could be used to enable/disable the frame buffer pipelines. In TI PSP kernel with DSS2 the entry is /sys/devices/platform/omapfb/overlays; In opensource community kernel the entry is /sys/devices/platform/omapdss/overlay. The instructions below are for TI PSP kernel only.
[root@OMAP3EVM /]# cat /sys/devices/platform/omapfb/overlays gfx t:lcd x:0 y:0 iw:480 ih:640 w:480 h:640 e:1 vid1 t:lcd x:0 y:0 iw:480 ih:640 w:480 h:640 e:0 vid2 t:lcd x:0 y:0 iw:480 ih:640 w:480 h:640 e:0 l4-ovl t:l4 x:0 y:0 iw:0 ih:0 w:0 h:0 e:0
In the last column e:1 means the layer is enabled, and e:0 means it is disabled.
For example to disable the graphics layer, use command
[root@OMAP3EVM /]# echo "gfx e:0" > /sys/devices/platform/omapfb/overlays
Experiment[edit]
This section demonstrates dual frame buffer switching by enable/disable the pipelines through the overlay sysfs interface.
When overlay manager is in normal mode (default), the video1 layer is always on top of the graphics layer. The video2 layer is always on top of the video1 and graphics as shown in the figure below.
+---------------------------+ | Screen | | | | +-------------+ | | | Graphics | | | | | | | | +------------+ | | | | Video1 | | | | | | | | +---| +-----------+ | | | | Video2 | | | | | | | | +---| | | | +-----------+ | +---------------------------+
After the kernel boots up, the frame buffers of /dev/fb0 and /dev/fb1 contain only 0's, which represent black color on LCD panel. We will fill a half screen of /dev/fb0 with white color, then turn on/off /dev/fb1 to verify how the video1 layer covers the graphics layer.
Create a file which contains RGB white color.
[root@OMAP3EVM /]# cat /dev/zero | tr '\0' '\377' | dd of=white.rgb bs=1K count=300
Reset the vid1 framebuffer. This step is only needed once after kernel boots up and is not necessary if Number of framebuffers is set to 3.
[root@OMAP3EVM /]# echo "1 t:vid1" > /sys/devices/platform/omapfb/framebuffers
Dump the file to /dev/fb0. Half screen white color is shown on LCD panel. Because by default /dev/fb1 is disabled, we can see the contains in /dev/fb0.
[root@OMAP3EVM /]# cat white.rgb > /dev/fb0
Enable /dev/fb1. Because /dev/fb1 covers /dev/fb0, the LCD panel turns to black.
[root@OMAP3EVM /]# echo "vid1 e:1" > /sys/devices/platform/omapfb/overlays
Disable /dev/fb1, the white color comes back.
[root@OMAP3EVM /]# echo "vid1 e:0" > /sys/devices/platform/omapfb/overlays