Commit graph

62615 commits

Author SHA1 Message Date
Sönke Holz
77a44df92b Meta: Download and use the Raspberry Pi 3 devicetree for running in qemu 2024-08-20 21:52:12 -04:00
Sönke Holz
c990c85d52 Meta: Use the correct build directory environment variable in run.py 2024-08-20 21:52:12 -04:00
Hendiadyoin1
e0a177061e Kernel/Firmware+riscv64: Move devicetree handling to Firmware directory
This also adds a `verify_fdt` method which will be used in later commits
2024-08-20 21:52:12 -04:00
Sönke Holz
1ffb7afba7 Kernel/aarch64: Make the kernel bootable from any physical load address
Instead calculate the load offset at runtime.

The mapping of the initial stack is now done explicitly. It was
previously included in the 2 MiB-aligned kernel range.

We need to use kernel8.img now, as we no longer hard-code the physical
addresses of all sections in the linker script. QEMU would otherwise
try to load us at KERNEL_MAPPING_BASE.
2024-08-20 21:52:12 -04:00
Sönke Holz
ba27989da1 Kernel/aarch64: Use MM's virtual_to_low_physical for Mailbox::send_queue
This is slightly better than assuming that cutting off the high 32 bits
results in the physical address. This worked for now because the kernel
(and stack) is mapped at KERNEL_MAPPING_BASE + PHYSICAL_LOAD_ADDR and
KERNEL_MAPPING_BASE & 0xffff'ffff == 0.

The next commit will move the kernel to KERNEL_MAPPINGS_BASE + 0, so
we need to get the physical address in a slightly less hacky way.
2024-08-20 21:52:12 -04:00
Sönke Holz
194d9df34f Kernel/Memory: Handle devicetree memory nodes with more than one region 2024-08-20 21:52:12 -04:00
Sönke Holz
ab44530304 Kernel/Memory: Remove x86 LAPIC address hack
MM is now able to handle MMIO after our "highest_phyisical_address".
2024-08-20 21:52:12 -04:00
Sönke Holz
810f2e7f29 Kernel/aarch64: Include .bss* sections in the linker script 2024-08-20 21:52:12 -04:00
A* Ulven
e863ba629e Documentation: Correct fuse2fs instructions for Fedora
`fuse2fs` comes from the `e2fsprogs` package in Fedora.
https://src.fedoraproject.org/rpms/e2fsprogs
2024-08-20 21:48:29 -04:00
Nico Weber
5b15951518 Meta: Port recent changes to the GN build
59aaef08d9 LibMedia: Rename LibVideo to LibMedia
aa2f5df0a9 AK: Add a helper to detect which CPU features are supported
0bbf42bca7 LibJS: Introduce the CanonicalizeKeyedCollectionKey AO
e06d74c314 LibWeb: Give DOM Elements a CountersSet
07fe3e57c6 LibWeb: Implement CounterStyleValue
1bc896fa60 LibWeb: Implement counter-[increment,reset,set] properties
78a22f5098 LibWeb: Replace templated retarget function with a regul...
e4fa0e7f63 LibWeb: Implement fetch record from the fetch spec
a8c4f34bff LibWeb: Create separate DedicatedWorkerGlobalScope class

Also add Services to include_dirs for LibWeb. This is necessary
due to the <WebWorker/DedicatedWorkerHost.h> include added in #24870.
2024-08-20 21:45:17 -04:00
Nico Weber
a3258d4094 LibGfx/ICC: Tolerate v2 profiles with D65 PCS illuminant
They do happen in practice.

We might have to do more to do actual color conversions with
these profiles, but for now let's at least load them.

Fixes rendering of a few images in my thesis in LibPDF.
The images were created in OmniGraffle in 2008, then saved as
PDF, then converted to eps using LaTeX tooling.
2024-08-20 09:43:06 -04:00
Stanisław Wiśniewski
02fd9b7d02 LibCore: Use forward() instead of move() for forwarding reference
Caught by clang-tidy `bugprone-move-forwarding-reference`
2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
f2990eea94 LibCore: Include AK/NonnullOwnPtr.h in EventLoopImplementationUnix.h 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
50a7ec6fc9 LibCore: Close fd if we fail to create AnonymousBuffer 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
6a41a43d49 LibCore: Add fixme about handling possible fd leaks 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
0687e29695 LibCore: Create fd_close_guard before possibly failing on fcntl 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
ca4c402309 LibCore: Put destruction of posix_spawn_file_actions in ScopeGuard 2024-08-20 09:12:50 -04:00
Stanisław Wiśniewski
1b486b8964 LibCore: Change return value of Command::create() to
...`ErrorOr<NonnullOwnPtr>` instead of `ErrorOr<OwnPtr>`

At every call site, after retrieving pointer from `ErrorOr` it is
dereferenced right away.
2024-08-20 09:12:50 -04:00
Alec Murphy
2a19fb5261 PDFViewer: Implement thumbnail previews
This PR adds thumbnail previews and navigation to PDFViewer :^)
2024-08-20 08:00:03 -04:00
Panagiotis "Ivory" Vasilopoulos
62b938b798 Documentation: Improve 'On ideologically motivated changes'
From my previous interactions with the Serenity community, it was clear
to me that this rule (for better or worse) was introduced by the author
that wanted to focus on the code and not let an open-source operating
system project be used as a 'political vehicle' and so as to not have
to possess a political science degree to operate the project thought to
be a technical exercise, like building a sandcastle.

For better or worse.

Unfortunately, the wording as-is can be interpreted as a dogwhistle
in the direction of "keep politics out of tech", which has been present
in communities like, as of recently, NixOS - and this seems to have
caused the problems that Serenity has been intentionally trying to
avoid.

It might also disregard cases of technical arguments, arguments
involving how people treat each other _within_ the community as well
as how to change the wording in documentation with the sole intent of
making the project more attractive to more contributors.

Given recent commits and governance changes, I decided to rewrite the
rule to make it more clear and encourage people to be "more excellent
to each other", while not compromising on what I see as the original
meaning.
2024-08-18 21:43:22 -04:00
Nico Weber
c10853ca89 LibGfx/PNGWriter: Change filter heuristic to match comment
We were computing abs(sum(signed_pixels)), while the comment says
that sum(abs(signed_pixels)) works well. Change the code to match
the comment. (While I did tweak this code recently, as far as I can
tell the code hasn't matched the comment from when it was originally
added.)

Using the benchmarking script and same inputs as in #24819, just changed
to write .png files with different --png-compression-level values:

    level 0: 390M -> 390M (no change)
    level 1:  83M ->  78M (6% smaller)
    level 2:  73M ->  69M (5.8% smaller at default compression level)
    level 3:  71M ->  67M (5.6% smaller)

Sizes as computed by `du -hAs`. (`-A` prints apparent size on macOS.
It's important to use that flag to get consistent results. On Linux,
this flag is spelled `-b` instead.)

The size of sunset_retro.png goes up a tiny bit, but but less than
0.4% at all sizes. At level 2, the size goes from 908K to 911K, for
example.

The size of Tests/LibGfx/test-inputs/jpg/big_image.jpg encoded as PNG
goes down by about 2.7%, but it's the 2.7% that gets us over an MB
boundary at levels 1 and 2. At level 1, from 14M to 13M; at level 2
from 13M to 12M. (Exact numbers: 14417809 bytes to 13429605 at level 1,
14076443 bytes to 13088791 at level 2.) For comparison, sips writes a
15M (15610049 bytes) file. So we were already writing a smaller file,
and now we're even better. (We need 778 ms at level 1 while
 sips needs 723ms. So it's a bit faster, but not a ton.)

The size of wow.apng goes from 606K to 584K (3.6% smaller).

Perf-wise, this is close to a wash. Worst case, it's maybe 2-3% slower,
but the numbers are pretty noisy, even with many repetitions in
`hyperfine`. I'm guessing `ministat` would claim that no significant
difference can be shown, but I haven't tried it. For example, for
sunset_retro.png at level 2, time goes from 179.3 ms ± 2.5 ms to
182.8 ms ± 1.9 ms, which would be a 2% slowdown. At level 0, where
the effect is relatively largest, it goes from 21.8 ms ± 0.7 ms to
22.6 ms ± 0.7 ms, a 3.6% slowdown (but with huge error bars).
For big_image.jpg level 1, time goes from 768.5 ms ± 8.4 ms to
777.9 ms ± 6.0 ms, 1.2% slower.
2024-08-17 11:03:29 -04:00
Nico Weber
b9a1eb1533 LibGfx/PNGWriter: Swap red and blue channel at write time
Previously, we were swapping red and blue before doing filtering.
The filters don't care about channel order, so instead only do
this when writing the PNG data.

In theory, this saves the work of channel swizzling when figuring
out which filter is best. In practice, it's perf-neutral:
swizzling is basically free. But it's still conceptually simpler.

No behavior change.
2024-08-17 11:03:29 -04:00
Sönke Holz
e7b8eed005 Kernel: Share Processor::capture_stack_trace() between architectures
This makes Processor::capture_stack_trace() work on all our
architectures. For this function to work on AArch64 and RISC-V, the
frame pointer has to be saved during context switches.

