Commit graph

31751 commits

Author SHA1 Message Date
Sam Atkins
289cf8d7ef LibCore: Add ErrorOr wrappers to socket syscalls
These are all pretty simple so I thought I would add them all in one go:

- socket()
- bind()
- listen()
- accept()
- accept4()
- connect()
- shutdown()
- send()
- sendmsg()
- sendto()
- recv()
- recvmsg()
- recvfrom()
- getsockopt()
- setsockopt()
- getsockname()
- getpeername()
- socketpair()
2021-12-27 22:00:01 +01:00
Sam Atkins
1fba221b46 LibJS: Implement console.time/timeLog/timeEnd() methods 2021-12-27 21:44:07 +01:00
Sam Atkins
2f3e24d71e LibWeb: Add rudimentary styling to <details> and <summary> 2021-12-27 21:44:07 +01:00
Sam Atkins
d702678d16 LibJS+WebContent+Browser+js: Implement console.group() methods
This implements:
- console.group()
- console.groupCollapsed()
- console.groupEnd()

In the Browser, we use `<details>` for the groups, which is not actually
implemented yet, so groups are always open.

In the REPL, groups are non-interactive, but still indent any output.
This looks weird since the console prompt and return values remain on
the far left, but this matches what Node does so it's probably fine. :^)
I expect `console.group()` is not used much outside of browsers.
2021-12-27 21:44:07 +01:00
Sam Atkins
ff5e07d718 LibJS+WebContent+js: Bring console.trace() to spec
The spec very kindly defines `Printer` as accepting
"Implementation-specific representations of printable things such as a
stack trace or group." for the `args`. We make use of that here by
passing the `Trace` itself to `Printer`, instead of having to produce a
representation of the stack trace in advance and then pass that to
`Printer`. That both avoids the hassle of tracking whether the data has
been html-encoded or not, and means clients don't have to implement the
whole `trace()` algorithm, but only the code needed to output the trace.
2021-12-27 21:44:07 +01:00
Sam Atkins
ce694490f3 LibJS+WebContent+js: Bring console.assert() to spec 2021-12-27 21:44:07 +01:00
Sam Atkins
9b78e287b0 LibJS+WebContent+js: Bring console.clear() to spec
This is identical to before, since we don't have "group stacks" yet, but
clear() now uses ThrowCompletionOr.
2021-12-27 21:44:07 +01:00
Sam Atkins
834ced82d4 LibJS+WebContent+js: Bring console.count[Reset]() to spec
The `CountReset` log level is displayed as a warning, since the message
is always to warn that the counter doesn't exist. This is also in line
with the table at https://console.spec.whatwg.org/#loglevel-severity
2021-12-27 21:44:07 +01:00
Sam Atkins
260836135a LibJS+WebContent+js: Reimplement console.log() and friends to spec
This implements the Logger and Printer abstract operations defined in
the console spec, and stubs out the Formatter AO. These are then used
for the "output a categorized log message" functions.
2021-12-27 21:44:07 +01:00
Sam Atkins
fd7163b125 WindowServer: Stop trying to close windows that are already destroyed 2021-12-27 21:27:16 +01:00
Sam Atkins
a330a070d4 WindowServer: Use is_internal() instead of checking if the client exists 2021-12-27 21:27:16 +01:00
Linus Groh
1298c27ca9 LibWeb: Implement CanvasRenderingContext2D.isContextLost()
Note that we don't implement the "context lost steps" yet, so this will
always return the initial value (false).
2021-12-27 16:43:23 +01:00
Linus Groh
2576af5db1 LibWeb: Implement CanvasRenderingContext2D.reset() 2021-12-27 16:43:23 +01:00
Linus Groh
3e0e965f24 LibWeb: Implement CanvasRenderingContext2D.restore() 2021-12-27 16:43:23 +01:00
Linus Groh
7d435b5ada LibWeb: Implement CanvasRenderingContext2D.save() 2021-12-27 16:43:23 +01:00
Linus Groh
6d50ff71de LibWeb: Encapsulate canvas drawing state in a struct
This will allow us to easily add copies of the relevant canvas drawing
state to a stack, and likewise replace the current drawing  state with
an entry from that stack.
2021-12-27 16:43:23 +01:00
Linus Groh
b32893eb54 LibWeb: Let canvas {fill,stroke}Style default to black, not transparent
I don't know if the original author simply missed this or thought the
default color of Gfx::Color is black, but this meant that drawing on a
canvas without explicitly setting a fillStyle or strokeStyle first would
be drawn in transparent color and therefore be invisible.

