Commit graph

20366 commits

Author SHA1 Message Date
Liav A
69a54e5f64 Documentation: Update bare metal troubleshooting guide 2021-05-16 19:58:33 +02:00
Liav A
ab52108982 Kernel: Allow the user to specify the virtual console when booting 2021-05-16 19:58:33 +02:00
Liav A
99eab4667a Kernel: Print scheduler state to the display console 2021-05-16 19:58:33 +02:00
Liav A
20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00
Liav A
dac129e10b Kernel: Expand the kernel memory slot from 16 MiB to 32 MiB
Like in 8cd5477e54, we need to expand the
kernel slot again to be able to boot again.
2021-05-16 19:58:33 +02:00
Liav A
7078119c58 Kernel: Don't ref-count UsedMemoryRange during iteration 2021-05-16 19:58:33 +02:00
Liav A
8f2ddde4cb Kernel: Rename Console => ConsoleDevice
This change will help to distinguish between the console
device and the Console abstraction layer in the Graphics
subsystem later.
2021-05-16 19:58:33 +02:00
Liav A
0669dd82e2 Kernel/PCI: Add helper to determine if device can access IO space 2021-05-16 19:58:33 +02:00
Liav A
2cd1f928e1 Kernel: Drop support of GRUB VBE modesetting
We used GRUB to modeset the resolution for a long time, but for good
reasons I see no point with keeping it supported in our kernel. We
support bochs-display device on QEMU (both the VGA compatible and
non-VGA compatible variants), so for QEMU we can still boot the system
in graphical mode even without GRUB help.

Also, we now have a native driver for Intel graphics and although it
doesn't support most Intel graphics cards out there yet, it's a good
starting point to support more cards. If a user wants to boot on
bare-metal in graphical mode, all he needs to do is to add the removed
flag back again, as the kernel still supports pre-set framebuffers.
2021-05-16 19:58:33 +02:00
Liav A
cc92538d49 Kernel/Graphics: Add basic support for Intel native accelerator
We simply modeset the resolution after determining the preferred
resolution after getting the EDID from the attached display.
2021-05-16 19:58:33 +02:00
Liav A
6a728e2d76 Kernel: Introduce a new graphics subsystem
This new subsystem is replacing the old code that was used to
create device nodes of framebuffer devices in /dev.

This subsystem includes for now 3 roles:
1. GraphicsManagement singleton object that is used in the boot
process to enumerate and initialize display devices.
2. GraphicsDevice(s) that are used to control the display adapter.
3. FramebufferDevice(s) that are used to control the device node in
/dev.

For now, we support the Bochs display adapter and any other
generic VGA compatible adapter that was configured by the boot
loader to a known and fixed resolution.

Two improvements in the Bochs display adapter code are that
we can support native bochs-display device (this device doesn't
expose any VGA capabilities) and also that we use the MMIO region,
to configure the device, instead of setting IO ports for such tasks.
2021-05-16 19:58:33 +02:00
Liav A
8515a1c49d Meta: Boot the Q35 machine without VGA support
Use the bochs-display device instead :)
2021-05-16 19:58:33 +02:00
Liav A
86be477da0 Kernel: Support the bochs-display device
This device is a graphics display device that is not supporting
VGA functionality.
Therefore, it exposes a MMIO region to configure it, so we use that
region to set the framebuffer resolution.
2021-05-16 19:58:33 +02:00
Stephan Unverwerth
2dcafde330 LibGL: Implement alpha testing in SoftwareRasterizer 2021-05-16 19:27:23 +02:00
Stephan Unverwerth
1bd754882d LibGL: Implement glAlphaFunc()
This implements glAlphaFunc() for setting alpha test func and ref value
and also allows enabling and disabling GL_ALPHA_TEST
2021-05-16 19:27:23 +02:00
Gunnar Beutner
b8b8b4b566 LibCompress: Add missing #include
This previously worked because <AK/ByteBuffer.h> included
<AK/Optional.h> - and now it doesn't anymore.
2021-05-16 19:21:47 +02:00
Gunnar Beutner
006f11f23d Kernel: Avoid allocations when handling network packets 2021-05-16 17:49:42 +02:00
Gunnar Beutner
53d0150827 AK+Userland: Remove nullability feature for the ByteBuffer type
Nobody seems to use this particular feature, in fact there were some
bugs which were uncovered by removing operator bool.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
c4d0b0cd6b Userland: Don't explicitly call Vector<T>::is_null()
This method always returns false so there's no reason for calling it.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
24ca645f08 HexEditor: Call size() instead of operator bool()
This previously called operator bool by accident.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
4b5dbc15df Kernel: Fix incorrect argument when constructing DiskPartitionMetadata
The existing code invokes operator bool for the partition_type
variable.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
24376e7759 LibGfx: Avoid copying ByteBuffers while loading PNG images
This wasn't much of a problem before because copying the ByteBuffer
merely copied the RefPtr but now that ByteBuffer behaves like Vector
this causes unnecessary allocations.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
fcaf98361f AK: Turn ByteBuffer into a value type
Previously ByteBuffer would internally hold a RefPtr to the byte
buffer and would behave like a reference type, i.e. copying a
ByteBuffer would not create a duplicate byte buffer, but rather
two objects which refer to the same internal buffer.