AArch64 and RISC-V don't support SMP yet, so the code for getting a
backtrace for processes running on other cores is guarded behind a
'#if ARCH(X86_64)'.
2024-08-16 16:01:19 -04:00
Sönke Holz
fa39086922 Kernel: Add ThreadRegisters::frame_pointer() accessors 2024-08-16 16:01:19 -04:00
Sönke Holz
c1dc55ec7c Kernel: Remove Processor::is_kernel_mode
This function was only used to verify that we are running in kernel
mode. But it is pretty much impossible that we will ever end up in
kernel code and actually are able to execute it in user mode. A lot of
stuff must go completely wrong to end up in such a situation.

Getting the current privilege level is also impossible on RISC-V by
design.
2024-08-16 15:58:27 -04:00
Nico Weber
0a4f8736e3 LibGfx/PNGWriter: Add support for inter-frame compression of apngs
Brings wow.apng from 1.2M to 606K, while reducing encoding time from
233 ms to 167 ms.

(For comparison, writing wow.webp currently takes 88ms and produces
a 255K file. The input wow.gif is 184K.)
2024-08-15 06:35:48 -04:00
Nico Weber
314d7d12ca animation: Add animated png writing support 2024-08-15 06:35:48 -04:00
Nico Weber
a2b59b9c98 LibGfx/PNGWriter: Implement support for writing animated PNGs
Based on #24021.

Co-Authored-By: Pixel Brush <letsplaytvirtmann@gmail.com>
2024-08-15 06:35:48 -04:00
Nico Weber
4484196b3b LibGfx/PNGLoader: Add two debug logs for invalid inputs 2024-08-15 06:35:48 -04:00
Nico Weber
56ea4a4a43 LibGfx/PNGLoader: Log chunk processing errors
We're currently just saying
"PNGImageDecoderPlugin: Decoding image data chunk" when failing
to load a PNG, even though we have much richer information internally.

For now, just log that information.
2024-08-15 06:35:48 -04:00
Nico Weber
43854a05a9 pdf: Move to stream-based PNGWriter::encode() 2024-08-15 06:35:48 -04:00
Nico Weber
3805ffa30c image: Move to stream-based PNGWriter::encode() 2024-08-15 06:35:48 -04:00
Nico Weber
37e75223b7 LibGfx/PNGWriter: Add a stream-based encode() overload 2024-08-15 06:35:48 -04:00
Ali Mohammad Pur
c9bfa4a3f4 LibWeb: Keep Wasm-imported functions alive
The user is not required to keep the object alive, this commit makes it
so the lifetime of these functions is extended to match the Wasm module
it is imported into.
Fixes the crash in #907.

(cherry picked from commit 1fa528b19fb4551ebc6b4d33b408e456ba367acc)
2024-08-13 18:00:24 -04:00
Liav A.
a52deb23a2 Utilities/du: Set minimum width when printing sizes
This change should help forcing basic alignment either on human readable
sizes (or just raw number).
2024-08-13 20:53:28 +01:00
Tim Ledbetter
cbf1905621 LibWeb: Account for header size when reading MessagePort message payload
Previously, the fact that this wasn't accounted for could lead to a
crash when large messages were received.

(cherry picked from commit 34e465a67e41b82b276050dde0b4b321c2cf1b18)
2024-08-13 15:44:49 -04:00
Aliaksandr Kalenik
0283f334af LibWeb: Apply scroll offset and clip rectangle to table borders
Moves paint_table_borders() call into PaintableBox::paint() to make
scroll offset and clip rectangle of enclosing scrollable be applied
in ::before_paint().

(cherry picked from commit 2cc2646f5585e4a1f617ac809806bf05e8e515a4)
2024-08-13 15:44:11 -04:00
Diego Frias
56bd11d00f LibWeb: No longer return undefined on null table entry in Wasm API
Return `null` instead, as per the specification.

(cherry picked from commit 3c5e3eef10a5e88284a78182585899962b76a8c3)
2024-08-13 15:43:53 -04:00
Timothy Flynn
c4f8b961b0 LibWebView: Make open file limit modifications non-fatal
If setrlimit fails, let's just report the error rather than failing to
start the browser at all.

(cherry picked from commit cf25a06d6715c8ef699973db7634016f8659c9d7)
2024-08-13 15:43:40 -04:00
Timothy Flynn
5d70ea62db LibCore: Use Error::from_syscall to report get/setrlimit errors
(cherry picked from commit 9e7e22dc74ff1bb99e0e8dff63128ef087623480)
2024-08-13 15:43:40 -04:00
BenJilks
736c931a15 LibWeb: Add additional padding to the end of the scrollable overflow
Adds additional padding to the end-side of the scrollable overflow
rectangle as necessary to enable a scroll position that satisfies
the requirements of `place-content: end` alignment.

