Closed Bug 1711244 Opened 3 years ago Closed 3 years ago

Implement proper frame callback handling in NativeLayerWayland

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: rmader, Assigned: rmader)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 3 obsolete files)

Currently there are several frame callback related issues that can make the browser freeze, most importantly:

  • trying to swap buffers for a tile that's not visible - the compositor may not have released the buffer, making the Wayland EGL platform block
  • WaylandVsyncSource only working on the MozContainerWayland surface, which may be hidden behind opaque tiles. ATM it also only covers to top-left pixel, increasing the likelihood of being hidden.
  • gdk_wayland_window_[add|remove]_frame_callback_surface only working on the MozContainerWayland surface, making GDK freeze when it's hidden. This is particular visible in maximized/fullscreen mode.

To some degree we can work around these issues by disabling widget.wayland.opaque-region.enabled and widget.wayland.vsync.enabled, however they decrease performance massively and loosing monitor VSync, including rendering at monitor refresh rate, is obviously bad.

Fix all of these issues by properly managing frame callbacks for NativeLayerWayland / NativeLayerRootWayland

Analogous to D102835 we need to make GDK aware of opaque surfaces
so frame callbacks get emitted for these surfaces as well. Otherwise
GDK may get stuck waiting on callbacks when used on compositors
that don't emit callbacks for occluded surfaces (which is explicitly
encouraged by the Wayland spec).

GDK runs on the main thread, so we need to dispatch these action
to the main thread as well.

Make the vsync source request frame callbacks from opaque native
layers. This is necessary as opaque layers may occlude the
MozContainer surface, which is normally used for frame callbacks.
Wayland compositors may (and are encouraged to) optimize away
such callbacks, so we need to make sure to request frame callbacks
from actually visible surfaces.

Callbacks are requested for all opaque layers, but only the first
one with call back to the vsync source.
In order to get this right concerning multiple requested callbacks,
possibly being called from different threads etc., introduce a
callback abstraction, FrameCallbackObject to make this simple
to handle for callers.

Depends on D115809

Depends on D115809

Do not reorder subsurfaces if not necessary and remove some dead
code.

Depends on D116026

Depends on D116026

Blocks: 1714326
Attachment #9223201 - Attachment description: WIP: Bug 1711244 - Register native layers for GDK frame callbacks → Bug 1711244 - Register native layers for GDK frame callbacks, r=#gfx-reviewers
Attachment #9223620 - Attachment description: WIP: Bug 1711244 - Integrate NativeLayerWayland with WaylandVsyncSource → Bug 1711244 - Integrate NativeLayerWayland with WaylandVsyncSource, r=stransky,#gfx-reviewers

Comment on attachment 9224863 [details]
WIP: Bug 1711244 - Cleanups and overhead reductions

Revision D116675 was moved to bug 1714326. Setting attachment 9224863 [details] to obsolete.

Attachment #9224863 - Attachment is obsolete: true
Keywords: leave-open

Analogous to D102835 we need to make GDK aware of opaque surfaces
so frame callbacks get emitted for these surfaces as well. Otherwise
GDK may get stuck waiting on callbacks when used on compositors
that don't emit callbacks for occluded surfaces (which is explicitly
encouraged by the Wayland spec).

GDK runs on the main thread, so we need to dispatch these action
to the main thread as well.

Attachment #9223201 - Attachment is obsolete: true
Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/37aeebaea4bb
Register native layers for GDK frame callbacks,

Fixed, thanks - a rebase error made things go to the wrong patch.

Flags: needinfo?(robert.mader)

Analogous to D102835 we need to make GDK aware of opaque surfaces
so frame callbacks get emitted for these surfaces as well. Otherwise
GDK may get stuck waiting on callbacks when used on compositors
that don't emit callbacks for occluded surfaces (which is explicitly
encouraged by the Wayland spec).

GDK runs on the main thread, so we need to dispatch these action
to the main thread as well.

Attachment #9224968 - Attachment is obsolete: true
Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/0e9cc3978c38
Register native layers for GDK frame callbacks,
Keywords: leave-open
Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/3c74d415fafd
Integrate NativeLayerWayland with WaylandVsyncSource, r=stransky,gfx-reviewers,jrmuizel
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Regressions: 1716006
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: