Open alex-tee opened 3 years ago
3BandEQ says this (on Wayland, not XWayland):
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 150 (GLX)
Minor opcode of failed request: 5 (X_GLXMakeCurrent)
Serial number of failed request: 30
Current serial number in output stream: 30
this may be related to https://gitlab.gnome.org/GNOME/gtk/-/issues/4441 (which is on XWayland but seems related)
it looks like this happens with bridged UIs as well.
DrumGizmo on Wayland using the ENGINE_OPTION_PREFER_UI_BRIDGES
option:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 31
Current serial number in output stream: 31
3BandEQ says this (on Wayland, not XWayland):
X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 150 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 30 Current serial number in output stream: 30
this may be related to https://gitlab.gnome.org/GNOME/gtk/-/issues/4441 (which is on XWayland but seems related)
This is a different one. Seems like creating a GL context is failing entirely.
The others are about giving input focus, something that could happen on X11 too.
3BandEQ says this (on Wayland, not XWayland):
X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 150 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 30 Current serial number in output stream: 30
this may be related to https://gitlab.gnome.org/GNOME/gtk/-/issues/4441 (which is on XWayland but seems related)
GTK dev checking in, @alex-tee just asked me about this:
This happens because Wayland uses EGL (and so does GTK on Wayland) and the X server (XWayland in this case) gets confused it both an EGL and a GLX context are current at the same time.
You can in theory fix that if you clear the current other context (and pray that Mesa/nvidia drivers don't fall over). However, neither EGL code nor GLX code usually is aware of this, so they don't do that and then explode.
Clearing contexts is also slow, so it's not recommended to excessively clear contexts.
it looks like this happens with bridged UIs as well.
DrumGizmo on Wayland using the
ENGINE_OPTION_PREFER_UI_BRIDGES
option:X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 42 (X_SetInputFocus) Serial number of failed request: 31 Current serial number in output stream: 31
the X_SetInputFocus
issue with fluida and the one I quoted above are fixed when clearing GTK's opengl context before running ui_idle()
and then returning it.
3BandEQ says this (on Wayland, not XWayland):
X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 150 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 30 Current serial number in output stream: 30
this may be related to https://gitlab.gnome.org/GNOME/gtk/-/issues/4441 (which is on XWayland but seems related)
this happens when attempting to open the UI with carla_show_custom_ui()
and is also fixed by clearing GTK's GL context before calling that and then returning the context afterwards
@benjamin-otte is it normal that GTK has a current context in source functions added with g_timeout_add()
or is it a bug? I wouldn't expect there to be a current context in random source functions because GTK is not doing anything OpenGL related at that time but I might be mistaken.
This is how I check if there is a current context and how I clear it btw:
static GdkGLContext *
clear_gl_context (void)
{
if (string_is_equal (
z_gtk_get_gsk_renderer_type (),
"GL"))
{
GdkGLContext * context =
gdk_gl_context_get_current ();
if (context)
{
g_warning ("have GL context - clearing");
g_object_ref (context);
gdk_gl_context_clear_current ();
}
return context;
}
return NULL;
}
static void
return_gl_context (
GdkGLContext * context)
{
if (context)
{
g_debug ("RETURNING CONTEXT");
gdk_gl_context_make_current (context);
g_object_unref (context);
}
}
@benjamin-otte is it normal that GTK has a current context
Yes.
Unsetting a context is expensive, so why do it?
@benjamin-otte is it normal that GTK has a current context
Yes.
Unsetting a context is expensive, so why do it?
Makes sense, thanks.
Sorry, I made a mistake about the X_SetInputFocus
thing. I was on X11 when I was testing that. The GL issue is fixed though. I can reproduce the X_SetInputFocus
error with Fluida and DrumGizmo on Wayland.
In both Fluida and DrumGizmo, the UI gets displayed and fails on the 2nd ui_idle()
call:
(zrythm:1226570): zrythm-WARNING **: 15:08:21.556: (clear_gl_context:119): have GL context - clearing
(zrythm:1226570): zrythm-DEBUG: 15:08:21.556: (carla_plugin_tick_cb:154): calling ui_idle()...
(zrythm:1226570): zrythm-DEBUG: 15:08:21.571: (carla_plugin_tick_cb:157): done calling ui_idle()
(zrythm:1226570): zrythm-DEBUG: 15:08:21.571: (return_gl_context:135): RETURNING CONTEXT
(zrythm:1226570): zrythm-WARNING **: 15:08:21.572: (clear_gl_context:119): have GL context - clearing
(zrythm:1226570): zrythm-DEBUG: 15:08:21.572: (carla_plugin_tick_cb:154): calling ui_idle()...
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 34
Current serial number in output stream: 34
note that with the latest commit, I cannot reproduce at all. so if the issue is still there, we need to come up with a simpler way to test case things like this
On latest commit I can reproduce this with Fluida, DrumGizmo, ZLFO, sfizz, Surge (all LV2) in Zrythm with the host lib. I can open DrumGizmo when I run carla standalone with carla -platform wayland-egl
so the issue is likely specific to a GTK4 host. I will try to see which of XSetInputFocus causes it in source/utils/CarlaPluginUI.cpp
like you said, or maybe we can look at this after I port Chibi to GTK4
On latest commit I can reproduce this with Fluida, DrumGizmo, ZLFO, sfizz, Surge (all LV2) in Zrythm with the host lib
we need to come up with a simpler way to test case things like this
@falkTX I can now reproduce these exact same issues with the new Chibi (on commit bc2145a0b45129565514bf377063bd1cf5128389) on Wayland so it's definitely an issue related to GTK4 hosts:
gdb -ex run --args build/src/Chibi http://drumgizmo.org/lv2
...
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 31
Current serial number in output stream: 31
gdb -ex run --args build/src/Chibi https://github.com/brummer10/Fluida.lv2
...
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 34
Current serial number in output stream: 34
Same problem on Fedora 37 when attempting to show certain plugin GUIs (e.g. calf, x42).
Setting QT_QPA_PLATFORM=xcb
successfully works around the issue.
program gets killed when trying to load a plugin's UI on wayland. this can be replicated by trying to open fluida in zrythm
cannot replicate the issue in ildaeil
Messages:
related code: https://git.zrythm.org/zrythm/zrythm/src/branch/gtk4/src/plugins/carla_native_plugin.c#L1400