We're hiring!
*

Panfrost update: A new kernel driver

Tomeu Vizoso avatar

Tomeu Vizoso
March 04, 2019

Share this post:

Reading time:

Following two months of work to develop a new kernel driver for Midgard and Bifrost GPUs, the kernel side of Panfrost is now in a form close to be acceptable in the mainline Linux kernel.

The video

Below you can see the same scene that I recorded in January, which was rendered by Panfrost in Mesa but using Arm's kernel driver. This time, Panfrost is using a new kernel driver that is in a form close to be acceptable in the mainline kernel:

The history behind it

During the past two months Rob Herring and I have been working on a new driver for Midgard and Bifrost GPUs that could be accepted mainline.

Arm already maintains a driver out of tree with an acceptable open source license, but it doesn't implement the DRM ABI and several design considerations make it unsuitable for inclusion in mainline Linux.

The absence of a driver in mainline prevents users from keeping their kernels up-to-date and hurts integration with other parts of the free software stack. It also discourages SoC and BSP vendors from submitting their code to mainline, and hurts their ability to track mainline closely.

Besides the code of the driver itself, there's one more condition for mainline inclusion: an open source implementation of the userspace library needs to exist, so other kernel contributors can help verifying, debugging and maintaining the kernel driver. It's an enormous pile of difficult work to reverse engineer the inner workings of a GPU and then implement a compiler and command submission infrastructure, so big thanks to Alyssa Rosenzweig for leading that effort.

Upstream status

Most of the Panfrost code is already part of mainline Mesa, with the code that directly interacts with the new DRM driver being in the review stage. Currently targeted GPUs are T760 and T860, with the RK3399 being the SoC more often used for testing.

The kernel driver is being developed in the open and though we are trying to follow the best practices as displayed by other DRM drivers, there's a number of tasks that need to be done before we consider it ready for submission.

The work ahead

In the kernel:

  • Make MMU code more complete for correctness and better performance
  • Handle errors and hangs and correctly reset the GPU
  • Improve fence handling
  • Test with compute shaders (to check completeness of the ABI)
  • Lots of cleanups and bug fixing!

In Mesa:

  • Get GNOME Shell working
  • Get Chromium working with accelerated WebGL
  • Get all of glmark2 working
  • Get a decent subset of dEQP passing and use it in CI
  • Keep refactoring the code
  • Support more hardware

Get the code

The exact bits used for the demo recorded above are in various stages of getting upstreamed to the various upstreams, but here are in branches for easier reproduction:

Comments (13)

  1. Anonymous:
    Mar 05, 2019 at 11:13 AM

    Will this work be dual-licensed so that more opensource projects than just Linux can benefit from it?

    Reply to this comment

    Reply to this comment

    1. Tomeu Vizoso:
      Mar 05, 2019 at 03:08 PM

      Yes, it will be also MIT.

      Reply to this comment

      Reply to this comment

  2. Nazar:
    Mar 05, 2019 at 02:48 PM

    What about Mali-400 GPU? It is still the world’s most popular mobile GPU, featured in 20% of devices.

    What about headless Linux (without X, without Wayland)?

    Reply to this comment

    Reply to this comment

    1. Tomeu Vizoso:
      Mar 05, 2019 at 03:03 PM

      Regarding Mali-400, that one has a completely different architecture and is thus supported by a different driver: Lima. Lima is in a more advanced state than Panfrost.

      Regarding headless, that's already supported.

      Reply to this comment

      Reply to this comment

      1. Peng Cheng:
        Nov 15, 2022 at 10:13 PM

        Hi, as you said "headless" is already supported. Could you elaborate a bit?
        I am trying to make Mesa panfrost work on an ARM board without any display controller(think it is headless if I am correct), but I am stuck here.

        Reply to this comment

        Reply to this comment

        1. Tomeu Vizoso:
          Nov 17, 2022 at 08:27 AM

          Hi!

          > Hi, as you said "headless" is already supported. Could you elaborate a bit?

          I was referring to https://registry.khronos.org/EGL/extensions/MESA/EGL_MESA_platform_surfaceless.txt being supported by Panfrost. So you can render to buffers without having a display or window system in place.

          > I am trying to make Mesa panfrost work on an ARM board without any display controller(think it is headless if I am correct), but I am stuck here.

          Feel free to put specific questions on IRC in the #panfrost channel in OFTC, or enter a support request at https://gitlab.freedesktop.org/mesa/mesa/-/issues/new .

          Good luck!

          Reply to this comment

          Reply to this comment

  3. Erik:
    Mar 06, 2019 at 12:16 PM

    What about the Mali-T628, which is also quite popular? A lot of existing installations would profit from support for it.

    Reply to this comment

    Reply to this comment

    1. Tomeu Vizoso:
      Mar 07, 2019 at 05:22 AM

      I don't know of current work on the T628, but I'm sure someone will do the work once things are a bit more advanced.

      Reply to this comment

      Reply to this comment

  4. stuart naylor:
    Jul 12, 2019 at 01:27 AM

    Tomeu,

    Great work but I am confused to which branch the curious should be using?
    I have been using the root master but still can not get glmark-es2 to complete with an rk3399 with wayland/weston, Linux 5.2.
    I have been looking at the branches and confused is there one that is specific for panfrost fixes?

    Reply to this comment

    Reply to this comment

    1. Tomeu Vizoso:
      Jul 23, 2019 at 07:50 AM

      Latest Mesa with 5.2 should work best.

      Reply to this comment

      Reply to this comment

      1. Stuart Naylor:
        Jul 23, 2019 at 02:05 PM

        Cheers Tom,

        PS dunno what happened with 5.3-rc1 but glmark2-es2 benchmarks plummeted

        Reply to this comment

        Reply to this comment

        1. Stuart Naylor:
          Jul 25, 2019 at 04:50 PM

          I was running Mesa 5.2 compiled at the same time.
          glmark2-es2 dropped 300% to what was with linux 5.2 and mesa 5.2.

          I will see if there are any updates and try a recompile of mesa 5.2 as was hoping there may be a quick fix

          Reply to this comment

          Reply to this comment

  5. Stuart Naylor:
    Jul 26, 2019 at 10:08 AM

    Just recompiled and 5.3rc1 & Mesa19.2 is almost 300% down on 5.2 & Mesa 19.2 glmark2-es2 performance

    Reply to this comment

    Reply to this comment


Add a Comment






Allowed tags: <b><i><br>Add a new comment:


Search the newsroom

Latest Blog Posts

Re-converging control flow on NVIDIA GPUs - What went wrong, and how we fixed it

25/04/2024

While I managed to land support for two extensions, implementing control flow re-convergence in NVK did not go as planned. This is the story…

Automatic regression handling and reporting for the Linux Kernel

14/03/2024

In continuation with our series about Kernel Integration we'll go into more detail about how regression detection, processing, and tracking…

Almost a fully open-source boot chain for Rockchip's RK3588!

21/02/2024

Now included in our Debian images & available via our GitLab, you can build a complete, working BL31 (Boot Loader stage 3.1), and replace…

What's the latest with WirePlumber?

19/02/2024

Back in 2022, after a series of issues were found in its design, I made the call to rework some of WirePlumber's fundamentals in order to…

DRM-CI: A GitLab-CI pipeline for Linux kernel testing

08/02/2024

Continuing our Kernel Integration series, we're excited to introduce DRM-CI, a groundbreaking solution that enables developers to test their…

Persian Rug, Part 4 - The limitations of proxies

23/01/2024

This is the fourth and final part in a series on persian-rug, a Rust crate for interconnected objects. We've touched on the two big limitations:…

Open Since 2005 logo

We use cookies on this website to ensure that you get the best experience. By continuing to use this website you are consenting to the use of these cookies. To find out more please follow this link.

Collabora Ltd © 2005-2024. All rights reserved. Privacy Notice. Sitemap.