Commit Graph

54 Commits

Author SHA1 Message Date
Jeremy Soller 28dd3596f3 More logging adjustments and set default level to info 2025-11-02 07:55:32 -07:00
Jeremy Soller ec49a96640 More logging improvements 2025-11-01 20:44:26 -06:00
Jeremy Soller 6d5523de2a Set all log levels, reduce unnecessary logs 2025-11-01 19:36:38 -06:00
Jeremy Soller 8bf5d60e96 Adjust logging, ensure drivers get unique logfiles 2025-10-24 08:19:34 -06:00
bjorn3 a261f1257d graphics/virtio-gpud: Destroy virtio-gpu resource before freeing fb memory
This fixes a gpu side use-after-free.
2025-07-03 20:57:55 +02:00
bjorn3 4f7b0eb6b6 graphics: Introduce a new graphics api
This allows page flipping and handling display resizing. Hardware
cursors and getting notifications about display resizing are not yet
supported.
2025-07-02 15:43:55 +02:00
bjorn3 27ca1c3296 graphics/virtio-gpud: Handle VIRTIO_GPU_EVENT_DISPLAY
This doesn't yet provide a way for individual consumers to resize their
own framebuffer in response to the display changing size.
2025-07-02 15:16:52 +02:00
bjorn3 7f3f181775 graphics/virtio-gpud: Create DisplayHandle after registering the scheme
This fixes a race-condition. It is unlikely to cause issues in practice
though.
2025-06-30 23:03:40 +02:00
bjorn3 56d4fdd025 graphics: Replace adapter.displays() with .display_count() 2025-06-30 19:58:25 +02:00
bjorn3 5ddddd91df graphics: Pass CursorPlane by shared ref to handle_cursor 2025-06-29 18:03:01 +02:00
bjorn3 215b8185c2 Handle vt switching for cursors without requiring a cursor update
This requires storing the cursor state on the driver-graphics side to be
be able to restore the correct state for the target vt.
2025-04-04 20:37:43 +02:00
bjorn3 abab5c9a3c Avoid passing unused fields to VIRTIO_GPU_CMD_MOVE_CURSOR 2025-04-04 20:25:57 +02:00
bjorn3 03cf0955d2 Move cursor resource writing to driver-graphics 2025-04-04 20:04:25 +02:00
Dimitar Gjorgievski de4cc6ed4a adding support for gpu cursor 2025-04-03 21:21:32 +00:00
bjorn3 f48ae933ff graphics: Only allow passing a single damage area at a time
Currently only fbbootlogd and fbcond make use of support for multiple
damage areas and they are not all that performance critical anyway.
Orbital always passes a single damage area per write call. Out of all
graphics drivers we have and are likely to get only vesad could
potentially benefit from fine-grained damage areas. This commit doesn't
significantly impact performance of fbcond.
2025-03-15 18:49:59 +01:00
bjorn3 be5b865058 graphics: Rename resource to framebuffer
This matches the Linux DRM name.
2025-03-06 21:41:26 +01:00
bjorn3 92295f2ea4 graphics/graphics-ipc: Use u32 fields in Damage
The fields should never be negative and this saves a couple of casts.
2025-03-06 20:49:21 +01:00
bjorn3 ee3382aed0 graphics/virtio-gpud: Add helper to submit a fenced request
This is necessary for implementing hardware cursor support.
2025-03-06 20:49:20 +01:00
bjorn3 fc92f0b0ce graphics: Rename the legacy graphics API to the v1 graphics API
It is quite likely that the next graphics API won't be the last one and
as such would become a legacy API too. Consistently using version
numbers makes it easier to refer to the exact version you mean.
2025-03-06 20:49:20 +01:00
bjorn3 972e19e900 graphics: Always pass damage to graphics drivers
This way the drivers don't have to special case switching between VTs.
2025-03-06 20:49:17 +01:00
bjorn3 88cfa76e2c graphics: Merge set_scanout and flush_resource into update_plane
The old api was pretty virtio-gpu specific. The new api is closed to how
atomic mode setting on Linux works.
2025-03-06 20:48:41 +01:00
bjorn3 e7fe3183b0 Make all pcid_interface methods abort the process on errors
Effectively the only way to recover from errors in the communication
with pcid is by restarting the driver from scratch possibly after
restarting pcid. As such moving the aborts from individual drivers to
pcid_interface simplifies drivers while at the same time allowing nicer
error messages.
2025-03-02 12:36:35 +01:00
bjorn3 e973f89139 Remove unnecessary feature gates
Some of these have been stabilized while others were likely no longer
used at all.
2025-02-22 14:38:33 +01:00
bjorn3 5fc04c332d graphics: Move Damage from inputd to graphics-ipc 2024-12-28 16:26:18 +01:00
bjorn3 b5eeaed9e1 graphics/virtio-gpud: Use resource size rather than display size in set_scanout
This ensures we use the right size if the display got resized but the
resource hasn't been resized yet.
2024-12-28 14:32:56 +01:00
bjorn3 0b8648ff5b graphics/virtio-gpud: Move some initialization code around 2024-12-28 14:16:56 +01:00
bjorn3 1ef298e576 graphics/virtio-gpud: Remove getters and setters for ResourceCreate2d 2024-12-28 14:04:10 +01:00
bjorn3 1d89ca7bd2 graphics/virtio-gpud: Remove unnecessary VolatileCell
The virtio queue abstraction already provides the necessary
synchronization to make everything data-race free without volatile
accesses.
2024-12-28 14:01:09 +01:00
bjorn3 d7becba023 graphics/virtio-gpud: Don't crash when multiple displays are attached 2024-12-27 15:11:15 +01:00
bjorn3 d2f1af9ca7 Add driver-graphics crate
This unifies the driver interface handling between graphics drivers and
makes it easier to change all graphics drivers in lockstep when adding
new features.
2024-12-27 12:47:43 +01:00
bjorn3 b7f4af9bd2 graphics/virtio-gpud: Bring scheme impl closer in line with vesad 2024-12-26 22:19:35 +01:00
bjorn3 1b6feeb7c7 graphics/virtio-gpud: Use VM window size as display size
Rather than hard coding 1920x1080. This doesn't yet handle resizing the
VM window at runtime though.
2024-12-26 20:59:08 +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 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 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 436a16b069 virtio-gpud: Migrate to redox-scheme 2024-12-22 16:44:27 +01: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 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 a3b957c2e5 pcid: Fetch config in PciFunctionHandle::connect_default() 2024-06-15 15:16:09 +02:00