Closed Bug 1730822 Opened 5 months ago Closed 2 months ago

Support eWindowType_child type properly

Categories

(Core :: Widget: Gtk, defect, P2)

Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- disabled
firefox92 --- disabled
firefox93 --- disabled
firefox94 --- fixed
firefox95 --- verified

People

(Reporter: darktrojan, Assigned: stransky)

References

(Regression)

Details

(Keywords: correctness, regression)

Attachments

(2 files)

To reproduce, run this code in the devtools:

Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)

With https://hg.mozilla.org/mozilla-central/rev/0805c499107891ed6bc2037260636e0d5f490406, the window contents aren't drawn, just the drop shadow where the window should be. Without it, the window's drawn as expected.

I have mesa 21.0.3.

Summary: Opening a window with the "popup" feature shows just an empty drop shadow → Thunderbird: Opening a window with the "popup" feature shows just an empty drop shadow

Debian Testing, Gnome Xwayland, Intel, Mesa 21.2.1 from unstable

Firefox STR:

  1. Open Main menu > More Tools > Browser console (devtools.chrome.enabled:true is needed to be able to run commands).
  2. Paste and press Enter: Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)
  3. a) With GLX, about:mozilla appears in the top left corner of my desktop without UI or window borders.
    mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true gfx.x11-egl.force-disabled:true
    b) With EGL, nothing happens.
    MOZ_X11_EGL=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true

The problem did not occur right after initial EGL support (bug 1640048):
Main menu > Web Developer > Browser console:
Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)
MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_X11_EGL=1 mozregression --launch 2020-07-02 --pref devtools.chrome.enabled:true gfx.webrender.all:true

MOZ_DISABLE_CONTENT_SANDBOX=1 MOZ_X11_EGL=1 mozregression --good 2020-07-02 --bad 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true

8:38.66 INFO: Last good revision: de1a1b350e9e0fb606cc7f5b709df544af8dd313
8:38.66 INFO: First bad revision: 52299c7cbec44f2fe75273acdf2aed8e2496931c
8:38.66 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=de1a1b350e9e0fb606cc7f5b709df544af8dd313&tochange=52299c7cbec44f2fe75273acdf2aed8e2496931c

52299c7cbec44f2fe75273acdf2aed8e2496931c stransky — Bug 1684194 [Linux] Use RenderCompositorEGL on X11/EGL, r=sotaro

Blocks: linux-egl
Has Regression Range: --- → yes
Regressed by: 1684194
Summary: Thunderbird: Opening a window with the "popup" feature shows just an empty drop shadow → MOZ_X11_EGL: Opening a window with the "popup" feature shows just an empty drop shadow (Reported by Thunderbird)

I wonder if there are tests that could have catched this - unfortunately we're currently flying blindly on EGL until the CI images get updated (also good for Wayland). OTOH, I hope there won't be that many bugs that only happen on EGL and not GLX - and are not covered by Android tests already.

RenderCompositorEGL

But the problem does not occur with Wayland:
MOZ_ENABLE_WAYLAND=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true

The problem does not occur with WebRender (Software OpenGL):
MOZ_X11_EGL=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true gfx.webrender.software:true gfx.webrender.software.opengl:true

This one enforces software 60 Hz, disables bug 1635451, bug 1697053, but it does not help:
MOZ_X11_EGL=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true layout.frame_rate:60 widget.dmabuf-webgl.enabled:false dom.ipc.avoid-gtk:false widget.non-native-theme.enabled:false widget.content.allow-gtk-dark-theme:false

(In reply to Darkspirit from comment #5)

The problem does not occur with WebRender (Software OpenGL):
MOZ_X11_EGL=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true gfx.webrender.software:true gfx.webrender.software.opengl:true

Right after executing Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)
the browser console says:

OpenGL compositor Initialized Succesfully.
Version: 4.6 (Compatibility Profile) Mesa 21.2.1
Vendor: Intel
Renderer: Mesa Intel(R) Iris(R) Graphics 6100 (BDW GT3)
FBO Texture Target: TEXTURE_2D

It does not when trying regular WebRender.

WebRender (Software OpenGL) is not affected by this bug because it apparently does not use RenderCompositorEGL yet.
Yes, SW WR OpenGL is affected by bug 1635186 on EGL/Xwayland while regular WR is not anymore.
MOZ_X11_EGL=1 mozregression --launch 2021-09-15 --pref devtools.chrome.enabled:true gfx.webrender.all:true gfx.webrender.software:true gfx.webrender.software.opengl:true -a https://www.vsynctester.com/ -a https://www.vsynctester.com/

Main menu and toolbar panels seem to have the same problem if gfx.webrender.unaccelerated-widget.force is true. (bug 1719898)
Do they really run into the same problem?

