After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748498 - Black background appears briefly before window gets drawn
Black background appears briefly before window gets drawn
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
: 757104 771708 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-04-26 21:24 UTC by mrblooter
Modified: 2018-05-02 16:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
application startup video (737.87 KB, video/webm)
2015-04-26 21:24 UTC, mrblooter
Details
testcase (796 bytes, text/x-csrc)
2017-08-03 17:13 UTC, Martin Stransky
Details
Black background (72.83 KB, video/webm)
2017-08-26 18:20 UTC, jeremy9856
Details

Description mrblooter 2015-04-26 21:24:11 UTC
Created attachment 302400 [details]
application startup video

When an application is started, a black background is drawn first, before the application's window content appears.

This is only happening when I'm not using a compositor. If compositing is turned on, all the windows get drawn nicely (without the black background appearing). 

I'm using GNOME applications outside of GNOME; I tested this with Openbox/Compton and with Xfce4's window manager/compositor and they both had the issue. It's also only happening with GTK3+ applications, GTK2 and applications using other toolkits get drawn without the black background.

I attached a short video clip which demonstrates it.
Comment 1 lex 2015-10-23 10:16:13 UTC
Starting from gtk 3.18 on Xfce, this behavior is more evident than previous gtk versions. With or without a compositor, the black background is shown and is very ugly, especially on light themes. On gtk 3.16 I can use a compositor to solve the problem, but on 3.18 not.
Comment 2 Sebastien Bacher 2015-11-02 15:46:37 UTC
same is happening here on Ubuntu with gtk 3.18 under unity
Comment 3 Emmanuele Bassi (:ebassi) 2015-11-11 17:38:09 UTC
The black may be coming from the X11 server — GTK+ 3.x heavily relies on the frame clock driven by a compositor using the _NET_WM_SYNC_REQUEST protocol:

  https://mail.gnome.org/archives/wm-spec-list/2011-October/msg00006.html

whereas GTK+ 2.x just drawn whenever the main loop was ready, thus reducing the potential for flickering.

Admittedly, the video shows an extreme effect, so I'm not entirely sure the lack of frame synchronisation is wholly to blame, here.
Comment 4 Iain Lane 2015-11-13 13:55:04 UTC
Although I don't understand it yet, I bisected to see if there was a commit which made this effect more pronounced. It turned up 74f2d9448f24bbfdaf32ae6b328ed3e126700afe.
Comment 5 TomTester 2016-04-13 09:48:13 UTC
Could this have "Importance" increased? It's very disruptive.

I see there is Ubuntu distributed patch that basically makes window transparent on creation, though I'm not certain it is correct solution. As it is, this bug presents itself regardless of compositor running or not.

I'm testing on GTK 3.20.2 with default (Adwaita) theme. For some reason it is mainly affecting windows that are dialogs. E.g., I'm testing with "spacefm" file manager and its "Preferences" dialog.
Comment 6 Matthias Clasen 2016-04-19 01:17:55 UTC
If this is very disruptive on ubuntu, then it should be a priority for people supporting that os. And no, making all windows, transparent is not the right fix.
Comment 7 TomTester 2016-04-20 07:16:13 UTC
I'm testing on ArchLinux (should have said that) and not Ubuntu. While searching for remedy I've found Ubuntu bug report leading me here.

GTK 3.20.3 vanilla (https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/gtk3)

Intel HD Graphics 4000

Linux hostname 4.5.0-1-ARCH #1 SMP PREEMPT Tue Mar 15 09:41:03 CET 2016 x86_64 GNU/Linux

X.Org X Server 1.18.3
Release Date: 2016-04-04

Section "Device"
    Identifier "card0"
    Driver "intel"
    BusID "pci:0:2:0"

    Option "DRI" "3"
    Option "TearFree" "on"
EndSection

What I've tried with no success:

* with/without compositor (compton)
* with/without intel's TearFree
* using 'modesetting' instead of 'intel'
Comment 8 Christian Stadelmann 2017-05-03 11:02:42 UTC
Same issue on Fedora (24, 25) in a GNOME/Wayland session with several Gtk+ applications, including Firefox. Firefox is running under XWayland, so it looks like comment #3 still applies. This does not depend on a specific version of Gtk+, gnome-shell, firefox or XWayland, but has been present for at least a year.

(In reply to Emmanuele Bassi (:ebassi) from comment #3)
> Admittedly, the video shows an extreme effect, so I'm not entirely sure the
> lack of frame synchronisation is wholly to blame, here.

I'm seeing this extreme effect _every_ time I open a firefox window, which might be a separate bug: https://bugzilla.redhat.com/show_bug.cgi?id=1444663
Comment 9 Christian Stadelmann 2017-05-03 17:47:17 UTC
This issue also happens during resizing, I've seen this for several applications running with on XWayland, e.g. with evolution or eclipse IDE. It seems like this only affects applications which are relatively slow to repaint since I cannot reproduce this with e.g. nautilus or gedit easily. With screen recording running,  can reproduce this on any application running with GDK_BACKEND=x11.
On a GNOME/Wayland session with pure wayland apps, this is harder to reproduce. I only managed to do so with applications which use internal compositing for drawing off-process content from e.g. WebKit2Gtk3, like Epiphany, Evolution or Yelp.

So: Also happens on Wayland, but rarely and less bad.
Comment 10 Martin Stransky 2017-07-31 10:32:48 UTC
(In reply to Matthias Clasen from comment #6)
> If this is very disruptive on ubuntu, then it should be a priority for
> people supporting that os. And no, making all windows, transparent is not
> the right fix.

The same issue is with Firefox/Fedora 26, both Wayland and X11 builds on Wayland session. The problem (AFAIK) is with CSD and delayed window composition - Firefox paints to child window where the parent one (with CSD shadows) may be already showed.
Comment 11 Martin Stransky 2017-07-31 12:37:24 UTC
Firefox Gtk2 used gdk_window_set_back_pixmap(null) to disable GdkWindow background rendering. What's the best way to do that for Gtk 3.20+? Thanks!
Comment 12 Martin Stransky 2017-08-01 15:11:09 UTC
Actually the bug is caused by delayed Firefox rendering at GdkWindow, when Firefox paints asynchronously (from compositor thread) to GdkWindow. Is there any way how to draw to GdkWindow asynchronously (so not at draw/expose event exclusively) and avoid the flickering?
Comment 13 Martin Stransky 2017-08-02 07:56:15 UTC
Hm, I was wrong here - can be reproduced without any firefox rendering, just with default GdkWindow background. I'll try to create a Gtk only testcase for it.
Comment 14 Martin Stransky 2017-08-03 17:13:21 UTC
Created attachment 356882 [details]
testcase

There's a simple testcase which shows this bug. This bug is exposed when main thread where Gtk events are processed is busy with different task, which is emulated by the loop here. 

Adjust the for cycle size for your box speed and then just hit alt+f10 to maximize the GtkWindow. The black square and window title/top bar is rendered immediately but the default GtkWindow background is rendered after it which causes flickering.

Reproducible on both X11 and Wayland.
Comment 15 Strangiato 2017-08-08 04:02:10 UTC
I see this bug on Arch when I open "About" dialog of apps running under xwayland like Firefox, K3b and Kdenlive.
My video adapter is intel hd 4000.
Comment 16 jeremy9856 2017-08-26 18:20:39 UTC
Created attachment 358491 [details]
Black background

I have a similar problem on Fedora 26 as you can see. It's a new install and for now I only saw it in gnome control center.

I'm on X11 with intel gpu (haswell - modesettings, glamor, dri3). Thanks !
Comment 17 jeremy9856 2017-09-10 14:17:51 UTC
It happen for me with when I use the modesetting driver instead of the intel one.
Comment 18 Martin Stransky 2017-10-30 08:05:04 UTC
Guys, any update here? Users keep to report that as Firefox bug.
Comment 19 Strangiato 2017-10-30 18:44:11 UTC
(In reply to Strangiato from comment #15)
> I see this bug on Arch when I open "About" dialog of apps running under
> xwayland like Firefox, K3b and Kdenlive.
> My video adapter is intel hd 4000.

It persists in gnome 3.26.1, Arch Linux.
Comment 20 Daniel Boles 2018-02-14 20:59:57 UTC
*** Bug 757104 has been marked as a duplicate of this bug. ***
Comment 21 Daniel Boles 2018-02-14 21:00:09 UTC
*** Bug 771708 has been marked as a duplicate of this bug. ***
Comment 22 lex 2018-03-22 18:20:35 UTC
re-adding what was removed in https://gitlab.gnome.org/GNOME/gtk/commit/74f2d9448f24bbfdaf32ae6b328ed3e126700afe fixes this on my system
Comment 23 GNOME Infrastructure Team 2018-05-02 16:34:08 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME'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.gnome.org/GNOME/gtk/issues/550.