Updated many rust things and configs

This commit is contained in:
Fedor 2023-11-17 18:13:04 +02:00
parent 1a0c3b0c57
commit 69b75208ad
1092 changed files with 61216 additions and 30313 deletions

1
.cargo/.gitignore vendored
View File

@ -1 +0,0 @@
config

View File

@ -1,31 +1,42 @@
# Note: if you add more configure substitutions here with required values
# you will also need to fix the sed commands in:
# taskcluster/scripts/builder/build-sm-mozjs-crate.sh
# taskcluster/scripts/builder/build-sm-rust-bindings.sh
# This file contains vendoring instructions for cargo.
# It was generated by `mach vendor rust`.
# Please do not edit.
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source."https://github.com/servo/serde"]
git = "https://github.com/servo/serde"
branch = "deserialize_from_enums10"
[source."https://github.com/jfkthame/mapped_hyph.git"]
git = "https://github.com/jfkthame/mapped_hyph.git"
replace-with = "vendored-sources"
tag = "v0.3.0"
[source."https://github.com/retep998/winapi-rs"]
git = "https://github.com/froydnj/winapi-rs"
branch = "aarch64"
replace-with = "vendored-sources"
[source."https://github.com/rust-lang-nursery/packed_simd"]
git = "https://github.com/hsivonen/packed_simd"
[source."https://github.com/hsivonen/packed_simd"]
branch = "rust_1_32"
git = "https://github.com/hsivonen/packed_simd"
replace-with = "vendored-sources"
[source."https://github.com/CraneStation/Cranelift"]
git = "https://github.com/CraneStation/Cranelift"
replace-with = "vendored-sources"
rev = "182414f15c18538dfebbe040469ec8001e93ecc5"
[source.crates-io]
replace-with = "vendored-sources"
# Take advantage of the fact that cargo will treat lines starting with #
# as comments to add preprocessing directives. This file can thus by copied
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
# (for e.g. independent tasks building rust code), or be preprocessed by
# the build system to produce a .cargo/config with the right content.
#define REPLACE_NAME vendored-sources
#define VENDORED_DIRECTORY third_party/rust
# We explicitly exclude the following section when preprocessing because
# it would overlap with the preprocessed [source."@REPLACE_NAME@"], and
# cargo would fail.
#ifndef REPLACE_NAME
[source.vendored-sources]
directory = '@top_srcdir@/third_party/rust'
directory = "third_party/rust"
#endif
# Thankfully, @REPLACE_NAME@ is unlikely to be a legitimate source, so
# cargo will ignore it when it's here verbatim.
#filter substitution
[source."@REPLACE_NAME@"]
directory = "@top_srcdir@/@VENDORED_DIRECTORY@"

View File

