Commit Graph

25983 Commits

Author SHA1 Message Date
Kenneth Myhra
3f5a42b3dd LibC: Add FNM_NOMATCH to fnmatch.h
Adding FNM_NOMATCH fixes the currently broken curl port.
2021-08-19 22:27:26 +02:00
fladd
1de104c6c4 LibCore: Fix build error in File.cpp on macOS
struct stat on macOS doesn't have st_atim.tv_sec and therefore broke the
Lagom build. Replacing it with st_atime fixes that.
2021-08-19 19:47:34 +01:00
Idan Horowitz
ee608f58ee LibJS: Add type range checks to the Date make_day AO
As the specification says "but if this is not possible (because some
argument is out of range), return NaN."
2021-08-19 19:15:00 +01:00
Idan Horowitz
95bc8e4641 LibCore: Make DateTime's members signed
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
2021-08-19 19:15:00 +01:00
Andrew Kaster
332b29c741 LibTest+Utilities: Print a start message before each test in run-tests
It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
2021-08-19 18:42:34 +02:00
Jesse Buhagiar
6666230d3e Kernel/USB: Remove unused free function from QueueHead
This function is no longer required as the freeing is done
inside of the controller class through the pool interface.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
3f94857e7c Kernel/USB: Harden Descriptor memory allocation
The previous version of this was pretty bad and caused a lot of
odd behevaiour to occur. We now abstract a lot of the allocation
behind a `template`d pool class that handles all of the memory
allocation.
2021-08-19 18:42:07 +02:00
Jesse Buhagiar
ebb0d3e0eb Kernel/USB: Remove unused include from UHCIController.cpp 2021-08-19 18:42:07 +02:00
Jesse Buhagiar
4abf399a74 Kernel/USB: Move UHCI related structures to subdirectory
The number of UHCI related files is starting to expand to the point
where it's best if we move this into their own subdirectory. It'll
also make it easier to manage when we decide to add some more
controller types (whenever that may be)
2021-08-19 18:42:07 +02:00
Itamar
43392c567e HackStudio: Fix "navigate to include"
This fixes an off-by-one error in the "navigate to include" feature
of HackStudio.
2021-08-19 17:20:37 +02:00
Itamar
9ae98bc81b LibCpp: Handle circular imports gracefully
This patch prevents CppComprehensionEngine from endlessly looping when
there's a circular #include in the code.

We now keep track of the set of currently processed files, and will not
re-process a file if it already exists in this set.
When we're done with processing a file it is removed from this set.

The pragma once directive is not yet implemented, but regardless a
mechanism that prevents #include loops even in the absence of
pragma once is desired.
2021-08-19 17:20:37 +02:00
Jesse Buhagiar
68d895eb7c LibGL: Don't crash on invalid pname value in glGetFloatv
This brings `glGetFloatv` more inline with the other `glGet`
functions. We should prevent crashing in the driver as much as
possible and instead let the application deal with the generated
GL error.
2021-08-19 17:08:04 +02:00
Brian Gianforcaro
ca9619c750 Meta: Explicitly configure source directory in debug-kernel.sh
Previously debug-kernel.sh wouldn't detect source if you launched the
script from the wrong path. By explicitly setting the name, source will
be loaded by gdb in all situations.
2021-08-19 11:42:20 +02:00
Edward Palmer
abccb45060 Kernel: Move set_metadata_dirty calls to notify_watchers 2021-08-19 10:41:54 +02:00
Brian Gianforcaro
8e41d96618 AK: Enable IntrusiveList self reference to be optimized out when empty
If a member is an empty class, the standard normally stats that it needs
to have a size of at least 1 byte in order to guarantee that the
addresses of distinct objects of the same type are always distinct.

However as of c++20, we can use [[no_unique_address]] to instruct the
compiler that if the member has an empty type, it may optimize it to
occupy no space.
2021-08-19 08:07:45 +04:30
Linus Groh
0e201fbb42 LibJS: Implement Temporal.PlainDate.prototype.toJSON() 2021-08-19 00:26:09 +01:00
Linus Groh
73d888e9e6 LibJS: Implement Temporal.PlainDate.prototype.toLocaleString() 2021-08-19 00:23:48 +01:00
Linus Groh
402f04c2fc LibJS: Implement Temporal.PlainDate.prototype.toString() 2021-08-19 00:14:17 +02:00
Linus Groh
310192f918 LibJS: Make Temporal's get_option() take a PropertyName directly
Instead of constructing a String and converting that to a PropertyName
on the fly, we can just leverage CommonPropertyNames, add a couple more
and directly pass ready-to-use PropertyNames with pre-allocated Strings.
2021-08-19 00:14:17 +02:00
sin-ack
705e5a3d87 WindowServer: Only clear the hovered item if the item was enabled
Otherwise, we emit a menu_item_left to the WindowServer client even
though the mouse never left the menu item (as is the case when a
disabled menu item is clicked).
2021-08-19 00:11:42 +02:00
sin-ack
d8fd4eee9b LibGUI: Move common action definitions to CommonActions.cpp
This makes Action.cpp itself only talk about the Action object, and
makes it easier to navigate.
2021-08-19 00:11:42 +02:00
Linus Groh
092f924cfd LibJS: Reflect naming consistency editorial changes in the Temporal spec
See:

- https://github.com/tc39/proposal-temporal/commit/2aa7dce
- https://github.com/tc39/proposal-temporal/commit/13daa33
- https://github.com/tc39/proposal-temporal/commit/8085873
2021-08-18 23:03:22 +01:00
Stephan Unverwerth
c4de2bb5e5 LibGL: Leave render loop early if color mask empty 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
addbcd42d7 LibGL: Fix triangle winding calculation
Since we operate in screen space where y points down we need to reverse
what is considered clock wise and what is considered counter clockwise.

