Enable Glamor EGL with Mali

Jasper St. Pierre jstpierre at mecheye.net
Mon Jan 4 11:17:37 PST 2016

Let me copy/paste an internal email I wrote when I was investigating a
similar thing.


I've been investigating using the new Glamor acceleration layer for
our Xorg DDX.

For those not familiar with Glamor, basically, it implements X11
drawing primitives on top of OpenGL, so you can use your GPU instead
of your CPU for drawing. It's a pretty significant win over software
rendering, so I started to investigate poking at it.

The first issue I encountered is that Glamor is designed to work
together with desktop GL and GLX. It does have a GLES mode, but I
really had to push hard and patch a bunch of stuff to figure out how
to turn it on. The Mali driver only has EGL and OpenGL ES. So, that's
a patch: http://sprunge.us/TggM

To actually talk to the underlying GL library, Glamor uses a utility
library called Epoxy which tries to wrangle WGL / AGL / GLX / EGL /
OpenGL / OpenGLES / everything.

Unfortunately, Epoxy hardcodes the assumption that if we're building
on Linux, we *must* have a full OpenGL stack. So, yeah, I needed to
patch that as well: http://sprunge.us/JQPi

We require a libGL to build the GLX extension, even though we
shouldn't ever load it in practice, but this is just another bit of
confusion for Epoxy, which might try to load the wrong libGL.

Anyway, after all that, you mess up your build environment and then
give up, and then realize that you messed up.


So here's where I'm at now. In order to do rendering to an offscreen
buffer that we can export, Glamor uses the "gbm" backend to EGL, which
allows us to render to a buffer of our choosing. Unfortunately, it
seems that backend isn't turned on in our Mali build.

So now, eglInitialize(); is still failing, even after a long time of
patching. At this point, I think the initial investigation is mostly
complete. I still think that if there's some downtime, I'm going to
pick this back up, since I do believe that it will significantly help
some of the performance issues I've been seeing. Slow application
performance can be traced with `perf top` back to fb's software

Future problems:

Glamor requires several EGL extensions. One of those is
surfaceless_context, which I've already hackily (and untested-ly!)
implemented for now in the DDK, but another would be MESA_drm_image,
which will be a lot more tricky to support.


If you have a copy of the closed-source Mali DDK source tree, we
should talk offline about implementing this if you want to continue
it. It would be a major win for us.

On Mon, Jan 4, 2016 at 5:07 AM, Erez Schneider <erez101 at gmail.com> wrote:
> Hello,
> I'm trying to enable glamor EGL on a Mali GPU (using mali binary egl/gles
> driver with x11).
> I am building xserver-xorg without GBM support (I had to change the
> galmor_egl.c a bit for it to compile properly, but from looking at it, it
> seems it's not a must to use GBM).
> I am calling eglGetDisplay() and it returns a display struct but when I call
> eglInitialize(), while setting DISPLAY=:0 the xserver just hangs.
> Any Idea on how to get this going?
> Thanks!
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list