| 1 | [[PageOutline]] |
| 2 | |
| 3 | = Goals = |
| 4 | 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). |
| 5 | |
| 6 | = Direct Rendering Manager (DRM) = |
| 7 | 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. |
| 8 | |
| 9 | For example, to retrieve a list of display devices found on your system which were registered by DRM (Gateworks GW540x): |
| 10 | {{{#!bash |
| 11 | root@OpenWrt:~# ls /sys/class/drm |
| 12 | card0 card0-HDMI-A-1 card0-LVDS-1 controlD64 version |
| 13 | }}} |
| 14 | |
| 15 | == Kernel Mode Settings (KMS) == |
| 16 | KMS is part of DRM, but solely focuses on configuring display modes (i.e. screen resolution, refresh rate etc). |
| 17 | |
| 18 | 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: |
| 19 | {{{#!bash |
| 20 | root@OpenWrt:~# cat /sys/class/drm/card0-HDMI-A-1/modes |
| 21 | 1680x1050 |
| 22 | 1280x1024 |
| 23 | 1280x1024 |
| 24 | 1152x864 |
| 25 | 1024x768 |
| 26 | 1024x768 |
| 27 | 800x600 |
| 28 | 800x600 |
| 29 | 640x480 |
| 30 | 640x480 |
| 31 | 720x400 |
| 32 | }}} |
| 33 | |
| 34 | 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]}}} |
| 35 | |
| 36 | Note the following variables (see also [https://www.kernel.org/doc/Documentation/fb/modedb.txt modedb.txt]): |
| 37 | * {{{<conn>}}}: Connector |
| 38 | * {{{<xres> x <yres>}}}: Resolution |
| 39 | * {{{M}}}: Display timings will be calculated using VESA(TM) Coordinated Video Timings instead of a lookup table (Please see [https://www.kernel.org/doc/Documentation/fb/modedb.txt modedb.txt] for more details) |
| 40 | * {{{R}}}: Do "Reduce Blanking" calculation for digital displays |
| 41 | * {{{-<bpp>}}}: color depth |
| 42 | * {{{i}}}: Calculate timings for an interlaced Mode |
| 43 | * {{{m}}}: Add margins to the calculation (1.8% of xres rounded down to 8 pixels and 1.8% of yres) |
| 44 | * {{{e}}}: Output Forced On |
| 45 | * {{{D}}}: Output Forced On and use Digital Outputs |
| 46 | * {{{d}}}: Output Forced Off |
| 47 | |
| 48 | Examples: |
| 49 | * Disable both the LVDS and HDMI outputs on a Gateworks GW540x: |
| 50 | {{{#!bash |
| 51 | setenv video 'video=LVDS-1:d video=HDMI-A-1:d' |
| 52 | }}} |
| 53 | |
| 54 | Then, when booted: |
| 55 | {{{#!bash |
| 56 | root@OpenWrt:/# dmesg | grep -E "LVDS-1|HDMI-A-1" |
| 57 | [ 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 |
| 58 | [ 12.181930] [drm] forcing HDMI-A-1 connector OFF |
| 59 | [ 12.196641] [drm] forcing LVDS-1 connector OFF |
| 60 | }}} |
| 61 | * Set HDMI output to 800x600 @ 60Hz refresh rate and disable LVDS: |
| 62 | {{{#!bash |
| 63 | setenv video 'video=LVDS-1:d video=HDMI-A-1:800x600@60' |
| 64 | }}} |
| 65 | |
| 66 | |
| 67 | == Limitations == |
| 68 | 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. |
| 69 | |
| 70 | To see more on the downstream vendor kernel provided in Yocto, please see [wiki:Yocto/Video_Out here]. |
| 71 | |
| 72 | == References == |
| 73 | * https://en.wikipedia.org/wiki/Direct_Rendering_Manager |
| 74 | * https://en.wikipedia.org/wiki/Mode_setting |
| 75 | * https://www.kernel.org/doc/Documentation/fb/modedb.txt |