Repository navigation
Config.GPU on X11 and Wayland through gpu2d's Vulkan back-end (L1) - #157
Merged
Merged
Conversation
Frames are recorded through gpupainter into a gpu2d list, drawn by gpu2d/vulkan, and the renderer's Pixels are copied into the window's own framebuffer, which the back-end presents as ever (MIT-SHM or PutImage on X11, wl_shm on Wayland). No dma-buf: that is L2 and L3 of gpu2d docs/NATIVE.md, Decision 3, fallback 2. internal/gpupath holds the shared state machine. Where Vulkan is unavailable, or a frame is refused (ErrTooLarge, ErrUnsupported, a lost device), the path stops for good, records why (GPUError), and that frame and every later one are drawn on the CPU, as the Cocoa path does. An incremental root redraws whole frames while the GPU draws, and for the first frame after it stops. gpu2d is raised to v0.9.1. go-gfx/vulkan's build constraint admits GOOS=android, which needs cgo for purego, so android gets a refusal instead of the import. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… README TestLiveGPUX11ShowsTheCPUFrame reads the window back from Xvfb with XGetImage and compares it with a window that did not ask for the GPU and with PixelPainter, before and after a resize. TestLiveGPUWaylandShowsTheCPUFrame compares the committed wl_shm buffer with the CPU window's and PixelPainter's, and grim's capture of a private headless sway. Both start their servers (WINDOW_GPU_SPAWN) and fail rather than skip without a Vulkan device (WINDOW_GPU_REQUIRE). test/gpu-linux/Dockerfile is the container recipe, the live-gpu lane the same tests on ubuntu. In-process tests over a CPU-reference renderer cover the fallbacks (refused frame, refused resize, Vulkan absent) for both back-ends; internal/gpupath joins the 100% coverage gate. BenchmarkLiveGPUFrame measures a whole frame, CPU path against GPU path; README gives the software numbers, labelled as such. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tannevaled
force-pushed
the
gpu-linux-l1
branch
from
November 10, 2026 14:46
0167b32 to
35352ed
Compare
…b there go-gfx/vulkan v0.2.1 (go-gfx/vulkan#6) no longer builds the purego loader for GOOS=android, so internal/gpupath imports gpu2d/vulkan everywhere again. CGO_ENABLED=0 GOOS=android GOARCH=arm64 go vet and build pass without it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
Updated: rebased on main (live Wayland input is pinned to ubuntu-24.04 by #158, evidence in its commit message), and the android workaround is gone because go-gfx/vulkan v0.2.1 (go-gfx/vulkan#6) builds the stub on android. The rest of the description stands. 🤖 Generated with Claude Code |
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
Config.GPUon the X11 and Wayland back-ends: frames are drawn by gpu2d'svulkanback-end (gpu2d v0.9.1), then presented through the window's existing CPU path (MIT-SHM / PutImage on X11, wl_shm on Wayland) from the renderer'sPixels(). This is milestone L1 of gpu2ddocs/NATIVE.md(Decision 3, fallback 2). No dma-buf: that is L2/L3.internal/gpupathholds the state machine shared by both back-ends, mirroringinternal/cocoa/gpu_darwin.go: start whenRunstarts, whole-frame redraw while the GPU draws,GPU()/GPUError().ErrTooLarge,ErrUnsupported, device lost, timeout), the renderer is released, the error is recorded, and that frame and every later one are drawn on the CPU, as Cocoa does. The first CPU frame after a drop is a whole one even for an incremental root.linux && (amd64 || arm64), whichGOOS=androidsatisfies, and purego then needs cgo there.gpupaththerefore refuses on android instead of importing it (theandroidCI lane stays CGO-free). Not filed upstream from this session; it should be.Proof
Live, under lavapipe (llvmpipe, LLVM 19.1.7) in a linux/arm64 container (
test/gpu-linux/Dockerfile; Xvfb and headless sway started by the tests):XGetImageequals the CPU window's and PixelPainter's, 192,000 bytes at 320 × 200 and 312,000 after a resize to 400 × 260 (MIT-SHM present).live GPU (lavapipe, X11 + Wayland)lane (same tests,WINDOW_GPU_REQUIRE=1so a missing driver fails);internal/gpupathjoins the 100 % coverage gate (its tests run over a CPU-reference renderer, so the gate needs no Vulkan).Software numbers (labelled as such)
6 interleaved rounds under abbench
--max-load 8, benchstat medians. The GPU path is lavapipe, a CPU rasterizer: under it the GPU path costs about ten times the CPU time and 35 to 52 % more wall time than the CPU path. See README for the table and allocation counts. Real-GPU numbers are pending (fractal is down).Not done: org landing and docs site updates.
🤖 Generated with Claude Code