Sunday, 27 October 2013

I.MX6 - Ubuntu 13.04 with GPU acceleration

One of the main drawbacks with the existing freescale BSP releases (up to 4.1.0) was the lack of support beyond xorg-server version 11. This was due to lack of support within the Vivante GPU libraries. With the introduction of a new BSP based on kernel 3.5.7,  it is finally possible to build support for xorg-server beyond version 11. The added bonus is support for armhf, however this is offset by the fact that the Vivante libraries are currently marked as alpha.


video


I've put together a preview Xubuntu Raring (13.04) rootfs to demonstrate this, 13.04 is based on xorg-server 13.3. Sadly there no video acceleration, this is work in progress, the major hurdle is that existing fsl gstreamer plugins are coded against 0.10 and there are compatibility issues with a later GLib version. The short video above gives an indication of how the libraries performs (video shows running  glmark2-es2,  vivante sdk sample and the 3D game Neverball at 720p). Note, not all OpenGL applications (eg FireFox) are compatible with the Vivante libraries because of limited API.

The rootfs has been updated to use the latest Vivante libraries producing better performance figures for OpenGL.

The origins of my rootfs is this minimal console rootfs  which I think was put together by Robert Nelson (this has no GPU/VPU support). My rootfs is fairly clean, sanitised and contains a minimal xbuntu installation. The intention was include just enough to get an accelerated desktop functioning and for the rest to be customised depending on the target device.

Another goal was to make the rootfs available to be deployable to any i.mx6 device. It should be possible to deploy this to any i.mx6 device (eg boundarydevices, wandboard, utilite, udoo, cubox-i) assuming it contains a dual or quad processor. By the way I don't own any of the mentioned devices but glad to accept hardware donations. All you require is a working uboot and kernel (4.1.0) or (3.5.7). I haven't tested again a 3.5.7 kernel, furthermore it may be possible to run against a later kernel again not tested. If you plan to derive a new rootfs from mine, please acknowledge the author.

Extract the rootfs to your designated media and copy your kernel and modules as required. The rootfs is configured to output to the serial console with auto-logon for root. By default the image boots to display a console logon prompt, if hdmi is configured. The user and password are 'ubuntu'.

Xfce4 is not configured to auto start, you can start it by:

service lightdm start

If you require auto start, remove lightdm override:

rm /etc/init/lightdm.override

You will need to configure networking as per your requirements. I decided not to install network-manager due the dependencies on gnome. You may need to edit the nameserver entry in /etc/resolvconf/resolv.conf.d/tail .

The mesa utilities glxgears,es2gears, glmark2, glmark2-es2 are pre-installed. glmark2 will end after the jellyfish demo with a segmentation fault.

The Vivante samples are located in /root/gpu-viv-bin-mx6q-3.10.9-1.0.0-hfp/opt/viv_samples.

If your deployment fails to run X, then my next post has some debugging steps. Also available to answer questions  IRC Freenode #imx6-dongle

21 comments:

  1. Hi Jasbir,

    I didn't have any luck with a 4.1.0 kernel on a Nitrogen6X.

    Something's failing with the message "libGL error: open DRM failed" right after successfully opening /dev/dri/card0 and failing to open /dev/dri/card1..16.

    /var/log/Xorg.log reports success loading the Vivante driver:

    [ 10.076] (II) VIVANTE(0): FB Start = 0x333f2000 FB Base = 0x333f2000 FB Offset = (nil)
    [ 10.076] (II) VIVANTE(0): test Initializing EXA
    [ 10.076] (II) EXA(0): Driver allocated offscreen pixmaps
    [ 10.076] (II) EXA(0): Driver registered support for the following operations:
    [ 10.076] (II) Solid
    [ 10.076] (II) Copy
    [ 10.076] (II) Composite (RENDER acceleration)
    [ 10.076] (II) UploadToScreen
    [ 10.082] (==) VIVANTE(0): Backing store disabled
    [ 10.083] (==) VIVANTE(0): DPMS enabled
    [ 10.105] (II) [drm] DRM interface version 1.4
    [ 10.105] (II) [drm] DRM open master succeeded.
    [ 10.105] (II) VIVANTE(0): [drm] Using the DRM lock SAREA also for drawables.
    [ 10.105] (II) VIVANTE(0): [drm] framebuffer handle = 0x18000000
    [ 10.105] (II) VIVANTE(0): [drm] added 1 reserved context for kernel
    [ 10.105] (II) VIVANTE(0): X context handle = 0x1
    [ 10.105] (II) VIVANTE(0): [drm] installed DRM signal handler
    [ 10.105] (II) VIVANTE(0): [DRI] installation complete
    [ 10.105] (==) RandR enabled
    [ 10.116] (II) SELinux: Disabled on system
    [ 10.117] (II) AIGLX: Screen 0 is not DRI2 capable
    [ 10.117] drmOpenDevice: node name is /dev/dri/card0
    [ 10.117] drmOpenDevice: open result is 12, (OK)
    [ 10.118] drmOpenByBusid: Searching for BusID platform:Vivante GCCore:00
    [ 10.118] drmOpenDevice: node name is /dev/dri/card0

    Do you have a working defconfig?

    ReplyDelete
    Replies
    1. I got it working on a gk802. I boot it with:
      Kernel command line: console=ttymxc3,115200 root=/dev/mmcblk1p1 rootwait rootfstype=ext4 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 console=tty0 fixrtc consoleblank=0

      My defconfig is:
      http://pastebin.com/USTFeD53


      Try to start X with startx, it might get you some more info like if there is a mismatch in galcore version. I had that on 4.1.0 and had to fetch drivers/mxc/gpu-viv from the dora buildt kernel and recompile.

      hste

      Delete
  2. Boots to command prompt with kernel 3.12.0-rc5-armv7-x4 on Wandboard Quad but no success trying to run X, no error msgs, either...

    ReplyDelete
    Replies
    1. 3.12 from Robert Nelson is mainline kernel, this release has nothing to do with systems running on mainline because Vivante kernel drivers are not available there. Run 3.0.35-4.1.0 to use this.

      Delete
  3. How exactly do I boot from this? I own an UDOO, in which it tends to have a hidden boot partition with no access to anything u-boot related. Do you have or know of a guide on how to set up the SD card so I can boot this?

    ReplyDelete
    Replies
    1. Hi,

      You don't need to access the uboot. What you need to do is extract the rootfs and deploy a compatible UDOO kernel.

      Delete
  4. Hi Jasbir,

    I got AIGLX error on missing /usr/lib/arm-linux-gnueabihf/dri/vivnate_dri.so. I copied /usr/lib/dri/vivante_dri.so into that directory but it still failed.
    [ 46.032] (EE) AIGLX error: vivante exports no extensions (/usr/lib/arm-linux-gnueabihf/dri/vivante_dri.so: undefined symbol: __driDriverExtensions)
    [ 46.032] (EE) AIGLX: reverting to software rendering
    [ 46.130] (II) AIGLX: Loaded and initialized swrast

    Did you see the same error or how did you solve this? Thanks.

    ReplyDelete
    Replies
    1. Hi, AIGLX is for glx non-DRI implementation. The vivante driver doesn't make use of AIGLX so this shouldn't stop it working.

      Delete
    2. Hi Jasbir,

      Thanks for the explanation. We'd like to give you our standard iMX6 quad board for evaluation. If you have interest, please leave your contact information here (http://www.bcmcom.com/bcm_inquiries_sales.htm). Thanks.

      Delete
    3. Hi Frodo,

      Happy to accept your offer of an imx6q evaluation board and sent you my contact details. By the way I would be very keen to evaluate your up comming Bay Trail motherboard (MX1900J) and compare to the imx6.

      Delete
    4. Hi Jasbir,

      We're waiting for the next shipment of MX1900J boards. We'll send you iMX6 board first and then MX1900J once available. Thanks.

      Delete
    5. Hi Frodo,

      Again many thanks, by the way I've added a contact form on the blog if you need to contact me.

      Delete
  5. Hello Jasbir,
    I am Robert, the founder of Open Source iMX6 Rex project. We are working together with group of enthusiastic game developers who are interested to check the capabilities of the iMX6 platform. You have a great knowledge about graphic acceleration. Would you be interested to have a look at our project?
    Thank you,
    Robert

    ReplyDelete
    Replies
    1. Hi Robert,
      I did hear of Rex a couple a months back, looks like an interesting board. Happy to look at your project.
      Jasbir

      Delete
    2. Hi Jasbir. Thank you very much. How could I contact you? Please, would you send me your email through the IMX6 Rex contact page? Have a very nice day, Robert.

      Delete
    3. Jasbir, based on your blog, we have tested the opt/viv_samples/vdk./tutorial7 on our Rex board - amazing - 630 FPS.
      R., from the game developers, is going to do more tests. You and your blog helped us a lot :) Thank you for great tutorials.

      Delete
    4. Hi,

      630 FPS is great, what resolution? I sent you contact details through Rex contact page.

      Delete
    5. We have tested it on our LVDS display: 1024x768. We will also try HDMI later. I have got your contact and I will send you an email.

      Delete
  6. Hi Jasbir,could you contact me asap hydragon at hotmail.nl.
    I want to send you some new hardware.

    ReplyDelete
  7. Hi Jasbir,

    Do you know if this will work to get Chromium/Webkit GPU accelerated? I need 3d css/ css animations to be GPU accelerated as much as possible using (preferrably) Chromium. If not, do you have any suggestions for the best path to take?

    Thanks!

    ReplyDelete
  8. Jasbr,
    If possible, I'd greatly appreciate a description of how to "Extract the rootfs to your designated media and copy your kernel and modules as required." you mentioned in your 10/27/13 post. I think I know how to do the extract part, but not the "copy" parts. I'm not sure where to locate the image I need for a Wandboard Quad or what modules I need. Also unsure about the correct location for each of these on the SD card. Thanks a lot.

    ReplyDelete