This also changes ByteBuffer so that it has some internal capacity
much like the Vector<T> type. Unlike Vector<T> however a byte
buffer's data may be uninitialized.

With this commit ByteBuffer makes use of the kmalloc_good_size()
API to pick an optimal allocation size for its internal buffer.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
f0fa51773a AK+Userland: Fix some compiler warnings and make variables const-ref
This fixes a few compiler warnings and makes some variables const-ref
in preparation for the next commit which changes how ByteBuffer works.
2021-05-16 17:49:42 +02:00
Gunnar Beutner
fbdc3b0ee2 Userland: Add missing #includes
These two header files relied on transitive header includes.
2021-05-16 17:49:42 +02:00
DragonAlex98
47ec5cf340 ImageViewer: Stop animation timer when deleting/changing image
Previously deleting an animated image wouldn't make the animation timer
stop. This resulted in the animation still running in the ViewWidget.

Moreover the timer wasn't stopped when loading different images, which
led to high CPU usage when going from an animated image to a
non-animated one.
2021-05-16 16:22:21 +01:00
DragonAlex98
bce119036a ImageViewer: Disable image actions when there is no image
Previously some actions like Rotate/Flip/Set as Desktop Wallpaper would
make the application crash if no image was loaded. Now image actions are
enabled/disabled based on whether an image has been loaded or not.
2021-05-16 16:22:21 +01:00
Itamar
400d3ddb08 LanguageServers: Rename AutoCompleteEngine => CodeComprehensionEngine
This feels like a better name since the "autocomplete engine" can, in
addition to providing autocomplete suggestions, also find declarations
of symbols and report back the symbols that are defined in a document.

