Commit graph

1373 commits

Author SHA1 Message Date
EWouters a07e12609e Ports/mrsh: Fix workdir, remove or upgrade patches
Also removes mrsh from the list of ports missing descriptions. I tried
to be descriptive about the patches, but as I picked this port up from
someone else, I'm not 100% sure how to best explain the patches.
2022-05-07 17:00:39 +02:00
Liav A c246d86867 Meta: Use VMWare SVGA adapter if running QEMU Q35 machine
This let us test the VMWare SVGA adapter easily. We already use the std
vga (which is compatible with bochs-display that only lacks VGA support)
on the i440FX QEMU machine so we keep testing it there too, and on the
Q35 machine we use a bochs-display device as secondary display.
2022-05-06 18:04:57 +02:00
Andrew Kaster 44bcd7c7aa CI: Add x86_64 Clang Coverage pipeline in Azure
Add a job to the Azure pipelines to run tests with coverage enabled, and
aggregate the test results in a folder of html pages showing the
coverage results overall, and per-file.

Future work is needed to take the published pipeline artifact for the
coverage results and display them somewhere interesting.
2022-05-02 01:46:18 +02:00
Andrew Kaster 3e32fb911e Meta: Add script to analyze coverage data from an existing disk image
The analyze-qemu-coverage.sh script cracks open the _disk_image for the
given SERENITY_ARCH and SERENITY_TOOLCHAIN and extracts llvm profile
data into a local directory owned by the current user. It then calls a
coverage artifact script from llvm to create a nice html report for all
the source files referenced by the profile data files.

We currently grab a script from llvm via wget. In the future a custom
script to call llvm-cov and llvm-profdata should probably be used.
2022-05-02 01:46:18 +02:00
Andrew Kaster 5120b39d0e Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option
This option sets -fprofile-instr-generate -fcoverage-mapping for Clang
builds only on almost all of Userland. Loader and LibTimeZone are
exempt. This can be used for generating code coverage reports, or even
PGO in the future.
2022-05-02 01:46:18 +02:00
Andrew Kaster a6b2c34746 Meta: Remove unused serenity_libc_static helper function 2022-05-02 01:46:18 +02:00
kleines Filmröllchen df57536c40 AK: Put invalid UTF8 debug spam behind a flag
This is very annoying if we're (intentionally) passing invalid UTF8 into
Utf8View.
2022-04-27 00:02:24 +02:00
kleines Filmröllchen a67bbf1ac4 Meta: Re-enable automatic virtualization detection on Windows
Before, we wouldn't enable virtualization on Windows anymore unless
SERENITY_VIRTUALIZATION_SUPPORT was set explicitly. As far as we know,
there's no automatic way of detecting whether WHPX is enabled or not. So
we'll just enable virtualization on Windows by default, and if that
doesn't work the user can still disable it manually with
SERENITY_VIRTUALIZATION_SUPPORT=0.
2022-04-26 22:42:38 +02:00
Daniel Bertalan dbb2347000 Meta: Allow Clang to be used as the host compiler for Lagom
Various Clang binaries are now considered when choosing the compiler for
Lagom.

The selection precedence is as follows:
1. Use the compiler set via CC/CXX if it's a supported version
2. Use newest available GCC if it's supported
3. Use newest available Clang if it's supported

Note that Apple Clang is still not supported, as its versioning scheme
and the fact that it masquerades as both GCC and Clang would complicate
this logic even more.

Fixes #12253
2022-04-26 15:01:46 +02:00
Daniel Bertalan 57c6829249 CI: Update the path to our LLVM patches
The LLVM patch has been broken up into smaller commits and moved to a
separate directory. CI should look at this new location to determine if
the toolchain needs to be rebuilt.
2022-04-23 10:43:32 -07:00
Daniel Bertalan d6a735fe62 Meta: Use clang-format from the Clang toolchain if available 2022-04-23 10:43:32 -07:00
Daniel Bertalan 01b31d9858 Toolchain+Ports: Update LLVM to 14.0.1
Besides a version bump, the following changes have been made to our
toolchain infrastructure:
- LLVM/Clang is now built with -march=native if the host compiler
  supports it. An exception to this is CI, as the toolchain cache is
  shared among many different machines there.
- The LLVM tarball is not re-extracted if the hash of the applied
  patches doesn't differ.
- The patches have been split up into atomic chunks.
- Port-specific patches have been integrated into the main patches,
  which will aid in the work towards self-hosting.
- <sysroot>/usr/local/lib is now appended to the linker's search path by
  default.
- --pack-dyn-relocs=relr is appended to the linker command line by
  default, meaning ports take advantage of RELR relocations without any
  patches or additional compiler flags.

The formatting of LLVM port's package.sh has been bothering me, so I
also indented the arguments to the CMake invocation.
2022-04-23 10:43:32 -07:00
kleines Filmröllchen 60ff054b02 Meta: Rename SERENITY_KVM_SUPPORT -> SERENITY_VIRTUALIZATION_SUPPORT 2022-04-23 13:39:13 +02:00
kleines Filmröllchen 67d99f80b9 Meta: Use SERENITY_KVM_SUPPORT to also toggle virtualization on Windows
It's sometimes nice to turn off virtualization, even on Windows :^)
2022-04-23 13:39:13 +02:00
kleines Filmröllchen 49b087f3cd LibAudio+Userland: Use new audio queue in client-server communication
Previously, we were sending Buffers to the server whenever we had new
audio data for it. This meant that for every audio enqueue action, we
needed to create a new shared memory anonymous buffer, send that
buffer's file descriptor over IPC (+recfd on the other side) and then
map the buffer into the audio server's memory to be able to play it.
This was fine for sending large chunks of audio data, like when playing
existing audio files. However, in the future we want to move to
real-time audio in some applications like Piano. This means that the
size of buffers that are sent need to be very small, as just the size of
a buffer itself is part of the audio latency. If we were to try
real-time audio with the existing system, we would run into problems
really quickly. Dealing with a continuous stream of new anonymous files
like the current audio system is rather expensive, as we need Kernel
help in multiple places. Additionally, every enqueue incurs an IPC call,
which are not optimized for >1000 calls/second (which would be needed
for real-time audio with buffer sizes of ~40 samples). So a fundamental
change in how we handle audio sending in userspace is necessary.

This commit moves the audio sending system onto a shared single producer
circular queue (SSPCQ) (introduced with one of the previous commits).
This queue is intended to live in shared memory and be accessed by
multiple processes at the same time. It was specifically written to
support the audio sending case, so e.g. it only supports a single
producer (the audio client). Now, audio sending follows these general
steps:
- The audio client connects to the audio server.
- The audio client creates a SSPCQ in shared memory.
- The audio client sends the SSPCQ's file descriptor to the audio server
  with the set_buffer() IPC call.
- The audio server receives the SSPCQ and maps it.
- The audio client signals start of playback with start_playback().
- At the same time:
  - The audio client writes its audio data into the shared-memory queue.
  - The audio server reads audio data from the shared-memory queue(s).
  Both sides have additional before-queue/after-queue buffers, depending
  on the exact application.
- Pausing playback is just an IPC call, nothing happens to the buffer
  except that the server stops reading from it until playback is
  resumed.
- Muting has nothing to do with whether audio data is read or not.
- When the connection closes, the queues are unmapped on both sides.

This should already improve audio playback performance in a bunch of
places.

Implementation & commit notes:
- Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept
  for WavLoader, see previous commit message.
- Most intra-process audio data passing is done with FixedArray<Sample>
  or Vector<Sample>.
- Improvements to most audio-enqueuing applications. (If necessary I can
  try to extract some of the aplay improvements.)
- New APIs on LibAudio/ClientConnection which allows non-realtime
  applications to enqueue audio in big chunks like before.
- Removal of status APIs from the audio server connection for
  information that can be directly obtained from the shared queue.
- Split the pause playback API into two APIs with more intuitive names.

I know this is a large commit, and you can kinda tell from the commit
message. It's basically impossible to break this up without hacks, so
please forgive me. These are some of the best changes to the audio
subsystem and I hope that that makes up for this :yaktangle: commit.

:yakring:
2022-04-21 13:55:00 +02:00
kleines Filmröllchen 6b13436ef6 LibCore: Introduce SharedSingleProducerCircularQueue
This new class with an admittedly long OOP-y name provides a circular
queue in shared memory. The queue is a lock-free synchronous queue
implemented with atomics, and its implementation is significantly
simplified by only accounting for one producer (and multiple consumers).
It is intended to be used as a producer-consumer communication
datastructure across processes. The original motivation behind this
class is efficient short-period transfer of audio data in userspace.