(cherry picked from commit 963cf1c2c4e4b1cd482c41d6f673b7207bbcc067)
2024-08-13 15:43:28 -04:00
Sam Atkins
a7cf06b288 LibWebView: Sort vendor-prefixed properties last in the inspector
Previously, the legacy `-webkit-foo` properties would all be top of the
list, when they are generally not useful to inspect. Instead, put them
at the bottom, so that users can still see them if they want to, but
they're not in the way.

(cherry picked from commit 113b4da1df7ec65a8686af4e7b91e2f8d4114e2c)
2024-08-13 15:43:00 -04:00
Timothy Flynn
8999ebae52 LibWebView: Use an overflow-x value of 'auto' for Inspector containers
The Inspector looks a bit nicer if we don't paint the horizontal scroll
bars unless we need to.

(cherry picked from commit 5c73a31b4f3e18acb783b6a5c6c9a479d2956de8)
2024-08-13 15:42:42 -04:00
Timothy Flynn
75eea197c2 LibWebView: Improve scrolling of Inspector content containers
Currently, the feel of scrolling containers in the Inspector is a bit
awkward. We make the entire split-view container scrollable, then we
absolutely position the tab control buttons to force them to not scroll.
The result is that the scroll bar is painted over the tab controls, and
the tab content that we actually want to scroll has to scroll under the
tab controls. This never looked quite right.

It was basically:

    <div tab-container> <!-- Scrollable -->
        <div tab-controls /> <!-- Pinned to not be scrollable -->
        <div tab-content /> <!-- The part we actually want to scroll -->
    </div>

This patch moves the "scrollability" to just the tab content. We then
don't need to go out of our way to ensure only the content is actually
scrollable.

So we now have:

    <div tab-container> <!-- Not scrollable -->
        <div tab-controls /> <!-- Not pinned, uses normal layout -->
        <div tab-content /> <!-- Scrollable -->
    </div>

(cherry picked from commit d2c775b0ca202aa9be81ab21b0c71a8f8ac005e3)
2024-08-13 15:42:42 -04:00
Andreas Kling
055f4ec64f LibURL: Make URL a copy-on-write type
This patch moves the data members of URL to an internal URL::Data struct
that is also reference-counted. URL then uses a CopyOnWrite<T> template
to give itself copy-on-write behavior.

This means that URL itself is now 8 bytes per instance, and copying is
cheap as long as you don't mutate.

This shrinks many data structures over in LibWeb land. As an example,
CSS::ComputedValues goes from 3024 bytes to 2288 bytes per instance.

(cherry picked from commit 936b76f36e87a6d4cf267c15c95786ef677515fc)
2024-08-13 15:42:19 -04:00
Andreas Kling
bee67f187c LibWeb: Make CSS::PercentageOr<T> non-virtual
This shrinks each instance of PercentageOr by 8 bytes and avoids virtual
dispatch when resolving calc() values. It's a win-win!

Many data structures shrink as a result. An example is ComputedValues
which goes from 3376 bytes to 3024 bytes per instance.

(cherry picked from commit c282138fd0b20604384b39bfc0a8c5f6ccab56bd)
2024-08-13 15:42:19 -04:00
Andreas Kling
9348ea160a LibWeb: Use bitmaps for important/inherited bits in StyleProperties
This avoids padding the style value array, shrinking StyleProperties
from 4368 bytes to 2288 bytes per instance.

(cherry picked from commit b42b7c8dd02911504e6947fc2816b85220cdcf9f)
2024-08-13 15:42:19 -04:00
Andreas Kling
225dc0be5a LibWeb: Only remember source CSSStyleDeclaration for animation-name
We were saving to source declarations for *every* property, even though
we only ever looked it up for animation-name.

This patch gets rid of the per-property source pointer and we now keep
a single pointer to the animation-name source only.

This shrinks StyleProperties from 6512 bytes to 4368 bytes per instance.

(cherry picked from commit c288bfb40453d4abe95af694dfc7c2175cd04a14)
2024-08-13 15:42:19 -04:00
Timothy Flynn
b69d81d459 WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top-
level clients, created for e.g. subframes. We also want to make sure the
Console client is updated if the top-level document has changed.

(cherry picked from commit 0e640f6f706e7682b8a0004945ef0ddec2d44988)
2024-08-13 15:39:53 -04:00
Timothy Flynn
6159f71e4d LibWeb+WebContent: Store console clients on the DOM document
We explicitly stopped visting the map of documents to console clients in
commit 44659f2f2a to avoid keeping the
document alive. However, if nothing else visits the console clients, we
may set the top-level console client to a client that has been garbage
collected.

So instead of storing this map, just store the console client on the
document itself. This will allow the document to visit its client.

(cherry picked from commit 0a819e628eb296200b8b5e609b4936a1a4bf330f)
2024-08-13 15:39:53 -04:00