ti 板子的tv输出和lcd输出的切换

本文档提供了使用sysfs接口更改显示设置的一些示例,这些示例基于DSS2显示驱动程序,适用于Linux 2.6.32内核。内容包括如何配置帧缓冲区参数、覆盖层、管理者及显示器等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://processors.wiki.ti.com/index.php?title=DSS2_SYSFS_Examples#Enable_dual_display_on_LCD_and_TV

DSS2 SYSFS Examples

From Texas Instruments Wiki
Jump to: navigationsearch

TIBanner.png

Return to the Sitara Linux Software Developer's Guide

Overview

This wiki article provides some examples of using sysfs interface to change display settings. These examples are based on DSS2display 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

The main components of the DSS2 framework are as shown in figure below.

DSS2Arch1.PNG

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

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

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

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

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

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

We are considering framebuffer0 for the examples listed below, depending on how many framebuffers are enabled these entities can be modified.

Mirroring
  • Enable mirroring:
echo 1 > /sys/class/graphics/fb0/mirror
  • Disable mirroring:
echo 0 > /sys/class/graphics/fb0/mirror
Rotation
  • 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

Currently only VRFB based rotation is enabled

Blanking FB
  • Powerdown fb0:
echo 4 > /sys/class/graphics/fb0/blank
  • Unblanking fb0:
echo 0 > /sys/class/graphics/fb0/blank
Setting framebuffer to overlay

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
  • 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

Overlay

We are considering graphics pipeline/overlay0 for the examples listed below.

Enable/disable overlay
  • 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
  • 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

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
  • 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

Please note that tv is linked to manager 1 only and manage0 can be linnked to lcd or dvi.

Read manager attributes
  • 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
  • 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
  • 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
  • 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

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
Enabling/Disabling display
  • 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
  • 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
  • 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
  • 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
  • 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

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

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

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

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

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

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

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

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

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/arm/OMAP/DSS


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值