[Buildroot] Buildroot + Rpi4 + Accelerated OpenGL + X11

Giulio Benetti giulio.benetti at benettiengineering.com
Tue Aug 31 22:36:06 UTC 2021


Hi David,

On 9/1/21 12:05 AM, David Corbeil wrote:
> Hi,
> 
> 
> Using Buildroot, I’m trying to build an OS that can run my OpenGL (not 
> ES) app with accelerated 3D graphics. I also want it to use X11 as a 
> display server. So far I haven’t tried my app directly on my built OS 
> because it has many dependencies but I’m using glmark2, kmscube and 
> glxgear to debug and try out different Buildroot configurations.
> 
> 
> I tried the /vc4-kms-v3d-pi4/ and /vc4-kms-v3d/ overlays in the 
> config.txt, but I’ve had better results using the former.
> 
> 
> So far I was able to get glmark2 to run but it was using a software 
> OpenGL renderer (swrast). Although performance is abysmal so that’s a no 
> go.
> 
> 
> I have 4 flavors of glmark2 in my OS, glmark2, glmark2-es2, 
> glmark-es2-drm and glmark2-drm. The only ones that run are glmark2-drm 
> and glmark2-es2-drm. They run really well at 60fps. kmscube runs really 
> well as well.
> 
> 
> The problem comes when I try to run glxgears and glxinfo when X11 is 
> running. I get the following errors:
> 
>   *
> 
>     Glxgears
> 
>         Error: Couldn’t get an RGB, Doubled-bufferedvisual
> 
>   *
> 
>     Glxinfo:
> 
>         name of display: :0
> 
>         Error: couldn’t find RGB GLX visual or fbconfig >   *
> 
>     Glmark2:
> 
>         Error: GLX version >= 1.3 is required
> 
>         Error: Error: Couldn’t get GL visual config
> 
>         Error: main: Could not initialize canvas
> 
> I’d like to get the regular glmark2 to run since, from my understanding, 
> it uses regular OpenGL?

It depends on your OpenGL implementation, and here you have an ES 
implementation, so it's only a subset, but considering your defconfig 
below X tries to use the ES one but doesn't succeed because of fbturbo 
doesn't support your broadcom gpu.

> 
> I’m pretty convinced my end goal is possible because I was able to get 
> my app to run flawlessly in Raspberry Pi OS using regular OpenGL. Just 
> need to find all the necessary packages and configure the OS correctly. 
> Easy to say, easy to do right?

It is possible

> 
> I linked my defconfig, the xorg configuration file and xorg log file.
> 
> 
> buidlroot Rpi4_32_defconfig_eudev: https://pastebin.com/xfJ9WbdQ 
> <https://pastebin.com/xfJ9WbdQ>
> 
> xorg.conf: https://pastebin.com/vewDwmtD <https://pastebin.com/vewDwmtD>
> 
> xorg log: https://pastebin.com/0yDXGDr7 <https://pastebin.com/0yDXGDr7>
> 
> 
> Maybe the xorg configuration file needs to be modified? But how? 
> According to this <https://github.com/raspberrypi/linux/issues/4526>, I 
> should not be using fbturbo but I don’t know what to replace it with.

Yes, you need to use glamor as I recall, so you need to enable it in 
Buildroot and 'make clean; make'.

Try to take a look here for xorg.conf example:
https://www.mindwerks.net/2014/09/videocoreiv-glamor-on-your-raspberry-pi/

That way you tell X11 to use glamor and force Gallium(the Broadcom mesa 
driver). But you need to do some attempt, I don't know if it will work 
as it is.

Some time passed since I've had my hands on X11 on a Rockchip. But 
glamor should be the way.

I didn't check everything I've written above, so take it with a grain of 
salt.

Best regards
-- 
Giulio Benetti
Benetti Engineering sas


More information about the buildroot mailing list