Commit graph

62565 commits

Author SHA1 Message Date
Timothy Flynn facfe12682 WebContent: Do not create JS consoles for fragment-parsing documents
There's no need to go through this setup.

(cherry picked from commit a1c57ed79a355fae8601a3f40a10f30831122f8f)
2024-08-13 15:39:53 -04:00
Timothy Flynn aab5320900 LibWeb: Indicate documents are for fragment parsing during construction
This will allow testing if they are for fragment parsing during methods
invoked from Document::initialize.

(cherry picked from commit c838ca78c81261e6111aa255c79e4a0599759c80)
2024-08-13 15:39:53 -04:00
Sönke Holz c3c5378c82 Kernel/USB: Always check for the Intel xHCI port routing quirk
The quirk previously only worked when USBLEGSUP was present and the BIOS
owned the host controller.
2024-08-12 10:54:00 -04:00
Nico Weber 82053da343 LibGfx/PNGWriter: Remove one output data copy
Now that we do two passes, we can easily write into
uncompressed_block_data directly.

Somewhat surprisingly, this is perf-neutral.
2024-08-11 13:50:11 -04:00
Nico Weber 32855d2c49 LibGfx/PNGWriter: Compute which predictor to use first, store data then
Before, we would compute and store the output of each predictor,
then pick the best one, and then copy its data.

Now, we compute the output of each predictor but only compute its
score and do not store the predicted data. We then pick the best
one, and do a second pass that re-computes the output of the best
predictor, and stores it.

