From 15107f54be5b76fc94c17c3e79ca6acb09c6198d Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Tue, 21 Jul 2026 11:22:07 +0100 Subject: [PATCH] =?UTF-8?q?build:=20run-x86-64-gpu=20=E2=80=94=20the=20int?= =?UTF-8?q?eractive=20twin=20of=20the=20display-native=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Boots the usual VGA/GOP floor plus a virtio-gpu-pci adapter, so the device-manager stack spawns the driver and the compositor upgrades to the native fenced-present backend interactively. QEMU shows one head per adapter: the live output is the virtio-gpu console in the View menu (the VGA head freezes at the moment of upgrade). 512M, matching display-native. --- build.zig | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/build.zig b/build.zig index 372bf5c..f0351c0 100644 --- a/build.zig +++ b/build.zig @@ -850,6 +850,53 @@ pub fn build(b: *std.Build) void { const run_efi_step = b.step("run-x86-64", "Boot the x86-64 kernel in QEMU (UEFI/OVMF); serial0 is logged to zig-out/qemu-test/run-x86-64-serial0-.log"); run_efi_step.dependOn(&run_efi.step); + // --- run-x86-64-gpu: the same boot plus a virtio-gpu adapter --- + // The VGA device still supplies the boot (GOP) framebuffer the compositor starts + // on; the virtio-gpu function is discovered by the device-manager stack, its + // driver announces a shared scanout, and the compositor upgrades off the GOP + // floor to fenced — vsync, tear-free — native presents (docs/display-v2.md). + // This is the interactive twin of the `display-native` test case, and 512M + // matches it (the whole driver stack + the compositor's surfaces at once). + // QEMU shows one head per adapter: pick the virtio-gpu head in the View menu + // to watch the native output. + const run_gpu = b.addSystemCommand(&.{ + "qemu-system-x86_64", + "-device", + "qemu-xhci,id=xhci", + "-device", + "usb-mouse,bus=xhci.0", + "-device", + "usb-kbd,bus=xhci.0", + "-machine", + "q35", + "-m", + "512M", + "-drive", + b.fmt("if=pflash,format=raw,readonly=on,file={s}", .{ovmf_code}), + }); + run_gpu.addArg("-drive"); + run_gpu.addPrefixedFileArg("if=pflash,format=raw,file=", vars_out); + run_gpu.addArg("-drive"); + run_gpu.addPrefixedFileArg("if=none,id=bootusb,format=raw,file=", fat_image_serial); + run_gpu.addArgs(&.{ + "-device", + "usb-storage,bus=xhci.0,drive=bootusb,removable=on,bootindex=0", + "-net", + "none", + "-vga", + "none", + "-device", + "VGA,edid=on,xres=1280,yres=720", + "-device", + "virtio-gpu-pci", + }); + const gpu_serial_log = b.fmt("{s}/run-x86-64-gpu-serial0-{s}.log", .{ log_dir, timestamp(b) }); + run_gpu.addArgs(&.{ "-serial", b.fmt("file:{s}", .{gpu_serial_log}) }); + run_gpu.step.dependOn(&make_log_dir.step); + + const run_gpu_step = b.step("run-x86-64-gpu", "Boot in QEMU with a virtio-gpu adapter: the compositor upgrades to fenced (tear-free) native presents; watch the virtio-gpu head in QEMU's View menu"); + run_gpu_step.dependOn(&run_gpu.step); + // const run_cmd = b.addRunArtifact(exe); // const run_step = b.step("run", "Run the app"); // run_step.dependOn(&run_cmd.step);