Closed Bug 1557265 Opened 6 months ago Closed 5 months ago

[Wayland] Search for libdrm & gbm headers to build Wayland with dmabuf support

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

Details

Attachments

(3 files)

Search for libdrm & gbm headers to build Wayland with dmabuf support.

It's hard to say anything about this without any use for this config.

This is the last piece which enables direct GPU rendering on Wayland backend, see Bug 1552590 and Bug 1554520 where the symbols are binded run-time.

When Bug 1557266 lands you can flip widget.wayland_dmabuf_backend.enabled and Wayland backend will draw directly to GPU memory instead of SHM which saves you CPU -> GPU memory copy in compositor. It's useful for video playback and full screen changes.

Next step is to implement GL binding to WaylandDMABuf surface so it can be used for pixel sharing between compositor/chrome processes which is main target here which saves CPU cycles of readbacks during composition.

But this leaves me wondering
what this means for mozilla.org build with wayland enabled at runtime.

If you put libdrm & gbm headers to mozilla build roots and when this one and Bug 1557266 lands Wayland users can enable direct GPU rendering in Firefox 69 when widget.wayland_dmabuf_backend.enabled is set.

Flags: needinfo?(mh+mozilla)

bug 1554520 has a single ifdef for both gbm and libdrm. Seems like you don't really need to define both.

If you put libdrm & gbm headers to mozilla build roots

Please file a bug for that.

With that being said, wouldn't it be desirable for these not to be optional build dependencies? (although I don't know the availability of these libraries)

Flags: needinfo?(mh+mozilla)

where the symbols are binded run-time.

... by loading libdrm.so and libgbm.so, which are development libraries (i.e. not full sonames) that won't be installed on people's systems. libgbm might also not be very widespread. As in, while I have libdrm installed on my desktop machine, I don't have libgbm.

(In reply to Mike Hommey [:glandium] from comment #3)

bug 1554520 has a single ifdef for both gbm and libdrm. Seems like you don't
really need to define both.

You're right, thanks, I'll merge that.

If you put libdrm & gbm headers to mozilla build roots

Please file a bug for that.

Filed as Bug 1557662.

With that being said, wouldn't it be desirable for these not to be optional
build dependencies? (although I don't know the availability of these
libraries)

Me neither...let's decide when DMABuf support is finished and used by compositor.

(In reply to Mike Hommey [:glandium] from comment #4)

where the symbols are binded run-time.

... by loading libdrm.so and libgbm.so, which are development libraries
(i.e. not full sonames) that won't be installed on people's systems. libgbm
might also not be very widespread. As in, while I have libdrm installed on
my desktop machine, I don't have libgbm.

Good point, thanks. Filed as Bug 1557658.

Mike, can you review this or do I need to find someone else? Thanks.

Flags: needinfo?(mh+mozilla)
Attachment #9070200 - Attachment description: Bug 1557265 - [Wayland] Search for libdrm & gbm headers to build Wayland with dmabuf support, r=glandium → Bug 1557265 - [Wayland] Require libdrm to build Wayland backend, r=glandium
Flags: needinfo?(mh+mozilla)
Keywords: checkin-needed

Pushed by rvandermeulen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5fc2424b9085
[Wayland] Require libdrm to build Wayland backend, r=glandium
https://hg.mozilla.org/integration/autoland/rev/0739231e0456
Remove HAVE_LIBDRM defines as libdrm is mandatory now, r=glandium
https://hg.mozilla.org/integration/autoland/rev/7b180f98ba3e
Include gbm.h to build Wayland dmabuf backend, r=glandium

Keywords: checkin-needed

Backed out 3 changesets (Bug 1557265) for build bustage at /obj-firefox/dist/include/mozilla/widget/nsWaylandDisplay.h.

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&revision=7b180f98ba3edadcdfcc72682fb5d6a0cff97ae8

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=252533722&repo=autoland&lineNumber=23781

Backout link: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=252479470&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&revision=c497c45f090c25395b1b07680034e7653fb94d7f

[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  In file included from /builds/worker/workspace/build/src/widget/gtk/WaylandDMABufSurface.h:11:
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/widget/nsWaylandDisplay.h:18:10: fatal error: 'drm/drm_fourcc.h' file not found
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  #include <drm/drm_fourcc.h>
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -           ^~~~~~~~~~~~~~~~~~
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  1 error generated.
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  /builds/worker/workspace/build/src/config/rules.mk:810: recipe for target 'Unified_cpp_widget_gtk0.o' failed
[task 2019-06-20T00:40:52.668Z] 00:40:52    ERROR -  make[4]: *** [Unified_cpp_widget_gtk0.o] Error 1
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/widget/gtk'
[task 2019-06-20T00:40:52.668Z] 00:40:52     INFO -  make[4]: *** Waiting for unfinished jobs....
[task 2019-06-20T00:40:52.676Z] 00:40:52     INFO -  make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/layout/generic'
[task 2019-06-20T00:40:52.676Z] 00:40:52     INFO -  layout/generic/Unified_cpp_layout_generic0.o
[task 2019-06-20T00:40:52.676Z] 00:40:52     INFO -  make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/layout/generic'
[task 2019-06-20T00:40:53.237Z] 00:40:53     INFO -  make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/widget/headless'
[task 2019-06-20T00:40:53.237Z] 00:40:53     INFO -  /builds/worker/workspace/build/src/clang/bin/clang++ -o Unified_cpp_widget_headless0.o -c  -I/builds/worker/workspace/build/src/obj-firefox/dist/stl_wrappers -I/builds/worker/workspace/build/src/obj-firefox/dist/system_wrappers -include /builds/worker/workspace/build/src/config/gcc_hidden.h -DDEBUG=1 -DOS_POSIX=1 -DOS_LINUX=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/builds/worker/workspace/build/src/widget/headless -I/builds/worker/workspace/build/src/obj-firefox/widget/headless -I/builds/worker/workspace/build/src/widget -I/builds/worker/workspace/build/src/widget/headless -I/builds/worker/workspace/build/src/widget/gtk -I/builds/worker/workspace/build/src/obj-firefox/ipc/ipdl/_ipdlheaders -I/builds/worker/workspace/build/src/ipc/chromium/src -I/builds/worker/workspace/build/src/ipc/glue -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++1z-compat -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -Os -fno-omit-frame-pointer -funwind-tables -Werror  -MD -MP -MF .deps/Unified_cpp_widget_headless0.o.pp   /builds/worker/workspace/build/src/obj-firefox/widget/headless/Unified_cpp_widget_headless0.cpp
[task 2019-06-20T00:40:53.237Z] 00:40:53     INFO -  make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/widget/headless'
[task 2019-06-20T00:40:53.241Z] 00:40:53     INFO -  make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/layout/forms'
[task 2019-06-20T00:40:53.241Z] 00:40:53     INFO -  mkdir -p '.deps/'
Flags: needinfo?(stransky)

drm/drm_fourcc.h is a part of kernel-headers. It's needed just for DRM_FORMAT_ARGB8888/DRM_FORMAT_XRGB8888 so let's define that directly.

Flags: needinfo?(stransky)

DRM_FORMAT_ARGB8888/DRM_FORMAT_XRGB8888 are also defined in <libdrm/drm_fourcc.h>. Given this bug is about adding libdrm dependency why can't you use macros from there as well?

(In reply to Jan Beich from comment #14)

DRM_FORMAT_ARGB8888/DRM_FORMAT_XRGB8888 are also defined in
<libdrm/drm_fourcc.h>. Given this bug is about adding libdrm dependency why
can't you use macros from there as well?

Yes, it's in the try already, Thanks.

Try looks good.

Keywords: checkin-needed

Pushed by aiakab@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f7e5ef31a50b
[Wayland] Require libdrm to build Wayland backend, r=glandium
https://hg.mozilla.org/integration/autoland/rev/f10c947516e0
Remove HAVE_LIBDRM defines as libdrm is mandatory now, r=glandium
https://hg.mozilla.org/integration/autoland/rev/5e797f74091a
Include gbm.h to build Wayland dmabuf backend, r=glandium

Keywords: checkin-needed

Thanks. Looks like we miss CFLAGS returned from LIBDRM in toolkit flags.

Flags: needinfo?(stransky)

Should be fine now, I did try on all arches.

Keywords: checkin-needed

Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/54f8d7c37934
[Wayland] Require libdrm to build Wayland backend, r=glandium
https://hg.mozilla.org/integration/autoland/rev/add34d86fd69
Remove HAVE_LIBDRM defines as libdrm is mandatory now, r=glandium
https://hg.mozilla.org/integration/autoland/rev/757d55658592
Include gbm.h to build Wayland dmabuf backend, r=glandium

Keywords: checkin-needed

Is the latest build setting MOZ_WAYLAND at build time to build a wayland compatible version? The latest nightly doesn't work in wayland for me (and others). https://hg.mozilla.org/mozilla-central/rev/757d55658592#l1.12

Regressions: 1560545
Regressions: 1560776
Regressions: 1560670
You need to log in before you can comment on or make changes to this bug.