Also, Cpp/ParserAutoComplete has been renamed to CppComprehensionEngine
and Shell/AutoComplete has been renamed to ShellComprehensionEngine.
2021-05-16 16:39:21 +02:00
Itamar
b1531b78f6 HackStudio+CppLanguageServer: Remove lexer-based autocomplete engine
The parser-based autocomplete engine is at a point where it's stable
enough that I don't think there's a need for the lexer-based
alternative anymore.
2021-05-16 16:39:21 +02:00
Timothy Flynn
ddb278ab85 Solitaire: Add key combo to dump the state of the layout
Useful for chasing down bugs.
2021-05-16 16:37:51 +02:00
Timothy Flynn
ce030ca584 AK+Meta: Add a debug option for Solitaire 2021-05-16 16:37:51 +02:00
Timothy Flynn
68e86dc804 Solitaire: Add shift modifier to hidden "game over" key combo
Makes it a bit less likely that someone will hit it on accident and ruin
their game.
2021-05-16 16:37:51 +02:00
Timothy Flynn
e310b9cd0d Solitaire: Add setting for number of cards to be drawn
Klondike Solitaire has a couple more modes, but this adds modes for 1-
and 3-card draws.
2021-05-16 16:37:51 +02:00
Timothy Flynn
3a45bf5254 Solitaire: Add stack for the playable cards on top of the waste stack
While the waste stack and the playable card on top of the waste stack
are collectively referred to as the "waste", it's programatically nice
to separate them to enable 3-card-draw mode. In that mode, the playable
stack will contain 3 cards with a slight x-axis shift, while the waste
stack underneath will remain unshifted. So rather than introducing some
ugly logic to CardStack to handle this, it's more convenient to have a
separate stack on top of the waste stack.
2021-05-16 16:37:51 +02:00
Daniel Bertalan
d5ea04cdfb LibC+Kernel: Add sys/ttydefaults.h
This non-POSIX header is used in Linux/BSD systems for storing the
default termios settings. This lets us setup new TTYs' `m_termios.c_cc`
in a nicer way than using a magic string.
2021-05-16 16:31:30 +02:00
Linus Groh
7ec8cb97e9 LibVT: Run clang-format on Terminal.cpp
Some trailing whitespace is causing the CI to fail. :^)
2021-05-16 15:16:50 +01:00
Stephan Unverwerth
d6e8634576 LibGL: Add glBlendFunc() and glShadeModel() to call lists 2021-05-16 15:53:58 +02:00
Stephan Unverwerth
da57563c1c LibGL: Implement glShadeModel()
This turns off interpolation of vertex colors when GL_FLAT is selected.
2021-05-16 15:53:58 +02:00
Daniel Bertalan
26953c2be1 LibVT: Implement ST (ESC \) escape sequence
Closes #7175
2021-05-16 15:53:02 +02:00
Daniel Bertalan
7b9051afe5 LibVT: Fix 8-bit control codes clobbering UTF-8
Bytes in the 0x80..0x9F range were treated as C1 control codes,
which prevented them from being parsed as UTF-8 bytes.

This caused some characters (like U+DF, encoded as 0xC3 0x9F)
from being recognized as printable characters.
2021-05-16 14:17:04 +02:00
Daniel Bertalan
e0b6cfec1a LibVT: fix SM/RM not respecting private markers
Since we now store intermediate characters separately, the intermediates
should be checked for the presence of the '?' DEC private marker, not
the first parameter.
2021-05-16 11:50:56 +02:00
Daniel Bertalan
be519022c3 LibVT: Implement new ANSI escape sequence parser
This commit replaces the former, hand-written parser with a new one that
can be generated automatically according to a state change diagram.

The new `EscapeSequenceParser` class provides a more ergonomic interface
to dealing with escape sequences. This interface has been inspired by
Alacritty's [vte library](https://github.com/alacritty/vte/).

I tried to avoid changing the application logic inside the `Terminal`
class. While this code has not been thoroughly tested, I can't find
regressions in the basic command line utilities or `vttest`.

`Terminal` now displays nicer debug messages when it encounters an
unknown escape sequence. Defensive programming and bounds checks have
been added where we access parameters, and as a result, we can now
endure 4-5 seconds of `cat /dev/urandom`. :D

We generate EscapeSequenceStateMachine.h when building the in-kernel
LibVT, and we assume that the file is already in place when the userland
library is being built. This will probably cause problems later on, but
I can't find a way to do it nicely.
2021-05-16 11:50:56 +02:00
Daniel Bertalan
1b347298f1 LibVT: Add state machine file for the new parser
The parser itself will be included in a later commit.
2021-05-16 11:50:56 +02:00
Daniel Bertalan
22195d965f DevTools: Add StateMachineGenerator utility
This program turns a description of a state machine that takes its input
byte-by-byte into C++ code. The state machine is described in a custom
format as specified below:

```
// Comments are started by two slashes, and cause the rest of the line
// to be ignored

@name ExampleStateMachine // sets the name of the generated class
@namespace Test           // sets the namespace (optional)
@begin Begin              // sets the state the parser will start in

// The rest of the file contains one or more states and an optional
// @anywhere directive. Each of these is a curly bracket delimited set
// of state transitions. State transitions contain a selector, the
// literal "=>" and a (new_state, action) tuple. Examples:
//     0x0a => (Begin, PrintLine)
//     [0x00..0x1f] => (_, Warn)      // '_' means no change
//     [0x41..0x5a] => (BeginWord, _) // '_' means no action

// Rules common to all states. These take precedence over rules in the
// specific states.
@anywhere {
    0x0a         => (Begin, PrintLine)
    [0x00..0x1f] => (_, Warn)
}

Begin {
    [0x41..0x5a] => (Word, _)
    [0x61..0x7a] => (Word, _)
    // For missing values, the transition (_, _) is implied
}

Word {
    // The entry action is run when we transition to this state from a
    // *different* state. @anywhere can't have this
    @entry IncreaseWordCount
    0x09 => (Begin, _)
    0x20 => (Begin, _)

    // The exit action is run before we transition to any *other* state
    // from here. @anywhere can't have this
    @exit EndOfWord
}
```

The generated code consists of a single class which takes a
`Function<Action, u8>` as a parameter in its constructor. This gets
called whenever an action is to be done. This is because some input
might not produce an action, but others might produce up to 3 (exit,
state transition, entry). The actions allow us to build a more
advanced parser over the simple state machine.

The sole public method, `void advance(u8)`, handles the input
byte-by-byte, managing the state changes and requesting the appropriate
Action from the handler.

Internally, the state transitions are resolved via a lookup table. This
is a bit wasteful for more complex state machines, therefore the
generator is designed to be easily extendable with a switch-based
resolver; only the private `lookup_state_transition` method needs to be
re-implemented.

My goal for this tool is to use it for implementing a standard-compliant
ANSI escape sequence parser for LibVT, as described on
<https://vt100.net/emu/dec_ansi_parser>
2021-05-16 11:50:56 +02:00
Nicholas Baron
aa4d41fe2c
AK+Kernel+LibELF: Remove the need for IteratorDecision::Continue
By constraining two implementations, the compiler will select the best
fitting one. All this will require is duplicating the implementation and
simplifying for the `void` case.

This constraining also informs both the caller and compiler by passing
the callback parameter types as part of the constraint
(e.g.: `IterationFunction<int>`).

Some `for_each` functions in LibELF only take functions which return
`void`. This is a minimal correctness check, as it removes one way for a
function to incompletely do something.

There seems to be a possible idiom where inside a lambda, a `return;` is
the same as `continue;` in a for-loop.
2021-05-16 10:36:52 +01:00
Ali Mohammad Pur
bbaa463032 LibLine: Make line management less broken when at the last line
Previously, all sorts of weird stuff would happen when the editor was at
the last line of the terminal (or when the printed line would be at the
last line), this commit makes the editor scroll the terminal up before
trying to write to a row that doesn't actually exist (yet).
This fixes ^R search making a mess when initiated at the last line
(especially with multiline prompts).
2021-05-16 10:11:56 +01:00
Idan Horowitz
3f08e957d4 Meta: Add a check for periods on the end of titles to commit linter 2021-05-16 01:25:24 +01:00
spigwitmer
04f26183cb
Debugger: Add basic backtrace support
This adds the "bt" command to the debugger which displays a backtrace
of the current thread.
2021-05-16 00:47:01 +01:00
Stephan Unverwerth
f70a6ff712 LibGL: Implement color blending
This implements different blend modes in the SoftwareRasterizer by
first setting up the blend factors then rendering the pixels into a
temporary buffer and finally mixing the contents of the temporary buffer
with the contents of the backbuffer based on the blend factors.
2021-05-16 00:44:31 +01:00
Stephan Unverwerth
d6e9b433cf LibGL: Add support for GL_BLEND in glEnable() and glDisable() 2021-05-16 00:44:31 +01:00