Commit graph

62783 commits

Author SHA1 Message Date
Nico Weber 34a4d16776 AK: Add AK::SIMD::to_i8x4() 2024-08-06 23:00:32 -04:00
Dennis Camera b367479d00 AK: Fix {:c} formatter for big-endian 2024-08-06 23:03:10 +02:00
Ali Mohammad Pur 0b54579173 RequestServer: Make the ThreadPool global
Previously we made one thread pool per ipc client, which is excessive
and can eat up all the available fds very fast.

This is a manual port of commit 18499c4eac301db7e8915284f33766ca96cdeef2
from Ladybird.
2024-08-06 15:37:37 +02:00
Alec Murphy 041243c97a Presenter: Modify CSS to hide scrollbars
This PR modifies the style for the `slide` class generated in
`Presentation::render()` to hide the scrollbars.
2024-08-05 14:40:37 -04:00
Nico Weber efc6f8d7b7 Toolchain: Remove dependency on grealpath from BuildClang.sh
Regular `realpath` seems to work fine.

This removes the last coreutils dependency from BuildClang.sh.
It can now run on a system that has just ninja and cmake and Xcode
installed.

No intended behavior change.
2024-08-04 22:42:43 +02:00
Nico Weber d8cf885f89 Toolchain: Remove dependency on install from BuildClang.sh
Less code, and makes it easier to run this script on vanilla macOS.

No intended behavior change.
2024-08-04 22:42:43 +02:00
sdomi 7b65200b72 Ports/SDL2: Upgrade to 2.30.5
Co-Authored-By: EWouters <6179932+EWouters@users.noreply.github.com>
2024-08-04 16:42:32 -04:00
sdomi 05d0a03768 Ports/SuperTuxKart: Fix building on Clang
Removed redundant link flags from CXXFLAGS, which was necessary due to
clang treating them as errors. Additionally, removed legacy include
paths.
2024-08-04 11:11:18 -04:00
sdomi 4db8a0b964 Toolchain: Fix default library paths when building with clang
When building with the GNU toolchain, /usr/local/lib and
/usr/local/include are among the default search paths for the compiler
and linker. It seems that this is not the case for Clang/LLVM, and thus
some packages fail to build, while others silently drop optional deps.

This commit adds those paths back, fixing multiple packages at once.
Additionally, it removes legacy -I/-L includes in various Ports which
are no longer needed.

Co-Authored-By: Nico Weber <thakis@chromium.org>
2024-08-04 11:09:53 -04:00
Liav A. cb10f70394 Kernel: Change internal handling of filesystem-specific options
Instead of using a raw `KBuffer` and letting each implementation to
populating the specific flags on its own, we change things so we only
let each FileSystem implementation to validate the flag and its value
but then store it in a HashMap which its key is the flag name and
the value is a special new class called `FileSystemSpecificOption`
which wraps around `AK::Variant<...>`.

This approach has multiple advantages over the previous:
- It allows runtime inspection of what the user has set on a `MountFile`
  description for a specific filesystem.
- It ensures accidental overriding of filesystem specific option that
  was already set is not possible
- It removes ugly casting of a `KBuffer` contents to a strongly-typed
  values. Instead, a strongly-typed `AK::Variant` is used which ensures
  we always get a value without doing any casting.

Please note that we have removed support for ASCII string-oriented flags
as there were no actual use cases, and supporting such type would make
`FileSystemSpecificOption` more complicated unnecessarily for now.
2024-08-03 20:35:06 +02:00
Sergey Lisov f439f02083 LibELF: Fix incorrect treatment of DT_REL&DT_RELA
In the current code, these are treated as if they were a bitmap. They
are not, and (DT_REL & DT_RELA) is actually nonzero. This causes the
linker to treat all sections as having addends, which is not correct.
2024-08-03 19:33:42 +02:00
Linus Groh 6b4c300353 Ports: Update Python to 3.12.4
Released on 2024-06-06.
https://www.python.org/downloads/release/python-3124/
2024-08-02 23:06:23 -04:00
Andreas Kling 8a7d9a7b68 ImageDecoder: Pass decoded images as Gfx::Bitmap over IPC
Before this change, we were passing them as Gfx::ShareableBitmap. The
problem is that shareable bitmaps keep their underlying file descriptor
open, so that they can be shared again with someone else.

When a Gfx::Bitmap is decoded from an IPC message, the file descriptor
is closed and recovered immediately.

This fixes an issue where we'd accumulate one file descriptor for every
image decoded. This eventually led to descriptor starvation after enough
images were loaded and still referenced at the same time.

