Bug 108651

Summary: Screen flickering when using compositor with OpenGL backend
Product: Mesa Reporter: Yuxuan Shui <yshuiv7>
Component: Drivers/DRI/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED MOVED QA Contact: Nouveau Project <nouveau>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 105132, 108705    
Bug Blocks:    

Description Yuxuan Shui 2018-11-04 20:33:11 UTC
Some users of both compton and nouveau have experienced screen flickering when using the upgraded compton with GLX backend.

Nothing really changed in how compton uses OpenGL, so I suspect this could be a driver bug.

For details, please go to: https://github.com/yshui/compton/issues/33
Comment 1 Ilia Mirkin 2018-11-04 21:39:12 UTC
How reproducible is this?

Is there an easy way for me, a non-compton user, to see these issues without massive software installation? (Could I just run compton with windowmaker, for example?)

What version of mesa did this work with? Or what was the change that precipitates these issues?
Comment 2 Yuxuan Shui 2018-11-05 12:06:44 UTC
compton itself does not have lots of dependencies. Right now all the users experienced this problem seems to be using the i3 window manager, I don't know if this is reproducible with windowmaker.

I don't know the mesa version they use, I will ask. But judging that they are all archlinux users, they are probably using mesa 18.2.4.

They started experiencing this issue when they upgraded their compton. One of the reporters did a bisect (though he cannot reliably reproduce this problem) and find out the bad commit seems to be https://github.com/yshui/compton/commit/7af815a0aaaffc02e114e1d0adccb5f87dcc3548, which touches nothing OpenGL related.
Comment 3 cj.wijtmans 2018-11-05 14:21:00 UTC
unsubscribe
On Mon, Nov 5, 2018 at 1:06 PM <bugzilla-daemon@freedesktop.org> wrote:
>
> Comment # 2 on bug 108651 from Yuxuan Shui
>
> compton itself does not have lots of dependencies. Right now all the users
> experienced this problem seems to be using the i3 window manager, I don't know
> if this is reproducible with windowmaker.
>
> I don't know the mesa version they use, I will ask. But judging that they are
> all archlinux users, they are probably using mesa 18.2.4.
>
> They started experiencing this issue when they upgraded their compton. One of
> the reporters did a bisect (though he cannot reliably reproduce this problem)
> and find out the bad commit seems to be
> https://github.com/yshui/compton/commit/7af815a0aaaffc02e114e1d0adccb5f87dcc3548,
> which touches nothing OpenGL related.
>
> ________________________________
> You are receiving this mail because:
>
> You are the QA Contact for the bug.
> You are the assignee for the bug.
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
Comment 4 Yuxuan Shui 2018-11-05 20:37:20 UTC
They confirmed they are using mesa 18.2.4
Comment 5 John Lindgren 2018-11-10 18:44:17 UTC
This probably isn't specific to nouveau.  I am using Intel graphics (modesetting driver) and I was also bitten by screen flickering in compton after the switch to XCB (commits 43f3744fea07 and 7af815a0aaaf).

It is specific to DRI2.  With DRI3 or software rendering (LIBGL_ALWAYS_SOFTWARE=1), the flickering goes away.

Looking at mesa source (src/glx/dri2.c), DRI2 seems to be incompatible with xcb event processing due to usage of XESetWireToEvent()/XESetEventToWire(), which hook into the traditional Xlib event processing.  Without Xlib in the loop, DRI2 misses its Invalidate events and the result is that glXSwapBuffers() doesn't work as expected.  (Take a look at src/glx/dri2_glx.c - dri2XcbSwapBuffers() contains an explicit XSync() call to wait for Invalidate events, which it never gets.)

One workaround I found is to change the following line in src/glx/dri2_glx.c:

   pdp->invalidateAvailable = (pdp->driMinor >= 3);

To this:

   pdp->invalidateAvailable = 0;

This causes mesa to think it's using an older X Server that doesn't send Invalidate events and use some kind of internal fallback.  It's enough to make the flickering go away, but I don't know what other side effects it has.
Comment 6 Ilia Mirkin 2018-11-10 18:55:41 UTC
Note that by default, xf86-video-nouveau does not expose DRI3. There's a bit of incompatibility between EXA and DRI3, which I'm told is unfixable (without major changes to EXA).

This can be forced by adding

Option "DRI" "3"

in the Driver section.
Comment 7 Yuxuan Shui 2018-11-29 10:51:24 UTC
So the problem is actually a incompatibility between using xcb event loop and mesa DRI2.

It is hacked around in compton.

More details in bug 108705
Comment 8 GitLab Migration User 2019-09-18 20:47:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1164.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.