Changing the buffer modifer via Wayland dmabuf-feedback apparently does not reliably reset the buffer age to 0
This was discovered while debugging a glitch with gtk4-widget-factory
running on Mutter in fullsceen (https://gitlab.gnome.org/GNOME/gtk/-/issues/4676): when Mesa receives the scanout tranch from the Wayland compositor and creates new dri images in create_dri_image_from_dmabuf_feedback()
(IIUC), it's apparently not guaranteed that the buffer age for all color buffers gets reset. Concretely what I observe is that after the buffer feedback, the GTK4 app / Mesa switches from two to three buffers (expected in direct scanout cases). However apparently only two out of three buffers get their buffer age reset to 0.
This results in flickering because one buffer get initialized to 0
and only partly gets updated by GTK (assuming the analysis above is correct - I did some checking that GTK4 behaves correct indeed). Reuploading the video from the GTK bug here:
Screencast_from_01.02.2022_22_01_52
One "fix" (not perfect yet) is to add the following code to create_dri_image_from_dmabuf_feedback()
:
for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
dri2_surf->color_buffers[i].age = 0;
cc @leandrohrb