(cherry picked from commit 166e603c5eb0a103eea148baf97a075fe5fea964)
2024-08-02 09:04:13 -04:00
Andreas Kling 1270daca0e LibGfx: Add ability to pass NonnullRefPtr<Gfx::Bitmap> over IPC
(cherry picked from commit 9f1a853cc83a08ece3fa949a637c8b9f1bbb142c;
amended to also serialize scale factor)
2024-08-02 09:04:13 -04:00
Aliaksandr Kalenik 7a88c19975 LibGfx: Add release callback for Bitmap
In upcoming changes, bitmap is going to be used to wrap the memory of
the IOSurface, and we will want to release the corresponding IOSurface
along with the bitmap.

(cherry picked from commit 3110411c60f0c5f9860ba9de4d229e246afadb62;
amended to fix trivial conflicts arising from serenityos still having an
`intrinsic_scale` argument that ladybird removed. We don't need this
commit for IOSurfaces, but for the use added in
LadybirdBrowser/ladybird#688)
2024-08-02 09:04:13 -04:00
sideshowbarker 38ea81c312 LibGfx: Handle UTF-16-encoded OpenType font names
This change makes OpenType::Name::string_for_id handle fonts whose names
are UTF-16-encoded (along with handling UTF-8-encoded names).

Otherwise, without this change, the existing code assumes the names are
UTF-8-encoded, fails gracelessly if they’re not, and crashes.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/75

(cherry picked from commit 1a9dabe5ff443315a1e3e9c577f93936e6dd45dc)
2024-08-02 08:52:26 -04:00
sdomi e8bfd9ea4c Ports/libpng: Upgrade to 1.6.43 2024-08-02 08:47:34 -04:00
Ralf Donau d369ec2f03 Maps: Use Config::pledge_domain() 2024-08-02 08:46:48 -04:00
Ralf Donau e182bcd9ff MapsSettings: Use Config::pledge_domain() 2024-08-02 08:46:48 -04:00
gouchi ac0e71c8ac Ports: Update RetroArch to version 1.19.1
Update AvailablePorts.md
2024-08-01 16:27:58 -07:00
sdomi 9351ba8568 Ports/aria2: Upgrade to 1.37.0
This fixes building with clang.
2024-08-01 16:19:00 -07:00
sdomi c0f58505bc Ports/harfbuzz: Upgrade to 9.0.0
This fixes building with clang.
2024-08-01 16:18:38 -07:00
Sönke Holz ad64243bb9 Kernel/x86: Properly restore rflags in the syscall handler
The sysret instruction restores the rflags value from the r11 register.
Before, we expected that the value in RegisterState::r11 is still the
rflags value saved by syscall and therefore didn't copy
RegisterState::rflags to r11 before the sysret.

But signal handlers and ptrace can change the value in
RegisterState::r11 while we are handling a syscall, so we shouldn't
assume that it still contains the saved rflags.
While handling a syscall the contents of RegisterState::rflags may also
have been updated by e.g. ptrace in which case we should restore the
updated rflags, not the original state on syscall entry.
2024-08-01 22:08:08 +02:00
doctor-rd 3e20c7bbc0 Terminal: Remove unveiling portal/config 2024-08-01 12:07:02 -07:00
Andrew Kaster a0bc09af85 LibThreading: Guard closing the background thread on the thread existing
This prevents a crash in ImageDecoder when it's closed before any
image decoding requests have been made.

(cherry picked from commit 88176d4be2339108d9d54b8af62f5438f9c82f30)
2024-08-01 12:06:30 -07:00
randomusername-a 8ee652bc7c ImageViewer: Call clear() in the ViewWidget before loading a new image
We need to do this to stop the animation timer and delete the current
animation, otherwise the new image will be shown only for a moment
before the previous animation continues.
2024-08-01 12:06:13 -07:00
Sönke Holz 640530dbed Kernel/PCI: Handle 64-bit MSI-X BARs
PCI::get_BAR just returns the raw BAR value and doesn't handle 64-bit
BARs.
2024-08-01 12:05:56 -07:00
Nico Weber 28af4aa4ff LibGfx/PNGWriter: Change default PNG compression level to Default
The numbers in the previous commit show that going from n = 2 to
n = 3 comes with a big cost in runtime (3-4 times as long) for a
very modest to modest size win (0.5% to 2.5%). The jumps from n = 0
to n = 1 and from n = 1 to n = 2 look much more reasonable.

If image size is the main concern, webp is a better option now.
If PNG size is a big concern, recompressing with something like
zopflipng is currently still necessary anyways.

All in all, I think Default is the better default compression level now.

This effectively reverts #14738.

Affects PNGs written by all apps in the system (PixelPaint, Mandelbrot,
LibWeb's HTMLCanvasElement png serialization, LibWeb's screenshot
feature, `shot`, SpiceAgent, Magnify, `pdf` output, `image` without
--png-compression-level flag).
2024-07-31 18:39:08 -07:00
Nico Weber fd6142eba4 LibGfx/PNGWriter: Only store alpha channel if it's used
Using the same two benchmarks as in the previous commit:

1.

    n |               time |   size
    --+--------------------+--------
    0 |  56.5 ms ±  0.9 ms | 2.3M
    1 |  88.2 ms ± 14.0 ms |   962K
    2 | 214.8 ms ±  5.6 ms |   908K
    3 | 670.8 ms ±  3.6 ms |   903K

Compared to the numbers in the previous commit:

    n = 0: 17.3% faster, 23.3% smaller
    n = 1: 12.9% faster, 12.5% smaller
    n = 2, 24.9% faster,  9.2% smaller
    n = 3: 49.6% faster,  9.6% smaller

For comparison,
`sips -s format png -o sunset_retro_sips.png sunset_retro.bmp` writes
a 1.1M file (i.e. it always writes RGBA, not RGB when not necessary),
and it needs 49.9 ms ± 3.0 ms for that (also using a .bmp input). So
our output file size is competitive! We have to get a bit faster though.

For another comparison, `image -o sunset_retro.webp sunset_retro.bmp`
writes a 730K file and needs 32.1 ms ± 0.7 ms for that.

2.

    n |         time | size
    --+----------------+------
    0 | 11.334 total | 390M
    1 | 13.640 total |  83M
    2 | 15.642 total |  73M
    3 | 48.643 total |  71M

Compared to the numbers in the previous commit:

    n = 0: 15.8% faster, 25.0% smaller
    n = 1: 15.5% faster,  7.7% smaller
    n = 2: 24.0% faster,  5.2% smaller
    n = 3: 29.2% faster,  5.3% smaller

So a relatively bigger speed win for higher levels, and
a bigger size win for lower levels.

Also, the size at n = 2 with this change is now lower than it
was at n = 3 previously.
2024-07-31 18:39:08 -07:00
Nico Weber 4772d41657 image: Add --png-compression-level for picking the compression level
No change to the default behavior.

This allows collecting some statistics.

1.

    hyperfine --warmup 1 \
        'Build/lagom/bin/image -o sunset_retro.png sunset_retro.bmp \
            --png-compression-level $n'

    n |                    time |   size
    --+-------------------------+--------
    0 |    68.3 ms ±     3.8 ms | 3.0M
    1 |   101.3 ms ±     2.1 ms | 1.1M
    2 |   286.0 ms ±     2.5 ms | 1.0M
    3 | 1.331    s ± 0.005    s |   999K

2.

Using the benchmarking script from #24819, just changed to write
.png files with different --png-compression-level values:

    n |           time | size
    --+----------------+------
    0 |   13.467 total | 520M
    1 |   16.151 total |  90M
    2 |   20.592 total |  77M
    3 | 1:08.69  total |  75M
2024-07-31 18:39:08 -07:00
Nico Weber 7308ef7ce9 LibGfx/PNGWriter: Make compression level configurable
Not yet used anywhere, no behavior change.
2024-07-31 18:39:08 -07:00
Sönke Holz 26555baf53 Kernel/USB: Make USBHubDescriptor::hub_characteristics union packed
AArch64 Clang otherwise complains that this anonymous union is more
aligned than the struct.
2024-07-30 09:07:32 -04:00
noahdossan b526e3c428 Documentation: Fix BuildInstructions.md capitialization
build instructions --> Build Instructions
2024-07-29 09:52:13 -04:00
Logkos ad73adef5d Kernel/Net: Rename IPv4-specific files and structs 2024-07-29 09:49:56 -04:00
Jamie Mansfield f82e976df4 LibWeb: Implement DOMStringList
(cherry picked from commit 75216182c9a04741b2f773eb2f26ceb7a96bfbba)
(cherry picked from commit 2a55ab13ef9c735a16674006a518c0e5acf7c88f)

Co-authored-by: Sam Atkins <atkinssj@serenityos.org>
2024-07-29 09:14:06 -04:00
Aliaksandr Kalenik 4b79d439d0 LibWeb/Painting: Delete unused LinearGradientData.h
(cherry picked from commit aa08e525489e392b9bac9c65e8d4ca824389251b)
2024-07-29 09:13:49 -04:00
Diego Frias 56d54b94c3 LibWasm: Remove unused ParseError variant
(cherry picked from commit 41dc58f70236975348ad46f521c14589c2da51f9)
2024-07-29 14:34:01 +02:00
Diego Frias ccc4be6287 LibWasm: Introduce TRY_READ for parser
Convenience macro akin to `TRY` for reading from a stream.

(cherry picked from commit 9800ef6047374ad3cd7ae6cc3ad92f62b88e5993)
2024-07-29 14:34:01 +02:00
Diego Frias e5b14aadb0 LibWasm: Remove Module::functions
`Module::functions` created clones of all of the functions in the
module. It provided a _slightly_ better API, but ended up costing around
40ms when instantiating spidermonkey.

(cherry picked from commit dc52998341bb86ad8fb790fb72f943e43b16e8e5)
2024-07-29 14:34:01 +02:00
Diego Frias 3fe206d44f AK/SIMDExtras: Fix masking logic in shuffle_or_0
(cherry picked from commit a168bec7efcb26ef7e27cd5294fdefa1ff9e4ca9)
2024-07-29 14:34:01 +02:00
Diego Frias 2b708f791b AK/LEB128: Speed up reading unsigned LEB128 values
Unroll the first byte as a fast path, and remove a branch. This speeds
up the instantiation of spidermonkey by 10ms.

(cherry picked from commit a6ebd100ecd9ed633e290153f61466362e63b73a)
2024-07-29 14:34:01 +02:00
Diego Frias ffe3f02e2b LibWasm: Remove needless and costly copies
Speeds up spidermonkey.wasm instantiation by around 60ms (240ms -> 180ms)

(cherry picked from commit fc57f5111dfbed55208f13b17edb3c77d9cfdb8b)
2024-07-29 14:34:01 +02:00
Diego Frias ff6d9cc6b6 LibWasm: Stop using ConstrainedStream for function parsing
Speeds up spidermonkey.wasm instantiation by around 20ms (260ms -> 240ms)

(cherry picked from commit 2192c149e298a2a4fc135bb1a36bafee4a462398)
2024-07-29 14:34:01 +02:00
Diego Frias 63e45c1752 LibWasm: Provide size hint when parsing instructions into a vector
Speeds up spidermonkey.wasm instantiation by around 20ms (280ms -> 260ms)

(cherry picked from commit 5cde327d463edc39093385a0b7155d97b7f5d16b)
2024-07-29 14:34:01 +02:00
Diego Frias 71f2582a71 LibWasm: Flatten instructions in one continuous loop during parsing
Instead of multiple loops and multiple vectors, parse Wasm expressions
in a simple loop. This gets us from ~450ms to instantiate spidermonkey
to ~280ms.

(cherry picked from commit 2cfc1873c0436f598f897dd84172b753e2c2b03c)
2024-07-29 14:34:01 +02:00
Diego Frias c0b69a3466 LibWasm: Remove unused vector methods of the interpreter
(cherry picked from commit 4e8376d07e6b928572f7b4a9bb3b6a4468a8b6e7)
2024-07-29 14:34:01 +02:00
Diego Frias 519d3674fa LibWasm: Fix SIMD shuffle and swizzle
`swizzle` had the wrong operands, and the vector masking boolean logic
was incorrect in the internal `shuffle_or_0` implementation. `shuffle`
was previously implemented as a dynamic swizzle, when it uses an
immediate operand for lane indices in the spec.

(cherry picked from commit 9cc3e7d32d150dd30d683c1a8cf0bd59676f14ab)
2024-07-29 14:34:01 +02:00
Diego Frias f92916b4ce LibWasm: Fix SIMD bit shift right
Set the sign in the vector's element type (even though it's a bit
redundant).

(cherry picked from commit d841742c3582e086613bda41a9679dfa6f7f2393)
2024-07-29 14:34:01 +02:00
Diego Frias 73ed02a3d4 LibWasm: Implement the rest of the SIMD conversions
(cherry picked from commit 4b9649282ebfef46e645e404e09f3b50b578d56f)
2024-07-29 14:34:01 +02:00
Diego Frias 91fe4b8a30 LibWasm: Fix v128.any_true instruction
(cherry picked from commit 21c5084d233a0e04bc1235c0f53852d0cd2d3a08)
2024-07-29 14:34:01 +02:00