"MESA_swap_control is required for this functionality" on raspian buster - raspi 4

20 views
Skip to first unread message

Volker Süß

unread,
Aug 18, 2019, 12:59:06 PM8/18/19
to pyglet-users
I got this error with pyglet 1.4  on a new raspi 4 with raspian buster:

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/__init__.py", line 353, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Sprite'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./pyglettest.py", line 66, in <module>
class Picmove(pyglet.sprite.Sprite):
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/__init__.py", line 359, in __getattr__
__import__(import_name)
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/sprite.py", line 109, in <module>
from pyglet.gl import *
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 237, in <module>
import pyglet.window
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/window/__init__.py", line 1889, in <module>
gl._create_shadow_window()
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 209, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 171, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/window/__init__.py", line 642, in __init__
self._create()
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 265, in _create
self.context.set_vsync(self._vsync) # XXX ?
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 255, in set_vsync
glxext_mesa.glXSwapIntervalMESA(interval)
File "/home/pi/.local/lib/python3.7/site-packages/pyglet/gl/lib.py", line 64, in MissingFunction
raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: glXSwapIntervalMESA is not exported by the available OpenGL driver. MESA_swap_control is required for this functionality.

The output of glxinfo looks mostly similar to my ubuntu 18.04 desktop.

Any idea how to fix this? Or is this a raspian-bug?

Thx

Volker

Benjamin Moran

unread,
Aug 19, 2019, 8:24:30 AM8/19/19
to pyglet-users
What happens if you set vsync=False when creating the window?

Volker Süß

unread,
Aug 19, 2019, 12:36:10 PM8/19/19
to pyglet-users
Meanwhile I found a other hint -> https://github.com/anholt/libepoxy/issues/201#issuecomment-473466249

And so I changed the xlib.py in pyglet:

#        self._have_MESA_swap_control = config.glx_info.have_extension('GLX_MESA_swap_control')
        self._have_MESA_swap_control = config.glx_info.have_extension('GLX_EXT_swap_control') # vs. 19/8/19

This works for me. But my raspi 4 is actually to slow to show my sprites smoothly...

Mathew Workman

unread,
Aug 19, 2019, 1:01:06 PM8/19/19
to pyglet-users

I am in Linux (Mint) and have Raspberry PI's here as well...   would it help you if I also tried to run what you are running, to see if I get similar results?

Benjamin Moran

unread,
Aug 20, 2019, 12:07:34 AM8/20/19
to pyglet-users
It seems like we should change to GLX_EXT_swap_control in pyglet. 
I'll look into that. 

Also, it's interesting to know that pyglet works on Raspberry Pi. 

Benjamin Moran

unread,
Sep 4, 2019, 9:35:53 PM9/4/19
to pyglet-users
In the master branch on Github, support has been added for GLX_EXT_swap_control. This does not replace GLX_MESA_swap_control, but it will be tried first if it exists. After looking into this, is seems that one or the other will be available - depending on your graphics drivers. 

If someone with a Raspberry Pi could give this a try, that would be great! 

-Ben

Manolis Froudarakis

unread,
Sep 5, 2019, 9:09:20 PM9/5/19
to pyglet-users
I did, but it still goes with the mesa even though it fails later. 
So I have to force it to use the glxSwapIntervalEXT but the code has a bug and you have to use the following format:
glxext_arb.glXSwapIntervalEXT(self.x_display,True,0)

Also performance wise I don't see any difference with SGI, steady fps but a lot of tearing.  
Reply all
Reply to author
Forward
0 new messages