Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virglrenderer: enable venus and DRM native context support #382283

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

alois31
Copy link
Contributor

@alois31 alois31 commented Feb 15, 2025

Venus is currently required for Vulkan support in Virtio-GPU. DRM native context will allow using the native Mesa drivers in the guest, improving support and performance; support in QEMU (on the host) and Mesa (on the guest) is required and not in upstream releases yet.

Fixes: #379454

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@alois31
Copy link
Contributor Author

alois31 commented Feb 15, 2025

Only Venus has been (superficially, but successfully) tested. Native context is untested because I didn't want to hunt down appropriately patched QEMU and Mesa versions.

@kuruczgy
Copy link
Contributor

Native context is untested because I didn't want to hunt down appropriately patched QEMU and Mesa versions.

I do happen to have such a setup lying around (https://codeberg.org/kuruczgy/aarch64-gaming/commit/8e50a5d7fd17dc9ae083f5b59cd5f02a882a969e1d86e6f92dd81891cb23c487), so I tested it, drm native context seems to work well with this PR 👍 (system: aarch64, Snapdragon X Elite)

sc

@NyCodeGHG
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 382283


x86_64-linux

❌ 4 packages failed to build:
  • discourse
  • discourseAllPlugins
  • python313Packages.guestfs
  • python313Packages.guestfs.dist
✅ 57 packages built:
  • OVMFFull
  • OVMFFull.fd
  • akkoma-frontends.akkoma-fe
  • colima
  • cot (python312Packages.cot)
  • cot.dist (python312Packages.cot.dist)
  • crosvm
  • crosvm.debug
  • curtail
  • diffoscope
  • diffoscope.dist
  • diffoscope.man
  • garble
  • image_optim
  • kata-runtime
  • krun
  • libguestfs
  • libguestfs.guestfsd
  • lima
  • lima-bin
  • lxd-lts
  • multipass
  • nemu
  • open-watcom-bin
  • open-watcom-bin-unwrapped
  • out-of-tree
  • oxipng
  • python312Packages.guestfs
  • python312Packages.guestfs.dist
  • python313Packages.cot
  • python313Packages.cot.dist
  • qemu
  • qemu.debug
  • qemu.doc
  • qemu.ga
  • qemu_full
  • qemu_full.debug
  • qemu_full.doc
  • qemu_full.ga
  • qemu_kvm
  • qemu_kvm.debug
  • qemu_kvm.doc
  • qemu_kvm.ga
  • qemu_xen
  • qemu_xen.debug
  • qemu_xen.doc
  • qemu_xen.ga
  • qtemu
  • quickemu
  • quickgui
  • quickgui.debug
  • quickgui.pubcache
  • vagrant
  • virglrenderer
  • virglrenderer.debug
  • virt-v2v
  • vmctl

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Mar 13, 2025
@NyCodeGHG
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 382283


x86_64-linux

❌ 2 packages failed to build:
  • python313Packages.guestfs
  • python313Packages.guestfs.dist
✅ 55 packages built:
  • OVMFFull
  • OVMFFull.fd
  • colima
  • cot (python312Packages.cot)
  • cot.dist (python312Packages.cot.dist)
  • crosvm
  • crosvm.debug
  • diffoscope
  • diffoscope.dist
  • diffoscope.man
  • guestfs-tools
  • kata-runtime
  • krun
  • libguestfs
  • libguestfs-with-appliance
  • libguestfs-with-appliance.guestfsd
  • libguestfs.guestfsd
  • lima
  • lima-bin
  • lxd-lts
  • multipass
  • nemu
  • open-watcom-bin
  • open-watcom-bin-unwrapped
  • out-of-tree
  • python312Packages.guestfs
  • python312Packages.guestfs.dist
  • python313Packages.cot
  • python313Packages.cot.dist
  • qemu
  • qemu.debug
  • qemu.doc
  • qemu.ga
  • qemu_full
  • qemu_full.debug
  • qemu_full.doc
  • qemu_full.ga
  • qemu_kvm
  • qemu_kvm.debug
  • qemu_kvm.doc
  • qemu_kvm.ga
  • qemu_xen
  • qemu_xen.debug
  • qemu_xen.doc
  • qemu_xen.ga
  • qtemu
  • quickemu
  • quickgui
  • quickgui.debug
  • quickgui.pubcache
  • vagrant
  • virglrenderer
  • virglrenderer.debug
  • virt-v2v
  • vmctl

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Mar 17, 2025
Copy link
Member

@PedroHLC PedroHLC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Testing VM:

{ nixpkgs
, testingDM ? "gdm" # "sddm" | "gdm"
, testingDE ? "gnome" # "plasma6" | "gnome"
, testingSession ? "gnome" # "gnome" | "plasma"
, testingWithAutoLogin ? true
}:

import "${nixpkgs}/nixos/tests/make-test-python.nix" ({ pkgs, lib, ... }: {
  name = "venus-test";

  nodes.machine = { pkgs, ... }: {
    imports = [
      "${nixpkgs}/nixos/tests/common/user-account.nix"
    ];

    virtualisation.qemu.options = [
      "-m 16G"
      "-vga none"
      "-device virtio-vga-gl,hostmem=8G,blob=true,venus=true"
      "-object memory-backend-memfd,id=mem1,size=16G"
      "-machine memory-backend=mem1"
      "-display gtk,gl=on"
    ];
    
    # Apply nixpkgs#382283
    virtualisation.qemu.package = lib.mkForce (pkgs.qemu.override {
      virglrenderer = pkgs.virglrenderer.overrideAttrs (prevAttrs: {
        buildInputs = prevAttrs.buildInputs ++ [ pkgs.vulkan-headers pkgs.vulkan-loader ];
        mesonFlags = prevAttrs.mesonFlags ++ [ (lib.mesonBool "venus" true) (lib.mesonOption "drm-renderers" "amdgpu-experimental,msm") ];
      });
    });

    environment.systemPackages = with pkgs; [
      vulkan-tools
      mesa-demos
      alacritty
    ];

    services.xserver = {
      enable = true;
      displayManager = {
        "${testingDM}".enable = true;
        autoLogin = {
          enable = testingWithAutoLogin;
          user = "alice";
        };
        defaultSession = testingSession;
      };
      desktopManager.${testingDE}.enable = true;
    };
  };

  # TODO: TODO
  testScript =
    ''
      start_all()
    '';
})

Venus is currently required for Vulkan support in Virtio-GPU. DRM native
context will allow using the native Mesa drivers in the guest, improving
support and performance; support in QEMU (on the host) and Mesa (on the guest)
is required and not in upstream releases yet.

Fixes: NixOS#379454
@alois31 alois31 force-pushed the push-ztonpmwqkkwu branch from 0becbf9 to d082fd7 Compare March 18, 2025 17:19
@wegank wegank removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Mar 19, 2025
@eljamm eljamm added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Mar 21, 2025
@wegank wegank added 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Mar 21, 2025
@SuperSandro2000 SuperSandro2000 merged commit fad54df into NixOS:master Mar 22, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 10.rebuild-linux: 11-100 12.approvals: 3+ This PR was reviewed and approved by three or more reputable people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

virglrenderer: Expose Venus and AMDGPU native context support as options
8 participants