Closed Bug 1550658 Opened 5 months ago Closed 5 months ago

GDK_IS_X11_DISPLAY(gdk_display_get_default()) does not work as expected in content process on XWayland

Categories

(Core :: Widget: Gtk, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: sotaro, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

Attachments

(1 file, 1 obsolete file)

GDK_IS_X11_DISPLAY(gdk_display_get_default()) is used to check if a process works on Wayland or X11. But the function did not work in content process on XWayland.

When wayland is disabled in XREMain::XRE_mainStartup(), GDK_IS_X11_DISPLAY(gdk_display_get_default()) returns true. But in content process, GDK_IS_X11_DISPLAY(gdk_display_get_default()) returns false.

Firefox uses X11 backend as default on wayland. It is set in the following.

Assignee: nobody → sotaro.ikeda.g

With Attachment 9063966 [details] [diff], the problem could be checked during running WebGL.

ContentChild::Init() had a code to initialized X11 Display.

But it was not used when wayland is disabled in XREMain::XRE_mainStartup()

ContentChild::Init() expects that "MOZ_GDK_DISPLAY" is set. But the disabling wayland code does not set "MOZ_GDK_DISPLAY".

Blocks: wayland
Regressed by: 1503592
Assignee: sotaro.ikeda.g → nobody

(In reply to Sotaro Ikeda [:sotaro] from comment #3)

ContentChild::Init() had a code to initialized X11 Display.

But it was not used when wayland is disabled in XREMain::XRE_mainStartup()

https://searchfox.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp#3780

ContentChild::Init() expects that "MOZ_GDK_DISPLAY" is set. But the
disabling wayland code does not set "MOZ_GDK_DISPLAY".

We need to call gdk_display_manager_set_default_display() at ContentChild::Init() otherwise the default Wayland display is obtained by gdk_display_get_default().

Hm, looks more complicated as we call gtk_init() with the correct display argument. I'll look at it, I suspect it also causes a failure at Bug 1548475.

With
GDK_BACKEND=wayland mozregression --repo try --launch 97abed1250d36155a209d3e6c5b35bd6832c62d1 --pref layers.gpu-process.enabled:true layers.acceleration.force-enabled:true -B debug
I still get a GPU process crash on wayland:

0:54.74 INFO: (/tmp/tmptUVWUq/firefox/firefox-bin:6950): Gtk-WARNING **: 10:10:39.431: cannot open display: :1

GPUParent.cpp might need a similar exclusion of PR_GetEnv("DISPLAY"), or not?
https://searchfox.org/mozilla-central/search?q=+PR_GetEnv%28%22DISPLAY%22%29%3B&case=true&path=

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #8)

GPUParent.cpp might need a similar exclusion of PR_GetEnv("DISPLAY"), or not?
https://searchfox.org/mozilla-central/search?q=+PR_GetEnv%28%22DISPLAY%22%29%3B&case=true&path=

Yea, it seems necessary.

Blocks: 1549965

Updated for GPUParent.cpp

GDK_BACKEND=wayland mozregression --repo try --launch e9bdfb2b0aaa6159e4bb1d221be23f2f87350020 --pref layers.gpu-process.enabled:true layers.acceleration.force-enabled:true -B debug

0:48.66 INFO: [Parent 8243, Main Thread] WARNING: Need BrowserChild to get the nativeWindow from!: file /builds/worker/workspace/build/src/widget/PuppetWidget.cpp, line 1094
0:48.69 INFO: [Child 8306, Main Thread] WARNING: Failed to duplicate file handle for current process!: file /builds/worker/workspace/build/src/ipc/glue/FileDescriptor.cpp, line 147
0:48.69 INFO: ++DOCSHELL 0x7f2ce436f800 == 4 [pid = 8243] [id = {1803614e-043f-4d1d-94db-5467902b1454}]
0:48.69 INFO: ++DOMWINDOW == 7 (0x7f2ce4217020) [pid = 8243] [serial = 7] [outer = (nil)]
0:48.69 INFO: ++DOMWINDOW == 8 (0x7f2ce43e5c00) [pid = 8243] [serial = 8] [outer = 0x7f2ce4217020]
0:48.70 INFO: ++DOMWINDOW == 9 (0x7f2ce43e6800) [pid = 8243] [serial = 9] [outer = 0x7f2ce4217020]
0:48.79 INFO: Couldn't convert chrome URL: chrome://branding/locale/brand.properties
0:48.94 INFO: ++DOCSHELL 0x7f9ee1e88800 == 1 [pid = 8306] [id = {97444c83-cbd5-4710-abcd-a4dcfa245cd7}]
0:49.02 INFO: ++DOMWINDOW == 1 (0x7f9ef5ae8100) [pid = 8306] [serial = 1] [outer = (nil)]
0:49.02 INFO: [Child 8306, Main Thread] WARNING: Fallback to BasicLayerManager: file /builds/worker/workspace/build/src/dom/ipc/BrowserChild.cpp, line 2678
0:49.02 INFO: [Child 8306, Main Thread] WARNING: No active window: file /builds/worker/workspace/build/src/js/xpconnect/src/XPCJSContext.cpp, line 662
0:49.03 INFO: ++DOCSHELL 0x7f9ee3179000 == 2 [pid = 8306] [id = {15a3f894-ec26-4ce2-ae40-6ebef28af8b0}]
0:49.03 INFO: ++DOMWINDOW == 2 (0x7f9ef5ae86a0) [pid = 8306] [serial = 2] [outer = (nil)]
0:49.03 INFO: [Child 8306, Main Thread] WARNING: Fallback to BasicLayerManager: file /builds/worker/workspace/build/src/dom/ipc/BrowserChild.cpp, line 2678
0:49.03 INFO: ++DOCSHELL 0x7f9ee317b000 == 3 [pid = 8306] [id = {25c28b3a-d010-46db-878f-e70bba8a3809}]
0:49.03 INFO: ++DOMWINDOW == 3 (0x7f9ef5ae8880) [pid = 8306] [serial = 3] [outer = (nil)]
0:49.03 INFO: [Child 8306, Main Thread] WARNING: Fallback to BasicLayerManager: file /builds/worker/workspace/build/src/dom/ipc/BrowserChild.cpp, line 2678
0:49.04 INFO: ++DOCSHELL 0x7f9ee317d000 == 4 [pid = 8306] [id = {09e6c640-d79c-4794-8b14-60fa5a3139f8}]
0:49.04 INFO: ++DOMWINDOW == 4 (0x7f9ef5ae8a60) [pid = 8306] [serial = 4] [outer = (nil)]
0:49.04 INFO: [Child 8306, Main Thread] WARNING: Fallback to BasicLayerManager: file /builds/worker/workspace/build/src/dom/ipc/BrowserChild.cpp, line 2678
0:49.05 INFO: ++DOCSHELL 0x7f9ee317f800 == 5 [pid = 8306] [id = {16f937c9-79aa-4634-937a-eb195543d8ac}]
0:49.05 INFO: ++DOMWINDOW == 5 (0x7f9ef5ae8c40) [pid = 8306] [serial = 5] [outer = (nil)]
0:49.05 INFO: [Child 8306, Main Thread] WARNING: Fallback to BasicLayerManager: file /builds/worker/workspace/build/src/dom/ipc/BrowserChild.cpp, line 2678
0:49.07 INFO: [Parent 8243, Main Thread] WARNING: nsWindow::GetNativeData(): NS_NATIVE_SHAREABLE_WINDOW is not handled on Wayland!: file /builds/worker/workspace/build/src/widget/gtk/nsWindow.cpp, line 1672
0:49.07 INFO: X Error of failed request: BadWindow (invalid Window parameter)
0:49.07 INFO: Major opcode of failed request: 3 (X_GetWindowAttributes)
0:49.07 INFO: Resource id in failed request: 0x0
0:49.07 INFO: Serial number of failed request: 7
0:49.07 INFO: Current serial number in output stream: 8
0:49.07 INFO: Assertion failure: isEmpty() (failing this assertion means this LinkedList's creator is buggy: it should have removed all this list's elements before the list's destruction), at /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/LinkedList.h:433

https://searchfox.org/mozilla-central/rev/8308eb7ea14318f53b55f3289c2bb9b712265318/widget/gtk/nsWindow.cpp#1741

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #12)

0:49.07 INFO: [Parent 8243, Main Thread] WARNING: nsWindow::GetNativeData(): NS_NATIVE_SHAREABLE_WINDOW is not handled on Wayland!: file /builds/worker/workspace/build/src/widget/gtk/nsWindow.cpp, line 1672

This is Bug 1481405. Window handles can't be shared on Wayland.

Attachment #9063966 - Attachment is obsolete: true
Keywords: checkin-needed
Assignee: nobody → stransky

Pushed by ccoroiu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/194ec02ee76d
[Linux/Gtk] Don't use Wayland display in content process when it's disabled in chrome, r=sotaro

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.