Commit graph

35863 commits

Author SHA1 Message Date
Pierce Andjelkovic
7b2e0af13f Ports: Point libexpat to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
37161afbdf Ports: Point libtool to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
901cb247fb Ports: Point nasm to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
52656accb1 Ports: Point yasm to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
756f90d15e Ports: Point freedink to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
dedc534046 Ports: Point libgd to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
39868e833c Ports: Point freeciv to the correct config.sub location 2022-03-15 14:03:07 +00:00
Pierce Andjelkovic
8f531a62eb Ports: Replace gsl download mirror with functional download url 2022-03-15 14:03:07 +00:00
Daniel Bertalan
e3eb68dd58 AK+Kernel: Avoid double memory clearing of HashTable buckets
Since the allocated memory is going to be zeroed immediately anyway,
let's avoid redundantly scrubbing it with MALLOC_SCRUB_BYTE just before
that.

The latest versions of gcc and Clang can automatically do this malloc +
memset -> calloc optimization, but I've seen a couple of places where it
failed to be done.

This commit also adds a naive kcalloc function to the kernel that
doesn't (yet) eliminate the redundancy like the userland does.
2022-03-15 11:56:46 +01:00
Hendiadyoin1
cd21e03225 AK+Everywhere: Add sincos and use it in some places
Calculating sin and cos at once is quite a bit cheaper than calculating
them individually.
x87 has even a dedicated instruction for it: `fsincos`.
2022-03-15 11:39:42 +01:00
Hendiadyoin1
47fe911196 UserspaceEmulator: Clear c0 on x87 constant load instructions 2022-03-15 11:39:42 +01:00
Hendiadyoin1
3f581c77d9 UserspaceEmulator: Make error checks in FYL2XP1 and FYL2X a bit closer
...to the manual

This removes the non complete NaN checks and fixes a bounds check in
FYL2X.
2022-03-15 11:39:42 +01:00
Hendiadyoin1
60cb5b8dfa UserspaceEmulator: Add more FIXMES to SoftFPU
This also includes an exception check for sqrt and two
pow(2,...) -> exp2(...) changes.
2022-03-15 11:39:42 +01:00
Karol Kosek
62668ebd81 Spreadsheet: Move tab widget actions to the main widget constructor
There's no need to reassign these functions when we add a new tab.
Nothing changes inside them and they don't depend on anything in the
function.
2022-03-15 12:01:27 +03:30
Karol Kosek
c0c9825f67 Spreadsheet: Get the active sheet via TabWidget::active_widget()
We don't have to track the active widget ourselves anymore -- less
possible boogs!
2022-03-15 12:01:27 +03:30
Karol Kosek
dcd3d7fe22 Spreadsheet: Set tab functions for every tab on setup
Previously, we were setting tab actions only for the active tab on a tab
change, and the same actions for the previous tab were removed.

Unfortunately, this also happened when making a new tab, which meant
that you could trick the cell editor to jump to the new sheet and start
writing there.

To fix this, every view will always have on_selection_changed
and on_selection_dropped assigned.  I haven't seen much difference in
the memory usage, so I guess it'll be fine :)
2022-03-15 12:01:27 +03:30
Luke Wilde
db1236b336 LibJS/Bytecode: Fix typo in object binding an entry with no alias
In object binding, we would attempt to get NonnullRefPtr<Identifier>
from alias on the alias.has<Empty>() code path. In this case, we need
to get it from name instead.
2022-03-15 11:57:51 +03:30
Luke Wilde
515f3e0b85 LibJS/Bytecode: End for's variable scope after update block generation
The update block can generate bytecode that refers to the lexical
environment, so we have to end the scope after it has been generated.
Previously the Jump to the update block would terminate the block,
causing us to leave the lexical environment just before jumping to the
update block.
2022-03-15 11:57:51 +03:30
Luke Wilde
1fc6bbcdc3 LibJS: Stop generating switch case statements on block termination
After we terminate a block (e.g. break, continue), we cannot generate
anymore bytecode for the block. This caused us to crash with this
example code:
```
a = 0;
switch (a) {
    case 0:
        break;
        console.log("hello world");
}
```
Anything after a block terminating instruction is considered
unreachable code, so we can safely skip any statements after it.
2022-03-15 11:57:51 +03:30
Lucas CHOLLET
6f29ccaa5a HackStudio: Remove Terminal widget when the bound shell process dies
This feature allows the terminal widget to be automatically closed when
typing `exit` inside the shell.
2022-03-14 23:43:36 +01:00
Hendiadyoin1
1a739b5d6e Kernel: Try to reuse empty slabheaps before expanding the kmalloc-heap 2022-03-14 23:30:08 +01:00
Hendiadyoin1
05381753c2 Kernel: Bail out earlier from Process::lookup_stacks_directory 2022-03-14 23:28:35 +01:00
Linus Groh
4260638121 Meta: Add copy-src to commands in ZSH autocomplete script 2022-03-14 22:20:35 +00:00
Linus Groh
7560f61b71 Meta: Add aarch64 to targets in ZSH autocomplete script 2022-03-14 22:20:24 +00:00
Samu698
a39c921421 HexEditor: Selection follows cursor while pressing shift
This patch makes the HexEditor behaviour similar to the one of the
text editor, this can be seen by pressing shift and the arrow keys
2022-03-14 22:48:16 +01:00
Samu698
61b8834b1a HexEditor: Disable selection dependent actions when no selection is made
This applies for the "copy as hex", "copy as text", "copy as C code",
"fill selection" actions
2022-03-14 22:48:16 +01:00
Samu698
d694af8be0 HexEditor: Offset segment in status bar opens goto offset dialog 2022-03-14 22:48:16 +01:00
Samu698
a562518ad7 HexEditor: Fill selection sets only bytes inside selection
Before this patch the fill selection command would set the selection
and one byte after it
2022-03-14 22:48:16 +01:00
Samu698
7bf4ed98d7 HexEditor: Copy as C code doesn't add trailing spaces 2022-03-14 22:48:16 +01:00
kleines Filmröllchen
79deb7d6c7 AudioServer: Decrease sample headroom to 5%
This might still be too much, but it's better than what we had before.
2022-03-14 22:46:46 +01:00
kleines Filmröllchen
1088c2c716 Piano: Decrease sample headroom
Multiplying all samples by 0.1 was kind of silly. This also requires
adjusting the wave visualizer so that the waves still fit.
2022-03-14 22:46:46 +01:00
kleines Filmröllchen
d2510d0caa SoundPlayer: Implement logarithmic spectrum display
Now that we have y-axis (gain) logarithmic display, we should also have
x-axis (frequency) logarithmic display; that's how our ears work. This
can be turned off with an option, but it generally looks much nicer.
2022-03-14 22:45:05 +01:00
kleines Filmröllchen
9f856f3e45 SoundPlayer: Adjust peaking logic for bars visualization
This should give us better peaks by also reducing the energy on lower
frequency bars.
2022-03-14 22:45:05 +01:00
kleines Filmröllchen
21266f42f1 SoundPlayer: Use overlapping windows for bars visualization
For DSP reasons I can't explain myself (yet, sorry), short-time Fourier
transform (STFT) is much more accurate and aesthetically pleasing when
the windows that select the samples for STFT overlap. This implements
that behavior by storing the previous samples and performing windowed
FFT over both it as well as the current samples. This gives us 50%
overlap between windows, a common standard that is nice to look at.
2022-03-14 22:45:05 +01:00
Arne Elster
a5d95aa6e8 SoundPlayer: Rework FFT visualization
The input to the FFT was distorted by the usage of fabs on the samples.
It led to a big DC offset and a distorted spectrum. Simply removing fabs
improves the quality of the spectrum a lot.

The FFT input should be windowed to reduce spectral leakage. This also
improves the visual quality of the spectrum.

Also, no need to do a FFT of the whole buffer if we only mean to render
64 bars. A 8192 point FFT may smooth out fast local changes but at 44100
hz samplerate that's 200 ms worth of sound which significantly reduces
FPS.

A better approach for a fluent visualization is to do small FFTs at the
current playing position inside the current buffer.
There may be a better way to get the current playing position, but for
now it's implemented as an estimation depending on how many frames where
already rendered with the current buffer.
Also I picked y-axis log scale as a default because there's usually a
big difference in energy between low and high frequency bands. log scale
looks nicer.
2022-03-14 22:45:05 +01:00
Arne Elster
9edaa033e5 SoundPlayer: Auto refresh visualization widgets
Visualization widgets should only have to tell how many samples they
need per frame and have a render method which receives all data relevant
to draw the next frame.
2022-03-14 22:45:05 +01:00
kleines Filmröllchen
02462b6068 SoundPlayer: Enable frequency energy adjustment by default
Although it's nice to have this as an option, it should be the default
to adjust higher frequencies as they intrinsically have less energy than
lower energies.
2022-03-14 22:45:05 +01:00
Arne Elster
8185e7e932 LibDSP: Add windowing functions
Windows are used in many DSP related applications. A prominent use case
is spectral analysis, where windowing the signal before doing spectral
analysis mitigates spectral leakage.
2022-03-14 22:45:05 +01:00
kleines Filmröllchen
00dd8f8fbe LibDSP: Generalize & improve FFT
Several related improvements to our Fast Fourier Transform
implementation:
- FFT now operates on spans, allowing it to use many more container
  types other than Vector. It's intended anyways that FFT transmutes the
  input data.
- FFT is now constexpr, moving the implementation to the header and
  removing the cpp file. This means that if we have static collections
  of samples, we can transform them at compile time.
- sample_data.data() weirdness is now gone.
2022-03-14 22:45:05 +01:00
Liav A
428d4ae337 Kernel/PCI: Break early of controller iteration over devices in OOM case
This is mainly useful when adding an HostController but due to OOM
condition, we abort temporary Vector insertion of a DeviceIdentifier
and then exit the iteration loop to report back the error if occured.
2022-03-14 22:39:09 +01:00
Liav A
3fb289e27d Kernel/PCI: Don't hold spinlocks when doing fast device enumeration
Instead, hold the lock while we copy the contents to a stack-based
Vector then iterate on it without any locking.

Because we rely on heap allocations, we need to propagate errors back
in case of OOM condition, therefore, both PCI::enumerate API function
and PCI::Access::add_host_controller_and_enumerate_attached_devices use
now a ErrorOr<void> return value to propagate errors. OOM Error can only
occur when enumerating the m_device_identifiers vector under a spinlock
and trying to expand the temporary Vector which will be used locklessly
to actually iterate over the PCI::DeviceIdentifiers objects.
2022-03-14 22:39:09 +01:00
Brian Gianforcaro
c0ed656c94 Kernel: Fix buffer overflow in VirtIOGPU create_3d_resource(..)
This code attempts to copy the `Protocol::Resource3DSpecification`
struct into request, starting at `Protocol::ResourceCreate3D::target`
member of the `Protocol::ResourceCreate3D` struct.

The problem is that the `Protocol::Resource3DSpecification` struct
does not having the trailing `u32 padding` that the `ResourceCreate3D`
struct has. Leading to memcopy overrunning the struct and corrupting
32 bits of data trailing the struct.

Found by SonarCloud:
 - Memory copy function overflows the destination buffer.
2022-03-14 22:30:22 +01:00
Brian Gianforcaro
af50895fa3 LibWeb: Fix height/width copy paste bug in SVGFormattingContext::run
This was found by SonarCloud:
- Identical sub-expressions on both sides of operator "&&".
2022-03-14 22:30:22 +01:00
Karol Kosek
a5e149c012 WindowServer: Update menu buttons' rects on font change
Prior to this change, after changing the system font, the menu rects
stayed the same, making the menu bar look a bit cramped on larger fonts.
2022-03-14 22:29:57 +01:00
Karol Kosek
fe47e66438 WindowServer: Use font height for item heights in Menus
The height of menu items was relatively small on larger fonts.
2022-03-14 22:29:57 +01:00
Karol Kosek
11f82a32d4 LibGUI: Use preferred font line height for item heights in ListView
Previously, changing the font to one with a height greater than 18 meant
that no text was visible in the list items anymore.
2022-03-14 22:29:57 +01:00
Ali Mohammad Pur
d75cf27e02 LibJS: Implement default values for function parameters in BC 2022-03-14 22:28:53 +01:00
Ali Mohammad Pur
0b8d2fb62f LibJS/Bytecode: Replace merged block references before copying them 2022-03-14 22:28:53 +01:00
Simon Wanner
1f9d76c7b8 LibWeb: Invalidate styles after CSSImportRule loads
This replicates the behavior of StyleSheetList::add_sheet, making sure
the rules added by the imported style sheet are applied.
2022-03-14 22:22:53 +01:00
Simon Wanner
1ed5e79478 LibWeb: Fix resolving relative URLs in style sheets
Relative URLs in style sheets should be resolved relative to the
style sheet they're in instead of the document.
2022-03-14 22:22:53 +01:00