acer
Posts: 8
Joined: Mon Dec 30, 2013 3:33 pm

OpenGL Drivers on Raspberry Pi B/B+/Zero

Thu Nov 24, 2016 1:17 am

The experimental OpenGL drivers that shipped with Jessie about half a year ago are said to only work with the Pi 2 and Pi 3, due to "memory requirements". However, I would like to be able to test these drivers on my older Raspberry Pi devices, as well as the Pi Zero.

Is there any possible way to run the experimental OpenGL drivers on the older B and B+, as well as on the Zero? Is it possible, perhaps, to reduce the amount of memory that these drivers use?

Any help would be greatly appreciated.

levelcrow
Posts: 47
Joined: Tue Aug 12, 2014 5:04 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Fri Nov 25, 2016 6:00 pm

Here is the way I've done it. Please be aware that this could mess up your image and may not be fully correct, I'm giving instructions from memory. Do not attempt this unless you've got a backup and you're willing to scrap the image you're working on.

Introduction
You're in for a treat. The ability to adjust for different CMA sizes landed earlier this year. The OpenGL driver does work on the Raspberry Pi 1 and 0, or at the very least you can get to the desktop and run glxgears. Things definitely aren't as smooth on the RPi 1/0 relative to the RPi 2/3, window dragging is noticeably slow and actual desktop use like the LibreOffice suite seems to be slower than the closed driver. I don't think it's that surprising, as much of the Mesa and Xserver work done in the past year isn't up to date - or at least that what I believe. I've been looking forwards to the release of Raspbian 9 Stretch for this reason, the package updates should bring a lot of fixes and great changes. So far as I know, Raspbian seems to be a lot like the rest of the Linux community in that they don't like to make promises but rather prefer to simultaneously announce and deliver. But if I were to speculate what exciting changes we may see in 2017, I'd guess we might see a default adoption of Compton and perhaps LXQt. It will be cool to see if there really is a better way to do things, and if so by how much. The Raspberry Pi 1 has been around for a long time, it's not often you see hardware get significantly better performance 4 years down the road due to software. But given the power of the GPU relative to the ARMv6 CPU, we may be in for a demonstration on the power of well-written software. Or maybe we'll find out that software only goes so far, who knows?

Methods
I changed my raspi-config to allow for enabling the OpenGL driver on the Raspberry Pi 1/0. First open up raspi-config for modification.

In terminal:

Code: Select all

sudo geany /usr/bin/raspi-config &
In raspi-config, find the method do_gldriver(). Underneath should be this conditional.

Code: Select all

if is_pione || is_pizero; then
    whiptail --msgbox "GL driver cannot be used on Pi 1 or Pi 0" 20 60 2
    return 1
  fi
Delete this section of code. Save Raspi-config and exit.

Now go to /boot/config.txt and add the following line to the file:

Code: Select all

#dtoverlay=vc4-kms-v3d,cma-128
It is very important that the cma-128 be present or else the aforementioned memory problems will be problematic. After making these changes you can run raspi-config and enable the OpenGL driver as you would for a RPi 2/3.

Tell me how it goes and if this doesn't work out!
Michael

acer
Posts: 8
Joined: Mon Dec 30, 2013 3:33 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Fri Nov 25, 2016 6:58 pm

Thanks, I will definitely try that and get back to you!

acer
Posts: 8
Joined: Mon Dec 30, 2013 3:33 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Fri Nov 25, 2016 8:01 pm

You are right that window dragging is slow, but the drivers appear to be enabled and working on the Raspberry Pi B+! glxgears works, and I'm installing neverball right now to test it out.

Thanks for the help! If any problems are found I will post them.

levelcrow
Posts: 47
Joined: Tue Aug 12, 2014 5:04 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Sat Nov 26, 2016 2:01 am

Great, glad to hear it worked out!

I hope that the window dragging problem is fixed soon. Eric Anholt actually addressed this in his most recent blog post 11/14/2016.

http://anholt.livejournal.com/49712.html?nojs=1
I also tracked down a major performance issue in Raspbian's desktop using the open driver. I asked them to use xcompmgr a while back, because readback from the front buffer using the GPU is really slow (The texture unit can't read from raster textures, so we have to reformat them to be readable), and made window dragging unbearable. However, xcompmgr doesn't unredirect fullscreen windows, so full screen GL apps emit copies (with reformatting!) instead of pageflipping.

It looks like the best choice for Raspbian is going to be using compton, an xcompmgr fork that does pageflipping (you get tear free screen updates!) and unredirection of full screen windows (you get pageflipping directly from GL apps). I've also opened a bug report on compton with a description of how they could improve their GL drawing for a tiled renderer like the Pi, which could improve its performance for windowed updates significantly.

Simon ran into some trouble with compton, so he hasn't flipped the default yet, but I would encourage anyone running a Raspberry Pi desktop to give it a shot -- the improvement should be massive.
Perhaps you could try out Compton on the Pi 1/0 with the OpenGL driver and tell me how that goes. I've been curious, I haven't gotten around to trying it. But if you did, I'd be very interested to hear about it.

Edit: Also, if Simon Long were to come into this thread and give info regarding Compton and its current development/adoption into Raspbian, that would be extremely and unbelievably cool.

acer
Posts: 8
Joined: Mon Dec 30, 2013 3:33 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Sun Jan 01, 2017 9:46 pm

Haven't checked this thread in awhile, but reading more carefully through it, I'm going to try compton soon. Hopefully window dragging performance will be improved as well as the performance fullscreen GL applications.

Quick side note: what is the effect of changing the gpu_mem setting in config.txt while the experimental drivers are enabled? My initial testing indicated that I could set it to a low value like 16 but not as low as 0. My guess is that with experimental drivers, the gpu_mem is used to initialize the gpu and from then on the CMA memory is used, can anyone confirm or deny?

Aeyesi
Posts: 8
Joined: Sun Jan 15, 2017 5:46 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Sun Mar 05, 2017 12:09 pm

Hey hey,
I wanted to give this a try, but the info's here seems not to be correct.
Anyone interested in updating this thread?

acer
Posts: 8
Joined: Mon Dec 30, 2013 3:33 pm

Re: OpenGL Drivers on Raspberry Pi B/B+/Zero

Mon Mar 06, 2017 4:12 am

As far as I know it's correct. What are you experiencing issues with?

Return to “Raspbian”