Commit Graph
65539 Commits
Author SHA1 Message Date
Sönke Holz 1c182d7cac Meta: Update CI status badge URL
The main CI workflow was renamed from "Build, lint, and test" to "CI" by
660e3ccb1c ("Build, lint, and test" => "SerenityOS") and ae6025987d
("SerenityOS" => "CI").

The new badge is based on the markdown created by the CI workflow page
"Create status badge" menu item.
2025-08-01 21:24:14 +02:00
Sönke Holz d99bd249db Toolchain: Add an EDK II build script
This makes it easier to try SerenityOS on the Pi 4.
2025-08-01 17:55:05 +02:00
Sönke Holz 9d4f761f6c Meta: Run shellcheck with --external-sources
From the shellcheck man page:
> This option defaults to false only due to ShellCheck's origin as a
> remote service for checking untrusted scripts.
> It can safely be enabled for normal development.

This allows us to remove the `shellcheck source=/dev/null` workaround
in most places.
2025-08-01 17:55:05 +02:00
Sönke Holz 9ac2cb6f20 Kernel/xHCI: Use MemoryType::IO for zeroing scratchpad buffer pages
The default MemoryType (Normal) would cause the zeroing to be cached.
2025-08-01 17:55:05 +02:00
Sönke Holz 2202ad0bc5 Kernel/MM: Add MemoryType argument to allocate_physical_page()
This makes it possible to specify the MemoryType that should be used
when zeroing the allocated page.
2025-08-01 17:55:05 +02:00
Sönke Holz 81194028ca Kernel/MM: Add MemoryType argument to quickmap_page()
This makes it possible to request MemoryTypes other than Normal.
2025-08-01 17:55:05 +02:00
Sönke Holz 8cacc2555e Kernel/PCI: Add support for the BCM2711 PCIe host controller
This host controller is very similar to the one in the BCM2712, so
we can reuse this driver.

The Raspberry Pi firmware doesn't initialize the host controller,
so you need to boot with EDK II.
2025-08-01 17:55:05 +02:00
Sönke Holz deea1020fb Kernel/PCI: Rename {BCM2712 => Broadcom}HostController
The next commit will add support for the BCM2711 (Raspberry Pi 4) PCIe
host controller to this driver.
2025-08-01 17:55:05 +02:00
Nico Weber 787c439271 LibGfx/CCITT: Make decoding of wide ccitt3-2d and ccitt-4 images faster
`take_first()` on a Vector is O(n), meaning this function used to have
O(n^2) behavior in the width of an image.

We can just use a span instead, which can be be advanced in O(1) time.

Makes

    pdf --debugging-stats ~/Downloads/ignition.pdf

go from 10.2s to 6.7s, 34% faster.

Makes the first 50 pages of

    pdf --debugging-stats pdf-stuff/Mellor_ACTITC_10.pdf

go from 65.9s to 13.2s, 80% faster.

Fixes #26082.
2025-07-31 14:59:21 -04:00
Nico Weber c2a1571183 LibGfx/JBIG2: Support using custom tables in symbol segment
This is basically identical to the commit that added support for this
in text segments in #26078 (160b06eccb).

This is used on most, maybe all, pages of Mellor_ACTITC_10.pdf,
and on at least some pages of most files of the PDFs at
https://library.sciencemadness.org/library/books/.
2025-07-30 16:32:08 -04:00
Nico Weber 95068607eb LibGfx/JBIG2: Make symbol decoding input table pointers const
No behavior change.
2025-07-30 16:32:08 -04:00
Nico Weber d94333080f LibGfx/JBIG2: Use a named constant for the lower range bit
No behavior change.
2025-07-30 08:46:15 -04:00
Nico Weber 160b06eccb LibGfx/JBIG2: Support using custom tables in text segment
With this, we can decode all pages of ignition.pdf :^)
2025-07-30 07:34:25 -04:00
Nico Weber e59b8bf8c8 LibGfx/JBIG2: Implement decoding custom huffman tables
Custom tables still error out at a later point when used, so
no dramatic change in behavior yet.
2025-07-30 07:34:25 -04:00
Sönke Holz a72b3b2dde EFIPrekernel: Add AArch64 support
arch_enter_kernel is more complex on AArch64 than on x86_64 or riscv64.
We have to initialize more registers, disable the MMU, and switch to EL1
if we entered in EL2.
We need to disable the MMU, as switching the MMU configuration is not
a single atomic register write.
While the MMU is disabled, no memory that was previously cached should
be accessed.

The rest of the code is very similar to the other architectures.
2025-07-29 15:46:15 +02:00
Sönke Holz e6cd45a5a1 Kernel/aarch64: Make ASM_wrapper.h usable in the EFIPrekernel 2025-07-29 15:46:15 +02:00
Sönke Holz 26da054b99 Kernel/aarch64: Rename SCTLR_EL1::{reset => default}_value()
Most bits in that register have undefined reset values.

Also add some comments where these values are coming from.
LSMAOE is bit 29, so put it after nTLSMD (bit 28).
2025-07-29 15:46:15 +02:00
Sönke Holz 1bb456cf5a Kernel/aarch64: Remove TCR_EL1::reset_value()
This function is unused.
2025-07-29 15:46:15 +02:00
Sönke Holz 7e873f6f4c Kernel/aarch64: Set the kernel entry point to init()
The EFI prekernel will enter the kernel at the entry point specified in
the ELF header.

The current pre_init code doesn't use the specified entry point, as it's
linked to a raw binary.
2025-07-29 15:46:15 +02:00
Sönke Holz 79cbdd5521 Kernel/aarch64: Build kernel as position-independent code
The EFI Prekernel needs the kernel to be relocatable, so build it
without --no-pie and stop linking the kernel to KERNEL_MAPPING_BASE.

Preprocess the linker script, so we can use PF_{X,W,R} macros instead of
using magic numbers, similar to the linker scripts of other
architectures.

pre_init now needs to relocate itself so it still works when linking
without `--no-pie`.

KSyms.cpp also needs to be changed, as it currently expects the kernel
to be linked to KERNEL_MAPPING_BASE.
2025-07-29 15:46:15 +02:00
Nico Weber e495a08597 LibGfx/JBIG2: Add standard huffman table J
We can now decode 144 of ignition.pdf's 233 pages.

The remaining pages all need support for custom huffman tables
stored in table segments. That's for later.
2025-07-29 07:48:21 -04:00
Nico Weber fa1cf4a621 LibGfx/JBIG2: Add standard huffman table I
We can now decode 92 of ignition.pdf's 233 pages.
2025-07-29 07:48:21 -04:00
Nico Weber ac1201f84e LibGfx/JBIG2: Add standard huffman table M
We can now decode 89 of ignition.pdf's 233 pages.
2025-07-29 07:48:21 -04:00
Nico Weber 249a90781a LibGfx/JBIG2: Add huffman support to text_region_decoding_procedure()
We can now decode 16 of ignition.pdf's 233 pages, up from 9 :^)

Most of the previous 9 successfully-decoded pages were empty pages.
We can now newly decode pages 1, 6, 17, 214, 220, 221, 229 -- all
contain actual text!

