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.
DSS2 SYSFS Examples
Content is no longer maintained and is being kept for reference only!
Return to the Sitara Linux Software Developer's Guide
Contents
Overview[edit]
This wiki article provides some examples of using sysfs interface to change display settings. These examples are based on DSS2 display driver and are supported on linux2.6.32 adapted in PSP 03.00.01.06. IOCTLS are explained in the display driver user guide, here we mainly address use case examples using sysfs interface.
DSS2 Framework[edit]
The main components of the DSS2 framework are as shown in figure below.
Data from the framebuffer is displayed through these entities. Framebuffer is the memory area in the SRAM/SDRAM which contains the pixel data for the image to be displayed. It is characterized by height, width and color depth.
Overlay[edit]
Overlay 0, overlay 1 and overlay 2 represent the graphics, video1 and video 2 pipelines respectively. Overlay defines where the pixels are read from and where it is displayed on the screen. The overlay may be smaller than framebuffer, thus displaying only part of the framebuffer. The position of the overlay may be changed if the overlay is smaller than the display.
Manager[edit]
Manager 0 and manager 1 are used to control the combine the overlay units into a single image and feed it to the display device.
Display[edit]
Display 0, display 1 and display 2 represent the physical display devices where display 0 represents LCD, display 2 represents DVI and display 1 represents TV.
Note[edit]
A few main points to note while using DSS2 are:
- At any point of time either LCD or DVI can be enabled, not both.
- A framebuffer can be connected to multiple overlays to show the same pixel data. In this case the overlay input sizes must be the same.
- Due to its scaling feature, the output size of video overlays can be different.
- Overlay manager can be connected to a single display at any point of time. Manager 0 can be connected to LCD or DVI display while manager 1 can only be connected to TV display.
- Framebuffer memory is allocated using the OMAP VRAM allocator
For more details of hardware features please refer display sub-system wiki
SYSFS Parameters[edit]
Using sysfs framebuffer parameters are set using sys/class/graphics/fb and dss entities are set using /sys/devices/platform/omapdss
SYSFS Entries for FB[edit]
We are considering framebuffer0 for the examples listed below, depending on how many framebuffers are enabled these entities can be modified.
Mirroring[edit]
- Enable mirroring:
echo 1 > /sys/class/graphics/fb0/mirror
- Disable mirroring:
echo 0 > /sys/class/graphics/fb0/mirror
Rotation[edit]
- Enable rotation angle of 0 degrees:
echo 0 > /sys/class/graphics/fb0/rotate
- Enable rotation angle of 90 degrees:
echo 1 > /sys/class/graphics/fb0/rotate
- Enable rotation angle of 180 degrees:
echo 2 > /sys/class/graphics/fb0/rotate
- Enable rotation angle of 270 degrees:
echo 3 > /sys/class/graphics/fb0/rotate
Rotation type[edit]
Currently only VRFB based rotation is enabled
Blanking FB[edit]
- Powerdown fb0:
echo 4 > /sys/class/graphics/fb0/blank
- Unblanking fb0:
echo 0 > /sys/class/graphics/fb0/blank
Setting framebuffer to overlay[edit]
Multiple overlays can be linked to a single framebuffer as shown in the example below.
- Setting fb0 to overlay0:
echo 0 > /sys/class/graphics/fb0/overlays
- Setting fb0 to overlay1:
echo 0 > /sys/class/graphics/fb0/overlays
- Setting fb0 to both overlay0 and overlay1:
echo "0,1" > /sys/class/graphics/fb0/overlays
Reading framebuffer attributes[edit]
- Reading physical address of fb0:
cat /sys/class/graphics/fb0/phys_addr
- Reading virtual address of fb0
cat /sys/class/graphics/fb0/virt_addr
- Reading size of fb0
cat /sys/class/graphics/fb0/size
SYSFS Entries for DSS[edit]
Overlay[edit]
We are considering graphics pipeline/overlay0 for the examples listed below.
Enable/disable overlay[edit]
- Set overlay0 ON:
echo "1" > /sys/devices/platform/omapdss/overlay0/enabled
- Set overlay0 OFF:
echo "0" > /sys/devices/platform/omapdss/overlay0/enabled
Set overlay's manager[edit]
- Set overlay0's manager as lcd
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled echo "lcd" > /sys/devices/platform/omapdss/overlay0/manager echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
- Set overlay0's manager as dvi
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled echo "dvi" > /sys/devices/platform/omapdss/overlay0/manager echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
- Set overlay0's manager as tv
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled echo "tv" > /sys/devices/platform/omapdss/overlay0/manager echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
Set global alpha value for[edit]
Global alpha value for overlay can be set between 0 to 255 where 0 is transparent and 255 opaque.
- Setting alpha value for various overlays:
echo 200 > /sys/devices/platform/omapdss/overlay0/global_alpha
Read overlay properties[edit]
- Read overlay1 input size, this represents the framebuffer size
cat /sys/devices/platform/omapdss/overlay0/input_size
- Reading overlay0's name
cat /sys/devices/platform/omapdss/overlay0/name
- Reading output_size of overlay0
cat /sys/devices/platform/omapdss/overlay0/output_size
- Reading position of overlay0
cat /sys/devices/platform/omapdss/overlay0/position
- Reading screen_width of overlay0
cat /sys/devices/platform/omapdss/overlay0/screen_width
Manager[edit]
Please note that tv is linked to manager 1 only and manage0 can be linnked to lcd or dvi.
Read manager attributes[edit]
- Reading display name to which manager0 has been attached
cat /sys/devices/platform/omapdss/manager0/display cat /sys/devices/platform/omapdss/manager0/name
Set manager display entity[edit]
- Switch manager0 to dvi display
echo "dvi" > /sys/devices/platform/omapdss/manager0/display
- Switch manager1 to lcd display
echo "lcd" > /sys/devices/platform/omapdss/manager0/display
Manager alpha-blending[edit]
- Enable alpha blending for manager0
echo 1 > /sys/devices/platform/omapdss/manager0/alpha_blending_enabled
- Disable alpha blending for manager0
echo 0 > /sys/devices/platform/omapdss/manager0/alpha_blending_enabled
Manager transparency key[edit]
- Enable transparency key for manager0
echo 1 > /sys/devices/platform/omapdss/manager0/trans_key_enabled
- Disable alpha blending for manager0
echo 0 > /sys/devices/platform/omapdss/manager0/trans_key_enabled
- Read transparency key type
cat /sys/devices/platform/omapdss/manager0/trans_key_type
Setting alpha-blending for seeing three videos simultaneously one over the other[edit]
Assuiming default case where all overlays are set to the manager lcd. First, enable alpha blending for manager0
echo 1 > /sys/devices/platform/omapdss/manager0/alpha_blending_enabled
Set alpha value for various overlays
echo 50 > /sys/devices/platform/omapdss/overlay1/global_alpha echo 150 > /sys/devices/platform/omapdss/overlay2/global_alpha echo 200 > /sys/devices/platform/omapdss/overlay3/global_alpha
Display[edit]
Enabling/Disabling display[edit]
- Enable display0/lcd
echo 1 > /sys/devices/platform/omapdss/display0/enabled
- Disable display0/lcd
echo 0 > /sys/devices/platform/omapdss/display0/enabled
Read display attributes[edit]
- Read display name to which manager0 has been attached
cat /sys/devices/platform/omapdss/manager0/display cat /sys/devices/platform/omapdss/manager0/name
- Read the name of display0:
cat /sys/devices/platform/omapdss/display0/name
Display timing[edit]
- Reading timing values of display0:
cat /sys/devices/platform/omapdss/display0/timings
- Timings of the display device can be set using sysfs interface. Timing for sysfs format is as follows:
<pixel_clock>,<xres/hfp/hbp/hsw>,<yres/vfp/vbp/vsw>
- Set display timings
echo "<pixel_clock>,<xres/hfp/hbp/hsw>,<yres/vfp/vbp/vsw>" > /sys/devices/platform/omapdss/displayx/timings
Display1/tv timing[edit]
- Set display1/tv timings to NTSC
echo "13500,720/16/58/64,482/6/31/6" > /sys/devices/platform/omapdss/display1/timings
- Set display1/tv timings to PAL
echo "13500,720/12/68/64,574/5/41/5" > /sys/devices/platform/omapdss/display1/timings
Display2/dvi timing[edit]
- Set dvi display device timings to 480P
echo "26250,720/80/48/32,480/3/6/10" > /sys/devices/platform/omapdss/display2/timings
- Set dvi timings to 720P
echo "72428,1280/190/120/32,720/13/3/5" > /sys/devices/platform/omapdss/display2/timings
- Set dvi display device timings to XGA
echo "65000,1024/24/160/63,768/3/29/6" > /sys/devices/platform/omapdss/display2/timings
Examples[edit]
These set of examples assume that lcd is the current display. Kernel is compiled with a single framebuffer which is the default settings.
To switch from LCD to DVI[edit]
Disable display0/lcd
echo 0 > /sys/devices/platform/omapdss/display0/enabled
Configure framebuffer timings
fbset -fb /dev/fb0 -xres 640 -yres 480
Set manager0 to dvi display
echo "dvi" > /sys/devices/platform/omapdss/manager0/display
Enable display2/dvi
echo 1 > /sys/devices/platform/omapdss/display2/enabled
If needed display device timings can be set, for example to set display timings to 720P. Please refer section xx for timing parameters.
echo "72428,1280/190/120/32,720/13/3/5" > /sys/devices/platform/omapdss/display2/timings
To switch from DVI to TV[edit]
Disable display2/dvi
echo 0 > /sys/devices/platform/omapdss/display2/enabled
Disable overlay0. Before changing any overlay attributes, it should first be disabled.
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled
Reset overlay0 manager which is set to lcd by default
echo "" > /sys/devices/platform/omapdss/overlay0/manager
Configure framebuffer timings to either NTSC or PAL as shown
NTSC: fbset -fb /dev/fb0 -xres 720 -yres 482 -vxres 720 -vyres 482 PAL: fbset -fb /dev/fb0 -xres 720 -yres 574 -vxres 720 -vyres 574
Set overlay manager to tv
echo "tv" > /sys/devices/platform/omapdss/overlay0/manager
Enable display1/tv
echo 1 > /sys/devices/platform/omapdss/display1/enabled
Enable overlay
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
If required the timings of the display device can be configured using the timings parameter. By default the display1 timings are set to PAL, please refer section display timings for additional details on timing parameters.
NTSC: echo "13500,720/16/58/64,482/6/31/6" > /sys/devices/platform/omapdss/display1/timings PAL: echo "13500,720/12/68/64,574/5/41/5" > /sys/devices/platform/omapdss/display1/timings
To switch from TV to LCD[edit]
Disable display1/tv
echo 0 > /sys/devices/platform/omapdss/display1/enabled
Disable overlay0. Before changing any overlay attributes, it should first be disabled.
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled
Reset overlay0 manager which is now set to tv
echo "" > /sys/devices/platform/omapdss/overlay0/manager
Configure framebuffer timings to VGA, note the 480x640 resolution
fbset -fb /dev/fb0 -xres 480 -yres 640 -vxres 480 -vyres 640
Set overlay manager to lcd
echo "lcd" > /sys/devices/platform/omapdss/overlay0/manager
Enable display0/lcd
echo 1 > /sys/devices/platform/omapdss/display0/enabled
Enable overlay
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
To switch from LCD to TV[edit]
Disable display0/lcd
echo 0 > /sys/devices/platform/omapdss/display0/enabled
Disable overlay0. Before changing any overlay attributes, it should first be disabled.
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled
Reset overlay0 manager which is now set to lcd
echo "" > /sys/devices/platform/omapdss/overlay0/manager
Configure framebuffer timings to NTSC or PAL
NTSC: fbset -fb /dev/fb0 -xres 720 -yres 482 -vxres 720 -vyres 482 PAL: fbset -fb /dev/fb0 -xres 720 -yres 574 -vxres 720 -vyres 574
Set overlay manager to tv
echo "tv" > /sys/devices/platform/omapdss/overlay0/manager
Enable display1/lcd
echo 1 > /sys/devices/platform/omapdss/display1/enabled
Enable overlay
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
To switch from TV to DVI[edit]
Disable display1/tv
echo 0 > /sys/devices/platform/omapdss/display1/enabled
Disable overlay0. Before changing any overlay attributes, it should first be disabled.
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled
Reset overlay0 manager which is now set to lcd
echo "" > /sys/devices/platform/omapdss/overlay0/manager
Configure framebuffer timings
fbset -fb /dev/fb0 -xres 640 -yres 480 -vxres 640 -vyres 480
Set overlay manager to lcd
echo "lcd" > /sys/devices/platform/omapdss/overlay0/manager
Enable display2/dvi
echo 1 > /sys/devices/platform/omapdss/display2/enabled
Enable overlay
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled
To switch from DVI to LCD[edit]
Disable display2/dvi
echo 0 > /sys/devices/platform/omapdss/display2/enabled
Configure framebuffer timings
fbset -fb /dev/fb0 -xres 480 -yres 640
Set manager0 to lcd display
echo "lcd" > /sys/devices/platform/omapdss/manager0/display
Enable display0/lcd
echo 1 > /sys/devices/platform/omapdss/display0/enabled
Enable dual display on LCD and TV[edit]
Disable overlay0 and overlay1
echo 0 > /sys/devices/platform/omapdss/overlay0/enabled echo 0 > /sys/devices/platform/omapdss/overlay1/enabled
Disable display0/lcd and display1/tv
echo 0 > /sys/devices/platform/omapdss/display0/enabled echo 0 > /sys/devices/platform/omapdss/display1/enabled
Rest manager0/1 properties
echo "" > /sys/devices/platform/omapdss/overlay1/manager echo "" > /sys/devices/platform/omapdss/overlay0/manager
Confirm output size for LCD and TV out
echo "480,640" > /sys/devices/platform/omapdss/overlay1/output_size echo "720,426" > /sys/devices/platform/omapdss/overlay0/output_size
Set TV out timings to NTSC or PAL depending on local configuration
NTSC: echo "13500,720/16/58/64,482/6/31/6" > /sys/devices/platform/omapdss/display1/timings PAL: echo "13500,720/12/68/64,574/5/41/5" > /sys/devices/platform/omapdss/display1/timings
Here we configure GFX pipe to display data on TV out and video pipe to display data on LCD. Configure framebuffer
NTSC: fbset -fb /dev/fb0 -xres 720 -yres 482 -vxres 720 -vyres 482 PAL: fbset -fb /dev/fb0 -xres 720 -yres 574 -vxres 720 -vyres 574
Configure overlay manager
echo "lcd" > /sys/devices/platform/omapdss/overlay1/manager echo "tv" > /sys/devices/platform/omapdss/overlay0/manager
Enable display
echo 1 > /sys/devices/platform/omapdss/display0/enabled echo 1 > /sys/devices/platform/omapdss/display1/enabled
Enable overlay
echo 1 > /sys/devices/platform/omapdss/overlay0/enabled echo 1 > /sys/devices/platform/omapdss/overlay1/enabled
References[edit]
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/arm/OMAP/DSS