vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

OpenGL performance

Mon Nov 25, 2019 11:27 am

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?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27855
Joined: Sat Jul 30, 2011 7:41 pm

Re: OpenGL performance

Mon Nov 25, 2019 1:40 pm

What frame rate is the display?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
Paeryn
Posts: 3149
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: OpenGL performance

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).
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

Re: OpenGL performance

Mon Nov 25, 2019 4:09 pm

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.

vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

Re: OpenGL performance

Mon Nov 25, 2019 4:18 pm

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.

vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

Re: OpenGL performance

Mon Nov 25, 2019 4:40 pm

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.

User avatar
Gavinmc42
Posts: 5085
Joined: Wed Aug 28, 2013 3:31 am

Re: OpenGL performance

Tue Nov 26, 2019 3:45 am

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.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

Re: OpenGL performance

Wed Nov 27, 2019 12:03 pm

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.

User avatar
dividuum
Posts: 229
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: OpenGL performance

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.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

vaxon
Posts: 11
Joined: Fri Nov 22, 2019 4:32 pm

Re: OpenGL performance

Wed Nov 27, 2019 2:46 pm

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.

Return to “Graphics programming”