Closed Bug 1743631 Opened 4 years ago Closed 6 months ago

Implement wp_linux_dmabuf_feedback

Categories

(Core :: Widget: Gtk, enhancement)

Desktop
Linux
enhancement

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: rmader, Assigned: stransky)

References

(Blocks 2 open bugs)

Details

Attachments

(6 files)

See https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8

This protocol should help us with buffer modifier decisions, especially regarding direct scanout, overlay planes and also multi-gpu cases.

Severity: -- → S3
OS: Unspecified → Linux
Hardware: Unspecified → Desktop

We just merged feedback support for Mutter 42, see https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959. There's still some follow up work necessary to make it work for subsurfaces, but I have a local patch already applied and working.

With this in place, it's becoming interesting for Firefox: if we manage to implement it right, it should allow us to scan out WR tiles directly. For (hardware decoded) video this means we'll only do one copy (while also running the YUV -> RGB shader), which is already pretty good. The final step then is bug 1711461, which in some cases should allow us to scanout YUV buffers directly. But that is very hardware and decoder specific, in many cases we'll still need to do format conversion, i.e. do one copy (either in Firefox or the Wayland compositor).

Will look at it as we need to for HDR support.

Assignee: nobody → stransky
Flags: needinfo?(stransky)
Depends on: 1940221
Flags: needinfo?(stransky)
  • Remove DMABuf formats query from DMABufLibWrapper, us nsWaylandDisplay to get global dmabuf formats
  • Query GBMLib for CreateWithModifiers2 and export it to allow DMABuf creation with modifers and flags
  • Replace GbmFormat with DRMFormat and allow to create DMABuf surface with given format
  • Use CreateWithModifiers2() to create DMABuf surface with format, modifier and use flag
  • Use all layers / planes of RGBA surface to create wl_buffer
  • Remove wl_buffer ownership from DMABufSurface as one DMABuf surface can have multiple wl_buffers created over it
Duplicate of this bug: 1761927
  • Use DRMFormat directly to create DMABuf based wl_buffer
  • Use correct DMABuf flags to create it
  • Move ownership of wl_buffer from DMABufSurface to WaylandBuffer as multiple WaylandBuffers may use the same DMABufSurface.
Blocks: 1942232
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/2821fe0efa96 [Wayland] Implement wp_linux_dmabuf_feedback to get supported dmabuf formats with modifiers r=emilio https://hg.mozilla.org/integration/autoland/rev/5de39aa13d22 [Wayland] Get and provide global DMABuf formats by nsWaylandDisplay r=emilio https://hg.mozilla.org/integration/autoland/rev/126e03a4f619 [Wayland] Remove DMABuf formats query from DMABufLibWrapper and add CreateWithModifiers2 to create DMABuf with feedback formats r=emilio https://hg.mozilla.org/integration/autoland/rev/0d47fc0cc0bf [Wayland] Use feedback formats (DRMFormat) with DMABufSurface r=emilio https://hg.mozilla.org/integration/autoland/rev/f0cf7aac3ffb [Wayland] Update WaylandBuffer to use DRMFormat and flags r=emilio https://hg.mozilla.org/integration/autoland/rev/8624e41d4246 [Wayland] Don't run sync callback if WaylandBuffer is already detached r=emilio

Backed out for causing build bustages & mass failures @ DMABufFormats.h

Backout link: https://hg.mozilla.org/integration/autoland/rev/6e5dcbc6576e03e589810dc3a95dd2ac0dff3688

Push with failures

Failure log -> ERROR - /builds/worker/workspace/obj-build/dist/include/mozilla/widget/DMABufFormats.h