In the spec this is indicated by a small comment in the IDL definition:

    attribute ... strokeStyle; // (default black)
    attribute ... fillStyle; // (default black)

I'm starting to question whether Gfx::Color actually *should* have a
default constructor.
2021-12-27 16:43:23 +01:00
Linus Groh
6faaee2bc8 LibWeb: Fix copy/paste typo in CanvasRenderingContext2D::stroke_style()
This returned the fill style, not the stroke style!
2021-12-27 16:43:23 +01:00
Jesse Buhagiar
ca093f442c LibSoftGPU: Mark wrap_clamp as [[maybe_unused]]
This was breaking the fuzzer build becaues the function is not used
if the `CLAMP_DEPRECATED_BEHAVIOR` constexpr is not `true` during
compile time.
2021-12-27 15:08:19 +02:00
Ben Wiederhake
d9af659a12 Meta: Add link to awesome new meta-project from main website :^) 2021-12-27 15:06:39 +02:00
Rummskartoffel
ab2c5eebec Help: Fix memory leak given ambiguous man page title on command line
Given a command line with an ambiguous man page title, such as `$ Help
uname`, Help would find and try to open all matching pages, leading to
bad behavior such as a memory leak, flickering scrollbars, and
eventually a crash due to OOM. This commit fixes the issue by making
Help only open one page on startup.
2021-12-27 12:01:31 +01:00
Jelle Raaijmakers
b3672236bd Ports: Add Tux Racer
The patches take care of a port from SDL1 to SDL2 and replace the
keyboard mapping logic, which will otherwise take a whopping 16 GiB of
memory to run.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
02647fd485 Ports: Add Mesa GLU
This is a dependency for Tux Racer, and is compiled against Serenity's
LibGL.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
f856f49edb LibSoftGPU: Clamp to edge instead of border
According to the Khronos FAQ on texture edge sampling, the `GL_CLAMP`
option was never implemented in hardware and as such, it was
deprecated. A lot of applications and games depend on `GL_CLAMP` not
really meaning `GL_CLAMP` but `GL_CLAMP_TO_EDGE`, so we introduce an
option to toggle this behavior at compile-time.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
d9ea1fe4c9 LibGL: Implement GL_QUAD_STRIP
It seems like we can render this with `GL_TRIANGLE_STRIP`. This makes
the track marks in Tux Racer work.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
7833f25f8f LibGL: Remove stubbed border from glTexImage2D
Providing anything else than `border == 0` is deprecated and should
result in an invalid value error.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
b2e75929f4 LibGL: Implement GL_LINEAR_MIPMAP_NEAREST support 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
ccf6769d95 LibGL: Stub more API calls
These stubs are largely implemented the same: their API is exposed, but
they print to the debug console and sometimes `TODO()`. These changes
allow GLU and Tux Racer to build.

Methods stubbed:

* `glTexImage1D`
* `glTexImage3D`
* `glTexCoord2d(v)`
* `glNormalPointer`
* `glTexGen(d|f|i)`
* `glTexGenfv`
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
abecff1766 LibGL: Stub lots of map-related methods
This adds stubs for `glMap(1|2)(d|f)`, `glMapGrid(1|2)(d|f)`,
`glEvalCoord(1|2)(d|f)`, `glEvalMesh(1|2)` and `glEvalPoint(1|2)`.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
dae63352a3 LibGL: Implement glGetTexLevelParameteriv 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
d83702cb92 LibGL: Implement glRectf and glRecti 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
4a36d6b439 LibGL: Implement glMultMatrixd 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
60fa921daa LibGL: Fix GL_TRIANGLE_STRIP rendering only half its triangles
According to the documentation, we should switch around vertices every
other triangle to prevent front-face culling from removing them.

