Closed Bug 1602133 Opened 6 years ago Closed 5 years ago

Implement WebGPU swap chains and presentation

Categories

(Core :: Graphics: WebGPU, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: kvark, Assigned: kvark)

References

Details

Attachments

(2 files)

This is a large issue that is required to get anything on screen.
It spans over multiple platforms, which may need different means of sharing the texture surfaces with the content process.
It needs to work at least for WebRender compositing path.

Assignee: nobody → jgilbert

We'll have this bug for the initial swapchain implementation, which I'm working on now, and then crate platform-specific bugs for hardware-accelerated presentation.

Assignee: jgilbert → dmalyshau
Status: NEW → ASSIGNED
Attached file WebGPU presentation

This change adds support for CanvasContext presenting WebGPU via CPU readback.
The presentation is handled mostly on GPU process side by managing a list of staging buffers
and copying the contents into a WR external image (backed by an external buffer).

Pushed by dmalyshau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/377a757c583d WebGPU presentation r=jgilbert,webidl,smaug,aosmond

Backed out changeset 377a757c583d (bug 1602133) for webgpu related bustages

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&searchStr=build&fromchange=377a757c583d786255102a76f90813535f93f7f2&tochange=33f5a8585f5733b8ab9dad23972b9f587d2d1969&selectedJob=296475056

Backout link: https://hg.mozilla.org/integration/autoland/rev/089dfddf0e95cab6def61f9ea117fcb956d133e3

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

[task 2020-04-06T18:58:30.756Z] 18:58:30     INFO -  make[4]: Entering directory '/builds/worker/workspace/obj-build/dom/webgpu'
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/clang/bin/clang-cl -Xclang -std=c++17 --target=aarch64-windows-msvc -FoUnified_cpp_dom_webgpu1.obj -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -guard:cf -DNDEBUG=1 -DTRIMMED=1 -DUNICODE -D_UNICODE -D_CRT_RAND_S -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -D_SECURE_ATL -DCHROMIUM_BUILD -DU_STATIC_IMPLEMENTATION -DOS_WIN=1 -DWIN32 -D_WIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN -DCOMPILER_MSVC -DWINAPI_NO_BUNDLED_LIBRARIES -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/dom/webgpu -I/builds/worker/workspace/obj-build/dom/webgpu -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -I/builds/worker/workspace/obj-build/dist/include/nss -MD -FI /builds/worker/workspace/obj-build/mozilla-config.h -DMOZILLA_CLIENT -Qunused-arguments -Qunused-arguments -fcrash-diagnostics-dir=/builds/worker/artifacts -TP -Zc:sizedDealloc- -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -Gw -Wno-inline-new-delete -Wno-invalid-offsetof -Wno-microsoft-enum-value -Wno-microsoft-include -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-deprecated-declarations -Wno-invalid-noreturn -Wno-inconsistent-missing-override -Wno-implicit-exception-spec-mismatch -Wno-microsoft-exception-spec -Wno-unused-local-typedef -Wno-ignored-attributes -Wno-used-but-marked-unused -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Z7 -Xclang -load -Xclang /builds/worker/workspace/obj-build/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O2 -Oy- -Werror -Werror=implicit-int-conversion  -Xclang -MP -Xclang -dependency-file -Xclang .deps/Unified_cpp_dom_webgpu1.obj.pp -Xclang -MT -Xclang Unified_cpp_dom_webgpu1.obj   Unified_cpp_dom_webgpu1.cpp
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  In file included from Unified_cpp_dom_webgpu1.cpp:110:
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp(559,8): error: unused variable 'isNew' [-Werror,-Wunused-variable]
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -    bool isNew = mCanvasMap.insert({AsUint64(aExternalId), data}).second;
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -         ^
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  1 error generated.
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  /builds/worker/checkouts/gecko/config/rules.mk:750: recipe for target 'Unified_cpp_dom_webgpu1.obj' failed
[task 2020-04-06T18:58:30.757Z] 18:58:30    ERROR -  make[4]: *** [Unified_cpp_dom_webgpu1.obj] Error 1
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  make[4]: Leaving directory '/builds/worker/workspace/obj-build/dom/webgpu'
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  /builds/worker/checkouts/gecko/config/recurse.mk:74: recipe for target 'dom/webgpu/target-objects' failed
[task 2020-04-06T18:58:30.757Z] 18:58:30    ERROR -  make[3]: *** [dom/webgpu/target-objects] Error 2
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  make[3]: *** Waiting for unfinished jobs....
[task 2020-04-06T18:58:30.757Z] 18:58:30     INFO -  make[4]: Entering directory '/builds/worker/workspace/obj-build/gfx/angle/targets/libGLESv2'
Flags: needinfo?(dmalyshau)
Pushed by dmalyshau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bc6b2b003c6e WebGPU presentation r=jgilbert,webidl,smaug,aosmond

Backed out for causing build bustages on CanvasRenderingContextHelper.cpp.

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&resultStatus=testfailed%2Cbusted%2Cexception&revision=bc6b2b003c6e741ff56f7b2c31c16b196b0f3dd0&selectedJob=296489343

Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=296489343&repo=autoland

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

