Page 1 of 1

New OpenGL Drivers Causing Issues (Stretch)

Posted: Fri Jan 04, 2019 5:47 am
by davorB
Greetings,
I have been playing with the new Open GL config features and I have noticed that several things do/do not work, based on the chosen GL Driver option. Here are my findings, hopefully it will help with debugging.

G1 GL Full KMS (option 1) 128MB GPU memory split:
glxgears (test openGL program) runs smoothly (60 fps)
Programs in /opt/vc/src/hello_pi (test OpenGL code) return * failed to add service - already in use?
Other Open GL programs (e.g. games such as Neverball) run fine
Pi3d demo programs return assertion error
Trying to change the resolution through GUI Raspberry PI Configuration menu option (see the screen shot) freezes the board completely and it requires restart


G2 GL Fake KMS (option 2), 128MB GPU memory split:
glxgears runs smoothly (60 fps)
Programs in /opt/vc/src/hello_pi return * failed to add service - already in use?
Other Open GL programs (e.g. Neverball) run fine
Pi3d programs return * failed to add service - already in use?

G3 GL Legacy (option 3):
glxgears runs choppily
Programs in /opt/vc/src/hello_pi work well
GUI Raspberry PI Configuration menu option now allows changing resolution (expected behavior)

Configuration:
pi@kaermorhen:~/Documents/pi3d_demos-master $ uname -a
Linux kaermorhen 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

pi@kaermorhen:~/Documents/pi3d_demos-master $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@kaermorhen:~/Documents/pi3d_demos-master $

Re: New OpenGL Drivers Causing Issues (Stretch)

Posted: Fri Jan 04, 2019 8:04 am
by ShiftPlusOne
davorB wrote:
Fri Jan 04, 2019 5:47 am
Here are my findings, hopefully it will help with debugging.
Your post is a good summary of the state of things, but I'm not sure that there's anything to debug. OpenGL programs will never work with the legacy driver. There's ongoing work to make more legacy applications work with the new drivers, but there's never going to be 100% compatibility between the different interfaces.

Re: New OpenGL Drivers Causing Issues (Stretch)

Posted: Fri Jan 04, 2019 4:20 pm
by paddyg
Hi, here's a copy of my post on the pi3d.github issues board
@carambathat I would say it's the other way round! The 'built in' GPU driver uses OpenGL ES 2.0 and that's what pi3d uses - via the broadcom drivers now referred to as 'legacy'. However to get software not originally designed for mobile platforms to work there has been a move to write a 'shell' driver that can interpret OpenGL code and either pass it on the GPU as ES2.0 code it can process or do some CPU processing. Unless the new driver is written very efficiently then I would expect it to be slower than 'pure' OpenGL ES code through the original driver.

There is an extra complication in the appearance of Mesa drivers (that I think are part of debian distributions) that can interpret GL code for the GLES hardware but not very well. They also scramble pi3d's fairly low level access to the GPU.

At one point I looked at making pi3d use SDL2 as a wrapper so it could be installed in a more standard way on different platforms. However I decided that the performance hit (plus the work of refactoring) wouldn't be worth it until the new GL driver for the RPi was finished and signed off. (I did make a Rust version of pi3d as a learning process for myself, which uses SDL2 and runs on windows, linux and RPi https://github.com/paddywwoof/rust_pi3d

Re: New OpenGL Drivers Causing Issues (Stretch)

Posted: Fri Jan 04, 2019 5:09 pm
by davorB
Thank you!! Really appreciate the prompt answer and spelling it all out. I have just started looking into Pi3d and OpenGL (I know Python well) on Raspberry and I kept scratching my head what to do with the driver selection :D. I think the confusion on my part (as an OpenGL newbie) was distinction between the "regular" OpenGL vs. OpenGL ES. I would go on a limb to say that I am probably not the only one having a similar questions ;-)

So - just to make sure I got it right this time - the recommendation is to stick with the "Legacy" driver (which is basically the Open GL ES) for Pi3D?

Btw, just to make it clear, the whole Pi3D project looks like an awesome endeavor!

If there is a way to contribute (even by updating the FAQ's!), I'd be happy to participate.

Re: New OpenGL Drivers Causing Issues (Stretch)

Posted: Fri Jan 04, 2019 9:09 pm
by paddyg
Any help gratefully accepted. There are probably a few things that need to be added to the docs including, as you say, some clarification on the GL driver. There are only a couple of minor fixes in the develop branch so I probably won''t push another release unless something crops up.

The documentation is basically generated using sphinx from a local repository containing https://github.com/pi3d.github.com (install sphinx then cd to the sphinx directory and run 'make clean' then 'make') But it picks all the structured documentation relating to classes and functions from a repository 'at the same level' containing https://github.com/tipam/pi3d i.e.

Code: Select all

..
 |..
    |.. pi3d
    |  |.. experiments
    |  |.. images
    |
    |.. pi3d.github.com
       |.. html
       |.. sphinx
Which you might want to do to see the generated html but otherwise you can just change the markup files in pi3d.github.com then send a pull request and I can put it in my locals repo to check.

Simply using the pi3d module and sending feedback on what works well and what doesn't would be really valuable.

Paddy