This allows Tux in Tux Racer to render correctly.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
b455e6ca0d LibGL: Stub glClear support for stencil buffer
Previously, if the client supplied `GL_STENCIL_BUFFER_BIT`, `glClear`
would return an error. Since it is a valid parameter, we now continue
and report that this parameter is unimplemented instead.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
688adba1a8 LibGL: Uncrash glMaterialf on invalid input
We should handle this in the context.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
9e9e1c7634 LibGL: Implement glColor3/4dv 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
3883b42764 LibGL: Stub GL_(UN)PACK_* context parameters
Libraries like GLU depend on their memory initialization by requesting
these parameters, so if we do not support them, segfaults will occur.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
70c6907546 LibGL: Add glext.h and lots of new defines in gl.h
These constants are used by GLU and Tux Racer.
2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
2ce73b31b6 LibGL: Extract platform types to glplatform.h 2021-12-27 11:58:43 +01:00
Jelle Raaijmakers
ce37c138b4 Ports: Compile SDL2_mixer with libmodplug support 2021-12-27 11:58:43 +01:00
Daniel Bertalan
dbdb6abdb9 Ports/libuv: Fix build failure due to missing statfs() function
In 43c27e8, I mistakenly deleted the patch that removed calls to the
statfs() function, which we do not have. This made building the port
with a clean source tree fail.

This commit changes `libuv` to use our statvfs() function instead.
2021-12-27 02:02:03 -08:00
Andreas Kling
63e1b904a4 Kernel: Scrub kmalloc slabs when allocated and deallocated
This matches the behavior of the generic subheaps (and the old slab
allocator implementation.)
2021-12-26 21:22:59 +01:00
Andreas Kling
3399b6c57f Kernel: Remove old SlabAllocator :^)
This is no longer useful since kmalloc() does automatic slab allocation
without any of the limitations of the old SlabAllocator. :^)
2021-12-26 21:22:59 +01:00
Andreas Kling
66d35f2936 Kernel: Add FIXME about allocation waste in kmalloc slabheap 2021-12-26 21:22:59 +01:00
Andreas Kling
43099fb387 Kernel: Remove all uses of MAKE_SLAB_ALLOCATED()
Objects that were previously allocated via slab_alloc()/slab_dealloc()
now go through kmalloc()/kfree_sized() instead.
2021-12-26 21:22:59 +01:00
Andreas Kling
2a5cff232b Kernel: Use slab allocation automagically for small kmalloc() requests
This patch adds generic slab allocators to kmalloc. In this initial
version, the slab sizes are 16, 32, 64, 128, 256 and 512 bytes.

Slabheaps are backed by 64 KiB block-aligned blocks with freelists,
similar to what we do in LibC malloc and LibJS Heap.
2021-12-26 21:22:59 +01:00
Andreas Kling
f6c594fa29 Kernel: Remove arbitrary alignment requirement from kmalloc_aligned()
We were not allowing alignments greater than PAGE_SIZE for some reason.
2021-12-26 21:22:59 +01:00
Andreas Kling
9182653a0f Kernel: Log purported size of bogus kfree_sized() requests 2021-12-26 21:22:59 +01:00
Andreas Kling
c6c786c992 Kernel: Remove kfree(), leaving only kfree_sized() :^)
There are no more users of the C-style kfree() API in the kernel,
so let's get rid of it and enjoy the new world where we always know
how much memory we are freeing. :^)
2021-12-26 21:22:59 +01:00
Andreas Kling
6eb48f7df6 Kernel: Consolidate kmalloc_aligned() and use kfree_sized() within
This patch does two things:

- Combines kmalloc_aligned() and kmalloc_aligned_cxx(). Templatizing
  the alignment parameter doesn't seem like a valuable enough
  optimization to justify having two almost-identical implementations.

- Stores the real allocation size of an aligned allocation along with
  the other alignment metadata, and uses it to call kfree_sized()
  instead of kfree().
2021-12-26 21:22:59 +01:00