niem27
Posts: 2
Joined: Mon Aug 01, 2022 2:57 pm

How to enable hardware acceleration on Raspbian Stretch with Python + Kivy

Mon Aug 01, 2022 3:27 pm

Hi,

I have a Raspberry PI3 (compute module version) with Raspbian 9 Stretch that I am trying to run an application on.
The application is written in Python and uses the Kivy (kivy.org) libraries.
Now the problem is that although the app runs it is not hardware accelerated and some animations/drawing are slow/stuttering.

In the log produced by the application I always see OpenGL renderer <b'llvmpipe ...'> while I should read something like OpenGL renderer <b'VC4 V3D ...'>.

I tried several things like compiling kivy from source, compiling SDL2 from source (https://kivy.org/doc/stable/installatio ... source-rpi), changing a number of enviroment variables, boot to the CLI instead of the desktop etc... but none of this worked.
I searched both in this forum and others (like stackoverflow).

I also tried to enable/disable the f/kms overlay in config.txt, but I noticed that when when I wrote dtoverlay=vc4-kms-v3d (or equivalently using raspi-config) the display wouldn't start (screen completely black and nothing ever comes on) even though the pi was very much alive as I could ssh into it.

It would be nice to be able to benefit from the hardware acceleration.

Thanks in advance!

Some additional information that could be useful (if something else is needed please ask)

Code: Select all

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux

Code: Select all

pi@raspberrypi:~ $ glxinfo | grep -i opengl
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 13.0.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 13.0.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 13.0.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

Code: Select all

pi@raspberrypi:~ $ glxheads 
glxheads: exercise multiple GLX connections (any key = exit)
Usage:
  glxheads xdisplayname ...
Example:
  glxheads :0 mars:0 venus:1
Name: localhost:10.0
  Display:     0x1b7b318
  Window:      0x4600002
  Context:     0x1b8ef80
  GL_VERSION:  3.0 Mesa 13.0.6
  GL_VENDOR:   VMware, Inc.
  GL_RENDERER: Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)
glxgears reports around 33 fps

Code: Select all

pi@raspberrypi:~ $ vcgencmd version
Jul  9 2019 14:40:53 
Copyright (c) 2012 Broadcom
version 6c3fe3f096a93de3b34252ad98cdccadeb534be2 (clean) (release) (start)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13123
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: How to enable hardware acceleration on Raspbian Stretch with Python + Kivy

Mon Aug 01, 2022 6:33 pm

Why are you still trying to use Stretch? If you want support for vc4-kms-v3d you need to be on at least Buster, and preferably Bullseye, using a 5.10 or 5.15 kernel, recent firmware, and recent mesa.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Bluestang
Posts: 90
Joined: Sat May 30, 2020 8:43 pm

Re: How to enable hardware acceleration on Raspbian Stretch with Python + Kivy

Tue Aug 02, 2022 2:03 am

6by9 wrote: ...recent mesa.
Since there is a rpi patched version of MESA 20.3.5, why not use a more recent version i.e. - 21.X.X or 22.X.X?

Just looking at debian/patches folder there are 20+ backported patches (mostly for v3d) which seems like a maintainer's nightmare from an outsider's point of view...

niem27
Posts: 2
Joined: Mon Aug 01, 2022 2:57 pm

Re: How to enable hardware acceleration on Raspbian Stretch with Python + Kivy

Fri Aug 05, 2022 12:41 pm

Sorry for the late reply.
Yes the os is quite old, unfortunately for various reasons that was what I had to work on.
I will try to see if I can use a newer release. Thanks again.

Return to “Graphics programming”