This class includes formal proofs of several correctness properties of
the main queue operations `enqueue` and `dequeue`. These proofs are not
100% complete in their existing form as the invariants they depend on
are "handwaved". This seems fine to me right now, as any proof is better
than no proof :^). Anyways, the proofs should build confidence that the
implemented algorithms, which are only roughly based on existing work,
operate correctly in even the worst-case concurrency scenarios.
2022-04-21 13:55:00 +02:00
Tim Schumacher ec6016fa2c Meta: Allow setting a host IP address to bind to 2022-04-20 14:12:34 +02:00
Tim Schumacher 1878488c04 Meta: Commonize network device settings 2022-04-20 14:12:34 +02:00
Ali Mohammad Pur 302a0c54f0 Base: Add some default completions to shellrc 2022-04-18 19:53:10 +04:30
Sam Atkins 42d87239a8 LibWeb: Generate some metadata about transform functions
This will be used to parse and validate their parameters.
2022-04-18 14:16:28 +02:00
Sam Atkins 872ad98eba LibWeb: Generate TransformFunction to/from string functions 2022-04-18 14:16:28 +02:00
Sam Atkins 5f3498d50f LibWeb: Add code generator for CSS transform functions
This first step just generates the TransformFunction enum, but more will
follow.
2022-04-18 14:16:28 +02:00
Tim Schumacher 8c278bba43 Meta: Keep timestamps of manually copied toolchain output 2022-04-17 10:53:31 -07:00
Jelle Raaijmakers 8cfabbcd93 Tests: Implement reference image testing for LibGL
Each LibGL test can now be tested against a reference QOI image.
Initially, these images can be generated by setting `SAVE_OUTPUT` to
`true`, which will save a bunch of QOI images to `/home/anon`.
2022-04-17 09:58:29 +04:30
Sam Atkins d564cf1e89 LibCore+Everywhere: Make Core::Stream read_line() return StringView
Similar reasoning to making Core::Stream::read() return Bytes, except
that every user of read_line() creates a StringView from the result, so
let's just return one right away.
2022-04-16 13:27:51 -04:00
Sam Atkins 3b1e063d30 LibCore+Everywhere: Make Core::Stream::read() return Bytes
A mistake I've repeatedly made is along these lines:
```c++
auto nread = TRY(source_file->read(buffer));
TRY(destination_file->write(buffer));
```

It's a little clunky to have to create a Bytes or StringView from the
buffer's data pointer and the nread, and easy to forget and just use
the buffer. So, this patch changes the read() function to return a
Bytes of the data that were just read.

The other read_foo() methods will be modified in the same way in
subsequent commits.

Fixes #13687
2022-04-16 13:27:51 -04:00
Sam Atkins a20188cd91 LibWeb: Use generated enum code for property value validation
This has the nice benefit of removing a lot of duplicated lists of
values from Properties.json. :^)
2022-04-14 14:54:06 +02:00
Sam Atkins c66da0f2cb LibWeb: Assign an underlying type to generated CSS enums
I'm *pretty* sure that even a u32 would be overkill but you never know
with CSS specs.
2022-04-14 14:54:06 +02:00
Sam Atkins c50661067d LibWeb: Generate and use to_string(css_enum) functions
The only one that's actually used is for Repeat, but it's easy to
generate them so might as well. :^)
2022-04-14 14:54:06 +02:00
Sam Atkins 9bf511caa3 LibWeb: Generate to_value_id() functions 2022-04-14 14:54:06 +02:00
Sam Atkins 3f61f869c8 LibWeb: Generate ValueID-to-enum conversion functions 2022-04-14 14:54:06 +02:00
Sam Atkins a97944e483 LibWeb: Add a new code generator for CSS enums
Alias values are represented by "alias-name=real-name".

We have a lot of repetitive code for converting between ValueID and
property-specific enums. Let's see if we can generate it. :^)

This first step just produces the enums, from a JSON file. The values in
there are a duplication of what's in Properties.json, but eventually
those will go away.
2022-04-14 14:54:06 +02:00
Sam Atkins c449cabae3 LibWeb: Move CSS Parser into new Web::CSS::Parser namespace
The goal here is to move the parser-internal classes into this namespace
so they can have more convenient names without causing collisions. The
Parser itself won't collide, and would be more convenient to just
remain `CSS::Parser`, but having a namespace and a class with the same
name makes C++ unhappy.
2022-04-12 23:03:46 +02:00
EWouters d89a58216d Ports/pt2-clone: Update pt2-clone to version 1.43
Upgrade patches to git style, add ReadMe.md and remove from the list
of ports missing descriptions.
2022-04-11 19:43:56 -07:00
EWouters cf0798158a Ports/klong: Update klong to version 20220315
Upgrade patch to git style, add ReadMe.md and remove from the list of
ports missing descriptions.
2022-04-11 19:43:56 -07:00
EWouters 769615fc48 Ports/gawk: Update gawk to version 5.1.1
The patch for config.sub is no longer required.

This also removes gawk from the list of ports missing descriptions as
it no longer has any patches.
2022-04-11 19:43:56 -07:00
EWouters 8828b038f5 Ports/diffutils: Update diffutils to version 3.8
The fnmatch patch that was added in 6de6dff is reverted because it is
not clear why it is necessary, as discussed in #9206.

This also removes diffutils from the list of ports missing descriptions
as it no longer has any patches.
2022-04-11 19:43:56 -07:00
Simon Wanner 4cbbb72ce8 Meta/Lagom: Add a fuzzer for the WOFF parser 2022-04-09 23:48:18 +02:00
Simon Wanner bf6d64c199 LibGfx: Add a loader the Web Open Font Format (WOFF)
This format is 'just' a zlib compressed wrapper for TrueType/OpenType
which makes implementing it rather convenient. :^)
2022-04-09 23:48:18 +02:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Simon Wanner 6f8fd91f22 LibGfx: Move TTF files from TrueTypeFont/ to Font/TrueType/ 2022-04-09 23:48:18 +02:00
stelar7 ce08fae13b Meta: Add fuzzer for Poly1305 2022-04-08 14:02:02 +04:30
Timothy Flynn 1f2542247f LibUnicode: Upgrade to CLDR version 41.0.0
Release notes: https://cldr.unicode.org/index/downloads/cldr-41

Note that the HourCycleRegion enum now contains 272 entires, thus needs
to be bumped from u8 to u16.
2022-04-07 08:29:10 -04:00
Timothy Flynn 8a46794ff8 LibUnicode: Replace individual UCD file downloads with single UCD.zip
Instead of downloading nearly 20 files individually, we can download a
single .zip file similar to how we download a single CLDR .zip. This is
to reduce the number of connections/downloads to/from unicode.org.
2022-04-06 17:12:08 -07:00
Stephan Unverwerth 5bb76e9b63 LibGL+LibGPU+LibSoftGPU: Load SoftGPU driver dynamically
This loads libsoftgpu.so during GLContext creation and instantiates the
device class which is then passed into the GLContext constructor.
2022-04-06 11:32:24 +02:00
Kenneth Myhra 0b86574293 LibWeb: Verify argument_check before generating if statement
This fixes an error where we would generate an empty 'if' statement body
if argument_check was empty.
2022-04-05 22:33:44 +02:00
Kenneth Myhra 887e13f364 LibWeb: Get argument count from Function::parameters::size()
Previously this retrieved argument count from Function::length() which
did not return the correct count in all situations.
2022-04-05 22:33:44 +02:00
Kenneth Myhra ba23d036bd LibWeb: Add IDLGenerators::is_primitive()
This adds the is_primitive() method as described in the Web IDL
specification. is_primitive() returns true if the type is a bigint,
boolean or numeric type.
2022-04-05 22:33:44 +02:00
Timothy Flynn b36c3a68d8 js: Convert non-UTF-8 encoded files to UTF-8 before parsing 2022-04-05 00:14:29 +01:00
Nico Weber fd82121319 Tests: Add some test coverage for the TTF parser
This is in Tests/LibTTF instead of Tests/LibGfx because Tests/LibGfx
depends on serenity's file system layout and can't run in lagom,
but this new test runs just fine in lagom.
2022-04-03 19:16:03 +02:00