feat(krun): builder methods for displays, display backends and input devices - #118
Open
ya-luotao wants to merge 1 commit into
Open
feat(krun): builder methods for displays, display backends and input devices#118ya-luotao wants to merge 1 commit into
ya-luotao wants to merge 1 commit into
Conversation
…devices ConsoleBuilder::gpu_display(width, height) adds a scanout, gpu_display_backend installs a krun_display backend and input_device attaches a virtio-input device from krun_input backends. The vmm already supports all three through VmResources; the Rust API only exposed gpu_virgl_flags and gpu_shm_size. Re-export krun_display and krun_input so callers can implement the backends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
VmResourcesalready carriesdisplays,display_backendandinput_backends, and the vmm attaches virtio-gpu scanouts and virtio-input devices from them — but the Rust API (ConsoleBuilder) only exposesgpu_virgl_flags/gpu_shm_size, so anmsb_krunembedder cannot configure a scanout or attach input. This adds:ConsoleBuilder::gpu_display(width, height)— one scanout per call (DisplayInfo::new, default EDID). Without any display the guest driver disables KMS and exposes a render-only node.ConsoleBuilder::gpu_display_backend(DisplayBackend<'static>)— where presented frames go;NoopDisplayBackendremains the default.ConsoleBuilder::input_device(InputConfigBackend<'static>, InputEventProviderBackend<'static>)(featureinput) — one virtio-input device per call.pub use krun_display/pub use krun_inputso callers can implement the backend traits against the same crate versions.Kept on
ConsoleBuildernext to the existing gpu options rather than inventing a new builder; happy to move them if you would rather have agpu(|g| …)builder.Verification
Used by microsandbox's experimental display (https://github.com/ya-luotao/microsandbox/tree/gpu-m0): a 1920x1080 scanout, a shared-memory
krun_displaybackend, and a keyboard + absolute-pointer pair of input devices, driving an Omarchy/Hyprland guest in a native macOS window (with #116 and #117).cargo check -p msb_krun --features gpu,input,blkpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01A2DMienRTQjgR5CF3uQ2AZ