fix(gpu): run on rutabaga's 2D component when virgl is off - #117
Open
ya-luotao wants to merge 1 commit into
Open
fix(gpu): run on rutabaga's 2D component when virgl is off#117ya-luotao wants to merge 1 commit into
ya-luotao wants to merge 1 commit into
Conversation
With VIRGL_RENDERER_NO_VIRGL and no VENUS the host has no 3D renderer at all (macOS without a display server, for instance), yet the device always built a VirglRenderer component. virglrenderer then rejects every non-blob resource (RESOURCE_CREATE_2D, ATTACH_BACKING, TRANSFER_TO_HOST_2D, SET_SCANOUT, FLUSH all fail), so a guest with a KMS scanout never gets a frame to the host. In that mode build a Rutabaga2D component, advertise only VERSION_1 | EDID, and report zero capsets so the guest does not probe virgl either. flush_resource also read the whole resource with the resource stride into a frame buffer sized by the SET_SCANOUT rectangle; when the two differ (Hyprland's dumb buffers), transfer_2d fails and the unwrap took the gpu worker thread down. Record the scanout rectangle, copy only the intersection with the destination stride, and answer ErrUnspec instead of panicking.
This was referenced Aug 30, 2026
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.
Problem
The virtio-gpu device always builds a
VirglRendererrutabaga component, whatever the flags. WithVIRGL_RENDERER_NO_VIRGLand noVENUS— i.e. a host with no 3D renderer at all, which is what a headless macOS build gets — virglrenderer has no vrend state and rejects every non-blob resource. From the guest's side, after a KMS modeset:so a scanout never reaches the
krun_displaybackend, and the device advertises+virglwith 5 capsets that cannot work, which also makes guest mesa try the virgl driver.Change
is_2d_only(virgl_flags)=NO_VIRGLset andVENUSclear. In that modecreate_rutabaga(and the fallback) buildRutabagaComponentType::Rutabaga2Dwith no channels or export table; the device advertises onlyVERSION_1 | EDIDand reportsnum_capsets = 0. Venus/virgl configurations are untouched (this is complementary to virtio-gpu venus: fix blob mapping on macOS/HVF and Linux/KVM #91, which fixes the Venus blob path).flush_resourceread the whole resource withresource.width * 4as the stride into a frame buffer sized by the SET_SCANOUT rectangle. When the two differ (Hyprland's GBM dumb buffers), rutabaga'stransfer_2dreturnsInvalidIovecand theunwrap()took the gpu worker thread down.VirtioGpuScanoutnow records the rectangle,read_2d_resourcecopies the intersection with the destination stride, and a failed read-back answersErrUnspecinstead of panicking.Verification
macOS/HVF, Arch Linux ARM guest, libkrunfw 6.12:
modetest -M virtio_gpu -s 37@36:1920x1080completes with zero errors in dmesg (ten before); the guest logsfeatures: -virgl +edid -resource_blob …; Hyprland 0.56 on llvmpipe delivers 1920x1080 BGRX frames to akrun_displaybackend, and they render as a native window in https://github.com/ya-luotao/msb-omarchy.cargo check -p msb_krun_devices --features gpu,inputpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01A2DMienRTQjgR5CF3uQ2AZ