@ -202,9 +202,6 @@ gfx/wr/**
# intl/ exclusions
intl/icu/**
intl/locale/**
intl/strres/**
intl/uconv/**
# Bug 1527075: This directory is linted in github repository
intl/l10n/**

View File

@ -25,7 +25,6 @@ exclude =
python/devtools/migrate-l10n/migrate/main.py,
python/l10n/fluent_migrations,
python/mozbuild/dumbmake,
python/mozbuild/mozbuild,
servo/components/style,
testing/jsshell/benchmark.py,
testing/marionette/mach_commands.py,
@ -68,6 +67,7 @@ exclude =
memory/moz.configure,
mobile/android/*.configure,
node_modules,
python/mozbuild/mozbuild/test/configure/data,
security/nss/,
testing/marionette/harness/marionette_harness/runner/mixins,
testing/marionette/harness/marionette_harness/tests,
@ -91,6 +91,8 @@ ignore =
per-file-ignores =
ipc/ipdl/*: F403, F405
# cpp_eclipse has a lot of multi-line embedded XML which exceeds line length
python/mozbuild/mozbuild/backend/cpp_eclipse.py: E501
testing/firefox-ui/**/__init__.py: F401
testing/marionette/**/__init__.py: F401
testing/mozharness/configs/*: E124, E127, E128, E131, E231, E261, E265, E266, E501, W391

View File

@ -1,2 +1,2 @@
Andreas Tolfsen <ato@sny.no> <ato@mozilla.com>
Nika Layzell <nika@thelayzells.com> Michael Layzell <michael@thelayzells.com>
Nika Layzell <nika@thelayzells.com> <michael@thelayzells.com>

3313
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,6 @@ codegen-units = 1
[patch.crates-io]
libudev-sys = { path = "dom/webauthn/libudev-sys" }
winapi = { git = "https://github.com/froydnj/winapi-rs", branch = "aarch64" }
packed_simd = { git = "https://github.com/hsivonen/packed_simd", branch = "rust_1_32" }
[patch.crates-io.cranelift-codegen]

View File

@ -51,7 +51,7 @@ ifndef TEST_MOZBUILD
ifndef MOZ_PROFILE_USE
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
# rules.mk doesn't run early enough.
$(TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES)
$(RUNNABLE_TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES)
endif
endif
@ -157,6 +157,11 @@ recurse_win32-artifact:
mv $(DIST)/i686/bin/* $(DIST)/i686
endif
ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
recurse_android-fat-aar-artifact:
$(call py_action,fat_aar,$(MOZ_ANDROID_FAT_AAR_ARCHITECTURES) --distdir $(abspath $(DIST)/fat-aar))
endif # MOZ_ANDROID_FAT_AAR_ARCHITECTURES
ifdef MOZ_WIDGET_TOOLKIT
ifdef ENABLE_TESTS
# Additional makefile targets to call automated test suites

View File

@ -16,7 +16,7 @@ MIDL_GENERATED_FILES = \
# midl targets to avoid timestamp caching issues.
$(MIDL_GENERATED_FILES): done_gen ;
done_gen: IGeckoCustom.idl
done_gen: $(srcdir)/IGeckoCustom.idl
$(MIDL) $(MIDL_FLAGS) -I $(srcdir) -Oicf $(srcdir)/IGeckoCustom.idl
touch $@

View File

@ -16,10 +16,10 @@ MIDL_GENERATED_FILES = \
# midl targets to avoid timestamp caching issues.
$(MIDL_GENERATED_FILES): done_gen ;
done_gen: ISimpleDOM.idl \
ISimpleDOMNode.idl \
ISimpleDOMDocument.idl \
ISimpleDOMText.idl
done_gen: $(srcdir)/ISimpleDOM.idl \
$(srcdir)/ISimpleDOMNode.idl \
$(srcdir)/ISimpleDOMDocument.idl \
$(srcdir)/ISimpleDOMText.idl
$(MIDL) $(MIDL_FLAGS) -I $(srcdir) -robust -Oicf $(srcdir)/ISimpleDOM.idl
touch $@

View File

@ -21,7 +21,7 @@ export:: $(MIDL_GENERATED_FILES)
# midl targets to avoid timestamp caching issues.
$(MIDL_GENERATED_FILES): midl_done ;
midl_done: HandlerData.acf HandlerData.idl
midl_done: $(srcdir)/HandlerData.acf $(srcdir)/HandlerData.idl
$(MIDL) $(MIDL_FLAGS) $(DEFINES) -I $(topobjdir) -I $(DIST)/include -I $(IA2DIR) -I $(MSAADIR) -Oicf -acf $(srcdir)/HandlerData.acf $(srcdir)/HandlerData.idl
touch $@

View File

@ -15,7 +15,7 @@ MIDL_GENERATED_FILES = \
# midl targets to avoid timestamp caching issues.
$(MIDL_GENERATED_FILES): done_gen ;
done_gen: Accessible.idl
done_gen: $(srcdir)/Accessible.idl
$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/Accessible.idl
touch $@

1
aclocal.m4 vendored
View File

@ -15,7 +15,6 @@ builtin(include, build/autoconf/codeset.m4)dnl
builtin(include, build/autoconf/altoptions.m4)dnl
builtin(include, build/autoconf/mozprog.m4)dnl
builtin(include, build/autoconf/mozheader.m4)dnl
builtin(include, build/autoconf/frameptr.m4)dnl
builtin(include, build/autoconf/compiler-opts.m4)dnl
builtin(include, build/autoconf/expandlibs.m4)dnl
builtin(include, build/autoconf/arch.m4)dnl

View File

@ -31,7 +31,7 @@ ifeq ($(OS_ARCH),WINNT)
# (this dependency should really be just for firefox.exe, not other targets)
# Note the manifest file exists in the tree, so we use the explicit filename
# here.
EXTRA_DEPS += mypal.exe.manifest
EXTRA_DEPS += $(srcdir)/mypal.exe.manifest
endif
PROGRAMS_DEST = $(DIST)/bin

View File

@ -38,7 +38,7 @@ add_task(async function() {
},
dialog => {
let savedItemId = dialog.gEditItemOverlay.itemId;
Assert.ok(savedItemId > 0, "Found the itemId");
Assert.greater(savedItemId, 0, "Found the itemId");
return PlacesTestUtils.waitForNotification(
"onItemRemoved",
id => id === savedItemId

View File

@ -143,7 +143,7 @@ add_task(async function test_query_on_toolbar() {
});
// Get first child and check it is the just inserted query.
Assert.ok(toolbarNode.childCount > 0, "Toolbar node has children");
Assert.greater(toolbarNode.childCount, 0, "Toolbar node has children");
let queryNode = toolbarNode.getChild(0);
Assert.equal(
queryNode.title,

View File

@ -132,7 +132,7 @@ add_task(async function test_separator_first() {
await promiseReady;
let children = gToolbarContent.children;
Assert.ok(children.length > 2, "Multiple elements are visible");
Assert.greater(children.length, 2, "Multiple elements are visible");
Assert.equal(
children[1]._placesNode.uri,
"http://test.places.0/",

View File

@ -6,3 +6,4 @@ mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"
ac_add_options --enable-profile-generate
ac_add_options --disable-tests

View File

@ -4,9 +4,4 @@ export MOZ_PGO=1
ac_add_options --with-branding=browser/branding/aurora
export MOZ_LTO=1
ac_add_options --enable-profile-use
ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -5,4 +5,5 @@ mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"
ac_add_options --enable-profile-generate
ac_add_options --enable-profile-generate=cross
ac_add_options --disable-tests

View File

@ -2,6 +2,6 @@
ac_add_options --enable-official-branding
export MOZ_LTO=1
export MOZ_LTO=cross
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -2,7 +2,7 @@
ac_add_options --disable-install-strip
export MOZ_LTO=1
export MOZ_LTO=cross
ac_add_options --enable-instruments

View File

@ -8,7 +8,7 @@ if test `uname -s` != Linux; then
ac_add_options --enable-dtrace
fi
export MOZ_LTO=1
export MOZ_LTO=cross
ac_add_options --with-branding=browser/branding/nightly

View File

@ -5,7 +5,7 @@
ac_add_options --enable-official-branding
export MOZ_LTO=1
export MOZ_LTO=cross
# safeguard against someone forgetting to re-set EARLY_BETA_OR_EARLIER in
# defines.sh during the beta cycle

View File

@ -6,3 +6,4 @@ mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"
ac_add_options --enable-profile-generate
ac_add_options --disable-tests

View File

@ -4,7 +4,7 @@
ac_add_options --enable-official-branding
export MOZ_LTO=1
export MOZ_LTO=cross
unset ENABLE_CLANG_PLUGIN

View File

@ -22,3 +22,9 @@ export MOZ_PACKAGE_JSSHELL=1
if test -n "$MOZ_ARTIFACT_TASK_WIN32_OPT"; then
ac_add_options --enable-eme=widevine
fi
# Temporary signal to toolchain.configure that our compiler is patched to
# support CFG, until such support can be assumed.
if test -z "$USE_ARTIFACT"; then
ac_add_options --enable-hardening
fi

View File

@ -2,7 +2,7 @@
. "$topsrcdir/browser/config/mozconfigs/win64-aarch64/common-win64"
. "$topsrcdir/browser/config/mozconfigs/win64-aarch64/common-opt"
export MOZ_LTO=1
export MOZ_LTO=cross
ac_add_options --with-branding=browser/branding/aurora

View File

@ -2,7 +2,7 @@
. "$topsrcdir/browser/config/mozconfigs/win64-aarch64/common-win64"
. "$topsrcdir/browser/config/mozconfigs/win64-aarch64/common-opt"
export MOZ_LTO=1
export MOZ_LTO=cross
ac_add_options --with-branding=browser/branding/nightly

View File

@ -7,7 +7,7 @@
ac_add_options --enable-official-branding
export MOZ_LTO=1
export MOZ_LTO=cross
unset ENABLE_CLANG_PLUGIN

View File

@ -13,7 +13,3 @@ export MOZILLA_OFFICIAL=1
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
if [ -n "$MOZ_PGO" ]; then
RUSTFLAGS="-Clinker-plugin-lto"
fi

View File

@ -6,3 +6,4 @@ mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"
ac_add_options --enable-profile-generate
ac_add_options --disable-tests

View File

@ -575,7 +575,7 @@ add_task(async function test_dont_decrement_chances_on_same_day() {
let initChances = UnsubmittedCrashHandler.prefs.getIntPref(
"chancesUntilSuppress"
);
Assert.ok(initChances > 1, "We should start with at least 1 chance.");
Assert.greater(initChances, 1, "We should start with at least 1 chance.");
await createPendingCrashReports(1);
let notification = await UnsubmittedCrashHandler.checkForUnsubmittedCrashReports();
@ -625,7 +625,7 @@ add_task(async function test_decrement_chances_on_other_day() {
let initChances = UnsubmittedCrashHandler.prefs.getIntPref(
"chancesUntilSuppress"
);
Assert.ok(initChances > 1, "We should start with at least 1 chance.");
Assert.greater(initChances, 1, "We should start with at least 1 chance.");
await createPendingCrashReports(1);
let notification = await UnsubmittedCrashHandler.checkForUnsubmittedCrashReports();

View File

@ -1,48 +0,0 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Set MOZ_FRAMEPTR_FLAGS to the flags that should be used for enabling or
dnl disabling frame pointers in this architecture based on the configure
dnl options
AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
if test "$GNU_CC"; then
MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer -funwind-tables"
MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer -funwind-tables"
else
case "$target" in
dnl some versions of clang-cl don't support -Oy-; accommodate them.
aarch64-windows*)
if test "$CC_TYPE" = "clang-cl"; then
MOZ_ENABLE_FRAME_PTR="-Xclang -mdisable-fp-elim"
MOZ_DISABLE_FRAME_PTR="-Xclang -mdisable-fp-elim"
else
MOZ_ENABLE_FRAME_PTR="-Oy-"
MOZ_DISABLE_FRAME_PTR="-Oy"
fi
;;
dnl Oy (Frame-Pointer Omission) is only support on x86 compilers
*-mingw32*)
MOZ_ENABLE_FRAME_PTR="-Oy-"
MOZ_DISABLE_FRAME_PTR="-Oy"
;;
esac
fi
# If we are debugging, profiling, using sanitizers, or on win32 we want a
# frame pointer. It is not required to enable frame pointers on AArch64
# Windows, but we enable it for compatibility with ETW.
if test -z "$MOZ_OPTIMIZE" -o \
-n "$MOZ_PROFILING" -o \
-n "$MOZ_DEBUG" -o \
-n "$MOZ_MSAN" -o \
-n "$MOZ_ASAN" -o \
-n "$MOZ_UBSAN" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:x86" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:aarch64"; then
MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
else
MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
fi
])

View File

@ -40,10 +40,6 @@ AC_SUBST(MOZ_ASAN)
dnl ========================================================
dnl = Use Memory Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
[ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
MOZ_MSAN=1,
MOZ_MSAN= )
if test -n "$MOZ_MSAN"; then
CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins $CFLAGS"
CXXFLAGS="-fsanitize=memory -fsanitize-memory-track-origins $CXXFLAGS"
@ -58,10 +54,6 @@ AC_SUBST(MOZ_MSAN)
dnl ========================================================
dnl = Use Thread Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
[ --enable-thread-sanitizer Enable Thread Sanitizer (default=no)],
MOZ_TSAN=1,
MOZ_TSAN= )
if test -n "$MOZ_TSAN"; then
CFLAGS="-fsanitize=thread $CFLAGS"
CXXFLAGS="-fsanitize=thread $CXXFLAGS"
@ -94,16 +86,6 @@ AC_SUBST(MOZ_UBSAN)
dnl ========================================================
dnl = Use UndefinedBehavior Sanitizer to find integer overflows
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(signed-overflow-sanitizer,
[ --enable-signed-overflow-sanitizer Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts, default=no)],
MOZ_SIGNED_OVERFLOW_SANITIZE=1,
MOZ_SIGNED_OVERFLOW_SANITIZE= )
MOZ_ARG_ENABLE_BOOL(unsigned-overflow-sanitizer,
[ --enable-unsigned-overflow-sanitizer Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts, default=no)],
MOZ_UNSIGNED_OVERFLOW_SANITIZE=1,
MOZ_UNSIGNED_OVERFLOW_SANITIZE= )
if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
MOZ_UBSAN=1
SANITIZER_BLACKLISTS=""

View File

@ -12,6 +12,7 @@
"workaround-issue38586.patch",
"unpoison-thread-stacks.patch",
"downgrade-mangling-error.patch",
"r355141-arm64-cfg.patch",
"loosen-msvc-detection.patch",
"revert-r355311.patch"
]

View File

@ -0,0 +1,112 @@
[COFF] Add address-taken import thunks to the fid table
https://bugs.llvm.org/show_bug.cgi?id=39799
https://reviews.llvm.org/D58739
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -1390,19 +1390,47 @@
// symbol in an executable section.
static void maybeAddAddressTakenFunction(SymbolRVASet &AddressTakenSyms,
Symbol *S) {
- auto *D = dyn_cast_or_null<DefinedCOFF>(S);
-
- // Ignore undefined symbols and references to non-functions (e.g. globals and
- // labels).
- if (!D ||
- D->getCOFFSymbol().getComplexType() != COFF::IMAGE_SYM_DTYPE_FUNCTION)
+ if (!S)
return;
- // Mark the symbol as address taken if it's in an executable section.
- Chunk *RefChunk = D->getChunk();
- OutputSection *OS = RefChunk ? RefChunk->getOutputSection() : nullptr;
- if (OS && OS->Header.Characteristics & IMAGE_SCN_MEM_EXECUTE)
- addSymbolToRVASet(AddressTakenSyms, D);
+ switch (S->kind()) {
+ case Symbol::DefinedLocalImportKind:
+ case Symbol::DefinedImportDataKind:
+ // Defines an __imp_ pointer, so it is data, so it is ignored.
+ break;
+ case Symbol::DefinedCommonKind:
+ // Common is always data, so it is ignored.
+ break;
+ case Symbol::DefinedAbsoluteKind:
+ case Symbol::DefinedSyntheticKind:
+ // Absolute is never code, synthetic generally isn't and usually isn't
+ // determinable.
+ break;
+ case Symbol::LazyKind:
+ case Symbol::UndefinedKind:
+ // Undefined symbols resolve to zero, so they don't have an RVA. Lazy
+ // symbols shouldn't have relocations.
+ break;
+
+ case Symbol::DefinedImportThunkKind:
+ // Thunks are always code, include them.
+ addSymbolToRVASet(AddressTakenSyms, cast<Defined>(S));
+ break;
+
+ case Symbol::DefinedRegularKind: {
+ // This is a regular, defined, symbol from a COFF file. Mark the symbol as
+ // address taken if the symbol type is function and it's in an executable
+ // section.
+ auto *D = cast<DefinedRegular>(S);
+ if (D->getCOFFSymbol().getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
+ Chunk *RefChunk = D->getChunk();
+ OutputSection *OS = RefChunk ? RefChunk->getOutputSection() : nullptr;
+ if (OS && OS->Header.Characteristics & IMAGE_SCN_MEM_EXECUTE)
+ addSymbolToRVASet(AddressTakenSyms, D);
+ }
+ break;
+ }
+ }
}
// Visit all relocations from all section contributions of this object file and
--- a/lld/test/COFF/guardcf-thunk.s
+++ b/lld/test/COFF/guardcf-thunk.s
@@ -0,0 +1,43 @@
+# REQUIRES: x86
+
+# Make a DLL that exports exportfn1.
+# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
+# RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1 /implib:%t.lib
+
+# Make an obj that takes the address of that exported function.
+# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t2.obj
+# RUN: lld-link -entry:main -guard:cf %t2.obj %t.lib -nodefaultlib -out:%t.exe
+# RUN: llvm-readobj -coff-load-config %t.exe | FileCheck %s
+
+# Check that the gfids table contains *exactly* two entries, one for exportfn1
+# and one for main.
+# CHECK: GuardFidTable [
+# CHECK-NEXT: 0x{{[0-9A-Fa-f]+0$}}
+# CHECK-NEXT: 0x{{[0-9A-Fa-f]+0$}}
+# CHECK-NEXT: ]
+
+
+ .def @feat.00;
+ .scl 3;
+ .type 0;
+ .endef
+ .globl @feat.00
+@feat.00 = 0x001
+
+ .section .text,"rx"
+ .def main; .scl 2; .type 32; .endef
+ .global main
+main:
+ leaq exportfn1(%rip), %rax
+ retq
+
+ .section .rdata,"dr"
+.globl _load_config_used
+_load_config_used:
+ .long 256
+ .fill 124, 1, 0
+ .quad __guard_fids_table
+ .quad __guard_fids_count
+ .long __guard_flags
+ .fill 128, 1, 0
+

View File

@ -3,8 +3,18 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@depends(mozbuild_state_path, '--help')
@imports('os')
@imports(_from='mozboot.android', _import='NDK_VERSION')
def default_android_ndk_root(mozbuild_state_path, _):
path = os.path.join(mozbuild_state_path, 'android-ndk-%s' % NDK_VERSION)
if os.path.isdir(path):
return path
js_option('--with-android-ndk', nargs=1,
help='location where the Android NDK can be found')
default=default_android_ndk_root,
help='location where the Android NDK can be found{|}')
js_option('--with-android-toolchain', nargs=1,
help='location of the Android toolchain')
@ -50,11 +60,16 @@ add_old_configure_assignment('android_version', android_version)
@depends('--with-android-ndk')
@imports(_from='os.path', _import='isdir')
def ndk(value):
if not value:
die('You must specify --with-android-ndk=/path/to/ndk when '
'building for Android')
return value[0]
if value:
if not isdir(value[0]):
die("The path you specified with --with-android-ndk (%s) is not "
"a directory" % value[0])
return value[0]
die('You must specify --with-android-ndk=/path/to/ndk when targeting Android, '
'or try |mach bootstrap|.')
set_config('ANDROID_NDK', ndk)
@ -335,28 +350,6 @@ def bindgen_cflags_android(toolchain_flags, stlport_flags, toolchain,
]
@depends(host, ndk)
@imports(_from='os.path', _import='exists')
@imports(_from='os.path', _import='isdir')
def android_clang_compiler(host, ndk):
if not ndk:
return
llvm_format = '%s/toolchains/llvm/prebuilt/%s-%s/bin'
llvm_path = llvm_format % (ndk, host.kernel.lower(), host.cpu)
if not isdir(llvm_path) and host.cpu == 'x86_64':
llvm_path = llvm_format % (ndk, host.kernel.lower(), 'x86')
if not isdir(llvm_path):
die("Couldn't find path to LLVM toolchain at %s" % llvm_path)
clang = '%s/clang' % llvm_path
if not exists(clang):
die("Couln't find clang in LLVM toolchain at %s" % clang)
return clang
@depends('--with-android-googlevr-sdk', target)
@checking('for GoogleVR SDK', lambda x: x.result)
@imports(_from='os.path', _import='exists')

View File

@ -5,20 +5,18 @@
# Ensure Android SDK and build-tools versions depending on mobile target.
@depends(host, '--help')
@depends(host, mozbuild_state_path, '--help')
@imports('os')
def default_android_sdk_root(host, _):
mozbuild_state_dir = os.environ.get('MOZBUILD_STATE_PATH',
os.path.expanduser(os.path.join('~', '.mozbuild')))
def default_android_sdk_root(host, mozbuild_state_path, _):
sdk_basename = {
'Darwin': 'android-sdk-macosx',
'Linux': 'android-sdk-linux',
'WINNT': 'android-sdk-windows',
}.get(host.kernel)
if sdk_basename is None:
log.warning("%s is unsupported host" % host.kernel)
return None
return os.path.join(mozbuild_state_dir, sdk_basename)
if sdk_basename:
path = os.path.join(mozbuild_state_path, sdk_basename)
if os.path.isdir(path):
return path
option('--with-android-sdk', nargs=1,
@ -29,7 +27,10 @@ option('--with-android-sdk', nargs=1,
@depends('--with-android-sdk')
@imports(_from='os.path', _import='isdir')
def android_sdk_root(value):
if value and isdir(value[0]):
if value:
if not isdir(value[0]):
die("The path you specified with --with-android-sdk (%s) is not "
"a directory" % value[0])
return value[0]
die("You must specify --with-android-sdk=/path/to/sdk when targeting Android, "

View File

@ -1268,6 +1268,19 @@ set_define('MOZ_UPDATE_CHANNEL', update_channel)
add_old_configure_assignment('MOZ_UPDATE_CHANNEL', update_channel)
js_option(env='MOZBUILD_STATE_PATH', nargs=1,
help='Path to a persistent state directory for the build system '
'and related tools')
@depends('MOZBUILD_STATE_PATH', '--help')
@imports('os')
def mozbuild_state_path(path, _):
if path:
return path[0]
return os.path.expanduser(os.path.join('~', '.mozbuild'))
# A template providing a shorthand for setting a variable. The created
# option will only be settable with imply_option.
# It is expected that a project-specific moz.configure will call imply_option

View File

@ -0,0 +1,251 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# PGO
# ==============================================================
@depends(c_compiler, check_build_environment, target)
@imports('multiprocessing')
@imports(_from='__builtin__', _import='min')
def pgo_flags(compiler, build_env, target):
topobjdir = build_env.topobjdir
if topobjdir.endswith('/js/src'):
topobjdir = topobjdir[:-7]
if compiler.type == 'gcc':
return namespace(
gen_cflags=['-fprofile-generate'],
gen_ldflags=['-fprofile-generate'],
use_cflags=['-fprofile-use', '-fprofile-correction',
'-Wcoverage-mismatch'],
use_ldflags=['-fprofile-use'],
)
if compiler.type in ('clang-cl', 'clang'):
profdata = os.path.join(topobjdir, 'merged.profdata')
prefix = ''
if compiler.type == 'clang-cl':
prefix = '/clang:'
if target.cpu == 'x86_64':
gen_ldflags = ['clang_rt.profile-x86_64.lib']
elif target.cpu == 'x86':
gen_ldflags = ['clang_rt.profile-i386.lib']
else:
gen_ldflags = None
else:
gen_ldflags = ['-fprofile-generate']
return namespace(
gen_cflags=[prefix + '-fprofile-generate'],
gen_ldflags=gen_ldflags,
use_cflags=[prefix + '-fprofile-use=%s' % profdata,
# Some error messages about mismatched profile data
# come in via -Wbackend-plugin, so disable those too.
'-Wno-error=backend-plugin'],
use_ldflags=[],
)
set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags)
set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags)
set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)
llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
allow_missing=True,
paths=toolchain_search_path)
js_option('--enable-profile-generate',
nargs='?',
choices=('cross',),
help='Build a PGO instrumented binary')
imply_option('MOZ_PGO',
depends_if('--enable-profile-generate')(lambda _: True))
set_config('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))
set_define('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))
js_option('--enable-profile-use',
nargs='?',
choices=('cross',),
help='Use a generated profile during the build')
js_option('--with-pgo-profile-path',
help='Path to the directory with unmerged profile data to use during the build',
nargs=1)
js_option('--enable-cross-pgo',
help='Enable PGO on Rust code')
imply_option('MOZ_PGO',
depends_if('--enable-profile-use')(lambda _: True))
set_config('MOZ_PROFILE_USE',
depends_if('--enable-profile-use')(lambda _: True))
@depends('--with-pgo-profile-path', '--enable-profile-use', llvm_profdata)
@imports('os')
def pgo_profile_path(path, pgo_use, profdata):
if not path:
return
if path and not pgo_use:
die('Pass --enable-profile-use to use --with-pgo-profile-path.')
if path and not profdata:
die('LLVM_PROFDATA must be set to process the pgo profile.')
if not os.path.isdir(path[0]):
die('Argument to --with-pgo-profile-path must be a directory.')
if not os.path.isabs(path[0]):
die('Argument to --with-pgo-profile-path must be an absolute path.')
return path[0]
set_config('PGO_PROFILE_PATH', pgo_profile_path)
option('--with-pgo-jarlog',
help='Use the provided jarlog file when packaging during a profile-use '
'build',
nargs=1)
set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p))
@depends('MOZ_PGO', '--enable-profile-use', '--enable-profile-generate',
c_compiler, rustc_info)
def moz_pgo_rust(pgo, profile_use, profile_generate, c_compiler, rustc):
if not pgo:
return
# Enabling PGO through MOZ_PGO only and not --enable* flags.
if not profile_use and not profile_generate:
return
if profile_use and profile_generate:
die('Cannot build with --enable-profile-use and --enable-profile-generate.')
want_cross = (len(profile_use) and profile_use[0] == 'cross') \
or (len(profile_generate) and profile_generate[0] == 'cross')
if not want_cross:
return
if c_compiler.type == 'gcc':
die('Cannot use cross-language PGO with GCC.')
# PGO is not stable prior to 1.37
if rustc.version < Version('1.37'):
die('Cannot use cross-language PGO with Rust version %s.' % rustc.version)
return True
set_config('MOZ_PGO_RUST', moz_pgo_rust)
# LTO
# ==============================================================
js_option('--enable-lto',
env='MOZ_LTO',
nargs='?',
choices=('full', 'thin', 'cross'),
help='Enable LTO')
js_option(env='MOZ_LD64_KNOWN_GOOD',
nargs=1,
help='Indicate that ld64 is free of symbol aliasing bugs.')
imply_option('MOZ_LD64_KNOWN_GOOD', depends_if('MOZ_AUTOMATION')(lambda _: True))
@depends('--enable-lto', c_compiler, 'MOZ_LD64_KNOWN_GOOD', target)
@imports('multiprocessing')
def lto(value, c_compiler, ld64_known_good, target):
cflags = []
ldflags = []
enabled = None
rust_lto = False
if value:
enabled = True
# `cross` implies `thin`, but with Rust code participating in LTO
# as well. Make that a little more explicit.
if len(value) and value[0].lower() == 'cross':
if c_compiler.type == 'gcc':
die('Cross-language LTO is not supported with GCC.')
rust_lto = True
value = ['thin']
if target.kernel == 'Darwin' and target.os == 'OSX' \
and value[0].lower() == 'cross' and not ld64_known_good:
die('The Mac linker is known to have a bug that affects cross-language '
'LTO. If you know that your linker is free from this bug, please '
'set the environment variable `MOZ_LD64_KNOWN_GOOD=1` and re-run '
'configure.')
if c_compiler.type == 'clang':
if len(value) and value[0].lower() == 'full':
cflags.append("-flto")
ldflags.append("-flto")
else:
cflags.append("-flto=thin")
ldflags.append("-flto=thin")
elif c_compiler.type == 'clang-cl':
if len(value) and value[0].lower() == 'full':
cflags.append("-flto")
else:
cflags.append("-flto=thin")
# With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
# AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
cflags.append("-fuse-ld=lld");
# Explicitly set the CPU to optimize for so the linker doesn't
# choose a poor default. Rust compilation by default uses the
# pentium4 CPU on x86:
#
# https://github.com/rust-lang/rust/blob/master/src/librustc_target/spec/i686_pc_windows_msvc.rs#L5
#
# which specifically supports "long" (multi-byte) nops. See
# https://bugzilla.mozilla.org/show_bug.cgi?id=1568450#c8 for details.
#
# The pentium4 seems like kind of a weird CPU to optimize for, but
# it seems to have worked out OK thus far. LLVM does not seem to
# specifically schedule code for the pentium4's deep pipeline, so
# that probably contributes to it being an OK default for our
# purposes.
if target.cpu == 'x86':
ldflags.append('-mllvm:-mcpu=pentium4')
# This is also the CPU that Rust uses. The LLVM source code
# recommends this as the "generic 64-bit specific x86 processor model":
#
# https://github.com/llvm/llvm-project/blob/e7694f34ab6a12b8bb480cbfcb396d0a64fe965f/llvm/lib/Target/X86/X86.td#L1165-L1187
if target.cpu == 'x86_64':
ldflags.append('-mllvm:-mcpu=x86-64')
# We do not need special flags for arm64. Hooray for fixed-length
# instruction sets.
else:
num_cores = multiprocessing.cpu_count()
cflags.append("-flto")
cflags.append("-flifetime-dse=1")
ldflags.append("-flto=%s" % num_cores)
ldflags.append("-flifetime-dse=1")
return namespace(
enabled=enabled,
cflags=cflags,
ldflags=ldflags,
rust_lto=rust_lto,
)
add_old_configure_assignment('MOZ_LTO', lto.enabled)
set_config('MOZ_LTO', lto.enabled)
set_define('MOZ_LTO', lto.enabled)
set_config('MOZ_LTO_CFLAGS', lto.cflags)
set_config('MOZ_LTO_LDFLAGS', lto.ldflags)
set_config('MOZ_LTO_RUST', lto.rust_lto)
add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags)
add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags)

View File

@ -3,11 +3,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@deprecated_option(env='MOZ_JEMALLOC4')
def moz_jemalloc4(value):
die('MOZ_JEMALLOC4 is deprecated')
@depends(target)
def jemalloc_default(target):
return target.kernel in ('Darwin', 'Linux', 'WINNT')

View File

@ -193,7 +193,6 @@ def old_configure_options(*options):
'--enable-libproxy',
'--enable-llvm-hacks',
'--enable-logrefcnt',
'--enable-memory-sanitizer',
'--enable-mobile-optimize',
'--enable-necko-wifi',
'--enable-negotiateauth',
@ -213,10 +212,7 @@ def old_configure_options(*options):
'--enable-system-extension-dirs',
'--enable-system-pixman',
'--enable-system-sqlite',
'--enable-thread-sanitizer',
'--enable-signed-overflow-sanitizer',
'--enable-universalchardet',
'--enable-unsigned-overflow-sanitizer',
'--enable-updater',
'--enable-xul',
'--enable-zipwriter',

View File

@ -59,6 +59,7 @@ def rustc_info(rustc):
version=Version(info.get('release', '0')),
commit=info.get('commit-hash', 'unknown'),
host=info['host'],
llvm_version=Version(info.get('LLVM version', '0')),
)
set_config('RUSTC_VERSION', depends(rustc_info)(lambda info: str(info.version)))
@ -101,11 +102,10 @@ def rust_compiler(rustc_info, cargo_info, build_project):
or by directly running the installer from https://rustup.rs/
'''))
if build_project == 'tools/crashreporter':
rustc_min_version = Version('1.22.0')
cargo_min_version = Version('0.23.0')
rustc_min_version = Version('1.31.0')
else:
rustc_min_version = Version('1.34.0')
cargo_min_version = rustc_min_version
rustc_min_version = Version('1.35.0')
cargo_min_version = rustc_min_version
version = rustc_info.version
if version < rustc_min_version:

View File

@ -28,8 +28,8 @@ js_option('--disable-optimize',
help='Disable optimizations via compiler flags')
@depends('--enable-optimize')
def moz_optimize(option):
@depends('--enable-optimize', '--help')
def moz_optimize(option, _):
flags = None
if len(option):
@ -718,10 +718,11 @@ def toolchain_search_path_for(host_or_target):
target: vc_compiler_path,
}[host_or_target]
@depends(vc_path, original_path)
@depends(vc_path, original_path, developer_options, mozbuild_state_path)
@imports('os')
@imports(_from='os', _import='environ')
def toolchain_search_path(vc_compiler_path, original_path):
def toolchain_search_path(vc_compiler_path, original_path, developer_options,
mozbuild_state_path):
result = list(original_path)
if vc_compiler_path:
@ -735,22 +736,24 @@ def toolchain_search_path_for(host_or_target):
# Also add in the location to which `mach bootstrap` or
# `mach artifact toolchain` installs clang.
mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
os.path.expanduser(os.path.join('~', '.mozbuild')))
bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
result.append(bootstrap_clang_path)
bootstrapped = []
bootstrap_cbindgen_path = os.path.join(mozbuild_state_dir, 'cbindgen')
result.append(bootstrap_cbindgen_path)
bootstrap_clang_path = os.path.join(mozbuild_state_path, 'clang', 'bin')
bootstrapped.append(bootstrap_clang_path)
bootstrap_nasm_path = os.path.join(mozbuild_state_dir, 'nasm')
result.append(bootstrap_nasm_path)
bootstrap_cbindgen_path = os.path.join(mozbuild_state_path, 'cbindgen')
bootstrapped.append(bootstrap_cbindgen_path)
bootstrap_nasm_path = os.path.join(mozbuild_state_path, 'nasm')
bootstrapped.append(bootstrap_nasm_path)
# Also add the rustup install directory for cargo/rustc.
rustup_path = os.path.expanduser(os.path.join('~', '.cargo', 'bin'))
result.append(rustup_path)
return result
if developer_options:
return bootstrapped + result
return result + bootstrapped
return toolchain_search_path
@ -790,10 +793,9 @@ def default_c_compilers(host_or_target, other_c_compiler=None):
other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
@depends(host_or_target, target, toolchain_prefix, android_clang_compiler,
*other_c_compiler)
@depends(host_or_target, target, toolchain_prefix, *other_c_compiler)
def default_c_compilers(host_or_target, target, toolchain_prefix,
android_clang_compiler, *other_c_compiler):
*other_c_compiler):
if host_or_target.kernel == 'WINNT':
supported = types = ('clang-cl', 'gcc', 'clang')
elif host_or_target.kernel == 'Darwin':
@ -816,10 +818,6 @@ def default_c_compilers(host_or_target, other_c_compiler=None):
# -m32/-m64 for the host, it's probably toolchain-prefixed,
# so we prioritize a raw 'gcc' instead.
prioritized = info.type
elif info.type == 'clang' and android_clang_compiler:
# Android NDK clangs do not function as host compiler, so
# prioritize a raw 'clang' instead.
prioritized = info.type
types = [prioritized] + [t for t in types if t != info.type]
@ -829,12 +827,7 @@ def default_c_compilers(host_or_target, other_c_compiler=None):
result = []
for type in types:
# Android sets toolchain_prefix and android_clang_compiler, but
# we want the latter to take precedence, because the latter can
# point at clang, which is what we want to use.
if type == 'clang' and android_clang_compiler and host_or_target is target:
result.append(android_clang_compiler)
elif type == 'gcc':
if type == 'gcc':
result.extend(gcc)
else:
result.append(type)
@ -1387,75 +1380,31 @@ set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes)
set_config('VISIBILITY_FLAGS', visibility_flags)
@depends(c_compiler)
def depend_cflags(info):
if info.type != 'clang-cl':
return ['-MD', '-MP', '-MF $(MDDEPDIR)/$(@F).pp']
else:
# clang-cl doesn't accept the normal -MD -MP -MF options that clang
# does, but the underlying cc1 binary understands how to generate
# dependency files. These options are based on analyzing what the
# normal clang driver sends to cc1 when given the "correct"
# dependency options.
return [
'-Xclang', '-MP',
'-Xclang', '-dependency-file',
'-Xclang', '$(MDDEPDIR)/$(@F).pp',
'-Xclang', '-MT',
'-Xclang', '$@'
]
set_config('_DEPEND_CFLAGS', depend_cflags)
@depends(c_compiler, check_build_environment, target)
@imports('multiprocessing')
@imports(_from='__builtin__', _import='min')
def pgo_flags(compiler, build_env, target):
topobjdir = build_env.topobjdir
if topobjdir.endswith('/js/src'):
topobjdir = topobjdir[:-7]
if compiler.type == 'gcc':
return namespace(
gen_cflags=['-fprofile-generate'],
gen_ldflags=['-fprofile-generate'],
use_cflags=['-fprofile-use', '-fprofile-correction',
'-Wcoverage-mismatch'],
use_ldflags=['-fprofile-use'],
)
if compiler.type in ('clang-cl', 'clang'):
profdata = os.path.join(topobjdir, 'merged.profdata')
prefix = ''
if compiler.type == 'clang-cl':
prefix = '/clang:'
if target.cpu == 'x86_64':
gen_ldflags = ['clang_rt.profile-x86_64.lib']
elif target.cpu == 'x86':
gen_ldflags = ['clang_rt.profile-i386.lib']
else:
gen_ldflags = None
@template
def depend_cflags(host_or_target_c_compiler):
@depends(host_or_target_c_compiler)
def depend_cflags(host_or_target_c_compiler):
if host_or_target_c_compiler.type != 'clang-cl':
return ['-MD', '-MP', '-MF $(MDDEPDIR)/$(@F).pp']
else:
gen_ldflags = ['-fprofile-generate']
# clang-cl doesn't accept the normal -MD -MP -MF options that clang
# does, but the underlying cc1 binary understands how to generate
# dependency files. These options are based on analyzing what the
# normal clang driver sends to cc1 when given the "correct"
# dependency options.
return [
'-Xclang', '-MP',
'-Xclang', '-dependency-file',
'-Xclang', '$(MDDEPDIR)/$(@F).pp',
'-Xclang', '-MT',
'-Xclang', '$@'
]
if gen_ldflags:
return namespace(
gen_cflags=[prefix + '-fprofile-generate'],
gen_ldflags=gen_ldflags,
use_cflags=[prefix + '-fprofile-use=%s' % profdata,
# Some error messages about mismatched profile data
# come in via -Wbackend-plugin, so disable those too.
'-Wno-error=backend-plugin'],
use_ldflags=[],
)
return depend_cflags
set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags)
set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags)
set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)
set_config('_DEPEND_CFLAGS', depend_cflags(c_compiler))
set_config('_HOST_DEPEND_CFLAGS', depend_cflags(host_c_compiler))
@depends(c_compiler)
@ -1481,133 +1430,6 @@ def is_windows(target, host):
include('windows.configure', when=is_windows)
# PGO
# ==============================================================
llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
allow_missing=True,
paths=toolchain_search_path)
js_option('--enable-profile-generate',
help='Build a PGO instrumented binary')
imply_option('MOZ_PGO',
depends_if('--enable-profile-generate')(lambda _: True))
set_config('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))
js_option('--enable-profile-use',
help='Use a generated profile during the build')
js_option('--with-pgo-profile-path',
help='Path to the directory with unmerged profile data to use during the build',
nargs=1)
imply_option('MOZ_PGO',
depends_if('--enable-profile-use')(lambda _: True))
set_config('MOZ_PROFILE_USE',
depends_if('--enable-profile-use')(lambda _: True))
@depends('--with-pgo-profile-path', '--enable-profile-use', llvm_profdata)
@imports('os')
def pgo_profile_path(path, pgo_use, profdata):
if not path:
return
if path and not pgo_use:
die('Pass --enable-profile-use to use --with-pgo-profile-path.')
if path and not profdata:
die('LLVM_PROFDATA must be set to process the pgo profile.')
if not os.path.isdir(path[0]):
die('Argument to --with-pgo-profile-path must be a directory.')
if not os.path.isabs(path[0]):
die('Argument to --with-pgo-profile-path must be an absolute path.')
return path[0]
set_config('PGO_PROFILE_PATH', pgo_profile_path)
option('--with-pgo-jarlog',
help='Use the provided jarlog file when packaging during a profile-use '
'build',
nargs=1)
set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p))
# LTO
# ==============================================================
js_option('--enable-lto',
env='MOZ_LTO',
nargs='?',
choices=('full', 'thin', 'cross'),
help='Enable LTO')
@depends('--enable-lto', 'MOZ_PGO', '--enable-profile-generate', c_compiler)
@imports('multiprocessing')
def lto(value, pgo, profile_generate, c_compiler):
cflags = []
ldflags = []
enabled = None
rust_lto = False
# MSVC's implementation of PGO implies LTO. Make clang-cl match this.
if c_compiler.type == 'clang-cl' and pgo and not profile_generate and value.origin == 'default':
value = ['thin']
if value:
enabled = True
# `cross` implies `thin`, but with Rust code participating in LTO
# as well. Make that a little more explicit.
if len(value) and value[0].lower() == 'cross':
if c_compiler.type == 'gcc':
die('Cross-language LTO is not supported with GCC.')
rust_lto = True
value = ['thin']
if c_compiler.type == 'clang':
if len(value) and value[0].lower() == 'full':
cflags.append("-flto")
ldflags.append("-flto")
else:
cflags.append("-flto=thin")
ldflags.append("-flto=thin")
elif c_compiler.type == 'clang-cl':
if len(value) and value[0].lower() == 'full':
cflags.append("-flto")
else:
cflags.append("-flto=thin")
# With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
# AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
cflags.append("-fuse-ld=lld");
else:
num_cores = multiprocessing.cpu_count()
cflags.append("-flto")
cflags.append("-flifetime-dse=1")
ldflags.append("-flto=%s" % num_cores)
ldflags.append("-flifetime-dse=1")
return namespace(
enabled=enabled,
cflags=cflags,
ldflags=ldflags,
rust_lto=rust_lto,
)
add_old_configure_assignment('MOZ_LTO', lto.enabled)
set_config('MOZ_LTO', lto.enabled)
set_define('MOZ_LTO', lto.enabled)
set_config('MOZ_LTO_CFLAGS', lto.cflags)
set_config('MOZ_LTO_LDFLAGS', lto.ldflags)
set_config('MOZ_LTO_RUST', lto.rust_lto)
add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags)
add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags)
# ASAN
# ==============================================================
@ -1621,6 +1443,32 @@ def asan():
add_old_configure_assignment('MOZ_ASAN', asan)
# MSAN
# ==============================================================
js_option('--enable-memory-sanitizer', help='Enable Memory Sanitizer')
@depends(when='--enable-memory-sanitizer')
def msan():
return True
add_old_configure_assignment('MOZ_MSAN', msan)
# TSAN
# ==============================================================
js_option('--enable-thread-sanitizer', help='Enable Thread Sanitizer')
@depends(when='--enable-thread-sanitizer')
def tsan():
return True
add_old_configure_assignment('MOZ_TSAN', tsan)
# UBSAN
# ==============================================================
@ -1642,6 +1490,30 @@ def ubsan(options):
add_old_configure_assignment('MOZ_UBSAN_CHECKS', ubsan)
js_option('--enable-signed-overflow-sanitizer',
help='Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)')
@depends(when='--enable-signed-overflow-sanitizer')
def ub_signed_overflow_san():
return True
add_old_configure_assignment('MOZ_SIGNED_OVERFLOW_SANITIZE', ub_signed_overflow_san)
js_option('--enable-unsigned-overflow-sanitizer',
help='Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)')
@depends(when='--enable-unsigned-overflow-sanitizer')
def ub_unsigned_overflow_san():
return True
add_old_configure_assignment('MOZ_UNSIGNED_OVERFLOW_SANITIZE', ub_unsigned_overflow_san)
# Security Hardening
# ==============================================================
@ -1704,9 +1576,10 @@ def security_hardening_cflags(hardening_flag, asan, optimize, c_compiler, target
js_ldflags.append("-Wl,--dynamicbase")
# Control Flow Guard (CFG) ----------------------------
# See Bug 1525588 for why this doesn't work on Windows ARM
# On aarch64, this is enabled only with explicit --enable-hardening
# (roughly: automation) due to a dependency on a patched clang-cl.
if c_compiler.type == 'clang-cl' and c_compiler.version >= '8' and \
target.cpu != 'aarch64':
(target.cpu != 'aarch64' or hardening_flag):
flags.append("-guard:cf")
js_flags.append("-guard:cf")
# nolongjmp is needed because clang doesn't emit the CFG tables of
@ -1741,6 +1614,44 @@ add_old_configure_assignment('MOZ_HARDENING_LDFLAGS', security_hardening_cflags.
add_old_configure_assignment('MOZ_HARDENING_CFLAGS_JS', security_hardening_cflags.js_flags)
add_old_configure_assignment('MOZ_HARDENING_LDFLAGS_JS', security_hardening_cflags.js_ldflags)
# Frame pointers
# ==============================================================
@depends(c_compiler)
def frame_pointer_flags(compiler):
if compiler.type == 'clang-cl':
return namespace(
enable=['-Oy-'],
disable=['-Oy'],
)
return namespace(
enable=['-fno-omit-frame-pointer', '-funwind-tables'],
disable=['-fomit-frame-pointer', '-funwind-tables'],
)
@depends(moz_optimize.optimize, moz_debug, target,
'--enable-memory-sanitizer', '--enable-address-sanitizer',
'--enable-undefined-sanitizer')
def frame_pointer_default(optimize, debug, target, msan, asan, ubsan):
return bool(not optimize or debug or msan or asan or ubsan or \
(target.os == 'WINNT' and target.cpu in ('x86', 'aarch64')))
js_option('--enable-frame-pointers', default=frame_pointer_default,
help='{Enable|Disable} frame pointers')
@depends('--enable-frame-pointers', frame_pointer_flags)
def frame_pointer_flags(enable, flags):
if enable:
return flags.enable
return flags.disable
set_config('MOZ_FRAMEPTR_FLAGS', frame_pointer_flags)
# nasm detection
# ==============================================================
nasm = check_prog('NASM', ['nasm'], allow_missing=True, paths=toolchain_search_path)
@ -1903,8 +1814,8 @@ def rustc_opt_level(opt_level_option, moz_optimize):
return '1' if moz_optimize.optimize else '0'
@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols')
def rust_compile_flags(opt_level, debug_rust, debug_symbols):
@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols', '--enable-frame-pointers')
def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers):
# Cargo currently supports only two interesting profiles for building:
# development and release. Those map (roughly) to --enable-debug and
# --disable-debug in Gecko, respectively.
@ -1937,6 +1848,8 @@ def rust_compile_flags(opt_level, debug_rust, debug_symbols):
('yes' if debug_assertions else 'no'))
if debug_info is not None:
opts.append('debuginfo=%s' % debug_info)
if frame_pointers:
opts.append('force-frame-pointers=yes')
flags = []
for opt in opts:
@ -2098,10 +2011,10 @@ def select_linker(linker, c_compiler, developer_options, enable_gold,
die("Failed to find a linker")
if (linker is None and enable_gold.origin == 'default' and
developer_options and result.KIND == 'bfd'):
developer_options and result.KIND in ('bfd', 'gold')):
# try and use lld if available.
tried = try_linker('lld')
if tried is None or tried.KIND != 'lld':
if result.KIND != 'gold' and (tried is None or tried.KIND != 'lld'):
tried = try_linker('gold')
if tried is None or tried.KIND != 'gold':
tried = None

View File

@ -7,6 +7,7 @@ export MAKECAB=$TOOLTOOL_DIR/makecab.exe
if [ -z "$USE_ARTIFACT" ]; then
if [ -n "$MOZ_PGO_PROFILE_USE" ]; then
export MOZ_LTO=cross
ac_add_options --enable-profile-use
ac_add_options --with-pgo-jarlog="${WORKSPACE}/fetches/en-US.log"
ac_add_options --with-pgo-profile-path="${WORKSPACE}/fetches"

View File

@ -63,13 +63,18 @@ if __name__ == '__main__':
for path in prefpaths:
prefs.update(Preferences.read_prefs(path))
interpolation = {"server": "%s:%d" % httpd.httpd.server_address,
"OOP": "false"}
interpolation = {"server": "%s:%d" % httpd.httpd.server_address}
for k, v in prefs.items():
if isinstance(v, string_types):
v = v.format(**interpolation)
prefs[k] = Preferences.cast(v)
# Enforce e10s. This isn't in one of the user.js files because those
# are shared with android, which doesn't want this on. We can't
# interpolate because the formatting code only works for strings,
# and this is a bool pref.
prefs["browser.tabs.remote.autostart"] = True
profile = FirefoxProfile(profile=profilePath,
preferences=prefs,
addons=[os.path.join(
@ -80,10 +85,12 @@ if __name__ == '__main__':
env = os.environ.copy()
env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
env["XPCOM_DEBUG_BREAK"] = "warn"
# TODO should use e10s and gather data from all processes (bug 1196094).
# Note that unittest-required/user.js sets the autostart pref, but it
# is ignored by the code in nsAppRunner.
env["MOZ_FORCE_DISABLE_E10S"] = "1"
# We disable sandboxing to make writing profiling data actually work
# Bug 1553850 considers fixing this.
env["MOZ_DISABLE_CONTENT_SANDBOX"] = "1"
# Ensure different pids write to different files
env["LLVM_PROFILE_FILE"] = "default_%p_random_%m.profraw"
# For VC12+, make sure we can find the right bitness of pgort1x0.dll
if not substs.get('HAVE_64BIT_BUILD'):

View File

@ -26,9 +26,9 @@ else
if [ -n "$MOZ_PGO" ]; then
if [ -z "$USE_ARTIFACT" ]; then
export MOZ_LTO=1
export MOZ_LTO=cross
if [ -n "$MOZ_PGO_PROFILE_USE" ]; then
ac_add_options --enable-profile-use
ac_add_options --enable-profile-use=cross
ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches
fi

View File

@ -42,7 +42,30 @@ endif # WINNT
ifndef INCLUDED_AUTOCONF_MK
default::
else
TIERS := $(if $(MOZ_ARTIFACT_BUILDS),artifact )$(if $(MOZ_EME_WIN32_ARTIFACT),win32-artifact )pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools$(if $(filter check recurse_check,$(MAKECMDGOALS)), check)
# All possible tiers
ALL_TIERS := artifact win32-artifact android-fat-aar-artifact pre-export export rust compile misc libs tools check
# All tiers that may be used manually via `mach build $tier`
RUNNABLE_TIERS := $(ALL_TIERS)
ifndef MOZ_ARTIFACT_BUILDS
RUNNABLE_TIERS := $(filter-out artifact,$(RUNNABLE_TIERS))
endif
ifndef MOZ_EME_WIN32_ARTIFACT
RUNNABLE_TIERS := $(filter-out win32-artifact,$(RUNNABLE_TIERS))
endif
ifndef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
RUNNABLE_TIERS := $(filter-out android-fat-aar-artifact,$(RUNNABLE_TIERS))
endif
# All tiers that run automatically on `mach build`
TIERS := $(filter-out check,$(RUNNABLE_TIERS))
ifndef COMPILE_ENVIRONMENT
TIERS := $(filter-out rust compile,$(TIERS))
endif
ifndef MOZ_RUST_TIER
TIERS := $(filter-out rust,$(TIERS))
endif
endif
# These defines are used to support the twin-topsrcdir model for comm-central.

View File

@ -133,6 +133,7 @@ endif
# Enable profile-based feedback
ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
ifdef MOZ_PROFILE_GENERATE
PGO_CFLAGS += -DNS_FREE_PERMANENT_DATA=1
PGO_CFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_GEN_CFLAGS))
PGO_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
ifeq (WINNT,$(OS_ARCH))
@ -189,8 +190,8 @@ COMPILE_CMMFLAGS = $(MOZ_LTO_CFLAGS) $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
ASFLAGS = $(COMPUTED_ASFLAGS)
SFLAGS = $(COMPUTED_SFLAGS)
HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_DEPEND_CFLAGS)
HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_DEPEND_CFLAGS)
HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_HOST_DEPEND_CFLAGS)
HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_HOST_DEPEND_CFLAGS)
HOST_C_LDFLAGS = $(COMPUTED_HOST_C_LDFLAGS)
HOST_CXX_LDFLAGS = $(COMPUTED_HOST_CXX_LDFLAGS)

View File

@ -46,8 +46,11 @@ endif
cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
ifndef DEVELOPER_OPTIONS
ifndef MOZ_DEBUG_RUST
# Enable link-time optimization for release builds.
cargo_rustc_flags += -C lto
# Enable link-time optimization for release builds, but not when linking
# gkrust_gtest.
ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
cargo_rustc_flags += -Clto
endif
# Versions of rust >= 1.45 need -Cembed-bitcode=yes for all crates when
# using -Clto.
ifeq (,$(filter 1.22.% 1.23.% 1.24.% 1.25.% 1.26.% 1.27.% 1.28.% 1.29.% 1.30.% 1.31.% 1.32.% 1.33.% 1.34.% 1.35.% 1.36.% 1.37.% 1.38.% 1.39.% 1.40.% 1.41.% 1.42.% 1.43.% 1.44.%,$(RUSTC_VERSION)))
@ -129,6 +132,7 @@ export MOZ_SRC=$(topsrcdir)
export MOZ_DIST=$(ABS_DIST)
export LIBCLANG_PATH=$(MOZ_LIBCLANG_PATH)
export CLANG_PATH=$(MOZ_CLANG_PATH)
export PKG_CONFIG
export PKG_CONFIG_ALLOW_CROSS=1
export RUST_BACKTRACE=full
export MOZ_TOPOBJDIR=$(topobjdir)
@ -136,7 +140,11 @@ export MOZ_TOPOBJDIR=$(topobjdir)
target_rust_ltoable := force-cargo-library-build
target_rust_nonltoable := force-cargo-test-run force-cargo-library-check $(foreach b,build check,force-cargo-program-$(b))
$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST),-Clinker-plugin-lto)
ifdef MOZ_PGO_RUST
rust_pgo_flags := $(if $(MOZ_PROFILE_GENERATE),-C profile-generate=$(topobjdir)) $(if $(MOZ_PROFILE_USE),-C profile-use=$(topobjdir)/merged.profdata)
endif
$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST),-Clinker-plugin-lto) $(rust_pgo_flags)
$(target_rust_nonltoable): RUSTFLAGS:=$(rustflags_override) $(RUSTFLAGS)
TARGET_RECIPES := $(target_rust_ltoable) $(target_rust_nonltoable)
@ -248,9 +256,10 @@ $(RUST_LIBRARY_FILE): force-cargo-library-build
# When we are building in --enable-release mode; we add an additional check to confirm
# that we are not importing any networking-related functions in rust code. This reduces
# the chance of proxy bypasses originating from rust code.
ifndef DEVELOPER_OPTIONS
ifndef MOZ_DEBUG_RUST
# The check only works when rust code is built with -Clto.
ifndef MOZ_PROFILE_GENERATE
ifeq ($(OS_ARCH), Linux)
ifneq (,$(filter -Clto,$(cargo_rustc_flags)))
$(call py_action,check_binary,--target --networking $@)
endif
endif
@ -302,9 +311,9 @@ ifdef RUST_PROGRAMS
GARBAGE_DIRS += $(RUST_TARGET)
force-cargo-program-build:
force-cargo-program-build: $(RESFILE)
$(REPORT_BUILD)
$(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag)
$(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag) -- $(if $(RESFILE),-C link-arg=$(CURDIR)/$(RESFILE))
$(RUST_PROGRAMS): force-cargo-program-build

View File

@ -28,7 +28,7 @@ include root.mk
# Main rules (export, compile, libs and tools) call recurse_* rules.
# This wrapping is only really useful for build status.
$(TIERS)::
$(RUNNABLE_TIERS)::
$(if $(filter $@,$(MAKECMDGOALS)),$(call BUILDSTATUS,TIERS $@),)
$(call BUILDSTATUS,TIER_START $@)
+$(MAKE) recurse_$@
@ -41,7 +41,7 @@ binaries::
# Carefully avoid $(eval) type of rule generation, which makes pymake slower
# than necessary.
# Get current tier and corresponding subtiers from the data in root.mk.
CURRENT_TIER := $(filter $(foreach tier,$(TIERS) $(non_default_tiers),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
CURRENT_TIER := $(filter $(foreach tier,$(RUNNABLE_TIERS) $(non_default_tiers),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
$(error $(CURRENT_TIER) not supported on the same make command line)
endif
@ -129,7 +129,7 @@ else
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
$(TIERS)::
$(RUNNABLE_TIERS)::
else
#########################
@ -144,7 +144,7 @@ $(1):: $$(SUBMAKEFILES)
endef
$(foreach subtier,$(filter-out compile,$(TIERS)),$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
$(foreach subtier,$(filter-out compile,$(RUNNABLE_TIERS)),$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
ifndef TOPLEVEL_BUILD
ifdef COMPILE_ENVIRONMENT
@ -198,11 +198,29 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
toolkit/library/target: widget/gtk/mozgtk/gtk3/target
endif
ifdef MOZ_LDAP_XPCOM
ldap/target: security/target mozglue/build/target
toolkit/library/target: ldap/target
endif
endif
# Most things are built during compile (target/host), but some things happen during export
# Those need to depend on config/export for system wrappers.
$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
# Rust targets, and export targets that run cbindgen need
# $topobjdir/.cargo/config to be preprocessed first. Ideally, we'd only set it
# as a dependency of the rust targets, but unfortunately, that pushes Make to
# execute them much later than we'd like them to be when the file doesn't exist
# prior to Make running. So we also set it as a dependency of pre-export, which
# ensures it exists before recursing the rust targets and the export targets
# that run cbindgen, tricking Make into keeping them early.
$(rust_targets) gfx/webrender_bindings/export layout/style/export xpcom/base/export: $(DEPTH)/.cargo/config
ifndef TEST_MOZBUILD
pre-export:: $(DEPTH)/.cargo/config
endif
# When building gtest as part of the build (LINK_GTEST_DURING_COMPILE),
# force the build system to get to it first, so that it can be linked
# quickly without LTO, allowing the build system to go ahead with
# plain gkrust and libxul while libxul-gtest is being linked and
# dump-sym'ed.
ifneq (,$(filter toolkit/library/gtest/rust/target,$(compile_targets)))
toolkit/library/rust/target: toolkit/library/gtest/rust/target
endif
endif

View File

@ -40,8 +40,6 @@ endif
EXEC = exec
_VPATH_SRCS = $(abspath $<)
################################################################################
# Testing frameworks support
################################################################################
@ -310,24 +308,6 @@ EXTRA_DSO_LDOPTS += -dynamiclib -install_name $(_LOADER_PATH)/$(SHARED_LIBRARY)
endif
endif
ifdef SYMBOLS_FILE
ifeq ($(OS_TARGET),WINNT)
ifndef GNU_CC
EXTRA_DSO_LDOPTS += -DEF:$(call normalizepath,$(SYMBOLS_FILE))
else
EXTRA_DSO_LDOPTS += $(call normalizepath,$(SYMBOLS_FILE))
endif
else
ifdef GCC_USE_GNU_LD
EXTRA_DSO_LDOPTS += -Wl,--version-script,$(SYMBOLS_FILE)
else
ifeq ($(OS_TARGET),Darwin)
EXTRA_DSO_LDOPTS += -Wl,-exported_symbols_list,$(SYMBOLS_FILE)
endif
endif
endif
EXTRA_DEPS += $(SYMBOLS_FILE)
endif
#
# GNU doesn't have path length limitation
#
@ -719,11 +699,8 @@ $(foreach f,$(HOST_CSRCS) $(HOST_CPPSRCS) $(HOST_CMSRCS) $(HOST_CMMSRCS),$(eval
# The Rust compiler only outputs library objects, and so we need different
# mangling to generate dependency rules for it.
mk_libname = $(basename lib$(notdir $1)).rlib
src_libdep = $(call mk_libname,$1): $1 $$(call mkdir_deps,$$(MDDEPDIR))
mk_global_crate_libname = $(basename lib$(notdir $1)).$(LIB_SUFFIX)
crate_src_libdep = $(call mk_global_crate_libname,$1): $1 $$(call mkdir_deps,$$(MDDEPDIR))
$(foreach f,$(RSSRCS),$(eval $(call src_libdep,$(f))))
$(foreach f,$(RS_STATICLIB_CRATE_SRC),$(eval $(call crate_src_libdep,$(f))))
$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
@ -731,46 +708,31 @@ $(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
# Rules for building native targets must come first because of the host_ prefix
$(HOST_COBJS):
$(REPORT_BUILD_VERBOSE)
$(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(NSPR_CFLAGS) $<
$(HOST_CPPOBJS):
$(REPORT_BUILD_VERBOSE)
$(call BUILDSTATUS,OBJECT_FILE $@)
$(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(NSPR_CFLAGS) $<
$(HOST_CMOBJS):
$(REPORT_BUILD_VERBOSE)
$(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(HOST_CMFLAGS) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(HOST_CMFLAGS) $(NSPR_CFLAGS) $<
$(HOST_CMMOBJS):
$(REPORT_BUILD_VERBOSE)
$(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(NSPR_CFLAGS) $<
$(COBJS):
$(REPORT_BUILD_VERBOSE)
$(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
# 'moc' only knows about #defines it gets on the command line (-D...), not in
# included headers like mozilla-config.h
$(filter moc_%.cpp,$(CPPSRCS)): moc_%.cpp: %.h
$(REPORT_BUILD_VERBOSE)
$(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
$(filter moc_%.cc,$(CPPSRCS)): moc_%.cc: %.cc
$(REPORT_BUILD_VERBOSE)
$(MOC) $(DEFINES) $(ACDEFINES) $(_VPATH_SRCS:.cc=.h) $(OUTOPTION)$@
$(filter qrc_%.cpp,$(CPPSRCS)): qrc_%.cpp: %.qrc
$(REPORT_BUILD_VERBOSE)
$(RCC) -name $* $< $(OUTOPTION)$@
$(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $<
ifdef ASFILES
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
# a '-c' flag.
$(ASOBJS):
$(REPORT_BUILD_VERBOSE)
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(AS_DASH_C_FLAG) $<
endif
define syms_template
@ -821,31 +783,31 @@ $(SOBJS):
$(CPPOBJS):
$(REPORT_BUILD_VERBOSE)
$(call BUILDSTATUS,OBJECT_FILE $@)
$(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(CMMOBJS):
$(REPORT_BUILD_VERBOSE)
$(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $<
$(CMOBJS):
$(REPORT_BUILD_VERBOSE)
$(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $<
$(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))
$(REPORT_BUILD_VERBOSE)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(filter %.s,$(CPPSRCS:%.cc=%.s)): %.s: %.cc $(call mkdir_deps,$(MDDEPDIR))
$(REPORT_BUILD_VERBOSE)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(filter %.s,$(CPPSRCS:%.cxx=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))
$(REPORT_BUILD_VERBOSE)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(filter %.s,$(CSRCS:%.c=%.s)): %.s: %.c $(call mkdir_deps,$(MDDEPDIR))
$(REPORT_BUILD_VERBOSE)
$(CC) -S $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CC) -S $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $<
ifneq (,$(filter %.i,$(MAKECMDGOALS)))
# Call as $(call _group_srcs,extension,$(SRCS)) - this will create a list
@ -872,7 +834,7 @@ $$(_PREPROCESSED_$1_FILES): _DEPEND_CFLAGS=
$$(_PREPROCESSED_$1_FILES): %.i: %.$1
$$(REPORT_BUILD_VERBOSE)
$$(addprefix $$(MKDIR) -p ,$$(filter-out .,$$(@D)))
$$($3) -C $$(PREPROCESS_OPTION)$$@ $(foreach var,$4,$$($(var))) $$($$(notdir $$<)_FLAGS) $$(_VPATH_SRCS)
$$($3) -C $$(PREPROCESS_OPTION)$$@ $(foreach var,$4,$$($(var))) $$($$(notdir $$<)_FLAGS) $$<
endef
@ -934,13 +896,13 @@ endif
endif
$(RESFILE): %.res: %.rc
$(RESFILE): %.res: $(RCFILE)
$(REPORT_BUILD)
@echo Creating Resource file: $@
ifdef GNU_CC
$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $<
else
$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $<
endif
# Cancel GNU make built-in implicit rules
@ -955,21 +917,6 @@ endif
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
# MSYS has its own special path form, but javac expects the source and class
# paths to be in the DOS form (i.e. e:/builds/...). This function does the
# appropriate conversion on Windows, but is a noop on other systems.
ifeq ($(HOST_OS_ARCH),WINNT)
# We use 'pwd -W' to get DOS form of the path. However, since the given path
# could be a file or a non-existent path, we cannot call 'pwd -W' directly
# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
# on it, then merge with the rest of the path.
root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\1|')
non-root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\2|')
normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
else
normalizepath = $(1)
endif
###############################################################################
# Bunch of things that extend the 'export' rule (in order):
###############################################################################

View File

@ -34,7 +34,7 @@ endif
endif
endif
ifdef RCINCLUDE
_RC_STRING += -RCINCLUDE $(srcdir)/$(RCINCLUDE)
_RC_STRING += -RCINCLUDE $(RCINCLUDE)
endif
GARBAGE += $(RESFILE) $(RCFILE)

View File

@ -467,7 +467,7 @@ void nsLineBreaker::UpdateCurrentWordLanguage(nsAtom* aHyphenationLanguage) {
if (loc.GetScript().IsEmpty()) {
loc.AddLikelySubtags();
}
const nsCString& script = loc.GetScript();
const nsDependentCSubstring& script = loc.GetScript();
mScriptIsChineseOrJapanese =
script.EqualsLiteral("Hans") || script.EqualsLiteral("Hant") ||
script.EqualsLiteral("Jpan") || script.EqualsLiteral("Hrkt");

View File

@ -6,6 +6,15 @@ webidl_base := $(topsrcdir)/dom/webidl
ifdef COMPILE_ENVIRONMENT
# Akin to GLOBAL_DEPS, but set early enough that webidlsrcs.mk
# can make use of them as dependencies.
WEBIDL_PP_DEPS := \
backend.mk \
Makefile \
$(DEPTH)/config/autoconf.mk \
$(topsrcdir)/config/config.mk \
$(NULL)
# Generated by moz.build
include webidlsrcs.mk

View File

@ -146,14 +146,14 @@ add_task(async function test() {
let results = await ChromeUtils.requestPerformanceMetrics();
exploreResults(results);
Assert.ok(workerDuration > 0, "Worker duration should be positive");
Assert.ok(workerTotal > 0, "Worker count should be positive");
Assert.ok(duration > 0, "Duration should be positive");
Assert.ok(total > 0, "Should get a positive count");
Assert.greater(workerDuration, 0, "Worker duration should be positive");
Assert.greater(workerTotal, 0, "Worker count should be positive");
Assert.greater(duration, 0, "Duration should be positive");
Assert.greater(total, 0, "Should get a positive count");
Assert.ok(parentProcessEvent, "parent process sent back some events");
Assert.ok(isTopLevel, "example.com as a top level window");
Assert.ok(aboutMemoryFound, "about:memory");
Assert.ok(heapUsage > 0, "got some memory value reported");
Assert.greater(heapUsage, 0, "got some memory value reported");
Assert.ok(sharedWorker, "We got some info from a shared worker");
let numCounters = counterIds.length;
Assert.ok(
@ -183,8 +183,8 @@ add_task(async function test() {
workerTotal > previousWorkerTotal,
"Worker count should be positive"
);
Assert.ok(duration > previousDuration, "Duration should be positive");
Assert.ok(total > previousTotal, "Should get a positive count");
Assert.greater(duration, previousDuration, "Duration should be positive");
Assert.greater(total, previousTotal, "Should get a positive count");
// load a tab with a setInterval, we should get counters on TaskCategory::Timer
await BrowserTestUtils.withNewTab(
@ -194,7 +194,7 @@ add_task(async function test() {
let previousTimerCalls = timerCalls;
results = await ChromeUtils.requestPerformanceMetrics();
exploreResults(results, tabId);
Assert.ok(timerCalls > previousTimerCalls, "Got timer calls");
Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
}
);
@ -206,7 +206,7 @@ add_task(async function test() {
let previousTimerCalls = timerCalls;
results = await ChromeUtils.requestPerformanceMetrics();
exploreResults(results, tabId);
Assert.ok(timerCalls > previousTimerCalls, "Got timer calls");
Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
}
);
@ -217,7 +217,7 @@ add_task(async function test() {
let tabId = gBrowser.selectedBrowser.outerWindowID;
results = await ChromeUtils.requestPerformanceMetrics();
exploreResults(results, tabId);
Assert.ok(mediaMemory > 0, "Got some memory used for media");
Assert.greater(mediaMemory, 0, "Got some memory used for media");
}
);
}

View File

@ -38,8 +38,9 @@ class gfxVarReceiver;
_(DXP016Blocked, bool, false) \
_(UseWebRender, bool, false) \
_(UseWebRenderANGLE, bool, false) \
_(UseWebRenderFlipSequentialWin, bool, false) \
_(UseWebRenderDCompWin, bool, false) \
_(UseWebRenderDCompWinTripleBuffering, bool, false) \
_(UseWebRenderTripleBufferingWin, bool, false) \
_(UseWebRenderProgramBinaryDisk, bool, false) \
_(WebRenderDebugFlags, int32_t, 0) \
_(ScreenDepth, int32_t, 0) \
@ -48,7 +49,9 @@ class gfxVarReceiver;
_(UseOMTP, bool, false) \
_(AllowD3D11KeyedMutex, bool, false) \
_(SystemTextQuality, int32_t, 5 /* CLEARTYPE_QUALITY */) \
_(LayersWindowRecordingPath, nsCString, nsCString())
_(LayersWindowRecordingPath, nsCString, nsCString()) \
_(UseDoubleBufferingWithCompositor, bool, false) \
_(UseGLSwizzle, bool, true)
/* Add new entries above this line. */