Instead of computing the output of the 5 different predictors, we now
compute the output of the 5 different predictors, and then the output of
one of them again. In exchange, we only write each output row once
instead of 5 times. (We also have to read the input row twice instead of
once, but the second time round it'll come from L1 or L2.)
Making the simplifying assumption that each predictor takes the same
time to compute, this increases compute to 6/5th, and reduces memory
bandwidth to 3/6th. (Before: 1 input row read, 5 output row writes;
after: 2 input row reads, 1 output row write.)

Produces exactly the same output, but is faster:

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 0
       34.8 ms ± 0.9 ms ->  22.7 ms ± 0.8 ms (34.7% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 1
       64.2 ms ± 4.9 ms ->  50.5 ms ± 0.5 ms (31.3% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 2
      190.3 ms ± 1.6 ms -> 179.0 ms ± 2.8 ms (5.8% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 3
      646.5 ms ± 4.7 ms -> 635.3 ms ± 4.4 ms (3.3% faster)

Compression level 2 is the default, so about a 6% speedup in practice.

`sips` still needs 49.9 ms ± 3.0 ms to convert sunset_retro.bmp to
sunset_retro.png at its default compression level 1.
We used to take 1.27x as long as sips, now we take 1.01x as long,
while producing a smaller output :^)

(For other, larger, input files sips is still faster and produces
smaller output.)
2024-08-11 13:50:11 -04:00
Nico Weber ae57f6cad6 LibGfx/PNGWriter: Extract filter computation into new Filter::predict()
No behavior change.
2024-08-11 13:50:11 -04:00
Nico Weber 3cb83860fa LibGfx/PNGWriter+AK: SIMDify paeth predictor more
Takes

    (cd Tests/LibGfx; ../../Build/lagom/bin/BenchmarkPNG)

from 59ms to 32ms on my system.

Adds AK::SIMD::bitselect() (modeled after the wasm SIMD equivalent),
and AK::SIMD::abs() implemented on top of it.

No behavior change.
2024-08-10 13:07:01 -04:00
Nico Weber 4492de4e37 Tests: Add a test for paeth_predictor() 2024-08-10 13:07:01 -04:00
Nico Weber a1586e9c03 Tests: Add a benchmark for the PNG paeth predictor 2024-08-10 13:07:01 -04:00
Alec Murphy ebde452262 PDFViewer: Fix outline page number off-by-one
This PR fixes an off-by-one in the outline tree view, where the page
number did not match the corresponding page in the document.
2024-08-10 13:00:23 -04:00
brody-qq a0b021cbcf Kernel/Memory: Fix crash on writes to shared file mmaps
Writes to SharedInodeVMObjects could cause a Protection Violation if a
page was marked as dirty by a different process.

This happened due to a combination of 2 things:
* handle_dirty_on_write_fault() was skipped if a page was already marked
  as dirty
* when a page was marked as dirty, only the Region that caused the page
  fault was remapped

This commit:
* fixes the crash by making handle_fault() stop checking if a page was
  marked dirty before running handle_dirty_on_write_fault()
* modifies handle_dirty_on_write_fault() so that it always marks the
  page as dirty and remaps the page (this avoids a 2nd bug that was
  never hit due to the 1st bug)
2024-08-10 16:19:12 +02:00
Liav A. 79d9abd3cc Kernel: Create coredump by using the crashed process VFS root context
Resolve a regression caused by 01e1af732b.

This unbreaks coredump generation, because we need to use the VFS root
context of the crashed process and not of the FinalizerTask, as it will
hold an empty VFS root context that is assigned to kernel processes.
2024-08-10 10:14:37 -04:00
doctor-rd 2a8032bc68 Meta: Remove /mod
This directory was introduced with
commit a43b115a6c
and is no longer needed.
2024-08-10 10:13:52 -04:00
EWouters 48f578a898 Ports/git: Update to version 2.46.0 2024-08-10 10:10:55 -04:00
EWouters 54b6c3cbc5 Ports/bison: Update to version 3.8.2 2024-08-10 10:10:55 -04:00
EWouters d8d5691f7d Ports/ca-certificates: Update to version 2024-07-02 2024-08-10 10:10:55 -04:00
EWouters 5f661ba571 Ports/bash: Update to version 5.2.32 2024-08-10 10:10:55 -04:00
EWouters 126b2e638e Ports/curl: Update to version 8.9.1 2024-08-10 10:10:55 -04:00
EWouters 00afd803fd Ports/pcre2: Update to version 10.44 2024-08-10 10:10:55 -04:00
EWouters 724b3f4c36 Ports/ncurses: Update to version 6.5 2024-08-10 10:10:55 -04:00
Hendiadyoin1 832b5ff603 AK: Add simd_cast<T> and replace to_TxN with it 2024-08-08 22:43:53 -04:00
brody-qq e0242abf93 Tests/Kernel: Add test for Ext2FS reads and writes
This commit adds a new test case which carries out the following steps:
* write() to a block of an ext2 file, verify the write() was successful
* read() the same block back, verify the read() was successful
* verify that the data from the read() is identical to the data that was
  written in the write()

The test runs the above steps on the following blocks of an ext2 file:
* the first and last direct blocks
* the first and last singly indirect blocks
* the first and last doubly indirect blocks
* the first and last triply indirect blocks
2024-08-08 19:04:04 -04:00
Sönke Holz c247aac15e Meta: Add ahci option to SERENITY_BOOT_DRIVE 2024-08-07 18:30:06 -04:00
Sönke Holz bb9aa6c7c6 Meta: Allow choosing between UHCI and xHCI HCs for USB storage in run.py 2024-08-07 18:30:06 -04:00
Sönke Holz c7903e30f4 Meta: Combine boot drive environment variables into SERENITY_BOOT_DRIVE
This allows you to simply use e.g. SERENITY_BOOT_DRIVE=usb instead of
setting SERENITY_NVME_ENABLE=0 and SERENITY_USE_USBDRIVE=1.
2024-08-07 18:30:06 -04:00
Sönke Holz f2d3202e1d Meta: Remove unnecessary sdhci-pci devices from run.py
This allows us to have a more stable device address "root=sd0:0:0" for
SERENITY_USE_SDCARD.
2024-08-07 18:30:06 -04:00
Sönke Holz de3e864a80 Meta: Remove microvm machine type from run.py
Running in the microvm doesn't work anymore, since we removed IDE
support. Currently, we only support PCI(e)-attached storage devices,
which are not compatible with the microvm, as it doesn't support PCI(e)
at all.
2024-08-07 18:30:06 -04:00
Sönke Holz 4c307e9073 Meta: Remove bochsrc
Running in bochs was broken at least since the removal of IDE support.
2024-08-07 18:30:06 -04:00
Sönke Holz 6a195b6616 Kernel/USB: Add support for xHCI bulk transfers
Bulk transfers also use Normal TRBs, so move the reusable normal TRB
setup code from submit_async_interrupt_transfer into a new function
prepare_normal_transfer.

submit_bulk_transfer and submit_async_interrupt_transfer use this
function and then either block on the completion or submit it
asynchronously and wrap it into a PeriodicPendingTransfer.
2024-08-07 18:30:06 -04:00
Sönke Holz d82148aae1 Kernel/USB: Don't truncate the max packet size in the MassStorage driver 2024-08-07 18:30:06 -04:00
Nico Weber cf8210175f LibGfx/PNGWriter: Inline the now not very useful append(u8)
No behavior change.
2024-08-06 23:00:32 -04:00
Nico Weber 781a39e613 LibGfx/PNGWriter: Use SIMD for PNG score calculation
Produces exactly the same output, but a bit faster.

The speedup is relatively bigger for worse compression:

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 0
       56.8 ms ±  1.5 ms ->  34.8 ms ± 0.9 ms (38.7% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 1
       84.6 ms ±  1.7 ms ->  64.2 ms ± 4.9 ms (24.1% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 2
      212.1 ms ±  2.5 ms -> 190.3 ms ± 1.6 ms (10.3% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 3
      671.4 ms ± 12.3 ms -> 646.5 ms ± 4.7 ms (3.7% faster)

Compression level 2 is the default, so about a 10% speedup in practice.

For comparison, `sips` needs 49.9 ms ± 3.0 ms to convert
sunset_retro.bmp to sunset_retro.png, and judging from the output file
size, it uses something similar to our compression level 1.
We used to take 1.7x as long as sips, now we take 1.29x as long.
2024-08-06 23:00:32 -04:00
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