The rasterizer always expects triangles with a consistent winding order
thus swap 2 vertices if necessary to reverse the winding before passing
the triangle on to the rasterization stage.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
220ac5eb02 LibGL: Fix clipping and interpolate vertex attributes
The previous clipping implementation was problematic especially when
clipping against the near plane. Triangles are now correctly clipped
using homogenous coordinates against all frustum planes.

Texture coordinates and vertex colors are now correctly interpolated.
The earier implementation was just a placeholder.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
39ff1459f8 LibGL: Improve texture sampling performance
GL_NEAREST: Remove unnecessary modulo. UV is always in range due to
wrapping.
GL_LINEAR: Rewrite filter equation to save a few math operations.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
59998ff0b2 LibGL: Return white texel when sampling uninitialized texture 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
894d81c1b8 LibGL: Complete glGetString implementation
GL_VERSION: The spec mandates the following format: x.y or x.y.z
optionally followed by text separated by space.

GL_EXTENSIONS: Return empty string. We do not support any extensions.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
5b9c87a8b5 LibGL: Implement glDepthFunc 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
a97dbd2317 LibGL: Implement glDepthRange 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
3dd9efd35f LibGL: Fix incorrect blend factor setup 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
b38edf994b LibGL: Allow glTexImage2D to create uninitialized textures
When passing a nullptr as the pixel array LibGL now allocates texture
memory but does not initialize the texture contents.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
22905daacb LibGL: Fix interpretation of BGRA byte order
This fixes byte order interpretation in several places.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
e9514cf6c0 LibGL: Fix glVertexPointer argument validation 2021-08-18 20:30:58 +02:00
Stephan Unverwerth
5e27da20f4 LibGL: Fix glTexCoord behaviour
glTexCoord should behave like glColor. It only updates a gl context
variable that contains the current texture coordinates. The vertex is
only actually created once glVertex is called.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
b6373c2aba LibGL+3DFileViewer: Make glRotatef accept degrees, not radians
This is in accordance with the GL spec. Also adjust rotation values in
3DFileViewer to take the new units into account.
2021-08-18 20:30:58 +02:00
Jean-Baptiste Boric
5a8de62a1a Utilities: Remove memset calls inside ls 2021-08-18 20:30:46 +02:00
Jean-Baptiste Boric
58cebf1b6f Utilities: Implement -p flag for cp 2021-08-18 20:30:46 +02:00
Jean-Baptiste Boric
8cc8d72619 LibCore: Implement preserve flag for file/directory copy 2021-08-18 20:30:46 +02:00
Jean-Baptiste Boric
91bcff2994 Utilities: Properly sort files in ls 2021-08-18 20:30:46 +02:00
Linus Groh
b2badd6333 LibJS: Update some Temporal spec section numbers
These shifted due to the addition of the ParseTemporalRelativeToString
AO in https://github.com/tc39/proposal-temporal/commit/ad06578.
2021-08-18 19:26:08 +01:00
panky-codes
1b093c8b48 Kernel: Const defines for PCI IDs for storage controllers 2021-08-18 18:18:12 +02:00
kleines Filmröllchen
a9cbdcbcd0 Utilities: Make aplay respect loader errors
aplay would previously just retry a couple of times when the loader
encountered an error, even though there is a standard mechanism for
loaders to report errors. Now, aplay outputs these errors to the user
and exits.
2021-08-18 18:16:48 +02:00
kleines Filmröllchen
195d6d006f LibAudio: Resample FLAC audio data
FlacLoader initialized, but never used its resampler; this is now fixed
and all subframes are resampled before decorrelation occurs. FLAC files
with non-44100-Hz sample rates now play properly.
2021-08-18 18:16:48 +02:00
kleines Filmröllchen
d7ca60b998 LibAudio: Resample with integer ratios instead of floats
Floating-point ratios are inherently imprecise, and can lead to
unpredictable or nondeterministic behavior when resampling and expecting
a certain number of resulting samples. Therefore, the resampler now uses
integer ratios, with almost identical but fully predictable behavior.

This also introduces the reset() function that the FLAC loader will use
in the future.
2021-08-18 18:16:48 +02:00
Sergey Bugaev
6c9343e262 Userland: Also cache d_type in find(1)
Since readdir() actually gives us the file type, we don't have
to stat it again to know whether it's a directory! This means that
'find /' can process the majority of files without ever calling
stat() on them, simply by reading directories.

In addition, the TypeCommand (-t) can make use of this info too,
so, for instance, a 'find / -t d' does not need to stat anything
either.

This gives us a final huge speedup :^)
2021-08-18 18:13:59 +02:00
Sergey Bugaev
ed5b3f8495 Kernel: Specify directory entry types properly
...in a few more places, at least.

find(1) is about to start relying on the reported types more or less
reflecting reality. This is especially relevant for magic symlinks
in ProcFS.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
548a880310 Userland: Cache stat in find(1)
We have multiple commands that are implemented in terms of stat.
Let's cache the stat in FileData after we query it once.

This gives us another large speed-up :^)
2021-08-18 18:13:59 +02:00
Sergey Bugaev
d4232d5ee2 Userland: Simplify recursion in find(1)
Now walk_tree() itself checks whether it should descend into a file
(if the file is a directory) or not.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
ad15d0c880 Userland: Ditch Core::DirIterator for readdir() in find(1)
While Core::DirIterator is nice C++ API, we want more low-level
control here. In particular, we want to open the directory using
openat(), to also not pay the cost of re-traversing the path
components we have already resolved previously.

This gives us another nice speedup :^)

Also, in the future commits this will allow us to make use of more
data from the returned struct dirent, to speed things up even further.
2021-08-18 18:13:59 +02:00