Add GPU acceleration of path rasterization for accelerated Canvas2D
Categories
(Core :: Graphics: Canvas2D, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | fixed |
People
(Reporter: lsalzman, Assigned: lsalzman)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
Attachments
(3 files)
We want to use wpf-gpu-raster (https://github.com/FirefoxGraphics/wpf-gpu-raster) to add GPU acceleration of path rasterization to accelerated Canvas2D. Currently we rasterize paths in software and then upload them in a texture. In situations where the path has a lot of empty/filled interior and we have to regenerate it frequently, software rasterization can bog down quickly. GPU acceleration would allow us to do better in this case.
Assignee | ||
Comment 1•2 years ago
|
||
This adds the wpf-gpu-raster Rust crate so we can use it for the accelerated
Canvas2D project.
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D161477
Assignee | ||
Comment 3•2 years ago
|
||
This adds a path vertex buffer where triangle list output from WGR is stored.
Each PathCacheEntry can potentially reference a range of vertexes in this buffer
corresponding to triangles for that entry. When this buffer is full, it gets
orphaned and clears corresponding cache entries, so that it can start anew.
Depends on D161478
Comment 5•2 years ago
•
|
||
Backed out for causing windows build bustages. Later, this also happened for Android 4.1 x86 opt.
[task 2022-11-12T06:22:20.180Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=In file included from glsl-optimizer/src/compiler/glsl/glsl_parser_extras.cpp:41:
[task 2022-11-12T06:22:20.180Z] 06:22:20 WARNING - [glslopt 0.1.9] cargo:warning=glsl-optimizer/src/compiler/glsl/loop_analysis.h:125:4: warning: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Wdeprecated-builtins]
[task 2022-11-12T06:22:20.180Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=glsl-optimizer/src/util/ralloc.h:524:4: note: expanded from macro 'DECLARE_RALLOC_CXX_OPERATORS'
[task 2022-11-12T06:22:20.180Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning= DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, ralloc_size)
[task 2022-11-12T06:22:20.180Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning= ^
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=glsl-optimizer/src/util/ralloc.h:518:12: note: expanded from macro 'DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE'
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning= if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning= ^
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=glsl-optimizer/src/util/macros.h:195:44: note: expanded from macro 'HAS_TRIVIAL_DESTRUCTOR'
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning= ^
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] cargo:warning=14 warnings generated.
[task 2022-11-12T06:22:20.181Z] 06:22:20 INFO - [glslopt 0.1.9] exit status: 0
[task 2022-11-12T06:22:20.182Z] 06:22:20 INFO - [glslopt 0.1.9] running: "/builds/worker/fetches/sccache/sccache" "/builds/worker/fetches/clang/bin/clang++" "-O1" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-linux-gnu" "--sysroot" "/builds/worker/fetches/sysroot-x86_64-linux-gnu" "-Qunused-arguments" "-std=gnu++17" "-O3" "-DNDEBUG=1" "-DTRIMMED=1" "-I/builds/worker/checkouts/gecko/toolkit/library/gtest/rust" "-I/builds/worker/workspace/obj-build/toolkit/library/gtest/rust" "-I/builds/worker/workspace/obj-build/dist/include" "-DMOZILLA_CONFIG_H" "-I" "glsl-optimizer/include" "-I" "glsl-optimizer/src/mesa" "-I" "glsl-optimizer/src/mapi" "-I" "glsl-optimizer/src/compiler" "-I" "glsl-optimizer/src/compiler/glsl" "-I" "glsl-optimizer/src/gallium/auxiliary" "-I" "glsl-optimizer/src/gallium/include" "-I" "glsl-optimizer/src" "-I" "glsl-optimizer/src/util" "-D__STDC_FORMAT_MACROS" "-D_GNU_SOURCE" "-DHAVE_ENDIAN_H" "-DHAVE_PTHREAD" "-DHAVE_TIMESPEC_GET" "-DMOZ_INCLUDE_MOZALLOC_H" "-Dmozilla_throw_gcc_h" "-o" "/builds/worker/workspace/obj-build/release/build/glslopt-f2b6604f04a18673/out/glsl-optimizer/src/compiler/glsl/glsl_parser.o" "-c" "glsl-optimizer/src/compiler/glsl/glsl_parser.cpp"
[task 2022-11-12T06:22:20.182Z] 06:22:20 INFO - Compiling cose-c v0.1.5
[task 2022-11-12T06:22:20.182Z] 06:22:20 INFO - Compiling midir_impl v0.1.0 (/builds/worker/checkouts/gecko/dom/midi/midir_impl)
[task 2022-11-12T06:22:20.183Z] 06:22:20 INFO - Running `CARGO=/builds/worker/fetches/rustc/bin/cargo CARGO_CRATE_NAME=cosec CARGO_MANIFEST_DIR=/builds/worker/checkouts/gecko/third_party/rust/cose-c CARGO_PKG_AUTHORS='Franziskus Kiefer <franziskuskiefer@gmail.com>' CARGO_PKG_DESCRIPTION='C API for the cose crate' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MPL-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=cose-c CARGO_PKG_REPOSITORY='https://github.com/franziskuskiefer/cose-c-api' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.5 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=5 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/builds/worker/workspace/obj-build/release/deps:/builds/worker/fetches/rustc/lib' /builds/worker/fetches/sccache/sccache /builds/worker/fetches/rustc/bin/rustc --crate-name cosec /builds/worker/checkouts/gecko/third_party/rust/cose-c/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=296b82032869f986 -C extra-filename=-296b82032869f986 --out-dir /builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps --target i686-pc-windows-msvc -C linker=/builds/worker/checkouts/gecko/build/cargo-linker -L dependency=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps -L dependency=/builds/worker/workspace/obj-build/release/deps --extern cose=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libcose-87ad3146b265aa80.rmeta --cap-lints warn -C debuginfo=2 -C force-frame-pointers=yes -C control-flow-guard=yes -Dwarnings -Aproc-macro-back-compat -Cembed-bitcode=yes -C codegen-units=1`
[task 2022-11-12T06:22:20.184Z] 06:22:20 INFO - Running `CARGO=/builds/worker/fetches/rustc/bin/cargo CARGO_CRATE_NAME=midir_impl CARGO_MANIFEST_DIR=/builds/worker/checkouts/gecko/dom/midi/midir_impl CARGO_PKG_AUTHORS='Gabriele Svelto' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=midir_impl CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/builds/worker/workspace/obj-build/release/deps:/builds/worker/fetches/rustc/lib' /builds/worker/fetches/sccache/sccache /builds/worker/fetches/rustc/bin/rustc --crate-name midir_impl --edition=2018 dom/midi/midir_impl/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=606ed22f9beb90b2 -C extra-filename=-606ed22f9beb90b2 --out-dir /builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps --target i686-pc-windows-msvc -C linker=/builds/worker/checkouts/gecko/build/cargo-linker -L dependency=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps -L dependency=/builds/worker/workspace/obj-build/release/deps --extern midir=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libmidir-c142c2588cbbd18f.rmeta --extern nsstring=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libnsstring-d5216eda961c588a.rmeta --extern thin_vec=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libthin_vec-e2fe05670b990c88.rmeta --extern uuid=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libuuid-85ea55bac4a60604.rmeta -C debuginfo=2 -C force-frame-pointers=yes -C control-flow-guard=yes -Dwarnings -Aproc-macro-back-compat -Cembed-bitcode=yes -C codegen-units=1`
[task 2022-11-12T06:22:20.184Z] 06:22:20 ERROR - error[E0432]: unresolved import `std::arch::x86_64`
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - --> /builds/worker/checkouts/gecko/third_party/rust/wpf-gpu-raster/src/real.rs:12:28
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - |
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - 12 | ... use std::arch::x86_64::{__m128, _mm_set_ss, _mm_cvtss_si32, _mm_cvtsi32_ss, _mm_sub_ss, _mm_cmple_ss, _mm_store_ss, _mm_setzero_ps};
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - | ^^^^^^ could not find `x86_64` in `arch`
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - warning: ignoring -C extra-filename flag due to -o flag
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - For more information about this error, try `rustc --explain E0432`.
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - warning: `wpf-gpu-raster` (lib) generated 1 warning
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - error: could not compile `wpf-gpu-raster` due to previous error; 1 warning emitted
[task 2022-11-12T06:22:20.185Z] 06:22:20 INFO - Caused by:
[task 2022-11-12T06:22:20.186Z] 06:22:20 INFO - process didn't exit successfully: `CARGO=/builds/worker/fetches/rustc/bin/cargo CARGO_CRATE_NAME=wpf_gpu_raster CARGO_MANIFEST_DIR=/builds/worker/checkouts/gecko/third_party/rust/wpf-gpu-raster CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=wpf-gpu-raster CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/builds/worker/workspace/obj-build/release/deps:/builds/worker/fetches/rustc/lib' /builds/worker/fetches/sccache/sccache /builds/worker/fetches/rustc/bin/rustc --crate-name wpf_gpu_raster --edition=2021 /builds/worker/checkouts/gecko/third_party/rust/wpf-gpu-raster/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no --cfg 'feature="c_bindings"' --cfg 'feature="default"' -C metadata=4c6c978ce9854863 -C extra-filename=-4c6c978ce9854863 --out-dir /builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps --target i686-pc-windows-msvc -C linker=/builds/worker/checkouts/gecko/build/cargo-linker -L dependency=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps -L dependency=/builds/worker/workspace/obj-build/release/deps --extern typed_arena_nomut=/builds/worker/workspace/obj-build/i686-pc-windows-msvc/release/deps/libtyped_arena_nomut-b8c88a5e91d42a80.rmeta --cap-lints warn -C debuginfo=2 -C force-frame-pointers=yes -C control-flow-guard=yes -Dwarnings -Aproc-macro-back-compat -Cembed-bitcode=yes -C codegen-units=1` (exit status: 1)
[task 2022-11-12T06:22:20.186Z] 06:22:20 INFO - warning: build failed, waiting for other jobs to finish...
[task 2022-11-12T06:22:20.186Z] 06:22:20 INFO - warning: unused return value of `Box::<T>::from_raw` that must be used
[task 2022-11-12T06:22:20.186Z] 06:22:20 INFO - --> /builds/worker/checkouts/gecko/third_party/rust/mapped_hyph/src/ffi.rs:72:5
[task 2022-11-12T06:22:20.186Z] 06:22:20 INFO - |
<...>
Comment 7•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c7929716f859
https://hg.mozilla.org/mozilla-central/rev/b7497066ee4a
https://hg.mozilla.org/mozilla-central/rev/4245b2413dcc
Assignee | ||
Updated•2 years ago
|
Comment 8•2 years ago
•
|
||
Did this regress MotionMark Animometer?
https://arewefastyet.com/linux64/benchmarks/overview?numDays=60
https://arewefastyet.com/mac/benchmarks/overview?numDays=60
Assignee | ||
Comment 9•2 years ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #8)
Did this regress MotionMark Animometer?
https://arewefastyet.com/linux64/benchmarks/overview?numDays=60
https://arewefastyet.com/mac/benchmarks/overview?numDays=60
The profile does not show any time being spent in Canvas2D of note, so superficially this bug does not seem like the cause.
Comment 10•2 years ago
|
||
(In reply to Lee Salzman [:lsalzman] from comment #9)
The profile does not show any time being spent in Canvas2D of note, so superficially this bug does not seem like the cause.
The profile only includes time being spent in the "Multiply" test.
Comment 11•2 years ago
•
|
||
It is just that both times when the regression happened, perfherder points to this bug. And then it un-regressed for a short while
in https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=e51cd76008ef273e01c4b9c30c16d061e5955f13&tochange=c671a799829d029e89c7aa4a4f5a59b425ad2e58
Comment 12•2 years ago
|
||
We seem to regress the "Paths" sub test a lot. This is not that surprising. Implementing bug 1800570 would help.
Description
•