[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/gcc/bin/g++ -std=gnu++17 -o Unified_cpp_dom_canvas0.o -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -I/builds/worker/workspace/obj-build/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/dom/canvas -I/builds/worker/workspace/obj-build/dom/canvas -I/builds/worker/checkouts/gecko/js/xpconnect/wrappers -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/checkouts/gecko/dom/base -I/builds/worker/checkouts/gecko/dom/html -I/builds/worker/checkouts/gecko/dom/svg -I/builds/worker/checkouts/gecko/dom/workers -I/builds/worker/checkouts/gecko/dom/xul -I/builds/worker/checkouts/gecko/gfx/angle/checkout/include -I/builds/worker/checkouts/gecko/gfx/gl -I/builds/worker/checkouts/gecko/image -I/builds/worker/checkouts/gecko/js/xpconnect/src -I/builds/worker/checkouts/gecko/layout/generic -I/builds/worker/checkouts/gecko/layout/style -I/builds/worker/checkouts/gecko/layout/xul -I/builds/worker/checkouts/gecko/media/libyuv/libyuv/include -I/builds/worker/checkouts/gecko/gfx/skia -I/builds/worker/checkouts/gecko/gfx/skia/skia -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -I/builds/worker/workspace/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/mozilla-config.h -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -O2 -fno-omit-frame-pointer -funwind-tables -Werror -I/builds/worker/workspace/obj-build/dist/include/cairo -I/builds/worker/checkouts/gecko/widget/gtk/compat-gtk3 -pthread -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gtk-3.0/unix-print -Wno-error=shadow -Wno-missing-braces -Wno-error=unused-result  -MD -MP -MF .deps/Unified_cpp_dom_canvas0.o.pp   Unified_cpp_dom_canvas0.cpp
[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -  In file included from Unified_cpp_dom_canvas0.cpp:29:0:
[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -  /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContextHelper.cpp: In member function 'virtual already_AddRefed<nsISupports> mozilla::dom::CanvasRenderingContextHelper::GetContext(JSContext*, const nsAString&, JS::Handle<JS::Value>, mozilla::ErrorResult&)':
[task 2020-04-06T20:37:57.380Z] 20:37:57    ERROR -  /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContextHelper.cpp:199:9: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -           ;  // Telemetry::Accumulate(Telemetry::CANVAS_WEBGPU_SUCCESS, 0);
[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -           ^
[task 2020-04-06T20:37:57.380Z] 20:37:57    ERROR -  /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContextHelper.cpp:207:7: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
[task 2020-04-06T20:37:57.380Z] 20:37:57     INFO -         ;  // Telemetry::Accumulate(Telemetry::CANVAS_WEBGPU_SUCCESS, 1);
[task 2020-04-06T20:37:57.381Z] 20:37:57     INFO -         ^
[task 2020-04-06T20:37:57.381Z] 20:37:57     INFO -  In file included from Unified_cpp_dom_canvas0.cpp:65:0:
[task 2020-04-06T20:37:57.381Z] 20:37:57     INFO -  /builds/worker/checkouts/gecko/dom/canvas/HostWebGLContext.cpp: In member function 'void mozilla::HostWebGLContext::OnContextLoss(mozilla::webgl::ContextLossReason)':
[task 2020-04-06T20:37:57.381Z] 20:37:57  WARNING -  /builds/worker/checkouts/gecko/dom/canvas/HostWebGLContext.cpp:91:5: warning: ignoring return value of 'bool mozilla::dom::PWebGLParent::SendOnContextLoss(const ContextLossReason&)', declared with attribute warn_unused_result [-Wunused-result]
[task 2020-04-06T20:37:57.381Z] 20:37:57     INFO -       (void)mOwnerData.outOfProcess->mParent.SendOnContextLoss(reason);
[task 2020-04-06T20:37:57.381Z] 20:37:57     INFO -       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -  /builds/worker/checkouts/gecko/dom/canvas/HostWebGLContext.cpp: In member function 'void mozilla::HostWebGLContext::JsWarning(const string&) const':
[task 2020-04-06T20:37:57.382Z] 20:37:57  WARNING -  /builds/worker/checkouts/gecko/dom/canvas/HostWebGLContext.cpp:100:3: warning: ignoring return value of 'bool mozilla::dom::PWebGLParent::SendJsWarning(const string&)', declared with attribute warn_unused_result [-Wunused-result]
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -     (void)mOwnerData.outOfProcess->mParent.SendJsWarning(text);
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -  cc1plus: all warnings being treated as errors
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -  /builds/worker/checkouts/gecko/config/rules.mk:750: recipe for target 'Unified_cpp_dom_canvas0.o' failed
[task 2020-04-06T20:37:57.382Z] 20:37:57    ERROR -  make[4]: *** [Unified_cpp_dom_canvas0.o] Error 1
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -  make[4]: Leaving directory '/builds/worker/workspace/obj-build/dom/canvas'
[task 2020-04-06T20:37:57.382Z] 20:37:57     INFO -  make[4]: *** Waiting for unfinished jobs....

Ah, these aren't really errors, but warnings turned errors :(

Flags: needinfo?(dmalyshau)
Pushed by dmalyshau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/671618e0293c WebGPU presentation r=jgilbert,webidl,smaug,aosmond
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Pushed by dmalyshau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5d18f88ad3f5 Fix WebGPU canvas map population r=jgilbert
Regressions: 1633728
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: