Commit graph

50022 commits

Author SHA1 Message Date
Pankaj Raghav 9b3b0531e5 Kernel: Add MSIx support to NVMe
Add MSIx support to NVMe. Prefer MSIx over pin-based interrupts as they
are more efficient and all modern hardware support them.
2023-05-07 21:16:41 +02:00
Pankaj Raghav bfcf7ab3e8 Kernel: Pass NVMeController reference to NVMequeue
This is in preparation for adding MSI(x) support to the NVMe device.
NVMeInterruptQueue needs access to the PCI device to deal with MSI(x)
interrupts. It is ok to pass the NVMeController as a reference to the
NVMeQueue as NVMeController is the one that owns the NVMeQueue.

This is very similar to how AHCIController passes its reference to its
interrupt handler.
2023-05-07 21:16:41 +02:00
Pankaj Raghav 693e3419b7 NVMe: Use an explicit Queue type instead of using an Optional irq
Add an explicit QueueType enum which could be used to create a poll or
an interrupt queue. This is better than passing an Optional<irq>.

This refactoring is in preparation for adding MSIx support to NVMe.
2023-05-07 21:16:41 +02:00
Pankaj Raghav feb48cbc7c Kernel: Introduce PCIIRQHandler
PCIIRQHandler is a generic IRQ handler that the device driver can
inherit to use either Pin or MSI(x) based interrupt mechanism.

The PCIIRQHandler can do what the existing IRQHandler can do for pin
based interrupts but also deal with MSI based interrupts. We can
hopefully convert all the PCI based devices to use this handler so that
MSI(x) can be used.
2023-05-07 21:16:41 +02:00
Pankaj Raghav 82cf0bfb75 Kernel: Add APIs to PCI Device to use MSI(x)
Add reserve_irqs, allocate_irq, enable_interrupt and disable_interrupt
API to a PCI device.

reserve_irqs() can be used by a device driver that would like to
reserve irqs for MSI(x) interrupts. The API returns the type of IRQ
that was reserved by the PCI device. If the PCI device does not support
MSI(x), then it is a noop.

allocate_irq() API can be used to allocate an IRQ at an index. For
MSIx the driver needs to map the vector table into the memory and add
the corresponding IRQ at the given index. This API will return the
actual IRQ that was used so that the driver can use it create interrupt
handler for that IRQ.

{enable, disable}_interrupt API is used to enable or disable a
particular IRQ at the given index. It is a noop for pin-based
interrupts. This could be used by IRQHandler to enable or disable an
interrupt.
2023-05-07 21:16:41 +02:00
Pankaj Raghav f0b6eb6932 Kernel: Implement helpers to manipulate MSI(x) data structures
MSIx table entry is used to program interrupt vectors and it is
architecture specific. Add helper functions declaration in
Arch/PCIMSI.h. The definition of the function is placed in the
respective arch specific code.
2023-05-07 21:16:41 +02:00
Pankaj Raghav bf7ac06d7b Kernel: Implement {enable,disable}_msix interrupts in PCI Device
Implement enabling and disabling MSIx interrupts for a PCI device.

Removes two TODO()s from PCI::Device.cpp :^)
2023-05-07 21:16:41 +02:00
Pankaj Raghav d3bb63afff Kernel: Use PCIIdentifier is_msix_capable API to retrieve MSIx status
Instead of iterating through the capabilities, use the
is_msix_capable() API from the PCIIdentifier class that belongs to the
device.
2023-05-07 21:16:41 +02:00
Pankaj Raghav d0fbaf790a Kernel: Add MSIxInfo struct to PCI DeviceIdentifier
Add a struct named MSIxInfo that stores all the relevant MSIx
information as a part of PCI DeviceIdentifier struct.

