Open Bug 1780508 Opened 2 years ago Updated 1 month ago

[wayland/sway] Flickering and potential crash with tall menus

Categories

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

Firefox 102
defect

Tracking

()

UNCONFIRMED

People

(Reporter: stephane, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

Firefox Wayland used to have major flickering issues on Sway (and all wlroot based compositors?). On my laptop, most of them seem to be fixed except in one very specific case: Opening a context menu that occupies more than 50% of the screen height when the mouse pointer is near the middle of the screen ; Simply speaking this is when there is not enough space to open it entirely above nor below the mouse.

Actual results:

Under those conditions FF opens the menu below the mouse so with the bottom part partially outside the screen. Then, for whatever reason, the menu flickers a lot and often causes a crash.

I assume that this is caused by some repeated and unsuccessful attempts to reposition the menu (because wayland does not provide enough information?).

Fortunately, most context menus use less than 50% of the screen height (1366x768 on my laptop). In FF, I found that tall context menus can easily be obtained on image links (like in google image). Having text selected can add one or two lines and some add-ons can also make it even taller. And of course, setting layout.css.devPixelsPerPx and reducing the screen resolution can help to get a context menu taller than 50%.

For now, my workaround is to use userChrome.css to disable most entries in the context menus.

Remark: Thunderbird 102 is also affected by that problem but his context menus are generally taller which makes them even more unusable. For example, the context menu in the message list contains 20 entries and occupies 75% of the screen height on my laptop. That makes it almost impossible to open without causing flickering and crash.

Expected results:

When there is not enough room to open the context menu below or above the mouse pointer then it should be aligned with the bottom of the screen (so overlapping with the cursor).

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

I just discovered widget.wayland.use-move-to-rect=false

Not ideal but having some menus rendered partially off-screen is better that flickering and crashes.

As of Firefox 110.0b6 on latest (tip-of-the-tree) Sway and wlroots, everything seems to be working now.

I have reset widget.wayland.use-move-to-rect to true so I can re-check. Turns out the context menu is now rendered correctly, and no longer causes crashes for me. No portion of the menu appears off-screen for me, not even on tiny resolutions. If the menu happens to contain too many items, the excess is hidden behind a triangle, which allows me to scroll vertically so I reach the menu item I want.

Priority: -- → P3

I am testing 111.0b8 and I still see the flickering and occasional crashes when opening very tall bookmark menus (in the bookmark bar) with widget.wayland.use-move-to-rect=true .

However, I am still using Sway 1.7 so not the 'tip-of-the-tree' (will have to wait for debian to upgrade).

The errors message in the terminal are not always the same

[GFX1-]: Invalid mBounds in PopupCallback Rect(x=1503, y=87, w=402, h=27981) size state 0
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
Gdk-Message: 10:23:09.349: Lost connection to Wayland compositor.

or

(firefox-beta:245356): Gdk-CRITICAL **: 10:34:29.471: ../../../../../gdk/wayland/gdkdisplay-wayland.c:1319: Truncating shared memory file failed: Invalid argument
ExceptionHandler::GenerateDump cloned child 246734
ExceptionHandler::SendContinueSignalToChild sent continue signal to child
ExceptionHandler::WaitForContinueSignal waiting for continue signal...

In the PopupCallback message above, the value for x, y and w seem legit to me but h=27981 is strange. My test folder only contains 56 entries and its height should be less than 2000 pixels.

By the way, I noticed that Wayland is now the default in 111.0b8. The X11 version that does not suffer from flickering can be selected by setting MOZ_ENABLE_WAYLAND=0

Thanks to the package cache, I’ve managed to downgrade Sway from tip-of-the-tree to the stable releases 1.8 and then 1.7, restarting Sway in between.
Turns out that all else being equal, 1.8 is working fine for me but 1.7 re-introduces the flickering.

So the Sway v1.8 release may have fixed the issue.

I also had the issue, with sway 1.7 from debian unstable. Upgrading to sway 1.8.1 (from debian experimental) fixed the issue for me too.

(In reply to gueux+mozilla from comment #7)

I also had the issue, with sway 1.7 from debian unstable. Upgrading to sway 1.8.1 (from debian experimental) fixed the issue for me too.

Stephane, do you agree?

Flags: needinfo?(stephane)

Probably. I am current using Firefox 123.0.1 on Sway 1.9. I dropped the X11 version a long time ago. As far as I can tell, FF works fine on Sway.

Flags: needinfo?(stephane)
You need to log in before you can comment on or make changes to this bug.