See Also: → 1719898

Any news?

Flags: needinfo?(jan)

I'm just a voluntary tester, my Phabricator account is still banned since my BMO account was temporarily auto-banned due to a mail server problem.
Workaround: You could use a dialog, it has been fixed in bug 1695822:
Services.ww.openWindow(null, "about:mozilla", "_blank", "dialog,width=800,height=600", Services.ww)

Flags: needinfo?(jan)

I didn't realise you were a volunteer. It's hard to tell who is and who isn't. Thanks for your help.

:aosmond, any help? I was in the middle of developing something using a pop-up window (specifically because it has no titlebar or controls), and now I'm stuck. :-(

Flags: needinfo?(aosmond)

(In reply to Geoff Lankow (:darktrojan) from comment #14)

:aosmond, any help? I was in the middle of developing something using a pop-up window (specifically because it has no titlebar or controls), and now I'm stuck. :-(

Doesn't gfx.x11-egl.force-disabled:true work around the issue?

It does, but that doesn't help when it comes to deploying the window to all of our users. I'm assuming I'm not the only one with this problem.

(In reply to Geoff Lankow (:darktrojan) from comment #16)

It does, but that doesn't help when it comes to deploying the window to all of our users. I'm assuming I'm not the only one with this problem.

Sure - but it won't stop you from working on it :)

Anyhow, will look into it today - it's one of the only known mesa regressions with EGL (if not the only one).

So the issue is that the the content of the popup is not remote content (HasRemoteContent() => false) - thus bug 1719898 is indeed related / likely has the same root problem. A workaround would be trivial, but I'm now digging into it.

Flags: needinfo?(aosmond)

Gnome Xwayland, Debian Testing, Intel

STR

  1. Alt+Shift+J
  2. paste Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)

mozregression --launch 2021-09-29 --pref devtools.chrome.enabled:true

ChromeWindow about:blank

= invisible/transparent window, it prevents me from clicking/hovering things underneath it


try build from bug 1677314 comment 5:
mozregression --repo try --launch 5d2f2e7daeb2cddb8d7ccbb0f68d6f8f984087b1 --pref devtools.chrome.enabled:true

NS_ERROR_XPC_BAD_CONVERT_NATIVE: Could not convert Native argument arg 0 [nsIDocShell.domWindow] browsing-context.js:1775
null

= no window at all and this error

Currently child windows do not show up in this configuration and it's
not clear yet what the root cause of the issue is.
As we want to ship X11/EGL by default in 94, work around the issue
for now.

Assignee: nobody → robert.mader
Status: NEW → ASSIGNED
Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/b949f21fe5b9
Disable HW-WR for child windows on X11/EGL,

I don't believe this is a correct fix. eWindowType_child is used for nested windows (like plugins) and are not used (or should not be used). When such window appears on Linux it looks like bug. I'm going to remove such window types from Gtk toolkit code in Firefox 95.

For proper fix I'd need widget log, so please run Firefox with MOZ_LOG="Widget:5", reproduce the issue and attach the log here.

Thanks.

Robert, we can always uplift important patches to beta, especially in early beta stages so please do not land patches without review especially at end of development cycle.

Flags: needinfo?(jan)

Darkspirit,
can you please run Firefox with:

MOZ_LOG="Widget:5, WidgetPopup:5"

and attach the log here?
Thanks.

Attached file bug1730822widget.txt
  1. Pressed Ctrl+Shift+J
  2. Pasted Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)
  3. Waited a moment, pressed enter
  4. Ctrl+C

MOZ_LOG="Widget:5, WidgetPopup:5" mozregression --launch 2021-09-29 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true devtools.chrome.enabled:true -P stdout > bug1730822widget.txt

Flags: needinfo?(jan)

Robert, we can always uplift important patches to beta, especially in early beta stages so please do not land patches without review especially at end of development cycle.

Right, sorry :/

I'm going to remove such window types from Gtk toolkit code in Firefox 95.

That's good to hear, it appears to be very buggy in many regards.

eWindowType_child is used for nested windows (like plugins) and are not used (or should not be used).

Ah I see. In that case it's not really a EGL bug IIUC, but something deeper that just happened to work on GLX. With the patch I just wanted to avoid regressions because of EGL for now - I suppose if you remove eWindowType_child in 95, then you'll have to properly fix this case anyway.

With the tescase I'm getting:

(firefox:17980): Gtk-CRITICAL **: 16:18:31.540: gtk_widget_get_window: assertion 'GTK_IS_WIDGET (widget)' failed

and backtrace is:

#1 0x00007ff5aa367903 in g_log () at /lib64/libglib-2.0.so.0
#2 0x00007ff5ab1d7db9 in gtk_widget_get_window (widget=0x0) at /usr/src/debug/gtk3-3.24.30-1.1.fc34.x86_64/gtk/gtkwidget.c:16027
#3 0x00007ff5a5ccfb00 in nsWindow::Create(nsIWidget*, void*, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&, nsWidgetInitData*) ()
at /home/komat/Programy/firefox-nightly/libxul.so
#4 0x00007ff5a2bb5a00 in nsBaseWidget::CreateChild(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&, nsWidgetInitData*, bool) ()
at /home/komat/Programy/firefox-nightly/libxul.so
#5 0x00007ff5a5c99cd8 in nsView::CreateWidgetForParent(nsIWidget*, nsWidgetInitData*, bool, bool) () at /home/komat/Programy/firefox-nightly/libxul.so
#6 0x00007ff5a5d5de34 in nsDocumentViewer::MakeWindow(nsSize const&, nsView*) () at /home/komat/Programy/firefox-nightly/libxul.so
#7 0x00007ff5a5d5d3e8 in nsDocumentViewer::InitInternal(nsIWidget*, nsISupports*, mozilla::dom::WindowGlobalChild*, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, bool, bool, bool) () at /home/komat/Programy/firefox-nightly/libxul.so
#8 0x00007ff5a5d5d1db in nsDocumentViewer::Init(nsIWidget*, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, mozilla::dom::WindowGlobalChild*) ()

We're clearly creating a window which is wrongly configured. I'll look at it today.

Priority: -- → P2
Component: Graphics → Widget: Gtk
Priority: P2 → --

(Oops. My change was moving it to Gtk.)

Priority: -- → P2
Keywords: leave-open

btw. This is not related to EGL, happens as well as with GLX.

Summary: MOZ_X11_EGL: Opening a window with the "popup" feature shows just an empty drop shadow (Reported by Thunderbird) → Opening a window with the "popup" feature shows just an empty drop shadow (Reported by Thunderbird)
No longer blocks: linux-egl
Assignee: robert.mader → stransky

(In reply to Martin Stránský [:stransky] (ni? me) from comment #29)

btw. This is not related to EGL, happens as well as with GLX.

Can't confirm.

I still can't reproduce the problem with GLX/Xwayland. The red about:mozilla page shows up in the top-left corner of my desktop.
good: mozregression --launch 2021-09-29 --pref gfx.webrender.all:true gfx.x11-egl.force-disabled:true devtools.chrome.enabled:true -P stdout

I can reproduce this only with EGL/Xwayland. (bug 1695933 made it possible to ship WR on Xwayland (bug 1730671) because it doesn't run into bug 1635186 comment 49.)
bad: mozregression --launch 2021-09-29 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true devtools.chrome.enabled:true -P stdout

(In reply to Darkspirit from comment #30)

(In reply to Martin Stránský [:stransky] (ni? me) from comment #29)
I still can't reproduce the problem with GLX/Xwayland. The red about:mozilla page shows up in the top-left corner of my desktop.
good: mozregression --launch 2021-09-29 --pref gfx.webrender.all:true gfx.x11-egl.force-disabled:true devtools.chrome.enabled:true -P stdout

I can reproduce this only with EGL/Xwayland. (bug 1695933 made it possible to ship WR on Xwayland (bug 1730671) because it doesn't run into bug 1635186 comment 49.)
bad: mozregression --launch 2021-09-29 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true devtools.chrome.enabled:true -P stdout

Well, it may or may not work - the eWindowType_child setup is a bit random.

Summary: Opening a window with the "popup" feature shows just an empty drop shadow (Reported by Thunderbird) → Support eWindowType_child type properly

eWindowType_child needs bigger rework so let's wait to FF95 cycle. I'm not aware of any usage anyway. The testcase here is a bit special as parent window is not specified and we try to attach new popup to hidden window and link that by GdkWindow. We should create such window as toplevel but it needs more work as simple switch to eWindowType_toplevel type makes the window irresponsible.

Depends on: 1736068
Depends on: 1736377

This should work now.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #34)

This should work now.

Can this bug be closed?

Flags: needinfo?(stransky)

STR:
(Darkspirit from comment #25)

  1. Pressed Ctrl+Shift+J
  2. Pasted Services.ww.openWindow(null, "about:mozilla", "_blank", "popup,width=800,height=600", Services.ww)
  3. Waited a moment, pressed enter
  1. comment 32 merged a workaround for 94 ("Disable HW-WR for child windows on X11/EGL").
  2. bug 1736377 comment 3 removed the workaround in 95. The bug was fixed.
    mozregression --repo autoland --launch cd81b08e7ef2 --pref gfx.webrender.all:true gfx.x11-egl.force-enabled:true devtools.chrome.enabled:true -P stdout
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Flags: needinfo?(stransky)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.