Populate the MSIx struct during the PCI device init. As the
DeviceIdentifier struct need to populate MSIx info, don't mark
DeviceIdentifier as const in the PCI::Device class.
2023-05-07 21:16:41 +02:00
Pankaj Raghav 71c75873c9 Kernel: Add write{8,16,32} to the PCI Capability struct
MSI(x) mechanism requires the device to write to its Capability
structure. Add write{8,16,32} similar to read{8,16,32}.
2023-05-07 21:16:41 +02:00
Pankaj Raghav 91da264a4c Kernel: Add reserve_interrupt_handlers API
MSI(x) interrupts need to reserve IRQs so that it can be programmed by
the device. Add an API to reserve contiguous ranges of interrupt
handlers so that it can used by PCI devices that use MSI(x) mechanism.

This API needs to be implemented by aarch64 architecture.
2023-05-07 21:16:41 +02:00
Pankaj Raghav a5ec5f07fa Kernel/PCI: Set IRQ as reserved for pin-based interrupts
Set pin-based interrupt handler as reserved during PCI bus init.
This is required so that MSI(x) based interrupts can avoid sharing the
IRQ which has been marked as reserved.
2023-05-07 21:16:41 +02:00
Pankaj Raghav e5cc78e9db Kernel: Add m_reserved private variable to GenericInterruptHandler
Pin-based PCI device are allocated an IRQ, and it could be shared with
multiple devices. An interrupt handler with an IRQ for a PCI device
will get registered only during the driver initialization.

For MSI(x) interrupts, the driver has to allocate IRQs and this field
can be used to skip IRQs that have already been reserved by pin-based
interrupts so that we don't have to share IRQs, which generally will
reduce the performance.
2023-05-07 21:16:41 +02:00
MacDue b5e593d0e7 Ladybird: Don't ask Qt to decode any images for us
We should only rely on LibGfx to decode images for us, if LibGfx
can't decode an image that should be motivation to improve LibGfx,
not hidden by Qt picking up the slack :^)
2023-05-07 21:13:02 +02:00
thankyouverycool af8cd477b4 LibGUI: Always paint vertical lines for Frames in unmaximized windows
Fixes incorrect thread highlighting for ResourceGraph panels.

Prior to FrameStyles, these graphs were painted as faux-panels,
this is, sunken containers with a thickness of 1, and weren't
subject to the bug.
2023-05-07 21:12:35 +02:00
Andreas Kling 222a1b8b95 LibWeb: Don't force relayout on scheduled layout update
If something else has already caused a layout, there's no need to force
a new relayout when the layout timer fires.

This avoids a lot of redundant work on many pages. :^)
2023-05-07 21:00:12 +02:00
Kenneth Myhra 50413c2326 Toolchain: Replace inline nproc with get_number_of_processing_units() 2023-05-07 14:29:25 +02:00
Kenneth Myhra 36c892ae14 Meta: Add get_number_of_processing_units() to shell_include.sh
This adds the method get_number_of_processing_units() which returns the
number of processing units the system has available.
2023-05-07 14:29:25 +02:00
Ben Wiederhake 449911c286 Chess: Slightly improve error propagation during startup 2023-05-07 14:04:55 +02:00
Ben Wiederhake 0fe29a48ad Chess: Avoid IODevice and DeprecatedFile 2023-05-07 14:04:55 +02:00
Ben Wiederhake 715f4a8d7e LibSQL: Remove unused IODevice include 2023-05-07 14:04:55 +02:00
Ben Wiederhake 7f70676123 LibJS: Revert to original text in spec
See also:
36ff6187f6
https://github.com/SerenityOS/serenity/pull/18682#issuecomment-1537249544
2023-05-07 11:57:08 +02:00
Fabian Dellwing 589d2d50f5 netstat: Fix fallback value for pid field 2023-05-07 11:55:58 +02:00
Fabian Dellwing 2cd59df443 netstat: Add -e argument
This adds information about the user owning the process to our netstat
output. We do not fully match the behaviour of Linux as we don't show
an inode information.
2023-05-07 11:55:58 +02:00
Fabian Dellwing 34d699b678 netstat: Fix in/out bytes not showing
Some change in our JsonObject API broke the logic here. We now read
the correct type from the JsonObject and convert it to a string ourself.
2023-05-07 11:55:58 +02:00
Fabian Dellwing 2efdac9441 netstat: Fix port numbers not showing
Some change in our JsonObject API broke the logic here. We now read
the correct type from the JsonObject and convert it to a string ourself.
2023-05-07 11:55:58 +02:00
Andreas Kling 4637d020c3 LibWeb: Add fast_is<T>() helper for HTMLScriptElement
This makes loading Google Groups quite a bit faster, as 20% of runtime
while loading was spent asking if DOM nodes are HTMLScriptElement.
2023-05-07 10:47:30 +02:00
Andreas Kling 97f0106edd LibGfx/OpenType: Cache kerning values for faster text layout
The Font class now remembers the results of kerning lookups in a
HashMap. This fixes an issue where text-heavy UI (like WidgetGallery)
would lag when using a UI font with kerning data.
2023-05-07 10:44:05 +02:00
Lucas CHOLLET 677386bfaa LibGfx/JPEG: Use a lookup table to retrieve huffman symbols
Instead of testing all possible code to find the good symbol, we use a
lookup table to directly find the expected symbol. This method is used
by most Huffman decoder (gzip or libjpeg-turbo).

In order to use the correct key when peeking a constant number of bits
from the stream, we generate duplicates in the table. As an example, for
the code 110, all entries with that pattern 110***** will be set to
110's symbol. So, when you read this code plus garbage from following
codes, you still find the correct symbol.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET 9389177e5f LibGfx/JPEG: Make generate_huffman_codes be a method of HuffmanTable
And call it when reading the table definition instead of when starting
to decode the stream.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET 8cba8ed25a LibGfx/JPEG: Rename HuffmanTableSpec => HuffmanTable 2023-05-07 09:08:56 +02:00
Lucas CHOLLET 011fe0d9ba LibGfx/JPEG: Ensure capacity of vector instead of blindly appending 2023-05-07 09:08:56 +02:00
Lucas CHOLLET f4014f898d LibGfx/JPEG: Use peek_bits in next_symbol
This allows us to read all bits in a single shot instead of one by one.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET 5ec2aa4dcc LibGfx/JPEG: Introduce peek_bits and use it in read_bits
While already providing a performance improvement by removing the loop
in `read_bits`, this method was introduced to optimize `next_symbol`.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET 86ce9cc30f LibGfx/JPEG: Encapsulate operations on HuffmanStream
Advantages of encapsulation are really obvious here:
- Put related code together
- Prevent external functions to modify the object
- Abstract the implementation

No functional changes intended.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET 66108d102e LibGfx/JPEG: Store previous DC values in i16
Forgotten child of cfaa5120.
2023-05-07 09:08:56 +02:00
Lucas CHOLLET a08b91e63e LibGfx/JPEG: Rename HuffmanStreamState => HuffmanStream 2023-05-07 09:08:56 +02:00
Andreas Kling af5d892a7e Ladybird: Don't ask Qt to decode SVG images for us
While it's nice to see <img src="foo.svg"> suddenly work in Ladybird
after linking with the Qt SVG module, this is cheating.

