Commit graph

30 commits

Author SHA1 Message Date
Martin Robinson
aa0029c11c
Add rust-version to all Cargo.toml files (#33483)
This is another step preparing for building Servo without `mach`.

Fixes #33430.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-17 16:39:07 +00:00
Mukilan Thiyagarajan
a007baa4cf
deps: switch to tikv-jemallocator crates in Cargo.toml (#32828)
`jemallocator` and `jemallocator-sys` crates are same as the `tikv-*`
versions and these aliases were maintained for historical reasons, based
on crates.io documentation. For newer projects, it is recommended to use
the `tikv-` versions of the crate. Even though Servo is not a new
project, it makes sense to switch to the newer version for the sake of
clarity.

Also, more importantly, `tikv-jemallocator` has new release (0.6.0)
which includes a fix for #32720. There doesn't seem to be a
corresponding version publised for the `jemallocator` crate.

Fixes #32720

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-22 07:55:46 +00:00
Martin Robinson
4a7f3bac7c
Use workspace definitions for all crates and update to the 2021 edition (#32544) 2024-06-18 09:22:08 +00:00
Martin Robinson
e902d63732
deps: Switch from winapi to windows_sys in Servo code (#32516)
This is part of the switch from `winapi` to `windows-sys`. `windows-sys` is
maintained by Microsoft, so is more "official." More and more crates are
switching to it.
2024-06-17 08:27:50 +00:00
Mukilan Thiyagarajan
385f6f93bf
android: use jemalloc on Android (#32273)
This is a fix for the crash issue in 64-bit ARM [#32175][1].

When targeting Android 11 and above, 64-bit ARM platforms
have the 'Tagged Pointer' feature enabled by default which
causes memory allocated using the system allocator to have
a non-zero 'tag' set in the highest byte of heap addresses.

This is incompatible with SpiderMonkey which assumes that
only the bottom 48 bits are set and asserts this at various
points.

Both Servo and Gecko have a similar architecture where
the pointer to a heap allocated DOM struct is encoded as
a JS::Value and stored in the DOM_OBJECT_SLOT (reserved
slot) of the JSObject which reflects the native DOM struct.

As observed in #32175, even Gecko crashes with `jemalloc`
disabled which suggests that support for using the native
system allocator with tagged pointers enabled by default
is not present at the moment.

[1]: https://github.com/servo/servo/issues/32175

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-05-13 11:07:19 +00:00
Jonathan Schwender
ca064eaa51
Add font-fallback on OpenHarmony and fix several compilation issues (#32141)
* Add OpenHarmony support for allocator / profile

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* gfx: Build harfbuzz from source on OHOS

Updates `freetype-sys` to v0.20.1, which includes a build
fix for OpenHarmony.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* gfx: Don't depend on fontconfig on OpenHarmony

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* gfx: Add ohos font fallback

Hardcode HarmonyOS_Sans_SC_Regular for Chinese

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* libservo: OHOS useragent, and explicitly opt out of sandboxing

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* libservo: Disable get_native_media_display_and_gl_context on ohos

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-05-02 18:32:51 +00:00
Martin Robinson
38db1a5ce9
rustdoc: Add some basic Safety sections to unsafe functions (#31639) 2024-03-13 10:44:59 +00:00
Samson
11c16adcd1
Use libc::malloc_size on apple (#31602)
* Use libc::malloc_size on apple

* Unify malloc_usable_size under *mut _
2024-03-11 07:58:32 +00:00
eri
3a5ca785d3
clippy: fix warnings in various modules in components (#31568)
* clippy: fix warnings in various modules in components

* fix: unit tests

* fix: build on android

* fix: all samplers use new_boxed
2024-03-08 14:28:04 +00:00
Samson
9a9abe9152
Add use-system-allocator to not use jemalloc (#31443)
* Add `use-system-allocator` feature

* Allow `servo_allocator/use-system-allocator` on servoshell
2024-02-29 08:43:03 +00:00
Mukilan Thiyagarajan
d7de206dbd
Preliminary Android build support (#31086)
* Android build

* Fixes
* More fixes
  - Still failing in the linking step
* More work on getting linking working

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: use mozjs with ndk r25c. loads servo.org

more android build fixes.

* fix ./mach run for android and make it follow logs

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* add experimental logic for compositor pause/resume

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* pass DPI from android to simpleservo

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* ci: add android workflow

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* switch to ANDROID_SDK_ROOT and ANDROID_NDK_ROOT vars

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade gradle to 4.10.1

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade to gradle 5.1.1

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade to gradle 8 and agp 8

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* make compositing work again with external present

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: improve mach support for non-NixOS and CI

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fix sampler compilation bug introduced in #30490

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* ci: add android build to main workflow

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* gradle: set MinSdk = targetSdk = 30

NDK requires we compile against the minSdk API level
which is 30 in our case.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* add instructions for android in README.md

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: move servosurface to servoview

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: uncomment the mediasession callbacks on MainActivity

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: fix crash on MainAtivity.onDestroy

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: drop VR, arm 5 and unused code

This commit drops:
* support for google, oculusvr
* support for arm5 architecture

and also removes
* fakeld scripts
* unused java code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* cleanup shell.nix

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: add FIXMEs for gstreamer code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: remove commented code and debug logs

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* cleanup ServoView.java

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* mach: comment call to download gstreamer deps for android

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* disable bluetooth for jniapi as blurdroid is broken

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fixup! README.md

* fixup! remove change in Cargo.toml

* fixup! move shell variables together

* fixup! cleanup jniapi/Cargo.toml comments

* delete commented gstreamer related android code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* remove unused config variable in servbuild

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: more cleanup

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* force no_static_freetype only for android

* use actions to manage sdk, ndk and java

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* rename embedder event names to be more clear.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* link to startup crash issue

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fix lint issues

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade env_logger to 0.10 with duplicate exception

libservo and android_logger can use env_logger 0.10
but quickcheck is still stuck on 0.8 and has not seen
any activity in the last 2 years. This commit adds
a duplicate exception until the quickcheck dependency
can be upgraded (or replaced)

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: fix comments

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* disable jemalloc on android

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fixup! replace linux with android in cfg

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-22 13:00:15 +00:00
Martin Robinson
7964a4f582
Unfork and upgrade jemallocator (#30963)
This dependency was forked in ##20641 in order to fix the Android build.
Years have gone by and it's quite likely that many things have changed
in the Android toolchain and these dependencies. We can sort out this
issue when getting the Android build working -- or if all else fails,
disable jemalloc for Android. In the meantime, unfork the dependency and
upgrade it.

Fixes #20645.
2024-01-01 19:32:45 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Martin Robinson
2f4c47bfe7 Start the transition to workspace dependencies
This will ultimately make it simpler to update crate dependencies and
reduce duplicate when specifying requirements. Generally, this change
does not touch dependencies that are only used by a single crate. We
could consider moving them to workspace dependencies in the future.
2023-05-17 11:59:35 +02:00
Tomasz Miąsko
37af4f3f23 Update jemalloc-sys to 0.3.2 2019-11-20 00:00:00 +00:00
Anthony Ramine
600ce022dd Make Servo components use winapi 0.3 2019-01-16 14:29:53 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
9f9bf8f6bc Switch most crates to the 2018 edition 2018-11-06 16:12:04 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
kingdido999
b25a01f492 Format component allocator #21373 2018-08-16 15:44:54 +08:00
Simon Sapin
c94c2b6f76 Upgrade to rustc 1.28.0-nightly (b68432d56 2018-06-12) 2018-06-14 04:19:17 +02:00
Anthony Ramine
a553964123 Upgrade to rustc 1.28.0-nightly (524ad9b9e 2018-05-29)
Fixes https://github.com/servo/servo/issues/20844
2018-05-30 10:50:59 +02:00
Josh Matthews
e7979380ba Revert "Upgrade to rustc 1.27.0-nightly (8a37c75a3 2018-05-02)"
This reverts commit 46ad811017.
2018-05-18 11:44:47 -05:00
Simon Sapin
46ad811017 Upgrade to rustc 1.27.0-nightly (8a37c75a3 2018-05-02) 2018-05-04 11:38:45 +02:00
Simon Sapin
7dbc524207 Fork the jemallocator crate, fix for nightly-2018-04-15
CC https://github.com/alexcrichton/jemallocator/pull/40,
https://github.com/rust-lang/rust/pull/49669

The new version of jemallocator requires a more recent jemalloc
https://github.com/alexcrichton/jemallocator/pull/34
which doesn’t build on our current Android toolchain
https://github.com/jemalloc/jemalloc/issues/1175.

To avoid blocking on figuring that out, duplicate ~70 lines
from jemallocator and use the older jemalloc-sys directly.
2018-04-16 08:56:08 +02:00
Simon Sapin
6319ad0124 FreeType: don’t use usable_size() as deallocation size
Instead use C-level malloc()/free() so that the size doesn’t need
to be known during deallocation, since FreeType doesn’t provide it.

Hopefully fixes https://github.com/servo/servo/issues/19058
2017-10-30 18:22:30 +01:00
Simon Sapin
959ce482dd Stop relying on linking details of std’s default allocator
We’ve been bitten before by symbol names changing:
https://github.com/servo/heapsize/pull/46
and upstream is planning to stop using jemalloc by default:
https://github.com/rust-lang/rust/issues/33082#issuecomment-309781465

So use the (relatively) new `#[global_allocator]` attribute
to explicitly select the system allocator on Windows
and jemalloc (now in an external crate) on other platforms.
This choice matches current defaults.
2017-10-19 09:52:50 +02:00