Page 1 of 1

OpenGL performance

Posted: Mon Nov 25, 2019 11:27 am
by vaxon
I've been experimenting with OpenGL on Raspberry Pi 3.
I can get 60fps with a simple full-screen demo using Legacy driver and bcm libraries, which is quite cool.
However, using either fake KMS or full KMS drivers I don''t seem to get more than 30fps with the same demo
Even glxgears shows about 30fps when started with the -fullscreen option. Even vblank_mode=0 doesn't help.
Is this behavior expected?

BTW, is it different op Pi4?

Re: OpenGL performance

Posted: Mon Nov 25, 2019 1:40 pm
by jamesh
What frame rate is the display?

Re: OpenGL performance

Posted: Mon Nov 25, 2019 2:05 pm
by Paeryn
From what I've read, the VC6 on the RPi4 only has two QPU slices whereas the VC4 on older models had three. The new QPUs have more instructions (can work with half floats I think), more registers (in one bank rather than two), possibly better pipelined and maybe more cache in addition to being run at a higher frequency.

It's entirely possible that a basic shader won't be able to make much use of any improvements and so the reduced QPU count could lead to slower pixel throughput. Where it gains would be when using more complex shaders where the new QPUs could possibly do the pixel shading faster than the old ones to a point where, even though there is one fewer QPU available, the speed ups result in an overall increase in pixel throughput.

Also the old legacy driver would have been tuned to a high degree to work on just the VC4 whereas the MESA drivers might have inefficiencies due to less time / work spent on optimising them (the final code generation specific to the VC4 & VC6).

Re: OpenGL performance

Posted: Mon Nov 25, 2019 4:09 pm
by vaxon
jamesh wrote:
Mon Nov 25, 2019 1:40 pm
What frame rate is the display?
The display shows 60Hz with the legacy driver and 59.7Hz with fake/full kms.

Thanks,
V.

Re: OpenGL performance

Posted: Mon Nov 25, 2019 4:18 pm
by vaxon
Paeryn wrote:
Mon Nov 25, 2019 2:05 pm
From what I've read, the VC6 on the RPi4 only has two QPU slices whereas the VC4 on older models had three. The new QPUs have more instructions (can work with half floats I think), more registers (in one bank rather than two), possibly better pipelined and maybe more cache in addition to being run at a higher frequency.

It's entirely possible that a basic shader won't be able to make much use of any improvements and so the reduced QPU count could lead to slower pixel throughput. Where it gains would be when using more complex shaders where the new QPUs could possibly do the pixel shading faster than the old ones to a point where, even though there is one fewer QPU available, the speed ups result in an overall increase in pixel throughput.

Also the old legacy driver would have been tuned to a high degree to work on just the VC4 whereas the MESA drivers might have inefficiencies due to less time / work spent on optimising them (the final code generation specific to the VC4 & VC6).
Thank you very much for your detailed reply!
I wonder any actual benchmark/test results are available. Would be quite interesting to compare.

Thanks,
V.

Re: OpenGL performance

Posted: Mon Nov 25, 2019 4:40 pm
by vaxon
BTW, glxgears shows more fps at lower resolutions.
For example, "vblank_mode=0 glxgears -fullscreen" gives the following results with kms drivers:
30fps at 1920x1080@59.7
72fps at 1280x720@59.9

Not sure how to disable vblank sync with the legacy driver.
Thus, hello_triangle.bin test from /opt/vc/src/hello_pi/hello_triangle shows 60fps at any resolution.

Thanks,
V.

Re: OpenGL performance

Posted: Tue Nov 26, 2019 3:45 am
by Gavinmc42
It also depends on the mesa driver version.
And that can depend on the OS, Buster Raspbian is a bit behind Gentoo64.

Buster is also compiled as 32bit and Gentoo64 as 64bit.
There does seems to be a performance difference.

I use two OpenGL stress test games 0AD and Warzone2100, both are a bit better on Gentoo64.
OAD needs a lot of ram and only runs on Pi4B2 or 4GB.
SuperTuxKart prefers OpenGL3.3 but is playable.

Glxgears at 1980x1024 60fps for my Gentoo64 Pi4's is as high a resolution as I can test.
The Mesa demo ipers example gives me 23fps, 26584 polygons for 623786 poly/sec on 1280x1024.

Re: OpenGL performance

Posted: Wed Nov 27, 2019 12:03 pm
by vaxon
Thanks!

Looks like VC libraries and non-GL driver is the best option to get the highest frame rate on Pi3 at the moment.
Is it possible to disable vbank sync in this case to get more than 60fps?

Thanks,
V.

Re: OpenGL performance

Posted: Wed Nov 27, 2019 12:31 pm
by dividuum
vaxon wrote:
Wed Nov 27, 2019 12:03 pm
Looks like VC libraries and non-GL driver is the best option to get the highest frame rate on Pi3 at the moment.
I assume by non-GL drivers you mean non-Mesa drivers? If so, with the closed source GL drivers on pre-Pi4 hardware, I think eglSwapInterval(display, 0) worked for me. But then you probably get screen tearing.

Re: OpenGL performance

Posted: Wed Nov 27, 2019 2:46 pm
by vaxon
dividuum wrote:
Wed Nov 27, 2019 12:31 pm
vaxon wrote:
Wed Nov 27, 2019 12:03 pm
Looks like VC libraries and non-GL driver is the best option to get the highest frame rate on Pi3 at the moment.
I assume by non-GL drivers you mean non-Mesa drivers? If so, with the closed source GL drivers on pre-Pi4 hardware, I think eglSwapInterval(display, 0) worked for me. But then you probably get screen tearing.
Yes, that's exactly what I mean. It's called "Original non-GL desktop driver" in raspi-config if I'm not mistaken.
Thank you, eglSwapInterval works for me as well. I don't mind the tearing, just wanted to find out how fast it could possibly be.
Got 177 fps at 1920x1080 with the simple hello_triangle test from /opt/vc/src. Nice!

Thanks,
V.