We should implement SVG-as-image ourselves instead of relying on 3rd
party code to do it. :^)
2023-05-07 09:06:48 +02:00
Cubic Love eadef3e5c3 Base: Add web server tip to Tips-and-Tricks(7)
Add the very useful tip of how to transfer files from QEMU to your host
machine via the built-in web server.
2023-05-07 07:08:58 +02:00
Nico Weber 0d2e6162db LibGfx/WebP: Implement compressed ALPH chunk reading
A compressed ALPH chunk is a lossless webp bitstream, but without
the 5 byte "header" that stores width, height, is-alpha-channel-used
(it never is for an ALPH chunk since the ALPH chunk gets the alpha
data out of the lossless webp's green channel), and version fields.

For that reason, this cuts decode_webp_chunk_VP8L() into the
header-reading part and the remaining part, so that the remaining
part can be called by the ALPH reading routine.

Lossy webp files with a (losslessly) compressed alpha channel can
be found in the wild. Since we can't decode lossy webp data yet,
change the `#if 0` in decode_webp_chunk_VP8() to `#if 1` to test this.
2023-05-07 07:08:05 +02:00
Nico Weber fab6a3915e LibGfx/WebP: Implement uncompressed ALPH chunk reading
ALPH chunks are only used to give lossy webp frames an alpha channel,
and lossy decompression isn't implemented yet. So this can currently
never be hit in practice -- but for debugging and testing, I put in
some code behind `#if 0` for now that fake-decompresses a lossy webp
frame by returning an empty bitmap.

But this also doesn't implement compressed ALPH chunks yet, and I
couldn't find any lossy-webp-with-alpha files that use uncompressed
alpha channels. So the code here isn't really tested.
2023-05-07 07:08:05 +02:00
Nico Weber e9f5c9ab9d Tests/LibGfx: More preparation for lossy and alpha handling
If someone comes along who wants to implement lossy webp decoding,
they now only need to implement decode_webp_chunk_VP8() and everything
might Just Work.

It also makes it possible to implement alpha chunk decoding before
implementing lossy decoding (by making decode_webp_chunk_VP8()
return an empty black bitmap for testing).
2023-05-07 07:08:05 +02:00
Nico Weber 23386ac73a LibGfx/WebP: Extract a decode_webp_image_data() function
That way, animated and non-animated webp files use the same code path
to decode images. That will make it easier to add handling for lossy
decompression and for alpha chunk handling.

No behavior change.
2023-05-07 07:08:05 +02:00
Nico Weber ae7e26e095 Tests/LibGfx: Add some test coverage for animated webp decoding
Also add two FIXME comments for lossy decoding.
2023-05-07 07:08:05 +02:00
Cubic Love 18d527fce1 Base: Improve Assistant App Icon (16px)
I've been unsatisfied with the current Assistant app icon (16px).
After trying many variations, I have ended-up with this. The changes
may be slight, but the bow tie now has a more natural shape including
a more prominent knot, bringing it more inline with the 32px version.
Plus the shading has been tweaked.
2023-05-07 06:33:13 +02:00
Aliaksandr Kalenik 038283f3fc LibWeb: Rename function to find table box width inside table wrapper
compute_table_box_width_inside_table_wrapper should be a better name
considering what this function does.
2023-05-07 06:31:53 +02:00
Aliaksandr Kalenik 3a605d8c19 LibWeb: Set width in compute_width_for_table_wrapper()
Width of table wrapper need to be set to to calculate width of table
box inside. Otherwise TFC will set wrong width assuming width of
containing block is 0.
2023-05-07 06:31:53 +02:00
Timothy Flynn 88e060907b LibWeb: Implement IDL overload resolution steps to clamp argument counts
There is a NOTE in our implementation of these steps which states that
the effective overload set only contains overloads with the correct
number of arguments. While this is true, we should not skip the steps to
clamp the inspected argument count to that correct number. Otherwise, we
will dereference past the end of the overload set's type list as we
blindly iterate over the user-provided arguments.

Fixes #18670.
2023-05-07 06:30:27 +02:00
Andreas Kling fc3c3aef22 LibWeb: Enforce min/max height constraints on abspos replaced boxes
Fixes #18658
2023-05-07 06:28:47 +02:00
Ben Wiederhake 36ff6187f6 Everywhere: Change spelling of 'behaviour' to 'behavior'
"The official project language is American English […]."
5d2e915623/CONTRIBUTING.md?plain=1#L30

Here's a short statistic of the occurrences of the word "behavio(u)r":

$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
      2 BEHAVIOR
     24 Behaviour
     32 behaviour
    407 Behavior
    992 behavior

Therefore, it is clear that "behaviour" (56 occurrences) should be
regarded a typo, and "behavior" (1401 occurrences) should be preferred.

Note that The occurrences in LibJS are intentionally NOT changed,
because there are taken verbatim from the specification. Hence:

$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
      2 BEHAVIOR
     10 behaviour
     24 Behaviour
    407 Behavior
   1014 behavior
2023-05-07 01:05:09 +02:00