wiki:linux/display

Version 1 (modified by Tim Harvey, 6 years ago) ( diff )

restored from 10/14/2017 cache

Goals

The purpose of this page is to help educate about display output on upstream Linux (not to be confused with the 'downstream' vendor kernel provided in Yocto).

Direct Rendering Manager (DRM)

DRM is the driver subsystem in the kernel that is able to communicate with video drivers, such as the Freescale I.MX6 processors. Through ioctl() calls, multiple userspace programs can draw to a display at any given time as DRM will manage these requests. DRM is also able to interface with the graphics processor (GPU) in order to hardware accelerate these requests. This is separate from framebuffer in that it only allowed raw writes to a display. DRM exposes some information via sysfs in the /sys/class/drm directory.

For example, to retrieve a list of display devices found on your system which were registered by DRM (Gateworks GW540x):

root@OpenWrt:~# ls /sys/class/drm
card0           card0-HDMI-A-1  card0-LVDS-1    controlD64      version

Kernel Mode Settings (KMS)

KMS is part of DRM, but solely focuses on configuring display modes (i.e. screen resolution, refresh rate etc).

When booting your kernel, mode settings are read by what appears in the kernel command line, else defaults are chosen. DRM exports some modes available for a given display:

root@OpenWrt:~# cat /sys/class/drm/card0-HDMI-A-1/modes
1680x1050
1280x1024
1280x1024
1152x864
1024x768
1024x768
800x600
800x600
640x480
640x480
720x400

Mode settings can be passed to the kernel via the video= parameter from within U-Boot. The format of this is as follows: video=<conn>:<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]

Note the following variables (see also modedb.txt):

  • <conn>: Connector
  • <xres> x <yres>: Resolution
  • M: Display timings will be calculated using VESA(TM) Coordinated Video Timings instead of a lookup table (Please see modedb.txt for more details)
  • R: Do "Reduce Blanking" calculation for digital displays
  • -<bpp>: color depth
  • i: Calculate timings for an interlaced Mode
  • m: Add margins to the calculation (1.8% of xres rounded down to 8 pixels and 1.8% of yres)
  • e: Output Forced On
  • D: Output Forced On and use Digital Outputs
  • d: Output Forced Off

Examples:

  • Disable both the LVDS and HDMI outputs on a Gateworks GW540x:
    setenv video 'video=LVDS-1:d video=HDMI-A-1:d'
    

Then, when booted:

root@OpenWrt:/# dmesg | grep -E "LVDS-1|HDMI-A-1"
[    0.000000] Kernel command line: console=ttymxc1,115200 ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs video=LVDS-1:d video=HDMI-A-1:d
[   12.181930] [drm] forcing HDMI-A-1 connector OFF
[   12.196641] [drm] forcing LVDS-1 connector OFF
  • Set HDMI output to 800x600 @ 60Hz refresh rate and disable LVDS:
    setenv video 'video=LVDS-1:d video=HDMI-A-1:800x600@60'
    

Limitations

Using the upstream kernel currently has some limitations on the imx platform. For example, the driver is limited to the number of display outputs it can do. That means if both LVDS and HDMI were connected, both resolutions would be scaled to the display with the lower resolution. Both outputs are also mirror's of each other and cannot be run independently. However, using the 'downstream' vendor kernel that we provide on our Yocto BSPs do have features that allow for independently controlled displays, even allowing for an 'overlay' buffer for the first two displays.

To see more on the downstream vendor kernel provided in Yocto, please see here.

References

Note: See TracWiki for help on using the wiki.