View File

@ -160,9 +160,7 @@ static EGLDisplay GetAndInitWARPDisplay(GLLibraryEGL& egl, void* displayType) {
static EGLDisplay GetAndInitDisplayForWebRender(GLLibraryEGL& egl,
void* displayType) {
#ifdef XP_WIN
const EGLint attrib_list[] = {LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE,
LOCAL_EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE,
LOCAL_EGL_NONE};
const EGLint attrib_list[] = {LOCAL_EGL_NONE};
RefPtr<ID3D11Device> d3d11Device =
gfx::DeviceManagerDx::Get()->GetCompositorDevice();
if (!d3d11Device) {

View File

@ -255,8 +255,7 @@ mozilla::ipc::IPCResult GPUParent::RecvInit(
}
#ifdef XP_WIN
else {
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
IsWin10OrLater()) {
if (gfxVars::UseDoubleBufferingWithCompositor()) {
// This is needed to avoid freezing the window on a device crash on double
// buffering, see bug 1549674.
widget::WinCompositorWindowThread::Start();

View File

@ -496,6 +496,11 @@ void GPUProcessManager::OnRemoteProcessDeviceReset(GPUProcessHost* aHost) {
// indicating that we should give up and use software
mDeviceResetCount++;
// Disable double buffering when device reset happens.
if (!gfxVars::UseWebRender() && gfxVars::UseDoubleBufferingWithCompositor()) {
gfxVars::SetUseDoubleBufferingWithCompositor(false);
}
auto newTime = TimeStamp::Now();
auto delta = (int32_t)(newTime - mDeviceResetLastTime).ToMilliseconds();
mDeviceResetLastTime = newTime;

View File

@ -202,8 +202,8 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
(IDXGIFactory2**)getter_AddRefs(dxgiFactory2));
#if (_WIN32_WINDOWS_MAXVER >= 0x0A00)
if (StaticPrefs::gfx_direct3d11_use_double_buffering() && SUCCEEDED(hr) &&
dxgiFactory2 && IsWindows10OrGreater()) {
if (gfxVars::UseDoubleBufferingWithCompositor() && SUCCEEDED(hr) &&
dxgiFactory2) {
// DXGI_SCALING_NONE is not available on Windows 7 with Platform Update.
// This looks awful for things like the awesome bar and browser window
// resizing so we don't use a flip buffer chain here. When using

View File

@ -229,9 +229,9 @@ bool MLGSwapChainD3D11::Initialize(CompositorWidget* aWidget) {
}
RefPtr<IDXGIFactory2> dxgiFactory2;
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
if (gfxVars::UseDoubleBufferingWithCompositor() &&
SUCCEEDED(dxgiFactory->QueryInterface(dxgiFactory2.StartAssignment())) &&
dxgiFactory2 && IsWin10OrLater() && XRE_IsGPUProcess()) {
dxgiFactory2 && XRE_IsGPUProcess()) {
// DXGI_SCALING_NONE is not available on Windows 7 with the Platform Update:
// This looks awful for things like the awesome bar and browser window
// resizing, so we don't use a flip buffer chain here. (Note when using

View File

@ -1576,8 +1576,7 @@ PLayerTransactionParent* CompositorBridgeParent::AllocPLayerTransactionParent(
#ifdef XP_WIN
// This is needed to avoid freezing the window on a device crash on double
// buffering, see bug 1549674.
if (StaticPrefs::gfx_direct3d11_use_double_buffering() && IsWin10OrLater() &&
XRE_IsGPUProcess()) {
if (gfxVars::UseDoubleBufferingWithCompositor() && XRE_IsGPUProcess()) {
mWidget->AsWindows()->EnsureCompositorWindow();
}
#endif
@ -1784,7 +1783,8 @@ PWebRenderBridgeParent* CompositorBridgeParent::AllocPWebRenderBridgeParent(
MOZ_ASSERT(mWidget);
#ifdef XP_WIN
if (mWidget && DeviceManagerDx::Get()->CanUseDComp()) {
if (mWidget && (DeviceManagerDx::Get()->CanUseDComp() ||
gfxVars::UseWebRenderFlipSequentialWin())) {
mWidget->AsWindows()->EnsureCompositorWindow();
}
#endif

View File

@ -536,9 +536,17 @@ void WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) {
// The data we get from webrender is upside down. So flip and translate up so
// the image is rightside up. Webrender always does a full screen readback.
SurfacePattern pattern(
snapshot, ExtendMode::CLAMP,
Matrix::Scaling(1.0, -1.0).PostTranslate(0.0, aSize.height));
#ifdef XP_WIN
// ANGLE with WR does not need y flip
const bool needsYFlip = !WrBridge()->GetCompositorUseANGLE();
#else
const bool needsYFlip = true;
#endif
Matrix m;
if (needsYFlip) {
m = Matrix::Scaling(1.0, -1.0).PostTranslate(0.0, aSize.height);
}
SurfacePattern pattern(snapshot, ExtendMode::CLAMP, m);
DrawTarget* dt = mTarget->GetDrawTarget();
MOZ_RELEASE_ASSERT(dt);
dt->FillRect(dst, pattern);

View File

@ -42,6 +42,12 @@ const char* FeatureStatusToString(FeatureStatus aStatus) {
return "blocked-no-gfx-info";
case FeatureStatus::BlockedOverride:
return "blocked-override";
case FeatureStatus::BlockedReleaseChannelIntel:
return "blocked-release-channel-intel";
case FeatureStatus::BlockedReleaseChannelAMD:
return "blocked-release-channel-amd";
case FeatureStatus::BlockedReleaseChannelBattery:
return "blocked-release-channel-battery";
case FeatureStatus::Blacklisted:
return "blacklisted";
case FeatureStatus::OptIn:

View File

@ -38,6 +38,9 @@ enum class FeatureStatus {
BlockedScreenUnknown,
BlockedNoGfxInfo,
BlockedOverride,
BlockedReleaseChannelIntel,
BlockedReleaseChannelAMD,
BlockedReleaseChannelBattery,
// This feature has been blocked by the graphics blacklist.
Blacklisted,

View File

@ -30,6 +30,7 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/Unused.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Base64.h"
#include "mozilla/Logging.h"
#include "mozilla/Services.h"
@ -467,8 +468,10 @@ gfxPlatform::gfxPlatform()
mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo),
mTilesInfoCollector(this, &gfxPlatform::GetTilesSupportInfo),
mFrameStatsCollector(this, &gfxPlatform::GetFrameStats),
mCMSInfoCollector(this, &gfxPlatform::GetCMSSupportInfo),
mCompositorBackend(layers::LayersBackend::LAYERS_NONE),
mScreenDepth(0) {
mScreenDepth(0),
mScreenPixels(0) {
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
@ -570,6 +573,7 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
GFX_WEBRENDER_DEBUG(".disable-batching", wr::DebugFlags::DISABLE_BATCHING)
GFX_WEBRENDER_DEBUG(".epochs", wr::DebugFlags::EPOCHS)
GFX_WEBRENDER_DEBUG(".compact-profiler", wr::DebugFlags::COMPACT_PROFILER)
GFX_WEBRENDER_DEBUG(".smart-profiler", wr::DebugFlags::SMART_PROFILER)
GFX_WEBRENDER_DEBUG(".echo-driver-messages",
wr::DebugFlags::ECHO_DRIVER_MESSAGES)
GFX_WEBRENDER_DEBUG(".new-frame-indicator",
@ -903,8 +907,6 @@ void gfxPlatform::Init() {
gfxVars::SetProfDirectory(nsString(path));
}
gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
nsAutoCString path;
Preferences::GetCString("layers.windowrecording.path", path);
gfxVars::SetLayersWindowRecordingPath(path);
@ -1110,33 +1112,33 @@ void gfxPlatform::Init() {
}
}
static bool IsFeatureSupported(long aFeature) {
static bool IsFeatureSupported(long aFeature, bool aDefault) {
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString blockId;
int32_t status;
if (!NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, blockId, &status))) {
return true;
return aDefault;
}
return status != nsIGfxInfo::FEATURE_STATUS_OK;
return status == nsIGfxInfo::FEATURE_STATUS_OK;
}
/* static*/
bool gfxPlatform::IsDXInterop2Blocked() {
return IsFeatureSupported(nsIGfxInfo::FEATURE_DX_INTEROP2);
return !IsFeatureSupported(nsIGfxInfo::FEATURE_DX_INTEROP2, false);
}
/* static*/
bool gfxPlatform::IsDXNV12Blocked() {
return IsFeatureSupported(nsIGfxInfo::FEATURE_DX_NV12);
return !IsFeatureSupported(nsIGfxInfo::FEATURE_DX_NV12, false);
}
/* static*/
bool gfxPlatform::IsDXP010Blocked() {
return IsFeatureSupported(nsIGfxInfo::FEATURE_DX_P010);
return !IsFeatureSupported(nsIGfxInfo::FEATURE_DX_P010, false);
}
/* static*/
bool gfxPlatform::IsDXP016Blocked() {
return IsFeatureSupported(nsIGfxInfo::FEATURE_DX_P016);
return !IsFeatureSupported(nsIGfxInfo::FEATURE_DX_P016, false);
}
/* static */
@ -1371,8 +1373,7 @@ void gfxPlatform::WillShutdown() {
#endif
}
gfxPlatform::~gfxPlatform() {
}
gfxPlatform::~gfxPlatform() {}
/* static */
already_AddRefed<DrawTarget> gfxPlatform::CreateDrawTargetForSurface(
@ -1599,6 +1600,8 @@ void gfxPlatform::PopulateScreenInfo() {
do_GetService("@mozilla.org/gfx/screenmanager;1");
MOZ_ASSERT(manager, "failed to get nsIScreenManager");
manager->GetTotalScreenPixels(&mScreenPixels);
nsCOMPtr<nsIScreen> screen;
manager->GetPrimaryScreen(getter_AddRefs(screen));
if (!screen) {
@ -2399,6 +2402,10 @@ void gfxPlatform::InitAcceleration() {
gfxCriticalNote << "Cannot evaluate keyed mutex feature status";
gfxVars::SetAllowD3D11KeyedMutex(true);
}
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
IsWin10OrLater()) {
gfxVars::SetUseDoubleBufferingWithCompositor(true);
}
#endif
}
@ -2578,11 +2585,216 @@ static bool CalculateWrQualifiedPrefValue() {
return Preferences::GetBool(WR_ROLLOUT_PREF, WR_ROLLOUT_PREF_DEFAULTVALUE);
}
static void HardwareTooOldForWR(FeatureState& aFeature) {
aFeature.Disable(FeatureStatus::BlockedDeviceTooOld, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
}
static void UpdateWRQualificationForNvidia(FeatureState& aFeature,
int32_t aDeviceId,
bool* aOutGuardedByQualifiedPref) {
// 0x6c0 is the lowest Fermi device id. Unfortunately some Tesla
// devices that don't support D3D 10.1 have higher deviceIDs. They
// will be included, but blocked by ANGLE.
bool supported = aDeviceId >= 0x6c0;
if (!supported) {
HardwareTooOldForWR(aFeature);
return;
}
// Any additional Nvidia checks go here. Make sure to leave
// aOutGuardedByQualifiedPref as true unless the hardware is qualified
// for users on the release channel.
// Nvidia devices with device id >= 0x6c0 got WR in release Firefox 67.
*aOutGuardedByQualifiedPref = false;
}
static void UpdateWRQualificationForAMD(FeatureState& aFeature,
int32_t aDeviceId,
bool* aOutGuardedByQualifiedPref) {
// AMD deviceIDs are not very well ordered. This
// condition is based off the information in gpu-db
bool supported = (aDeviceId >= 0x6600 && aDeviceId < 0x66b0) ||
(aDeviceId >= 0x6700 && aDeviceId < 0x6720) ||
(aDeviceId >= 0x6780 && aDeviceId < 0x6840) ||
(aDeviceId >= 0x6860 && aDeviceId < 0x6880) ||
(aDeviceId >= 0x6900 && aDeviceId < 0x6a00) ||
(aDeviceId == 0x7300) ||
(aDeviceId >= 0x9830 && aDeviceId < 0x9870) ||
(aDeviceId >= 0x9900 && aDeviceId < 0x9a00);
if (!supported) {
HardwareTooOldForWR(aFeature);
return;
}
// we have a desktop CAYMAN, SI, CIK, VI, or GFX9 device.
#if defined(XP_WIN)
// These devices got WR in release Firefox 68.
*aOutGuardedByQualifiedPref = false;
#elif defined(NIGHTLY_BUILD)
// Qualify on Linux Nightly, but leave *aOutGuardedByQualifiedPref as true
// to indicate users on release don't have it yet, and it's still guarded
// by the qualified pref.
#else
// Disqualify everywhere else
aFeature.Disable(FeatureStatus::BlockedReleaseChannelAMD,
"Release channel and AMD",
NS_LITERAL_CSTRING("FEATURE_FAILURE_RELEASE_CHANNEL_AMD"));
#endif
}
static void UpdateWRQualificationForIntel(FeatureState& aFeature,
int32_t aDeviceId,
int64_t aScreenPixels,
bool* aOutGuardedByQualifiedPref) {
const uint16_t supportedDevices[] = {
// skylake gt2+
0x1912,
0x1913,
0x1915,
0x1916,
0x1917,
0x191a,
0x191b,
0x191d,
0x191e,
0x1921,
0x1923,
0x1926,
0x1927,
0x192b,
0x1932,
0x193b,
0x193d,
// kabylake gt2+
0x5912,
0x5916,
0x5917,
0x591a,
0x591b,
0x591c,
0x591d,
0x591e,
0x5921,
0x5926,
0x5923,
0x5927,
0x593b,
// coffeelake gt2+
0x3e91,
0x3e92,
0x3e96,
0x3e98,
0x3e9a,
0x3e9b,
0x3e94,
0x3ea0,
0x3ea9,
0x3ea2,
0x3ea6,
0x3ea7,
0x3ea8,
0x3ea5,
// broadwell gt2+
0x1612,
0x1616,
0x161a,
0x161b,
0x161d,
0x161e,
0x1622,
0x1626,
0x162a,
0x162b,
0x162d,
0x162e,
0x1632,
0x1636,
0x163a,
0x163b,
0x163d,
0x163e,
// HD Graphics 4600
0x0412,
0x0416,
0x041a,
0x041b,
0x041e,
0x0a12,
0x0a16,
0x0a1a,
0x0a1b,
0x0a1e,
};
bool supported = false;
for (uint16_t id : supportedDevices) {
if (aDeviceId == id) {
supported = true;
break;
}
}
if (!supported) {
HardwareTooOldForWR(aFeature);
return;
}
// Performance is not great on 4k screens with WebRender.
// Disable it for now on all release platforms, and also on Linux
// nightly. We only allow it on Windows nightly.
#if defined(XP_WIN) && defined(NIGHTLY_BUILD)
// Windows nightly, so don't do screen size checks
#else
// Windows release, Linux nightly, Linux release. Do screen size
// checks. (macOS is still completely blocked by the blocklist).
// On Windows release, we only allow really small screens (sub-WUXGA). On
// Linux we allow medium size screens as well (anything sub-4k).
# if defined(XP_WIN)
// Allow up to WUXGA on Windows release
const int64_t kMaxPixels = 1920 * 1200; // WUXGA
# else
// Allow up to 4k on Linux
const int64_t kMaxPixels = 3440 * 1440; // UWQHD
# endif
if (aScreenPixels > kMaxPixels) {
aFeature.Disable(
FeatureStatus::BlockedScreenTooLarge, "Screen size too large",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_TOO_LARGE"));
return;
}
if (aScreenPixels <= 0) {
aFeature.Disable(FeatureStatus::BlockedScreenUnknown, "Screen size unknown",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_UNKNOWN"));
return;
}
#endif
#if (defined(XP_WIN) || (defined(MOZ_WIDGET_GTK) && defined(NIGHTLY_BUILD)))
// Qualify Intel graphics cards on Windows to release and on Linux nightly
// (subject to device whitelist and screen size checks above).
// Leave *aOutGuardedByQualifiedPref as true to indicate no existing
// release users have this yet, and it's still guarded by the qualified pref.
#else
// Disqualify everywhere else
aFeature.Disable(FeatureStatus::BlockedReleaseChannelIntel,
"Release channel and Intel",
NS_LITERAL_CSTRING("FEATURE_FAILURE_RELEASE_CHANNEL_INTEL"));
#endif
}
static FeatureState& WebRenderHardwareQualificationStatus(
const IntSize& aScreenSize, bool aHasBattery, nsCString& aOutFailureId) {
int64_t aScreenPixels, bool aHasBattery, bool* aOutGuardedByQualifiedPref) {
FeatureState& featureWebRenderQualified =
gfxConfig::GetFeature(Feature::WEBRENDER_QUALIFIED);
featureWebRenderQualified.EnableByDefault();
MOZ_ASSERT(aOutGuardedByQualifiedPref && *aOutGuardedByQualifiedPref);
if (Preferences::HasUserValue(WR_ROLLOUT_HW_QUALIFIED_OVERRIDE)) {
if (!Preferences::GetBool(WR_ROLLOUT_HW_QUALIFIED_OVERRIDE)) {
@ -2594,197 +2806,85 @@ static FeatureState& WebRenderHardwareQualificationStatus(
}
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString failureId;
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
aOutFailureId, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
featureWebRenderQualified.Disable(FeatureStatus::Blacklisted,
"No qualified hardware", aOutFailureId);
} else {
nsAutoString adapterVendorID;
gfxInfo->GetAdapterVendorID(adapterVendorID);
nsAutoString adapterDeviceID;
gfxInfo->GetAdapterDeviceID(adapterDeviceID);
nsresult valid;
int32_t deviceID = adapterDeviceID.ToInteger(&valid, 16);
if (valid != NS_OK) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedDeviceUnknown, "Bad device id",
NS_LITERAL_CSTRING("FEATURE_FAILURE_BAD_DEVICE_ID"));
} else {
#ifdef NIGHTLY_BUILD
// For Intel devices, if we have a battery, ignore it if the screen is
// small enough. Note that we always check for a battery with NVIDIA
// because we do not have a limited/curated set of devices to support
// WebRender on.
const int32_t kMaxPixelsBattery = 1920 * 1200; // WUXGA
const int32_t screenPixels = aScreenSize.width * aScreenSize.height;
bool disableForBattery = aHasBattery;
if (adapterVendorID == u"0x8086" && screenPixels > 0 &&
screenPixels <= kMaxPixelsBattery) {
disableForBattery = false;
}
#else
bool disableForBattery = aHasBattery;
#endif
if (disableForBattery) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedHasBattery, "Has battery",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WR_HAS_BATTERY"));
} else if (adapterVendorID == u"0x10de") {
if (deviceID < 0x6c0) {
// 0x6c0 is the lowest Fermi device id. Unfortunately some Tesla
// devices that don't support D3D 10.1 have higher deviceIDs. They
// will be included, but blocked by ANGLE.
featureWebRenderQualified.Disable(
FeatureStatus::BlockedDeviceTooOld, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
}
} else if (adapterVendorID == u"0x1002") { // AMD
// AMD deviceIDs are not very well ordered. This
// condition is based off the information in gpu-db
if ((deviceID >= 0x6600 && deviceID < 0x66b0) ||
(deviceID >= 0x6700 && deviceID < 0x6720) ||
(deviceID >= 0x6780 && deviceID < 0x6840) ||
(deviceID >= 0x6860 && deviceID < 0x6880) ||
(deviceID >= 0x6900 && deviceID < 0x6a00) ||
(deviceID == 0x7300) ||
(deviceID >= 0x9830 && deviceID < 0x9870) ||
(deviceID >= 0x9900 && deviceID < 0x9a00)) {
// we have a desktop CAYMAN, SI, CIK, VI, or GFX9 device
// so treat the device as qualified.
} else {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedDeviceTooOld, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
}
#ifdef NIGHTLY_BUILD
} else if (adapterVendorID == u"0x8086") { // Intel
const uint16_t supportedDevices[] = {
// skylake gt2+
0x1912,
0x1913,
0x1915,
0x1916,
0x1917,
0x191a,
0x191b,
0x191d,
0x191e,
0x1921,
0x1923,
0x1926,
0x1927,
0x192b,
0x1932,
0x193b,
0x193d,
// kabylake gt2+
0x5912,
0x5916,
0x5917,
0x591a,
0x591b,
0x591c,
0x591d,
0x591e,
0x5921,
0x5926,
0x5923,
0x5927,
0x593b,
// coffeelake gt2+
0x3e91,
0x3e92,
0x3e96,
0x3e98,
0x3e9a,
0x3e9b,
0x3e94,
0x3ea0,
0x3ea9,
0x3ea2,
0x3ea6,
0x3ea7,
0x3ea8,
0x3ea5,
// broadwell gt2+
0x1612,
0x1616,
0x161a,
0x161b,
0x161d,
0x161e,
0x1622,
0x1626,
0x162a,
0x162b,
0x162d,
0x162e,
0x1632,
0x1636,
0x163a,
0x163b,
0x163d,
0x163e,
// HD Graphics 4600
0x0412,
0x0416,
0x041a,
0x041b,
0x041e,
0x0a12,
0x0a16,
0x0a1a,
0x0a1b,
0x0a1e,
};
bool supported = false;
for (uint16_t id : supportedDevices) {
if (deviceID == id) {
supported = true;
break;
}
}
if (!supported) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedDeviceTooOld, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
}
# ifdef MOZ_WIDGET_GTK
else {
// Performance is not great on 4k screens with WebRender + Linux.
// Disable it for now if it is too large.
const int32_t kMaxPixelsLinux = 3440 * 1440; // UWQHD
if (screenPixels > kMaxPixelsLinux) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedScreenTooLarge, "Screen size too large",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_TOO_LARGE"));
} else if (screenPixels <= 0) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedScreenUnknown, "Screen size unknown",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_UNKNOWN"));
}
}
# endif // MOZ_WIDGET_GTK
#endif // NIGHTLY_BUILD
} else {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedVendorUnsupported, "Unsupported vendor",
NS_LITERAL_CSTRING("FEATURE_FAILURE_UNSUPPORTED_VENDOR"));
}
}
}
} else {
if (NS_FAILED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBRENDER,
failureId, &status))) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedNoGfxInfo, "gfxInfo is broken",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WR_NO_GFX_INFO"));
return featureWebRenderQualified;
}
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
featureWebRenderQualified.Disable(FeatureStatus::Blacklisted,
"No qualified hardware", failureId);
return featureWebRenderQualified;
}
nsAutoString adapterVendorID;
gfxInfo->GetAdapterVendorID(adapterVendorID);
nsAutoString adapterDeviceID;
gfxInfo->GetAdapterDeviceID(adapterDeviceID);
nsresult valid;
int32_t deviceID = adapterDeviceID.ToInteger(&valid, 16);
if (valid != NS_OK) {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedDeviceUnknown, "Bad device id",
NS_LITERAL_CSTRING("FEATURE_FAILURE_BAD_DEVICE_ID"));
return featureWebRenderQualified;
}
if (adapterVendorID == u"0x10de") { // Nvidia
UpdateWRQualificationForNvidia(featureWebRenderQualified, deviceID,
aOutGuardedByQualifiedPref);
} else if (adapterVendorID == u"0x1002") { // AMD
UpdateWRQualificationForAMD(featureWebRenderQualified, deviceID,
aOutGuardedByQualifiedPref);
} else if (adapterVendorID == u"0x8086") { // Intel
UpdateWRQualificationForIntel(featureWebRenderQualified, deviceID,
aScreenPixels, aOutGuardedByQualifiedPref);
} else {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedVendorUnsupported, "Unsupported vendor",
NS_LITERAL_CSTRING("FEATURE_FAILURE_UNSUPPORTED_VENDOR"));
}
if (!featureWebRenderQualified.IsEnabled()) {
// One of the checks above failed, early exit. If this happens then
// this population must still be guarded by the qualified pref.
MOZ_ASSERT(*aOutGuardedByQualifiedPref);
return featureWebRenderQualified;
}
// We leave checking the battery for last because we would like to know
// which users were denied WebRender only because they have a battery.
if (aHasBattery) {
#ifndef XP_WIN
// aHasBattery is only ever true on Windows, we don't check it on other
// platforms.
MOZ_ASSERT(false);
#endif
// We never released WR to the battery populations, so let's keep the pref
// guard for these populations. That way we can do a gradual rollout to
// the battery population using the pref.
*aOutGuardedByQualifiedPref = true;
// if we have a battery, ignore it if the screen is small enough.
const int64_t kMaxPixelsBattery = 1920 * 1200; // WUXGA
if (aScreenPixels > 0 && aScreenPixels <= kMaxPixelsBattery) {
#ifndef NIGHTLY_BUILD
featureWebRenderQualified.Disable(
FeatureStatus::BlockedReleaseChannelBattery,
"Release channel and battery",
NS_LITERAL_CSTRING("FEATURE_FAILURE_RELEASE_CHANNEL_BATTERY"));
#endif // !NIGHTLY_BUILD
} else {
featureWebRenderQualified.Disable(
FeatureStatus::BlockedHasBattery, "Has battery",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WR_HAS_BATTERY"));
}
}
return featureWebRenderQualified;
}
@ -2812,10 +2912,10 @@ void gfxPlatform::InitWebRenderConfig() {
return;
}
nsCString failureId;
bool guardedByQualifiedPref = true;
FeatureState& featureWebRenderQualified =
WebRenderHardwareQualificationStatus(GetScreenSize(), HasBattery(),
failureId);
WebRenderHardwareQualificationStatus(mScreenPixels, HasBattery(),
&guardedByQualifiedPref);
FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
featureWebRender.DisableByDefault(
@ -2832,8 +2932,15 @@ void gfxPlatform::InitWebRenderConfig() {
featureWebRender.UserEnable("Force enabled by envvar");
} else if (prefEnabled) {
featureWebRender.UserEnable("Force enabled by pref");
} else if (wrQualifiedAll && featureWebRenderQualified.IsEnabled()) {
featureWebRender.UserEnable("Qualified enabled by pref ");
} else if (featureWebRenderQualified.IsEnabled()) {
// If the HW is qualified, we enable if either the HW has been qualified
// on the release channel (i.e. it's no longer guarded by the qualified
// pref), or if the qualified pref is enabled.
if (!guardedByQualifiedPref) {
featureWebRender.UserEnable("Qualified in release");
} else if (wrQualifiedAll) {
featureWebRender.UserEnable("Qualified enabled by pref");
}
}
// If the user set the pref to force-disable, let's do that. This will
@ -2918,19 +3025,32 @@ void gfxPlatform::InitWebRenderConfig() {
#endif
#ifdef XP_WIN
if (Preferences::GetBool("gfx.webrender.flip-sequential", false)) {
// XXX relax win version to windows 8.
if (IsWin10OrLater() && UseWebRender() && gfxVars::UseWebRenderANGLE()) {
gfxVars::SetUseWebRenderFlipSequentialWin(true);
}
}
if (Preferences::GetBool("gfx.webrender.dcomp-win.enabled", false)) {
// XXX relax win version to windows 8.
if (IsWin10OrLater() && UseWebRender() && gfxVars::UseWebRenderANGLE()) {
gfxVars::SetUseWebRenderDCompWin(true);
}
}
if (Preferences::GetBool("gfx.webrender.dcomp-win-triple-buffering.enabled",
false)) {
if (gfxVars::UseWebRenderDCompWin()) {
gfxVars::SetUseWebRenderDCompWinTripleBuffering(true);
if (Preferences::GetBool("gfx.webrender.triple-buffering.enabled", false)) {
if (gfxVars::UseWebRenderDCompWin() ||
gfxVars::UseWebRenderFlipSequentialWin()) {
gfxVars::SetUseWebRenderTripleBufferingWin(true);
}
}
#endif
// Set features that affect WR's RendererOptions
gfxVars::SetUseGLSwizzle(IsFeatureSupported(nsIGfxInfo::FEATURE_GL_SWIZZLE, true));
// The RemoveShaderCacheFromDiskIfNecessary() needs to be called after
// WebRenderConfig initialization.
gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
}
void gfxPlatform::InitOMTPConfig() {
@ -3219,6 +3339,38 @@ void gfxPlatform::GetFrameStats(mozilla::widget::InfoObject& aObj) {
}
}
void gfxPlatform::GetCMSSupportInfo(mozilla::widget::InfoObject& aObj) {
void* profile = nullptr;
size_t size = 0;
GetCMSOutputProfileData(profile, size);
if (!profile) {
return;
}
// Some profiles can be quite large. We don't want to include giant profiles
// by default in about:support. For now, we only accept less than 8kiB.
const size_t kMaxProfileSize = 8192;
if (size < kMaxProfileSize) {
char* encodedProfile = nullptr;
nsresult rv =
Base64Encode(reinterpret_cast<char*>(profile), size, &encodedProfile);
if (NS_SUCCEEDED(rv)) {
aObj.DefineProperty("CMSOutputProfile", encodedProfile);
free(encodedProfile);
} else {
nsPrintfCString msg("base64 encode failed 0x%08x",
static_cast<uint32_t>(rv));
aObj.DefineProperty("CMSOutputProfile", msg.get());
}
} else {
nsPrintfCString msg("%zu bytes, too large", size);
aObj.DefineProperty("CMSOutputProfile", msg.get());
}
free(profile);
}
class FrameStatsComparator {
public:
bool Equals(const FrameStats& aA, const FrameStats& aB) const {

View File

@ -280,6 +280,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
void GetApzSupportInfo(mozilla::widget::InfoObject& aObj);
void GetTilesSupportInfo(mozilla::widget::InfoObject& aObj);
void GetFrameStats(mozilla::widget::InfoObject& aObj);
void GetCMSSupportInfo(mozilla::widget::InfoObject& aObj);
// Get the default content backend that will be used with the default
// compositor. If the compositor is known when calling this function,
@ -904,6 +905,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
mozilla::widget::GfxInfoCollector<gfxPlatform> mApzSupportCollector;
mozilla::widget::GfxInfoCollector<gfxPlatform> mTilesInfoCollector;
mozilla::widget::GfxInfoCollector<gfxPlatform> mFrameStatsCollector;
mozilla::widget::GfxInfoCollector<gfxPlatform> mCMSInfoCollector;
nsTArray<mozilla::layers::FrameStats> mFrameStats;
@ -916,6 +918,9 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
int32_t mScreenDepth;
mozilla::gfx::IntSize mScreenSize;
// Total number of screen pixels across all monitors.
int64_t mScreenPixels;
// An instance of gfxSkipChars which is empty. It is used as the
// basis for error-case iterators.
const gfxSkipChars kEmptySkipChars;

View File

@ -21,6 +21,45 @@
namespace mozilla {
namespace wr {
void wr_compositor_add_surface(void* aCompositor, wr::NativeSurfaceId aId,
wr::DeviceIntPoint aPosition,
wr::DeviceIntRect aClipRect) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->AddSurface(aId, aPosition, aClipRect);
}
void wr_compositor_begin_frame(void* aCompositor) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->CompositorBeginFrame();
}
void wr_compositor_bind(void* aCompositor, wr::NativeSurfaceId aId,
wr::DeviceIntPoint* aOffset) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->Bind(aId, aOffset);
}
void wr_compositor_create_surface(void* aCompositor, wr::NativeSurfaceId aId,
wr::DeviceIntSize aSize) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->CreateSurface(aId, aSize);
}
void wr_compositor_destroy_surface(void* aCompositor, NativeSurfaceId aId) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->DestroySurface(aId);
}
void wr_compositor_end_frame(void* aCompositor) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->CompositorEndFrame();
}
void wr_compositor_unbind(void* aCompositor) {
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
compositor->Unbind();
}
/* static */
UniquePtr<RenderCompositor> RenderCompositor::Create(
RefPtr<widget::CompositorWidget>&& aWidget) {
@ -53,5 +92,11 @@ RenderCompositor::~RenderCompositor() {}
bool RenderCompositor::MakeCurrent() { return gl()->MakeCurrent(); }
bool RenderCompositor::IsContextLost() {
// XXX Add glGetGraphicsResetStatus handling for checking rendering context
// has not been lost
return false;
}
} // namespace wr
} // namespace mozilla

View File

@ -7,6 +7,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "Units.h"
namespace mozilla {
@ -35,7 +36,9 @@ class RenderCompositor {
virtual bool BeginFrame() = 0;
virtual void EndFrame() = 0;
virtual void WaitForGPU() = 0;
// Returns false when waiting gpu tasks is failed.
// It might happen when rendering context is lost.
virtual bool WaitForGPU() { return true; }
virtual void Pause() = 0;
virtual bool Resume() = 0;
@ -55,6 +58,26 @@ class RenderCompositor {
layers::SyncObjectHost* GetSyncObject() const { return mSyncObject.get(); }
virtual bool IsContextLost();
virtual bool ShouldUseNativeCompositor() { return false; }
// Interface for wr::Compositor
virtual void CompositorBeginFrame() {}
virtual void CompositorEndFrame() {}
virtual void Bind(wr::NativeSurfaceId aId, wr::DeviceIntPoint* aOffset) {}
virtual void Unbind() {}
virtual void CreateSurface(wr::NativeSurfaceId aId, wr::DeviceIntSize aSize) {
}
virtual void DestroySurface(NativeSurfaceId aId) {}
virtual void AddSurface(wr::NativeSurfaceId aId, wr::DeviceIntPoint aPosition,
wr::DeviceIntRect aClipRect) {}
void wr_compositor_unbind(void* aCompositor) {}
// Whether the surface contents are flipped vertically
virtual bool SurfaceIsYFlipped() { return false; }
protected:
RefPtr<widget::CompositorWidget> mWidget;
RefPtr<layers::SyncObjectHost> mSyncObject;

View File

@ -155,6 +155,7 @@ bool RenderCompositorANGLE::Initialize() {
if (!mSwapChain && dxgiFactory2 && IsWin8OrLater()) {
RefPtr<IDXGISwapChain1> swapChain1;
bool useTripleBuffering = false;
DXGI_SWAP_CHAIN_DESC1 desc{};
desc.Width = 0;
@ -166,12 +167,19 @@ bool RenderCompositorANGLE::Initialize() {
// framebuffer to texture on intel gpu.
desc.BufferUsage =
DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT;
// Do not use DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, since it makes HWND
// unreusable.
// desc.BufferCount = 2;
// desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
desc.BufferCount = 1;
desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
if (gfx::gfxVars::UseWebRenderFlipSequentialWin()) {
useTripleBuffering = gfx::gfxVars::UseWebRenderTripleBufferingWin();
if (useTripleBuffering) {
desc.BufferCount = 3;
} else {
desc.BufferCount = 2;
}
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
} else {
desc.BufferCount = 1;
desc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
}
desc.Scaling = DXGI_SCALING_NONE;
desc.Flags = 0;
@ -181,6 +189,7 @@ bool RenderCompositorANGLE::Initialize() {
DXGI_RGBA color = {1.0f, 1.0f, 1.0f, 1.0f};
swapChain1->SetBackgroundColor(&color);
mSwapChain = swapChain1;
mUseTripleBuffering = useTripleBuffering;
}
}
@ -281,7 +290,7 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
}
RefPtr<IDXGISwapChain1> swapChain1;
bool useTripleBuffering = gfx::gfxVars::UseWebRenderDCompWinTripleBuffering();
bool useTripleBuffering = gfx::gfxVars::UseWebRenderTripleBufferingWin();
DXGI_SWAP_CHAIN_DESC1 desc{};
// DXGI does not like 0x0 swapchains. Swap chain creation failed when 0x0 was
@ -319,11 +328,6 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
}
bool RenderCompositorANGLE::BeginFrame() {
if (mDevice->GetDeviceRemovedReason() != S_OK) {
RenderThread::Get()->HandleDeviceReset("BeginFrame", /* aNotify */ true);
return false;
}
mWidget->AsWindows()->UpdateCompositorWndSizeIfNecessary();
if (!ResizeBufferIfNeeded()) {
@ -355,7 +359,7 @@ void RenderCompositorANGLE::EndFrame() {
}
}
void RenderCompositorANGLE::WaitForGPU() {
bool RenderCompositorANGLE::WaitForGPU() {
// Note: this waits on the query we inserted in the previous frame,
// not the one we just inserted now. Example:
// Insert query #1
@ -369,7 +373,7 @@ void RenderCompositorANGLE::WaitForGPU() {
// Wait for query #2.
//
// This ensures we're done reading textures before swapping buffers.
WaitForPreviousPresentQuery();
return WaitForPreviousPresentQuery();
}
bool RenderCompositorANGLE::ResizeBufferIfNeeded() {
@ -387,14 +391,32 @@ bool RenderCompositorANGLE::ResizeBufferIfNeeded() {
return true;
}
HRESULT hr;
RefPtr<ID3D11Texture2D> backBuf;
// Release EGLSurface of back buffer before calling ResizeBuffers().
DestroyEGLSurface();
// Reset buffer size
mBufferSize.reset();
mBufferSize = Some(size);
if (!CreateEGLSurface()) {
mBufferSize.reset();
return false;
}
return true;
}
bool RenderCompositorANGLE::CreateEGLSurface() {
MOZ_ASSERT(mBufferSize.isSome());
MOZ_ASSERT(mEGLSurface == EGL_NO_SURFACE);
HRESULT hr;
RefPtr<ID3D11Texture2D> backBuf;
if (mBufferSize.isNothing()) {
gfxCriticalNote << "Buffer size is invalid";
return false;
}
const LayoutDeviceIntSize& size = mBufferSize.ref();
// Resize swap chain
DXGI_SWAP_CHAIN_DESC desc;
@ -448,7 +470,6 @@ bool RenderCompositorANGLE::ResizeBufferIfNeeded() {
}
mEGLSurface = surface;
mBufferSize = Some(size);
return true;
}
@ -509,18 +530,31 @@ void RenderCompositorANGLE::InsertPresentWaitQuery() {
mWaitForPresentQueries.emplace(query);
}
void RenderCompositorANGLE::WaitForPreviousPresentQuery() {
bool RenderCompositorANGLE::WaitForPreviousPresentQuery() {
size_t waitLatency = mUseTripleBuffering ? 3 : 2;
while (mWaitForPresentQueries.size() >= waitLatency) {
RefPtr<ID3D11Query>& query = mWaitForPresentQueries.front();
BOOL result;
layers::WaitForFrameGPUQuery(mDevice, mCtx, query, &result);
bool ret = layers::WaitForFrameGPUQuery(mDevice, mCtx, query, &result);
// Recycle query for later use.
mRecycledQuery = query;
mWaitForPresentQueries.pop();
if (!ret) {
return false;
}
}
return true;
}
bool RenderCompositorANGLE::IsContextLost() {
// XXX glGetGraphicsResetStatus sometimes did not work for detecting TDR.
// Then this function just uses GetDeviceRemovedReason().
if (mDevice->GetDeviceRemovedReason() != S_OK) {
return true;
}
return false;
}
} // namespace wr

View File

@ -36,7 +36,7 @@ class RenderCompositorANGLE : public RenderCompositor {
bool BeginFrame() override;
void EndFrame() override;
void WaitForGPU() override;
bool WaitForGPU() override;
void Pause() override;
bool Resume() override;
@ -52,10 +52,15 @@ class RenderCompositorANGLE : public RenderCompositor {
LayoutDeviceIntSize GetBufferSize() override;
bool IsContextLost() override;
bool SurfaceIsYFlipped() override { return true; }
protected:
void InsertPresentWaitQuery();
void WaitForPreviousPresentQuery();
bool WaitForPreviousPresentQuery();
bool ResizeBufferIfNeeded();
bool CreateEGLSurface();
void DestroyEGLSurface();
ID3D11Device* GetDeviceOfEGLDisplay();
void CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFactory2);

View File

@ -106,8 +106,6 @@ void RenderCompositorEGL::EndFrame() {
}
}
void RenderCompositorEGL::WaitForGPU() {}
void RenderCompositorEGL::Pause() {
#ifdef MOZ_WIDGET_ANDROID
java::GeckoSurfaceTexture::DestroyUnused((int64_t)gl());

View File

@ -22,7 +22,6 @@ class RenderCompositorEGL : public RenderCompositor {
bool BeginFrame() override;
void EndFrame() override;
void WaitForGPU() override;
void Pause() override;
bool Resume() override;

View File

@ -43,8 +43,6 @@ bool RenderCompositorOGL::BeginFrame() {
void RenderCompositorOGL::EndFrame() { mGL->SwapBuffers(); }
void RenderCompositorOGL::WaitForGPU() {}
void RenderCompositorOGL::Pause() {}
bool RenderCompositorOGL::Resume() { return true; }

View File

@ -22,7 +22,6 @@ class RenderCompositorOGL : public RenderCompositor {
bool BeginFrame() override;
void EndFrame() override;
void WaitForGPU() override;
void Pause() override;
bool Resume() override;

View File

@ -871,7 +871,7 @@ WebRenderProgramCache::WebRenderProgramCache(wr::WrThreadPool* aThreadPool) {
}
mProgramCache = wr_program_cache_new(&path, aThreadPool);
if (gfxVars::UseWebRenderProgramBinaryDisk()) {
wr_try_load_shader_from_disk(mProgramCache);
wr_try_load_startup_shaders_from_disk(mProgramCache);
}
}

View File

@ -108,6 +108,9 @@ bool RendererOGL::UpdateAndRender(const Maybe<gfx::IntSize>& aReadbackSize,
// XXX set clear color if MOZ_WIDGET_ANDROID is defined.
if (!mCompositor->BeginFrame()) {
if (mCompositor->IsContextLost()) {
RenderThread::Get()->HandleDeviceReset("BeginFrame", /* aNotify */ true);
}
return false;
}
@ -170,7 +173,13 @@ void RendererOGL::CheckGraphicsResetStatus() {
}
}
void RendererOGL::WaitForGPU() { mCompositor->WaitForGPU(); }
void RendererOGL::WaitForGPU() {
if (!mCompositor->WaitForGPU()) {
if (mCompositor->IsContextLost()) {
RenderThread::Get()->HandleDeviceReset("WaitForGPU", /* aNotify */ true);
}
}
}
void RendererOGL::Pause() { mCompositor->Pause(); }

View File

@ -68,30 +68,33 @@ class NewRenderer : public RendererEvent {
*mUseDComp = compositor->UseDComp();
*mUseTripleBuffering = compositor->UseTripleBuffering();
bool allow_texture_swizzling = gfx::gfxVars::UseGLSwizzle();
bool isMainWindow = true; // TODO!
bool supportLowPriorityTransactions = isMainWindow;
bool supportPictureCaching = isMainWindow;
wr::Renderer* wrRenderer = nullptr;
if (!wr_window_new(aWindowId, mSize.width, mSize.height,
supportLowPriorityTransactions,
StaticPrefs::gfx_webrender_picture_caching() &&
supportPictureCaching,
if (!wr_window_new(
aWindowId, mSize.width, mSize.height,
supportLowPriorityTransactions, allow_texture_swizzling,
StaticPrefs::gfx_webrender_picture_caching() &&
supportPictureCaching,
#ifdef NIGHTLY_BUILD
StaticPrefs::gfx_webrender_start_debug_server(),
StaticPrefs::gfx_webrender_start_debug_server(),
#else
false,
false,
#endif
compositor->gl(),
aRenderThread.GetProgramCache()
? aRenderThread.GetProgramCache()->Raw()
: nullptr,
aRenderThread.GetShaders()
? aRenderThread.GetShaders()->RawShaders()
: nullptr,
aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
&WebRenderMallocEnclosingSizeOf,
(uint32_t)wr::RenderRoot::Default, mDocHandle,
&wrRenderer, mMaxTextureSize)) {
compositor->gl(), compositor->SurfaceIsYFlipped(),
aRenderThread.GetProgramCache()
? aRenderThread.GetProgramCache()->Raw()
: nullptr,
aRenderThread.GetShaders()
? aRenderThread.GetShaders()->RawShaders()
: nullptr,
aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
&WebRenderMallocEnclosingSizeOf, (uint32_t)wr::RenderRoot::Default,
compositor->ShouldUseNativeCompositor() ? compositor.get()
: nullptr,
mDocHandle, &wrRenderer, mMaxTextureSize)) {
// wr_window_new puts a message into gfxCriticalNote if it returns false
return;
}

View File

@ -217,6 +217,10 @@ struct ImageDescriptor : public wr::WrImageDescriptor {
}
};
inline uint64_t AsUint64(const NativeSurfaceId& aId) {
return static_cast<uint64_t>(aId._0);
}
// Whenever possible, use wr::WindowId instead of manipulating uint64_t.
inline uint64_t AsUint64(const WindowId& aId) {
return static_cast<uint64_t>(aId.mHandle);

View File

@ -22,8 +22,8 @@ use gleam::gl;
use webrender::{
api::*, api::units::*, ApiRecordingReceiver, AsyncPropertySampler, AsyncScreenshotHandle,
BinaryRecorder, DebugFlags, Device, ExternalImage, ExternalImageHandler, ExternalImageSource,
PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
BinaryRecorder, Compositor, DebugFlags, Device, ExternalImage, ExternalImageHandler, ExternalImageSource,
NativeSurfaceId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, VertexUsageHint,
WrShaders, set_profiler_hooks,
};
@ -1066,8 +1066,8 @@ pub unsafe extern "C" fn wr_program_cache_delete(program_cache: *mut WrProgramCa
}
#[no_mangle]
pub unsafe extern "C" fn wr_try_load_shader_from_disk(program_cache: *mut WrProgramCache) {
(*program_cache).try_load_from_disk();
pub unsafe extern "C" fn wr_try_load_startup_shaders_from_disk(program_cache: *mut WrProgramCache) {
(*program_cache).try_load_startup_shaders_from_disk();
}
#[no_mangle]
@ -1132,24 +1132,141 @@ fn wr_device_new(gl_context: *mut c_void, pc: Option<&mut WrProgramCache>)
None => None,
};
Device::new(gl, resource_override_path, upload_method, cached_programs, false, true, true, None)
Device::new(gl, resource_override_path, upload_method, cached_programs, false, true, true, None, false)
}
extern "C" {
fn wr_compositor_create_surface(
compositor: *mut c_void,
id: NativeSurfaceId,
size: DeviceIntSize,
);
fn wr_compositor_destroy_surface(
compositor: *mut c_void,
id: NativeSurfaceId,
);
fn wr_compositor_bind(
compositor: *mut c_void,
id: NativeSurfaceId,
offset: &mut DeviceIntPoint,
);
fn wr_compositor_unbind(compositor: *mut c_void);
fn wr_compositor_begin_frame(compositor: *mut c_void);
fn wr_compositor_add_surface(
compositor: *mut c_void,
id: NativeSurfaceId,
position: DeviceIntPoint,
clip_rect: DeviceIntRect,
);
fn wr_compositor_end_frame(compositor: *mut c_void);
}
pub struct WrCompositor(*mut c_void);
impl Compositor for WrCompositor {
fn create_surface(
&mut self,
id: NativeSurfaceId,
size: DeviceIntSize,
) {
unsafe {
wr_compositor_create_surface(
self.0,
id,
size,
);
}
}
fn destroy_surface(
&mut self,
id: NativeSurfaceId,
) {
unsafe {
wr_compositor_destroy_surface(
self.0,
id,
);
}
}
fn bind(
&mut self,
id: NativeSurfaceId,
) -> DeviceIntPoint {
let mut offset = DeviceIntPoint::zero();
unsafe {
wr_compositor_bind(
self.0,
id,
&mut offset,
);
}
offset
}
fn unbind(
&mut self,
) {
unsafe {
wr_compositor_unbind(
self.0,
);
}
}
fn begin_frame(&mut self) {
unsafe {
wr_compositor_begin_frame(
self.0,
);
}
}
fn add_surface(
&mut self,
id: NativeSurfaceId,
position: DeviceIntPoint,
clip_rect: DeviceIntRect,
) {
unsafe {
wr_compositor_add_surface(
self.0,
id,
position,
clip_rect,
);
}
}
fn end_frame(&mut self) {
unsafe {
wr_compositor_end_frame(
self.0,
);
}
}
}
// Call MakeCurrent before this.
#[no_mangle]
pub extern "C" fn wr_window_new(window_id: WrWindowId,
window_width: i32,
window_height: i32,
support_low_priority_transactions: bool,
allow_texture_swizzling: bool,
enable_picture_caching: bool,
start_debug_server: bool,
gl_context: *mut c_void,
surface_is_y_flipped: bool,
program_cache: Option<&mut WrProgramCache>,
shaders: Option<&mut WrShaders>,
thread_pool: *mut WrThreadPool,
size_of_op: VoidPtrToSizeFn,
enclosing_size_of_op: VoidPtrToSizeFn,
document_id: u32,
compositor: *mut c_void,
out_handle: &mut *mut DocumentHandle,
out_renderer: &mut *mut Renderer,
out_max_texture_size: *mut i32)
@ -1202,10 +1319,17 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
ColorF::new(0.0, 0.0, 0.0, 0.0)
};
let native_compositor : Option<Box<dyn Compositor>> = if compositor != ptr::null_mut() {
Some(Box::new(WrCompositor(compositor)))
} else {
None
};
let opts = RendererOptions {
enable_aa: true,
enable_subpixel_aa: cfg!(not(target_os = "android")),
support_low_priority_transactions,
allow_texture_swizzling,
recorder: recorder,
blob_image_handler: Some(Box::new(Moz2dBlobImageHandler::new(workers.clone()))),
workers: Some(workers.clone()),
@ -1235,6 +1359,8 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
enable_picture_caching,
allow_pixel_local_storage_support: false,
start_debug_server,
native_compositor,
surface_is_y_flipped,
..Default::default()
};

View File

@ -1,12 +1,13 @@
use std::cell::RefCell;
use std::io::{Error, ErrorKind};
use std::fs::{File, create_dir_all, read_dir};
use std::ffi::{OsString};
use std::fs::{File, create_dir_all, read_dir, read_to_string};
use std::io::{Read, Write};
use std::path::{PathBuf};
use std::rc::Rc;
use std::sync::Arc;
use webrender::{ProgramBinary, ProgramCache, ProgramCacheObserver};
use webrender::{ProgramBinary, ProgramCache, ProgramCacheObserver, ProgramSourceDigest};
use bincode;
use fxhash;
use nsstring::nsAString;
@ -55,7 +56,6 @@ fn get_cache_path_from_prof_path(prof_path: &nsAString) -> Option<PathBuf> {
return None;
}
use std::ffi::OsString;
use std::os::windows::prelude::*;
let prof_path = OsString::from_wide(prof_path.as_ref());
@ -72,8 +72,6 @@ fn get_cache_path_from_prof_path(prof_path: &nsAString) -> Option<PathBuf> {
return None;
}
use std::ffi::OsString;
let utf8 = String::from_utf16(prof_path.as_ref()).unwrap();
let prof_path = OsString::from(utf8);
let mut cache_path = PathBuf::from(&prof_path);
@ -85,6 +83,7 @@ fn get_cache_path_from_prof_path(prof_path: &nsAString) -> Option<PathBuf> {
struct WrProgramBinaryDiskCache {
cache_path: PathBuf,
workers: Arc<ThreadPool>,
cached_shader_filenames: Vec<OsString>,
}
// Magic number + version. Increment the version when the binary format changes.
@ -92,6 +91,9 @@ const MAGIC: u32 = 0xB154AD30; // BI-SHADE + version.
const VERSION: u32 = 2;
const MAGIC_AND_VERSION: u32 = MAGIC + VERSION;
const WHITELIST_FILENAME: &str = "startup_shaders";
const WHITELIST_SEPARATOR: &str = "\n";
/// Helper to convert a closure returning a `Result` to one that returns void.
/// This allows the enclosed code to use the question-mark operator in a
/// context where the calling function doesn't expect a `Result`.
@ -104,10 +106,11 @@ impl WrProgramBinaryDiskCache {
WrProgramBinaryDiskCache {
cache_path,
workers: Arc::clone(workers),
cached_shader_filenames: Vec::new(),
}
}
/// Updates the on-disk cache to contain exactly the entries specified.
/// Updates the on-disk cache and whitelist to contain the entries specified.
fn update(&mut self, entries: Vec<Arc<ProgramBinary>>) {
info!("Updating on-disk shader cache");
@ -115,21 +118,30 @@ impl WrProgramBinaryDiskCache {
let mut entries: Vec<(String, Arc<ProgramBinary>)> =
entries.into_iter().map(|e| (format!("{}", e.source_digest()), e)).collect();
let whitelist = entries.iter().map(|e| e.0.as_ref()).collect::<Vec<&str>>().join(WHITELIST_SEPARATOR);
let mut whitelist_path = self.cache_path.clone();
whitelist_path.push(WHITELIST_FILENAME);
self.workers.spawn(move || result_to_void(move || {
info!("Writing startup shader whitelist");
let mut file = File::create(&whitelist_path).unwrap();
file.write_all(whitelist.as_bytes())
.map_err(|e| error!("shader-cache: Failed to write startup whitelist: {}", e))?;
Ok(())
}));
// For each file in the current directory, check if it corresponds to
// an entry we're supposed to write. If so, we don't need to write the
// entry. If not, we delete the file.
// entry. We do not delete unused shaders from disk here, however.
// There are a finite number of shaders that can be compiled, set at
// build-time, and whenever the build ID, device ID, or driver version
// changes `remove_program_binary_disk_cache` will remove all shaders
// from disk. Therefore the disk cache cannot grow too large over time.
for existing in read_dir(&self.cache_path).unwrap().filter_map(|f| f.ok()) {
let pos = existing.file_name().to_str()
.and_then(|digest| entries.iter().position(|x| x.0 == digest));
if let Some(p) = pos {
info!("Found existing shader: {}", existing.file_name().to_string_lossy());
entries.swap_remove(p);
} else {
self.workers.spawn(move || {
info!("Removing shader: {}", existing.file_name().to_string_lossy());
::std::fs::remove_file(existing.path())
.unwrap_or_else(|e| error!("shader-cache: Failed to remove shader: {:?}", e));
});
}
}
@ -174,16 +186,14 @@ impl WrProgramBinaryDiskCache {
}
}
pub fn try_load_from_disk(&mut self, program_cache: &Rc<ProgramCache>) {
use std::time::{Instant};
let start = Instant::now();
pub fn try_load_shader_from_disk(&mut self, filename: &str, program_cache: &Rc<ProgramCache>) {
if let Some(index) = self.cached_shader_filenames.iter().position(|e| e == filename) {
let mut path = self.cache_path.clone();
path.push(filename);
// Load program binaries if exist
for entry in read_dir(&self.cache_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
self.cached_shader_filenames.swap_remove(index);
info!("Loading shader: {}", entry.file_name().to_string_lossy());
info!("Loading shader: {}", filename);
match deserialize_program_binary(&path) {
Ok(program) => {
@ -193,6 +203,38 @@ impl WrProgramBinaryDiskCache {
error!("shader-cache: Failed to deserialize program binary: {}", err);
}
};
} else {
info!("shader-cache: Program binary not found in disk cache");
}
}
pub fn try_load_startup_shaders_from_disk(&mut self, program_cache: &Rc<ProgramCache>) {
use std::time::{Instant};
let start = Instant::now();
// Load and parse the whitelist if it exists
let mut whitelist_path = self.cache_path.clone();
whitelist_path.push(WHITELIST_FILENAME);
let whitelist = match read_to_string(&whitelist_path) {
Ok(whitelist) => {
whitelist.split(WHITELIST_SEPARATOR).map(|s| s.to_string()).collect::<Vec<String>>()
}
Err(err) => {
info!("shader-cache: Could not read startup whitelist: {}", err);
Vec::new()
}
};
info!("Loaded startup shader whitelist in {:?}", start.elapsed());
self.cached_shader_filenames = read_dir(&self.cache_path)
.unwrap()
.map(|e| e.unwrap().file_name())
.filter(|e| e != WHITELIST_FILENAME)
.collect::<Vec<OsString>>();
// Load whitelisted program binaries if they exist
for entry in &whitelist {
self.try_load_shader_from_disk(&entry, program_cache);
let elapsed = start.elapsed();
info!("Loaded shader in {:?}", elapsed);
@ -200,7 +242,11 @@ impl WrProgramBinaryDiskCache {
(elapsed.subsec_nanos() / 1_000_000) as u64;
if elapsed_ms > MAX_LOAD_TIME_MS {
// Loading the startup shaders is taking too long, so bail out now.
// Additionally clear the list of remaining shaders cached on disk,
// so that we do not attempt to load any on demand during rendering.
error!("shader-cache: Timed out before finishing loads");
self.cached_shader_filenames.clear();
break;
}
}
@ -225,6 +271,11 @@ impl ProgramCacheObserver for WrProgramCacheObserver {
self.disk_cache.borrow_mut().update(entries);
}
fn try_load_shader_from_disk(&self, digest: &ProgramSourceDigest, program_cache: &Rc<ProgramCache>) {
let filename = format!("{}", digest);
self.disk_cache.borrow_mut().try_load_shader_from_disk(&filename, program_cache);
}
fn notify_program_binary_failed(&self, _program_binary: &Arc<ProgramBinary>) {
error!("shader-cache: Failed program_binary");
}
@ -260,9 +311,9 @@ impl WrProgramCache {
&self.program_cache
}
pub fn try_load_from_disk(&self) {
pub fn try_load_startup_shaders_from_disk(&self) {
if let Some(ref disk_cache) = self.disk_cache {
disk_cache.borrow_mut().try_load_from_disk(&self.program_cache);
disk_cache.borrow_mut().try_load_startup_shaders_from_disk(&self.program_cache);
} else {
error!("shader-cache: Shader disk cache is not supported");
}

199
gfx/wr/Cargo.lock generated
View File

@ -18,7 +18,7 @@ name = "andrew"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rusttype 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -124,7 +124,7 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.0.3"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -174,6 +174,9 @@ dependencies = [
name = "cc"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cfg-if"
@ -196,7 +199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -209,7 +212,7 @@ name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -225,27 +228,43 @@ name = "cocoa"
version = "0.18.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "compositor"
version = "0.1.0"
dependencies = [
"compositor-windows 0.1.0",
"gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender 0.60.0",
]
[[package]]
name = "compositor-windows"
version = "0.1.0"
dependencies = [
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation"
version = "0.6.0"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -253,8 +272,8 @@ name = "core-graphics"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -264,8 +283,8 @@ name = "core-graphics"
version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -275,7 +294,7 @@ name = "core-text"
version = "10.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@ -286,7 +305,7 @@ name = "core-text"
version = "13.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@ -414,7 +433,7 @@ version = "0.1.0"
dependencies = [
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender 0.60.0",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -500,7 +519,7 @@ name = "font-loader"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@ -541,7 +560,7 @@ name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -577,17 +596,17 @@ dependencies = [
[[package]]
name = "gl_generator"
version = "0.9.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gl_generator"
version = "0.11.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -611,7 +630,7 @@ dependencies = [
"android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_egl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -624,7 +643,7 @@ dependencies = [
"objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -753,11 +772,6 @@ dependencies = [
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "khronos_api"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "khronos_api"
version = "3.1.0"
@ -837,12 +851,12 @@ dependencies = [
[[package]]
name = "malloc_size_of_derive"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -911,12 +925,13 @@ dependencies = [
[[package]]
name = "mozangle"
version = "0.1.7"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -929,24 +944,12 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nix"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nix"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1065,18 +1068,18 @@ name = "peek-poke"
version = "0.2.0"
dependencies = [
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"peek-poke-derive 0.2.0",
"peek-poke-derive 0.2.1",
]
[[package]]
name = "peek-poke-derive"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1110,7 +1113,7 @@ name = "png"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deflate 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)",
"inflate 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1507,14 +1510,14 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-protocols 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1560,17 +1563,6 @@ dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.12.1"
@ -1748,15 +1740,15 @@ dependencies = [
[[package]]
name = "wayland-client"
version = "0.21.10"
version = "0.21.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1771,21 +1763,23 @@ dependencies = [
[[package]]
name = "wayland-protocols"
version = "0.21.10"
version = "0.21.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wayland-scanner"
version = "0.21.10"
version = "0.21.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1804,10 +1798,10 @@ version = "0.60.0"
dependencies = [
"base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1820,8 +1814,8 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1846,6 +1840,7 @@ name = "webrender-examples"
version = "0.1.0"
dependencies = [
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1860,14 +1855,14 @@ name = "webrender_api"
version = "0.60.0"
dependencies = [
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.99.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"peek-poke 0.2.0",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1936,9 +1931,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1947,7 +1942,7 @@ dependencies = [
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1969,7 +1964,7 @@ dependencies = [
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1981,7 +1976,7 @@ dependencies = [
"image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"osmesa-src 0.1.1 (git+https://github.com/servo/osmesa-src)",
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2036,14 +2031,6 @@ name = "xdg"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "xml-rs"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "xml-rs"
version = "0.8.0"
@ -2078,7 +2065,7 @@ dependencies = [
"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2"
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
"checksum bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bda13183df33055cbb84b847becce220d392df502ebe7a4a78d7021771ed94d0"
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
"checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d"
"checksum block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc4358306e344bf9775d0197fd00d2603e5afb0771bb353538630f022068ea3"
@ -2092,8 +2079,8 @@ dependencies = [
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "95470235c31c726d72bf2e1f421adc1e65b9d561bf5529612cbe1a72da1467b3"
"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b"
"checksum core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7caa6cb9e76ddddbea09a03266d6b3bc98cd41e9fb9b017c473e7cca593ec25"
"checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a"
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
"checksum core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c4ab33705fa1fc8af375bb7929d68e1c1546c1ecef408966d8c3e49a1d84a"
"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9"
"checksum core-text 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f59bff773954e5cd058a3f5983406b52bec7cc65202bef340ba64a0c40ac91"
@ -2132,7 +2119,7 @@ dependencies = [
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
"checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd"
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
"checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a"
"checksum gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7f46fd8874e043ffac0d638ed1567a2584f7814f6d72b4db37ab1689004a26c4"
"checksum glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb26027a84c3b9e1949ef0df0b6a3db8d0c124243a5c161ea25c7def90cb1474"
"checksum glutin_egl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23f48987ab6cb2b61ad903b59e54a2fd0c380a7baff68cffd6826b69a73dd326"
@ -2149,7 +2136,6 @@ dependencies = [
"checksum ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79d98ee7dd1d2e796d254807fd86ea7189d07571aeaa74007603e29a79d15217"
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
"checksum khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
@ -2162,7 +2148,7 @@ dependencies = [
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"
"checksum malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e37c5d4cd9473c5f4c9c111f033f15d4df9bd378fdf615944e360a4f55a05f0b"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
@ -2170,9 +2156,8 @@ dependencies = [
"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432"
"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "45a8a18a41cfab0fde25cc2f43ea89064d211a0fbb33225b8ff93ab20406e0e7"
"checksum mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b74826530a7c9fffbe28d27d0499433bd51f67b4f45d658ba23e62499307cc17"
"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0"
"checksum nix 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "319fffb13b63c0f4ff5a4e1c97566e7e741561ff5d03bf8bbf11653454bbd70b"
"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce"
"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2"
"checksum num-integer 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac0ea58d64a89d9d6b7688031b3be9358d6c919badcf7fbb0527ccfd891ee45"
@ -2245,7 +2230,6 @@ dependencies = [
"checksum svg_fmt 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c666f0fed8e1e20e057af770af9077d72f3d5a33157b8537c1475dd8ffd6d32b"
"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b"
"checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83"
@ -2269,10 +2253,10 @@ dependencies = [
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45"
"checksum wayland-client 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4e519a7a979ddf97ee25c07830bd10b2c466b3b904b8ad4a05b4eee58c1a4e"
"checksum wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713"
"checksum wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec"
"checksum wayland-protocols 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)" = "e634e68e5b759cb549410ae1f25aab3c77cdc8f861aed9d0e86c2bd74efcb086"
"checksum wayland-scanner 0.21.10 (registry+https://github.com/rust-lang/crates.io-index)" = "1c8b867a824057b856790776e7cee37daf0435fc06543f2d96b2e37d15322e99"
"checksum wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145"
"checksum wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3828c568714507315ee425a9529edc4a4aa9901409e373e9e0027e7622b79e"
"checksum wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
@ -2286,7 +2270,6 @@ dependencies = [
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
"checksum x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "940586acb859ea05c53971ac231685799a7ec1dee66ac0bccc0e6ad96e06b4e3"
"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"
"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e"

View File

@ -5,6 +5,7 @@ members = [
"webrender",
"webrender_api",
"wrench",
"example-compositor/compositor",
]
[profile.release]

View File

@ -35,4 +35,5 @@ pushd examples
cargo build ${CARGOFLAGS}
popd
cargo test ${CARGOFLAGS} --all
cargo test ${CARGOFLAGS} \
--all --exclude compositor-windows --exclude compositor

View File

@ -41,4 +41,5 @@ pushd examples
cargo check ${CARGOFLAGS}
popd
cargo test ${CARGOFLAGS} ${CARGOTESTFLAGS} --all
cargo test ${CARGOFLAGS} ${CARGOTESTFLAGS} \
--all --exclude compositor-windows --exclude compositor

View File

@ -8,7 +8,7 @@ edition = "2018"
[target.'cfg(windows)'.dependencies]
euclid = "0.20"
gleam = "0.6.2"
mozangle = {version = "0.1", features = ["egl"]}
mozangle = {version = "0.3.1", features = ["egl"]}
webrender = {path = "../webrender"}
winapi = {version = "0.3", features = ["winerror", "d3d11", "dcomp"]}
winit = "0.19"

View File

@ -0,0 +1,9 @@
[package]
name = "compositor-windows"
version = "0.1.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
edition = "2018"
license = "MPL-2.0"
[build-dependencies]
cc = "1.0"

View File

@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
fn main() {
// HACK - This build script relies on Gecko having been built, so that the ANGLE libraries
// have already been compiled. It also assumes they are being built with an in-tree
// x86_64 object directory.
cc::Build::new()
.file("src/lib.cpp")
.include("../../../angle/checkout/include")
.compile("windows");
// Set up linker paths for ANGLE that is built by Gecko
println!("cargo:rustc-link-search=../../obj-x86_64-pc-mingw32/gfx/angle/targets/libEGL");
println!("cargo:rustc-link-search=../../obj-x86_64-pc-mingw32/gfx/angle/targets/libGLESv2");
// Link to libEGL and libGLESv2 (ANGLE) and D3D11 + DirectComposition
println!("cargo:rustc-link-lib=libEGL");
println!("cargo:rustc-link-lib=libGLESv2");
println!("cargo:rustc-link-lib=dcomp");
println!("cargo:rustc-link-lib=d3d11");
}

View File

@ -0,0 +1,470 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define UNICODE
#include <windows.h>
#include <math.h>
#include <dcomp.h>
#include <d3d11.h>
#include <assert.h>
#include <map>
#define EGL_EGL_PROTOTYPES 1
#define EGL_EGLEXT_PROTOTYPES 1
#include "EGL/egl.h"
#include "EGL/eglext.h"
#include "EGL/eglext_angle.h"
#include "GL/gl.h"
// The OS compositor representation of a picture cache tile.
struct Tile {
// Represents the underlying DirectComposition surface texture that gets drawn into.
IDCompositionSurface *pSurface;
// Represents the node in the visual tree that defines the properties of this tile (clip, position etc).
IDCompositionVisual *pVisual;
};
struct Window {
// Win32 window details
HWND hWnd;
HINSTANCE hInstance;
int width;
int height;
bool enable_compositor;
RECT client_rect;
// Main interfaces to D3D11 and DirectComposition
ID3D11Device *pD3D11Device;
IDCompositionDevice *pDCompDevice;
IDCompositionTarget *pDCompTarget;
IDXGIDevice *pDXGIDevice;
// ANGLE interfaces that wrap the D3D device
EGLDeviceEXT EGLDevice;
EGLDisplay EGLDisplay;
EGLContext EGLContext;
EGLConfig config;
// Framebuffer surface for debug mode when we are not using DC
EGLSurface fb_surface;
// The currently bound surface, valid during bind() and unbind()
EGLSurface current_surface;
IDCompositionSurface *pCurrentSurface;
// The root of the DC visual tree. Nothing is drawn on this, but
// all child tiles are parented to here.
IDCompositionVisual *pRoot;
// Maps the WR surface IDs to the DC representation of each tile.
std::map<uint64_t, Tile> tiles;
};
static const wchar_t *CLASS_NAME = L"WR DirectComposite";
static LRESULT CALLBACK WndProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam
) {
switch (message) {
case WM_DESTROY:
PostQuitMessage(0);
return 1;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
extern "C" {
Window *com_dc_create_window(int width, int height, bool enable_compositor) {
// Create a simple Win32 window
Window *window = new Window;
window->hInstance = GetModuleHandle(NULL);
window->width = width;
window->height = height;
window->enable_compositor = enable_compositor;
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = window->hInstance;
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);;
wcex.lpszMenuName = nullptr;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.lpszClassName = CLASS_NAME;
RegisterClassEx(&wcex);
int dpiX = 0;
int dpiY = 0;
HDC hdc = GetDC(NULL);
if (hdc) {
dpiX = GetDeviceCaps(hdc, LOGPIXELSX);
dpiY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
}
window->hWnd = CreateWindow(
CLASS_NAME,
L"DirectComposition Demo Application",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
static_cast<UINT>(ceil(float(width) * dpiX / 96.f)),
static_cast<UINT>(ceil(float(height) * dpiY / 96.f)),
NULL,
NULL,
window->hInstance,
NULL
);
ShowWindow(window->hWnd, SW_SHOWNORMAL);
UpdateWindow(window->hWnd);
GetClientRect(window->hWnd, &window->client_rect);
// Create a D3D11 device
D3D_FEATURE_LEVEL featureLevelSupported;
HRESULT hr = D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
NULL,
0,
D3D11_SDK_VERSION,
&window->pD3D11Device,
&featureLevelSupported,
nullptr
);
assert(SUCCEEDED(hr));
hr = window->pD3D11Device->QueryInterface(&window->pDXGIDevice);
assert(SUCCEEDED(hr));
// Create a DirectComposition device
hr = DCompositionCreateDevice(
window->pDXGIDevice,
__uuidof(IDCompositionDevice),
(void **) &window->pDCompDevice
);
assert(SUCCEEDED(hr));
// Create a DirectComposition target for a Win32 window handle
hr = window->pDCompDevice->CreateTargetForHwnd(
window->hWnd,
TRUE,
&window->pDCompTarget
);
assert(SUCCEEDED(hr));
// Create an ANGLE EGL device that wraps D3D11
window->EGLDevice = eglCreateDeviceANGLE(
EGL_D3D11_DEVICE_ANGLE,
window->pD3D11Device,
nullptr
);
EGLint display_attribs[] = {
EGL_NONE
};
window->EGLDisplay = eglGetPlatformDisplayEXT(
EGL_PLATFORM_DEVICE_EXT,
window->EGLDevice,
display_attribs
);
eglInitialize(
window->EGLDisplay,
nullptr,
nullptr
);
EGLint num_configs = 0;
EGLint cfg_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_NONE
};
EGLConfig configs[32];
eglChooseConfig(
window->EGLDisplay,
cfg_attribs,
configs,
sizeof(configs) / sizeof(EGLConfig),
&num_configs
);
assert(num_configs > 0);
window->config = configs[0];
if (window->enable_compositor) {
window->fb_surface = EGL_NO_SURFACE;
} else {
window->fb_surface = eglCreateWindowSurface(
window->EGLDisplay,
window->config,
window->hWnd,
NULL
);
assert(window->fb_surface != EGL_NO_SURFACE);
}
EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
// Create an EGL context that can be used for drawing
window->EGLContext = eglCreateContext(
window->EGLDisplay,
window->config,
EGL_NO_CONTEXT,
ctx_attribs
);
// Create the root of the DirectComposition visual tree
hr = window->pDCompDevice->CreateVisual(&window->pRoot);
assert(SUCCEEDED(hr));
hr = window->pDCompTarget->SetRoot(window->pRoot);
assert(SUCCEEDED(hr));
EGLBoolean ok = eglMakeCurrent(
window->EGLDisplay,
window->fb_surface,
window->fb_surface,
window->EGLContext
);
assert(ok);
return window;
}
void com_dc_destroy_window(Window *window) {
for (auto it=window->tiles.begin() ; it != window->tiles.end() ; ++it) {
it->second.pSurface->Release();
it->second.pVisual->Release();
}
if (window->fb_surface != EGL_NO_SURFACE) {
eglDestroySurface(window->EGLDisplay, window->fb_surface);
}
eglDestroyContext(window->EGLDisplay, window->EGLContext);
eglTerminate(window->EGLDisplay);
eglReleaseDeviceANGLE(window->EGLDevice);
window->pRoot->Release();
window->pD3D11Device->Release();
window->pDXGIDevice->Release();
window->pDCompDevice->Release();
window->pDCompTarget->Release();
CloseWindow(window->hWnd);
UnregisterClass(CLASS_NAME, window->hInstance);
delete window;
}
bool com_dc_tick(Window *window) {
// Check and dispatch the windows event loop
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
return false;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return true;
}
void com_dc_swap_buffers(Window *window) {
// If not using DC mode, then do a normal EGL swap buffers.
if (window->fb_surface != EGL_NO_SURFACE) {
eglSwapBuffers(window->EGLDisplay, window->fb_surface);
}
}
// Create a new DC surface
void com_dc_create_surface(
Window *window,
uint64_t id,
int width,
int height
) {
assert(window->tiles.count(id) == 0);
Tile tile;
// Create the video memory surface.
// TODO(gw): We should set alpha mode appropriately so that DC
// can do opaque composites when possible!
HRESULT hr = window->pDCompDevice->CreateSurface(
width,
height,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_ALPHA_MODE_PREMULTIPLIED,
&tile.pSurface
);
assert(SUCCEEDED(hr));
// Create the visual node in the DC tree that stores properties
hr = window->pDCompDevice->CreateVisual(&tile.pVisual);
assert(SUCCEEDED(hr));
// Bind the surface memory to this visual
hr = tile.pVisual->SetContent(tile.pSurface);
assert(SUCCEEDED(hr));
window->tiles[id] = tile;
}
void com_dc_destroy_surface(
Window *window,
uint64_t id
) {
assert(window->tiles.count(id) == 1);
// Release the video memory and visual in the tree
Tile &tile = window->tiles[id];
tile.pVisual->Release();
tile.pSurface->Release();
window->tiles.erase(id);
}
// Bind a DC surface to allow issuing GL commands to it
void com_dc_bind_surface(
Window *window,
uint64_t id,
int *x_offset,
int *y_offset
) {
assert(window->tiles.count(id) == 1);
Tile &tile = window->tiles[id];
// Store the current surface for unbinding later
window->pCurrentSurface = tile.pSurface;
// Inform DC that we want to draw on this surface. DC uses texture
// atlases when the tiles are small. It returns an offset where the
// client code must draw into this surface when this happens.
POINT offset;
D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D *pTexture;
HRESULT hr = tile.pSurface->BeginDraw(
NULL,
__uuidof(ID3D11Texture2D),
(void **) &pTexture,
&offset
);
assert(SUCCEEDED(hr));
pTexture->GetDesc(&desc);
// Construct an EGL off-screen surface that is bound to the DC surface
EGLint buffer_attribs[] = {
EGL_WIDTH, desc.Width,
EGL_HEIGHT, desc.Height,
EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE, EGL_TRUE,
EGL_NONE
};
window->current_surface = eglCreatePbufferFromClientBuffer(
window->EGLDisplay,
EGL_D3D_TEXTURE_ANGLE,
pTexture,
window->config,
buffer_attribs
);
assert(window->current_surface != EGL_NO_SURFACE);
// Make EGL current on the DC surface
EGLBoolean ok = eglMakeCurrent(
window->EGLDisplay,
window->current_surface,
window->current_surface,
window->EGLContext
);
assert(ok);
*x_offset = offset.x;
*y_offset = offset.y;
}
// Unbind a currently bound DC surface
void com_dc_unbind_surface(Window *window) {
HRESULT hr = window->pCurrentSurface->EndDraw();
assert(SUCCEEDED(hr));
eglDestroySurface(window->EGLDisplay, window->current_surface);
}
// At the start of a transaction, remove all visuals from the tree.
// TODO(gw): This is super simple, maybe it has performance implications
// and we should mutate the visual tree instead of rebuilding
// it each composition?
void com_dc_begin_transaction(Window *window) {
HRESULT hr = window->pRoot->RemoveAllVisuals();
assert(SUCCEEDED(hr));
}
// Add a DC surface to the visual tree. Called per-frame to build the composition.
void com_dc_add_surface(
Window *window,
uint64_t id,
int x,
int y,
int clip_x,
int clip_y,
int clip_w,
int clip_h
) {
Tile &tile = window->tiles[id];
// Add this visual as the last element in the visual tree (z-order is implicit,
// based on the order tiles are added).
HRESULT hr = window->pRoot->AddVisual(
tile.pVisual,
FALSE,
NULL
);
assert(SUCCEEDED(hr));
// Place the visual - this changes frame to frame based on scroll position
// of the slice.
int offset_x = x + window->client_rect.left;
int offset_y = y + window->client_rect.top;
tile.pVisual->SetOffsetX(offset_x);
tile.pVisual->SetOffsetY(offset_y);
// Set the clip rect - converting from world space to the pre-offset space
// that DC requires for rectangle clips.
D2D_RECT_F clip_rect;
clip_rect.left = clip_x - offset_x;
clip_rect.top = clip_y - offset_y;
clip_rect.right = clip_rect.left + clip_w;
clip_rect.bottom = clip_rect.top + clip_h;
tile.pVisual->SetClip(clip_rect);
}
// Finish the composition transaction, telling DC to composite
void com_dc_end_transaction(Window *window) {
HRESULT hr = window->pDCompDevice->Commit();
assert(SUCCEEDED(hr));
}
// Get a pointer to an EGL symbol
void *com_dc_get_proc_address(const char *name) {
return eglGetProcAddress(name);
}
}

View File

@ -0,0 +1,184 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::os::raw::{c_void, c_char};
/*
This is a very simple (and unsafe!) rust wrapper for the DirectComposite / D3D11 / ANGLE
implementation in lib.cpp.
It just proxies the calls from the Compositor impl to the C99 code. This is very
hacky and not suitable for production!
*/
// Opaque wrapper for the Window type in lib.cpp
#[repr(C)]
pub struct Window {
_unused: [u8; 0]
}
// C99 functions that do the compositor work
extern {
fn com_dc_create_window(width: i32, height: i32, enable_compositor: bool) -> *mut Window;
fn com_dc_destroy_window(window: *mut Window);
fn com_dc_tick(window: *mut Window) -> bool;
fn com_dc_get_proc_address(name: *const c_char) -> *const c_void;
fn com_dc_swap_buffers(window: *mut Window);
fn com_dc_create_surface(
window: *mut Window,
id: u64,
width: i32,
height: i32,
);
fn com_dc_destroy_surface(
window: *mut Window,
id: u64,
);
fn com_dc_bind_surface(
window: *mut Window,
id: u64,
x_offset: &mut i32,
y_offset: &mut i32,
);
fn com_dc_unbind_surface(window: *mut Window);
fn com_dc_begin_transaction(window: *mut Window);
fn com_dc_add_surface(
window: *mut Window,
id: u64,
x: i32,
y: i32,
clip_x: i32,
clip_y: i32,
clip_w: i32,
clip_h: i32,
);
fn com_dc_end_transaction(window: *mut Window);
}
pub fn create_window(width: i32, height: i32, enable_compositor: bool) -> *mut Window {
unsafe {
com_dc_create_window(width, height, enable_compositor)
}
}
pub fn destroy_window(window: *mut Window) {
unsafe {
com_dc_destroy_window(window);
}
}
pub fn tick(window: *mut Window) -> bool {
unsafe {
com_dc_tick(window)
}
}
pub fn get_proc_address(name: *const c_char) -> *const c_void {
unsafe {
com_dc_get_proc_address(name)
}
}
pub fn create_surface(
window: *mut Window,
id: u64,
width: i32,
height: i32,
) {
unsafe {
com_dc_create_surface(
window,
id,
width,
height
)
}
}
pub fn destroy_surface(
window: *mut Window,
id: u64,
) {
unsafe {
com_dc_destroy_surface(
window,
id,
)
}
}
pub fn bind_surface(
window: *mut Window,
id: u64,
) -> (i32, i32) {
unsafe {
let mut x_offset = 0;
let mut y_offset = 0;
com_dc_bind_surface(
window,
id,
&mut x_offset,
&mut y_offset,
);
(x_offset, y_offset)
}
}
pub fn add_surface(
window: *mut Window,
id: u64,
x: i32,
y: i32,
clip_x: i32,
clip_y: i32,
clip_w: i32,
clip_h: i32,
) {
unsafe {
com_dc_add_surface(
window,
id,
x,
y,
clip_x,
clip_y,
clip_w,
clip_h,
)
}
}
pub fn begin_transaction(window: *mut Window) {
unsafe {
com_dc_begin_transaction(window)
}
}
pub fn unbind_surface(window: *mut Window) {
unsafe {
com_dc_unbind_surface(window)
}
}
pub fn end_transaction(window: *mut Window) {
unsafe {
com_dc_end_transaction(window)
}
}
pub fn swap_buffers(window: *mut Window) {
unsafe {
com_dc_swap_buffers(window);
}
}

View File

@ -0,0 +1,13 @@
[package]
name = "compositor"
version = "0.1.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
edition = "2018"
license = "MPL-2.0"
[dependencies]
webrender = { path = "../../webrender" }
gleam = "0.6.2"
[target.'cfg(windows)'.dependencies]
compositor-windows = { path = "../compositor-windows" }

View File

@ -0,0 +1,231 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
An example of how to implement the Compositor trait that
allows picture caching surfaces to be composited by the operating
system.
The current example supports DirectComposite on Windows only.
*/
use gleam::gl;
use std::ffi::CString;
use std::sync::mpsc;
use webrender::api::*;
use webrender::api::units::*;
#[cfg(target_os = "windows")]
use compositor_windows as compositor;
// A very hacky integration with DirectComposite. It proxies calls from the compositor
// interface to a simple C99 library which does the DirectComposition / D3D11 / ANGLE
// interfacing. This is a very unsafe impl due to the way the window pointer is passed
// around!
struct DirectCompositeInterface {
window: *mut compositor::Window,
}
impl DirectCompositeInterface {
fn new(window: *mut compositor::Window) -> Self {
DirectCompositeInterface {
window,
}
}
}
impl webrender::Compositor for DirectCompositeInterface {
fn create_surface(
&mut self,
id: webrender::NativeSurfaceId,
size: DeviceIntSize,
) {
compositor::create_surface(self.window, id.0, size.width, size.height);
}
fn destroy_surface(
&mut self,
id: webrender::NativeSurfaceId,
) {
compositor::destroy_surface(self.window, id.0);
}
fn bind(
&mut self,
id: webrender::NativeSurfaceId,
) -> DeviceIntPoint {
let (x, y) = compositor::bind_surface(
self.window,
id.0,
);
DeviceIntPoint::new(x, y)
}
fn unbind(&mut self) {
compositor::unbind_surface(self.window);
}
fn begin_frame(&mut self) {
compositor::begin_transaction(self.window);
}
fn add_surface(
&mut self,
id: webrender::NativeSurfaceId,
position: DeviceIntPoint,
clip_rect: DeviceIntRect,
) {
compositor::add_surface(
self.window,
id.0,
position.x,
position.y,
clip_rect.origin.x,
clip_rect.origin.y,
clip_rect.size.width,
clip_rect.size.height,
);
}
fn end_frame(&mut self) {
compositor::end_transaction(self.window);
}
}
// Simplisitic implementation of the WR notifier interface to know when a frame
// has been prepared and can be rendered.
struct Notifier {
tx: mpsc::Sender<()>,
}
impl Notifier {
fn new(tx: mpsc::Sender<()>) -> Self {
Notifier {
tx,
}
}
}
impl RenderNotifier for Notifier {
fn clone(&self) -> Box<dyn RenderNotifier> {
Box::new(Notifier {
tx: self.tx.clone()
})
}
fn wake_up(&self) {
}
fn new_frame_ready(&self,
_: DocumentId,
_scrolled: bool,
_composite_needed: bool,
_render_time: Option<u64>) {
self.tx.send(()).ok();
}
}
fn main() {
// If true, use DirectComposition. If false, this will fall back to normal
// WR compositing of picture caching tiles, which can be used to check
// correctness of implementation.
let enable_compositor = true;
// Load GL, construct WR and the native compositor interface.
let device_size = DeviceIntSize::new(1024, 1024);
let window = compositor::create_window(
device_size.width,
device_size.height,
enable_compositor,
);
let debug_flags = DebugFlags::empty();
let native_compositor: Option<Box<dyn webrender::Compositor>> = if enable_compositor {
Some(Box::new(DirectCompositeInterface::new(window)))
} else {
None
};
let opts = webrender::RendererOptions {
clear_color: Some(ColorF::new(1.0, 1.0, 1.0, 1.0)),
debug_flags,
enable_picture_caching: true,
native_compositor,
..webrender::RendererOptions::default()
};
let (tx, rx) = mpsc::channel();
let notifier = Box::new(Notifier::new(tx));
let gl = unsafe {
gl::GlesFns::load_with(
|symbol| {
let symbol = CString::new(symbol).unwrap();
let ptr = compositor::get_proc_address(symbol.as_ptr());
ptr
}
)
};
let (mut renderer, sender) = webrender::Renderer::new(
gl.clone(),
notifier,
opts,
None,
device_size,
).unwrap();
let api = sender.create_api();
let document_id = api.add_document(device_size, 0);
let device_pixel_ratio = 1.0;
let mut current_epoch = Epoch(0);
let root_pipeline_id = PipelineId(0, 0);
// Kick off first transaction which will mean we get a notify below to build the DL and render.
let mut txn = Transaction::new();
txn.set_root_pipeline(root_pipeline_id);
txn.generate_frame();
api.send_transaction(document_id, txn);
// Tick the compositor (in this sample, we don't block on UI events)
while compositor::tick(window) {
// If there is a new frame ready to draw
if let Ok(..) = rx.try_recv() {
// Update and render. This will invoke the native compositor interface implemented above
// as required.
renderer.update();
renderer.render(device_size).unwrap();
let _ = renderer.flush_pipeline_info();
// Construct a simple display list that can be drawn and composited by DC.
let layout_size = device_size.to_f32() / euclid::Scale::new(device_pixel_ratio);
let mut txn = Transaction::new();
let mut root_builder = DisplayListBuilder::new(root_pipeline_id, layout_size);
let bg_rect = LayoutRect::new(LayoutPoint::new(100.0, 100.0), LayoutSize::new(800.0, 600.0));
root_builder.push_rect(
&CommonItemProperties::new(
bg_rect,
SpaceAndClipInfo {
spatial_id: SpatialId::root_scroll_node(root_pipeline_id),
clip_id: ClipId::root(root_pipeline_id),
},
),
ColorF::new(0.3, 0.3, 0.3, 1.0),
);
txn.set_display_list(
current_epoch,
None,
layout_size,
root_builder.finalize(),
true,
);
txn.generate_frame();
api.send_transaction(document_id, txn);
current_epoch.0 += 1;
// This does nothing when native compositor is enabled
compositor::swap_buffers(window);
}
}
renderer.deinit();
compositor::destroy_window(window);
}

View File

@ -66,3 +66,6 @@ glutin = "0.21"
rayon = "1"
webrender = { path = "../webrender" }
winit = "0.19"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.6.4"

View File

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate env_logger;
extern crate euclid;
use gleam::gl;
use glutin;
use std::env;
@ -108,6 +105,17 @@ pub fn main_wrapper<E: Example>(
) {
env_logger::init();
#[cfg(target_os = "macos")]
{
use core_foundation::{self as cf, base::TCFType};
let i = cf::bundle::CFBundle::main_bundle().info_dictionary();
let mut i = unsafe { i.to_mutable() };
i.set(
cf::string::CFString::new("NSSupportsAutomaticGraphicsSwitching"),
cf::boolean::CFBoolean::true_value().into_CFType(),
);
}
let args: Vec<String> = env::args().collect();
let res_path = if args.len() > 1 {
Some(PathBuf::from(&args[1]))

View File

@ -1,6 +1,6 @@
[package]
name = "peek-poke-derive"
version = "0.2.0"
version = "0.2.1"
authors = ["Dan Glastonbury <dan.glastonbury@gmail.com>"]
license = "MIT/Apache-2.0"
edition = "2018"
@ -14,4 +14,4 @@ proc-macro2 = "1"
quote = "1"
syn = "1"
synstructure = "0.12"
unicode-xid = "0.1"
unicode-xid = "0.2"

View File

@ -6,26 +6,22 @@ check-alphabetical-order = false
[ignore]
# Ignored packages with duplicated versions
packages = [
"core-graphics",
"core-text",
"crossbeam-utils",
"gl_generator",
"khronos_api",
"lazy_static",
"nix",
"percent-encoding",
"rand",
"rand_core",
"winapi",
"core-graphics",
"core-text",
"xml-rs",
"yaml-rust",
# These are tracked in bug 1587468, see there for pending work.
"syn",
"quote",
"unicode-xid",
"synstructure",
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
# Files that are ignored for all tidy and lint checks.

View File

@ -25,7 +25,7 @@ webrender_build = { version = "0.0.1", path = "../webrender_build" }
[dependencies]
base64 = { optional = true, version = "0.10" }
bincode = "1.0"
bitflags = "1.0"
bitflags = "1.2"
byteorder = "1.0"
cfg-if = "0.1.2"
cstr = "0.1.2"
@ -54,7 +54,7 @@ ws = { optional = true, version = "0.9" }
svg_fmt = "0.4"
[dev-dependencies]
mozangle = "0.1"
mozangle = "0.3.1"
rand = "0.4"
[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]

View File

@ -0,0 +1,44 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Composite a picture cache tile into the framebuffer.
#include shared
varying vec2 vUv;
flat varying vec4 vColor;
flat varying float vLayer;
#ifdef WR_VERTEX_SHADER
in vec4 aDeviceRect;
in vec4 aDeviceClipRect;
in vec4 aColor;
in float aLayer;
in float aZId;
void main(void) {
// Get world position
vec2 world_pos = aDeviceRect.xy + aPosition.xy * aDeviceRect.zw;
// Clip the position to the world space clip rect
vec2 clipped_world_pos = clamp(world_pos, aDeviceClipRect.xy, aDeviceClipRect.xy + aDeviceClipRect.zw);
// Derive the normalized UV from the clipped vertex position
vUv = (clipped_world_pos - aDeviceRect.xy) / aDeviceRect.zw;
// Pass through color and texture array layer
vColor = aColor;
vLayer = aLayer;
gl_Position = uTransform * vec4(clipped_world_pos, aZId, 1.0);
}
#endif
#ifdef WR_FRAGMENT_SHADER
void main(void) {
// The color is just the texture sample modulated by a supplied color
vec4 texel = textureLod(sColor0, vec3(vUv, vLayer), 0.0);
vec4 color = vColor * texel;
write_output(color);
}
#endif

Some files were not shown because too many files have changed in this diff Show More