(Page 1 of annex-h.jbig2 needs support for grayscale MMR too, so we
still can't decode that yet.)
2025-07-29 07:48:21 -04:00
Nico Weber b664454610 LibGfx/JBIG2: Implement decoding the symbol ID huffman table
Implements: 7.4.3.1.7 Symbol ID Huffman table decoding

This requires making the existing huffman table support codes
that are 32 bit long.

The spec says "This is very similar to the "zlib" coded format
documented in RFC 1951, though not identical". We should explore
if we can share more code here in the future. In particular,
`assign_huffman_codes()` looks like it might be the canonical
algorithm for assigning canonical codes.

Not used for anything yet.
2025-07-29 07:48:21 -04:00
Nico Weber 69dd9ca6a9 LibGfx/JBIG2: Add standard tables F, G, H, K, L, N
This requires adding support for the "lower range table line"
concept, for ranges that start at -infinity up to a given number.
I'm doing this for now by setting the top bit in `prefix_length`.

This is enough to get past 7.4.3.1.2 for both page 1 of annex-h.jbig2
and of page 1 of ignition.pdf.
2025-07-29 07:48:21 -04:00
Nico Weber 7a87754994 LibGfx/JBIG2: Read text region huffman flags
This implements 7.4.3.1.2 Text region segment Huffman flags.

Not used yet, so no behavior change yet.
2025-07-29 07:48:21 -04:00
Nico Weber a5402c2c5c LibGfx/JBIG2: Support striped images with initially unknown height
Do this by just looking through all EndOfStripe segments of the
current page and determining the height that way.

Also add a few consistency checks for PageInformation / EndOfStripe /
EndOfPage / EndOfFile segments. (But there's more to be done;
we could implement 7.3.2.)

With this, we can decode the remaining 15 files (*-stripe.jb2) in
t89-halftone.zip, and we can decode 042_9.jb2 from the power jbig2
test file set.

I haven't seen this in PDFs in the wild.
2025-07-27 07:15:51 -04:00
Nico Weber 81714e98fd LibGfx/JBIG2: Extract decode_end_of_stripe_segment()
No behavior change.
2025-07-27 07:15:51 -04:00
Nico Weber c0861fcce4 Tests/LibGfx: Add two more missing test cases to the jbig2 comment 2025-07-27 07:15:51 -04:00
Nico Weber 94f02a38e8 Tests/LibPDF: Update jbig2-globals.pdf to not contain EndOfPage segment
As detailed in the second commit of #23639, 290c9541de, I created
that file by first running

    Meta/jbig2_to_pdf.py -o foo.pdf \
        Tests/LibGfx/test-inputs/jbig2/bitmap.jbig2

But when I created that file, jbig2_to_pdf.py did not yet strip
EndOfPage. It only learned to do that recently, in #26051.

So I ran that command again, then I copied over the new output for the
main jbig2 image, and manually updated the offsets in the xref
table for the two objects following that. I also manually updated
the offset to the xref table in the startxref part.

No real behavior change, but makes jbig2-globals.pdf more
PDF-spec-compliant.
2025-07-27 07:15:51 -04:00
Nico Weber ce7a076990 Tests/LibGfx: Add missing EndOfPage segment to two jbig2 files
I had extracted white_47x23.jbig2 and black_47x23.jbig2 from a PDF
(and then tweaked them). PDFs store jbig2 data in the embedded
organization. In PDFs, the EndOfPage segment is stripped.

But in standalone files in the sequential organization, the EndOfPage
segment is required per spec (see 7.4.9 End of page segment syntax:
"Each page must have exactly one end of page segment associated with
it.").

I appended the bytes

    00 00 00 01 31 00 01 00 00 00 00

to each file. That's an EndOfPage segment with segment number 1,
associated with page 1. This should make the files valid.

(EndOfFile is only required for files in the random organization;
it's optional in the sequential organization from what I understand.)
2025-07-27 07:15:51 -04:00
Nico Weber d7dd6d84c3 Tests/LibPDF: Use TRY_OR_FAIL() for map() calls 2025-07-27 07:15:51 -04:00
rmg-x 5035362a31 Tests/LibWeb: Finish async test when an error is caught
This catches errors that occur within async tests so that we fail faster
rather than timing out due to `done()` not being called.

We use `Promise.resolve()` because `f` isn't guaranteed to be an async
function.

(cherry picked from commit 0de910784e498594f99017880b914b4cc2d4ad42)
2025-07-26 22:46:13 -04:00
Nico Weber 1195f67266 Meta: Update cacert.pem to 2025-07-15
It now matches the version used in ports after #26063.
2025-07-26 22:02:19 -04:00
Nico Weber b8935289a1 Tests/LibWeb: Skip two tests that fail on CI fairly consistently 2025-07-26 21:47:50 -04:00
Nico Weber 23f6cf2216 LibGfx/JBIG2: Support huffman-encoded symbol regions
Most JBIG2 files that use huffman-encoded symbol regions also use
huffman-encoded text regions, which we don't yet support.

But page 2 of annex-h.jbig2 uses a huffman-encoded global symbol
dictionary and arithmetic coding for everything else, so this
is enough to let us decode page 2 of annex-h.jbig2 :^)
2025-07-26 19:31:32 -04:00
Nico Weber 5727102c96 LibGfx/JBIG2: Sketch out a HuffmanTable class
I think we probably can't use CanonicalCodes here (this reads
in big endian order, it interleaves codes and values, and possibly
the codes aren't canonical). Maybe that's wrong, I'm not 100% sure.
But for now, let's get it working, and make it good later :^)
2025-07-26 19:31:32 -04:00
Nico Weber 8bd44758dd LibGfx/JBIG2: Tweak multi-page status update order
Previously, if one frame failed to decode, every further frame
would also fail.

Now, later frames can succeed.
2025-07-26 19:31:32 -04:00
Nico Weber 45996fe1f1 LibGfx/CCITT: Add a FIXME comment 2025-07-26 19:31:32 -04:00
Caoimhe Byrne 341d38f7cc Presenter: Resize web view after loading a file
Prior to this commit, the web view's relative rect wasn't set after
loading a file, which caused it to not show anything until the window
was resized.
2025-07-26 11:15:43 -04:00
Caoimhe Byrne 5f2c338811 Presenter: Move web view relative rect calculation to its own function
This allows the same logic to be used for resizing the webview outside
of window resize events.
2025-07-26 11:15:43 -04:00
Nico Weber 9a2cd5f4e5 Tests/LibGfx: Add a comment about missing jbig2 tests 2025-07-25 08:14:54 -04:00
Linus Groh cc0d64192d Ports: Update ninja to 1.13.1 2025-07-25 13:53:07 +02:00
Linus Groh 21fa3c2096 Ports: Update libicu to 77.1 2025-07-25 13:53:07 +02:00
Linus Groh 87eb379f1a Ports: Update SDL2_ttf to 2.24.0 2025-07-25 13:53:07 +02:00
Linus Groh 687bca7161 Ports: Update SDL2_image to 2.8.8 2025-07-25 13:53:07 +02:00
Linus Groh df7b7f24ef Ports: Update SDL2 to 2.32.8 2025-07-25 13:53:07 +02:00
Linus Groh 5f8e928018 Ports: Update nano to 8.5 2025-07-25 13:53:07 +02:00
Linus Groh 97383d6e5b Ports: Update bash to 5.3 2025-07-25 13:53:07 +02:00