INFO -  In file included from /builds/worker/checkouts/gecko/widget/gtk/DMABufLibWrapper.h:13:
[task 2025-01-17T21:35:15.696Z] 21:35:15    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/widget/DMABufFormats.h:32:37: error: no template named 'nsTArray'
[task 2025-01-17T21:35:15.696Z] 21:35:15     INFO -     32 |   DRMFormat(uint32_t aFormat, const nsTArray<uint64_t>& aModifiers)
[task 2025-01-17T21:35:15.697Z] 21:35:15     INFO -        |                                     ^
[task 2025-01-17T21:35:15.697Z] 21:35:15    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/widget/DMABufFormats.h:50:3: error: no template named 'nsTArray'
[task 2025-01-17T21:35:15.697Z] 21:35:15     INFO -     50 |   nsTArray<uint64_t>* GetModifiers() { return &mModifiers; }
[task 2025-01-17T21:35:15.697Z] 21:35:15     INFO -        |   ^
[task 2025-01-17T21:35:15.698Z] 21:35:15    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/widget/DMABufFormats.h:56:3: error: no template named 'AutoTArray'
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -     56 |   AutoTArray<uint64_t, 15> mModifiers;
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -        |   ^
[task 2025-01-17T21:35:15.698Z] 21:35:15    ERROR -  /builds/worker/checkouts/gecko/widget/gtk/DMABufFormats.cpp:346:8: error: use of undeclared identifier 'WaylandDisplayGet'
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -    346 |   if (!WaylandDisplayGet()->HasDMABufFeedback()) {
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -        |        ^
[task 2025-01-17T21:35:15.698Z] 21:35:15    ERROR -  /builds/worker/checkouts/gecko/widget/gtk/DMABufFormats.cpp:350:25: error: use of undeclared identifier 'WaylandDisplayGet'
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -    350 |   formats->InitFeedback(WaylandDisplayGet()->GetDmabuf(), aFormatRefreshCB,
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -        |                         ^
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -  In file included from /builds/worker/checkouts/gecko/widget/gtk/DMABufFormats.cpp:8:
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -  In file included from /builds/worker/checkouts/gecko/widget/gtk/DMABufLibWrapper.h:13:
[task 2025-01-17T21:35:15.698Z] 21:35:15    ERROR -  /builds/worker/workspace/obj-build/dist/include/mozilla/widget/DMABufFormats.h:56:28: error: private field 'mModifiers' is not used [-Werror,-Wunused-private-field]
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -     56 |   AutoTArray<uint64_t, 15> mModifiers;
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -        |                            ^
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -  6 errors generated.
[task 2025-01-17T21:35:15.698Z] 21:35:15    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:675: DMABufFormats.o] Error 1
[task 2025-01-17T21:35:15.698Z] 21:35:15     INFO -  gmake[4]: Leaving directory '/builds/worker/workspace/obj-build/widget/gtk'

Failure log -> Assertion failure: mPendingTranche, at /builds/worker/checkouts/gecko/widget/gtk/DMABufFormats.cpp

Flags: needinfo?(stransky)

Updated, Thanks.

Flags: needinfo?(stransky)
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/053438a61dae [Wayland] Implement wp_linux_dmabuf_feedback to get supported dmabuf formats with modifiers r=emilio https://hg.mozilla.org/integration/autoland/rev/b69e5bb67986 [Wayland] Get and provide global DMABuf formats by nsWaylandDisplay r=emilio https://hg.mozilla.org/integration/autoland/rev/1608b9ace7e6 [Wayland] Remove DMABuf formats query from DMABufLibWrapper and add CreateWithModifiers2 to create DMABuf with feedback formats r=emilio https://hg.mozilla.org/integration/autoland/rev/d003220456b6 [Wayland] Use feedback formats (DRMFormat) with DMABufSurface r=emilio https://hg.mozilla.org/integration/autoland/rev/4699eaef850b [Wayland] Update WaylandBuffer to use DRMFormat and flags r=emilio https://hg.mozilla.org/integration/autoland/rev/0847220839bc [Wayland] Don't run sync callback if WaylandBuffer is already detached r=emilio
Component: Graphics: WebRender → Widget: Gtk

Interesting, Thanks. Looks like Wayland compositor on Mozilla testsuite declares dmabuf feedback v3 support but doesn't send us any data. Will make the patch more error prone.

Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/112b85a7d375 [Wayland] Implement wp_linux_dmabuf_feedback to get supported dmabuf formats with modifiers r=emilio https://hg.mozilla.org/integration/autoland/rev/22095c083641 [Wayland] Get and provide global DMABuf formats by nsWaylandDisplay r=emilio https://hg.mozilla.org/integration/autoland/rev/93cc1cfa32d4 [Wayland] Remove DMABuf formats query from DMABufLibWrapper and add CreateWithModifiers2 to create DMABuf with feedback formats r=emilio https://hg.mozilla.org/integration/autoland/rev/96677fcedaad [Wayland] Use feedback formats (DRMFormat) with DMABufSurface r=emilio https://hg.mozilla.org/integration/autoland/rev/8d97555405a4 [Wayland] Update WaylandBuffer to use DRMFormat and flags r=emilio https://hg.mozilla.org/integration/autoland/rev/8aea352dbf15 [Wayland] Don't run sync callback if WaylandBuffer is already detached r=emilio
Flags: needinfo?(stransky)
Regressions: 1944490
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: