domingo, 7 de abril de 2013

Xorg, vesa, modelines, intel and 915resolution

TLDR


This post is perhaps a bit too technical and probably too long, but it is important that certain things are google indexed, for the Linux community to work better. That has been helpful to us many times in the past, so we are glad to do our share.

The Intel Cedarview Xorg driver seems to be quite slow. It is outperformed by the Xorg Vesa driver, at least for basic operations. You can use any graphics mode (including wide modes such as 1920x1080) with the Vesa driver thanks to a small program called 915resolution. For multiple devices connected to different monitors you can use Vesa + 915resolution and control the display resolution using DHCP.

Intel's Cedarview mess


Seems that the Intel Cedarview chipset had a tough start on Linux devices. The stupidity of outsourcing the GPU to PowerVR, while not ensuring to have working drivers in time, caused many complaints (example) from users around the world. That meant lots of hardware working at the wrong resolution or with sub-optimal performance. And it happened even though the very same Intel employs a highly trained Linux driver team. That team, unfortunately, can't do anything for rebranded 3rd-party hardware, if no specifications are delivered.

At some point, Intel finally made official drivers available. The Xorg driver is called pvr and can be found here. But guess what the Release Notes say:

 * Poor 2D rendering performance through Xlib protocol. (#9 #125 #126)

Having tried the version that landed on Ubuntu 12.04 official repositories (apt-get install cedarview) I must say the Release Notes are right. The driver seems unusable, as dragging and maximizing windows is painfully slow. While this would embarassing enough for Intel, I must add something to the situation. Their driver is outperformed by the Vesa driver and, with an up to date kernel such as the default kernel from Ubuntu 12.04.2, the Modesetting driver. Yes, it's true. The late coming specific driver from Intel is beaten hands down by two generic Linux drivers, one of which is several years old.

I must say we haven't tried OpenGL, XV or VAAPI with Intel's pvr driver. Even if it worked and performed well, it would still be pointless since the user can't properly drag a window without waiting one second for each repaint.

So, as a company that's responsible for thousands of EUR of Intel related purchases every year, we would like to greet Intel with the famous words, Linus Torvalds has given NVIDIA, and kindly suggest that they use their own driver team to have proper drivers written in time.


The Vesa driver


The Vesa driver is a generic Xorg driver that uses one of the VESA graphics modes that are present in the graphics cards BIOS. This driver doesn't know how to program low level details of the card and doesn't accelerate any operations. However, given a powerful enough CPU the Vesa driver is more than acceptable for daily work.

But there is a problem: the official VESA modes are not suitable for current displays. None of the currently used wide modes is available in the cards BIOSes and the driver will ignore any modelines that are added to Xorg.conf.

To help with that, a utility called 915resolution that works with Intel's cards was created. An updated version that works with the Cedarview chipset can be found here.

To run any graphics mode using the Vesa driver, you just need to load it into the card BIOS before Xorg is started. Some examples:


[root@host ubuntupxe]#./915resolution -c Cedarview 3c 1920 1080 16 2576 1120

[root@host ubuntupxe]#./915resolution -c Cedarview  3c 1600 900 16 2112 934

[root@host ubuntupxe]#./915resolution -c Cedarview 3c 1600 900 16 1904 934

The first argument of 915resolution, 3c,  is the code of the standard mode that will be overwritten. You can see a list of modes using the -l flag.

The remaining arguments are X, Y, DEPTH, HTOTAL and VTOTAL. Even though HTOTAL and VTOTAL are said to be optional, they are in fact necessary for the picture to have the right size and placement on screen. You can find values for HTOTAL and VTOTAL generating a modeline with cvt, as in the following example

[root@host ubuntupxe]# cvt 1600 900 60

In this example, we requested a modeline for 1600x900 @ 60 Hz. The result is

# 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
Modeline "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync

The values for HTOTAL and VTOTAL are always the 7th and 11th field (emphasis added above).

A generic xorg.conf for multiple devices


Once you ensure each of your devices has the best mode for its display made available using 915resolution, you only need a generic Xorg.conf. That file must contain  "vesa" as the graphics driver and a list of wide modes. In the example below, xorf.conf contains a set of wide modes all of which are ignored, except the one loaded into the card BIOS using 915resolution.

[...]
Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24
        SubSection "Display"
                Modes      "1600x900" "1440x900" "1366x768" "1360x768"
                Viewport   0 0
                Depth     24
        EndSubSection
        EndSection
If you must support multiple identical Intel devices, connected to different monitors you can even send the resolution, colour depth, HOTAL and VTOTAL via a DHCP custom variable, to configure their resolutions centrally. Please note that although the mode that was written to the card BIOS is "selected" automatically (ie, the others are rejected) using the above xorg.conf example, not all combinations of colour depth and resolution are possible. It may happen that 1600x900@24 bpp is possible whereas the maximum bpp for 1920x1080 is 16.

Acknowlegdments

Having the Vesa driver working at any resolution is due to the work of Steve Tomljenovic, author of the original 915resolution, and user vtaylor who posted a modified version at slitaz.org.


Sem comentários: