Commit Graph

51 Commits

Author SHA1 Message Date
bjorn3 3ed3ff2edb graphics/fbcond: Handle framebuffer resize during handoff 2024-12-26 20:57:53 +01:00
bjorn3 62f1a80c3e graphics/virtio-gpud: Move resources from Display to GpuScheme
Resources are global for the entire virtio-gpud device, not local to a
single display. In the future resource creation will become entirely
detached from specific displays.
2024-12-26 17:53:45 +01:00
bjorn3 2344206c21 graphics/virtio-gpud: Bundle resource id and resource mapping 2024-12-26 17:36:40 +01:00
bjorn3 8eabb75524 Update redox-scheme to 0.3.0 2024-12-26 15:50:30 +01:00
bjorn3 12fc959737 graphics/fbcond: Move blocking operations back to the main thread
With fbbootlogd split out it is no longer essential to avoid blocking
operations on the main thread of fbcond. Moving them back to the main
thread simplifies things a fair bit.
2024-12-24 21:39:41 +01:00
bjorn3 4e2f1a730c graphics: Introduce a separate daemon for the boot log
The daemon responsible for the boot log must never ever block to avoid
deadlocks, but doing so while still accepting keyboard input is
non-trivial. This commit splits the boot log out from fbcond into a
separate daemon to make this a lot easier to implement. This will also
allow making fbcond blocking again, which will simplify some things.
2024-12-24 21:39:41 +01:00
bjorn3 5a1648fdca graphics/fbcond: Migrate to redox-scheme 2024-12-24 16:56:11 +01:00
bjorn3 f4897c59b4 graphics/fbcond: Inline some helpers 2024-12-24 16:34:25 +01:00
bjorn3 aa35e573cf input: Introduce ProducerHandle type 2024-12-24 15:28:56 +01:00
bjorn3 84eed1ad0e graphics: Introduce new ConsumerHandle type
This type has a method to open the current display.
2024-12-24 14:49:42 +01:00
bjorn3 a82fa31437 graphics/fbcond: Get display path in the background thread 2024-12-24 14:49:42 +01:00
bjorn3 a88f2c4b53 graphics/vesad: Remove support for reading resize events
Nobody actually listens for them from vesad itself anyway. Instead they
listen for them from inputd.
2024-12-24 14:49:42 +01:00
bjorn3 db9ee0a495 vesad: Fix damage clipping
oops
2024-12-23 21:29:57 +01:00
bjorn3 05a6058131 Rustfmt 2024-12-23 19:05:00 +01:00
bjorn3 0019eecadd virtio-gpud: Don't process flush requests for background VT's
This ensures that the foreground VT doesn't lockup if a background VT
spams us with flush requests. In the future we may want to add a
scheduler or collapse redundant flush requests.
2024-12-23 19:02:24 +01:00
bjorn3 025086acd1 virtio-gpud: Add offset method to XferToHost2d
This will hopefully avoid confusion if someone in the future changes the
XferToHost2d in flush to pass a smaller GpuRect. Without adjusting
offset this would cause glitches.
2024-12-23 19:02:24 +01:00
bjorn3 f6cc7d25df graphics: Unify damage clipping 2024-12-23 19:02:24 +01:00
bjorn3 f2156d4654 graphics: Optimize the damage buffer api
It is now possible to write multiple damage locations in a single write
call. Vesad also no longer processes damage for background vt's. The
entire framebuffer will be redrawn once the vt switches to the
foreground anyway. And finally fsync now consistently redraws the entire
screen rather than having different behavior between vesad and
virtio-gpud.
2024-12-23 19:02:24 +01:00
bjorn3 4c4ab2de44 graphics: Implement handoff from vesad to virtio-gpud
With this virtio-gpud no longer has to support getting deactivated at
any time to hand back control to vesad. This makes it much easier to add
many new features that a proper graphics driver is supposed to support.

Be aware that virtio-gpud waits for the vsync on every flush request.
Fbcond and orbital are not really happy about this right now and when
something changes multiple times within a single frame, flush requests
queue up, causing the ui to hang until all flush requests are finished.
It is still possible to switch to another VT though which won't hang.
2024-12-23 18:59:18 +01:00
bjorn3 b9189b91cf virtio-gpud: Couple minor improvements 2024-12-23 13:40:09 +01:00
bjorn3 b0f682c95d virtio-gpud: Handle multiple VT's
The code will become simpler once handoff is implemented such that
virtio-gpud no longer needs to support reset and reinitialization of the
virtio gpu device.
2024-12-23 13:40:09 +01:00
bjorn3 31deddd0d5 virtio-gpud: Claim a new VT
Before these changes virtio-gpud effectively didn't do anything and
vesad's framebuffer was kept instead.
2024-12-23 12:50:41 +01:00
bjorn3 c97652a508 fbcond: Make sure we never block on the graphics driver
To prevent deadlocks if the graphics driver in turn tries to write to
fbcond for log messages.
2024-12-22 19:56:04 +01:00
bjorn3 5f7ee8f646 Use inputd's Damage everywhere instead of separate SyncRect types 2024-12-22 19:48:27 +01:00
bjorn3 15cee6bb48 fbcond: Resize ransid console on every write
This is necessary to correctly handle async changes to the framebuffer
size in the future.
2024-12-22 18:37:13 +01:00
bjorn3 99a00abeca fbcond: Split a couple of helper functions out of open_vt 2024-12-22 18:08:32 +01:00
bjorn3 8e92e2c743 inputd: Let graphics drivers pull vt activation events from inputd
Previously inputd would directly push vt activation events to the
graphics driver, which required being quite lazy to prevent deadlocks as
well as the graphics driver having a location where events can be pushed
to. By having graphics drivers pull the vt activation events instead,
the effective control flow becomes simpler and it becomes easier to
correctly handle multiple graphics drivers on the system. For example it
becomes possible for multiple graphics drivers to present displays for a
single VT as well as making it easier to provide a handoff from the
early framebuffer to a real graphics driver.
2024-12-22 17:18:24 +01:00
bjorn3 273cbda872 inputd: Split ControlHandle and DisplayHandle
ControlHandle is used to switch the active vt, while DisplayHandle is
used by display drivers to register new vt's. There are entirely
unrelated tasks and the fact that they had been merged together has been
confusing me for a while.

Also changed activating a VT to no longer create a new vt when none
existed previously. The target graphics driver may not be able to handle
the new VT. inputd -A already didn't allow activating non-existent VT's
as it first tried to open a consumer handle for the target VT.
2024-12-22 16:46:02 +01:00
bjorn3 436a16b069 virtio-gpud: Migrate to redox-scheme 2024-12-22 16:44:27 +01:00
bjorn3 7565720f34 vesad: Migrate to redox-scheme 2024-12-22 16:43:17 +01:00
Kamil Koczurek d2c82add9d Move Io/Pio/Mmio from redox_syscall to common
* Fix Mmio repr from transparent to packed.
* Rename Mmio::from to Mmio::new.
* Remove dead imports around affected code.
* Minor formatting.
2024-09-30 13:01:36 +02:00
bjorn3 7935ed0248 Deduplicate setup_logging between all drivers
This will make it easier to change the way logging is done for all
drivers. This also fixes the log category for a couple of drivers as
well as makes failing to set the logger a fatal error. Only when a
logger is already set is it impossible to set another logger.
2024-07-24 22:00:40 +02:00
bjorn3 66c1d0fd88 Tell the kernel to disable graphical_debug right before the first framebuffer write by userspace
Also remove the framebuffer clear in FrameBuffer::new as the entire
framebuffer will be overwritten anyway almost immediately after.
2024-07-24 21:06:29 +02:00
bjorn3 2e341fa742 Directly pass FrameBuffer to redraw and sync
This avoids creating an intermediate &'static mut [u32] of questionable
soundness and simplifies the code a bit.
2024-07-19 22:18:34 +02:00
bjorn3 53c02b5322 Move the framebuffer resizing code into a FrameBuffer method 2024-07-19 22:12:48 +02:00
bjorn3 857773393d Ensure fields of SyncRect are not reordered
Without repr(C), repr(packed) technically allows reordering fields.
2024-07-19 21:56:56 +02:00
bjorn3 ef29520cf5 Avoid ptr2int2ptr casts in GraphicScreen::sync
Also use pointer arithmetic on *mut u32 over manual multiplication by 4.
The ptr2int2ptr casts pessimize optimizations.
2024-07-19 21:55:21 +02:00
bjorn3 b33ea2b53a Fix a FIXME in display_fd_unmap
The len method on raw pointers has been stabilized.
2024-07-19 21:50:15 +02:00
bjorn3 8a91bae0a6 Remove unnecessary unsafe block 2024-07-19 21:25:52 +02:00
bjorn3 747898dfb2 Run rustfmt on the entire graphics subsystem 2024-07-19 21:24:48 +02:00
bjorn3 ebb2243538 Remove all traces of VtMode
It isn't used anywhere anymore.
2024-07-19 21:18:09 +02:00
bjorn3 2fc3923d46 Fix fbcon 2024-07-12 12:05:31 +02:00
bjorn3 fd8dabd1bc Use the new scheme format in most places
The graphics subsystem still uses the old format as orbital manually
parses the fpath result.
2024-07-11 21:14:45 +02:00
bjorn3 a3b957c2e5 pcid: Fetch config in PciFunctionHandle::connect_default() 2024-06-15 15:16:09 +02:00
bjorn3 fdb9ea816b pcid: Rename PcidServerHandle to PciFunctionHandle 2024-06-15 15:05:59 +02:00
4lDO2 7b2f4dda90 Use scatter-gather list for virtio framebuffer.
The current frame allocator limits requests to powers of two, between 4
KiB and 4 MiB. As such, a 8-bit color 1920x1080 framebuffer needs at
least two allocations.
2024-06-14 08:26:19 +02:00
4lDO2 4c35e88997 Use latest event queue interface everywhere. 2024-03-31 14:30:04 +02:00
Jacob Lorentzon ff956fd3bb Switch to libredox where applicable (fixed) 2024-03-18 22:09:25 +00:00
Jeremy Soller 98078650f8 Revert "Switch to libredox where applicable."
This reverts commit 2e7dbf1cc1.
2024-03-18 15:00:52 -06:00
4lDO2 2e7dbf1cc1 Switch to libredox where applicable. 2024-03-18 19:23:05 +01:00