From 0ece3a6effa3289b48c8bef8ca0d1e67adcdd801 Mon Sep 17 00:00:00 2001 From: Nicola Belluti Date: Wed, 26 Aug 2026 09:14:32 +0200 Subject: [PATCH] Added `mesa` role --- roles/mesa/tasks/main.yml | 37 +++++++++++++++++++++++++++++++++++++ roles/mesa/vars/main.yml | 9 +++++++++ site.yml | 4 ++++ 3 files changed, 50 insertions(+) create mode 100644 roles/mesa/tasks/main.yml create mode 100644 roles/mesa/vars/main.yml diff --git a/roles/mesa/tasks/main.yml b/roles/mesa/tasks/main.yml new file mode 100644 index 0000000..8544162 --- /dev/null +++ b/roles/mesa/tasks/main.yml @@ -0,0 +1,37 @@ +# community.general.pacman ignores the repo/pkg syntax, so call pacman. +- name: Install the patched Mesa stack + become: true + ansible.builtin.command: + argv: "{{ ['pacman', '-S', '--noconfirm'] + (mesa_stack | map('regex_replace', '^', 'bc250-cachyos/') | list) }}" + register: mesa_install + changed_when: "'there is nothing to do' not in mesa_install.stdout" + +- name: Read the installed Mesa version + ansible.builtin.command: pacman -Q mesa + register: mesa_ver + changed_when: false + +# bc250-cachyos pkgrel carries a dot (1.67), the official one does not. +- name: Verify the patched Mesa is the installed one + ansible.builtin.assert: + that: "'.' in mesa_ver.stdout.split('-')[-1]" + fail_msg: "Installed {{ mesa_ver.stdout }}: expected a bc250-cachyos pkgrel like 1.67." + +# The gfx103 patch is opt-in and off by default. Without this the device +# stays GFX10.1 and mesh/task shaders are not exposed. +- name: Enable the GFX10.3 promotion globally + become: true + ansible.builtin.lineinfile: + path: /etc/environment + regexp: '^RADV_GFX103=' + line: 'RADV_GFX103=1' + +# Pin last: IgnorePkg outranks the repo/pkg syntax, so writing it before +# the install would make pacman prompt instead of proceeding. +- name: Pin the Mesa stack against upstream upgrades + become: true + ansible.builtin.lineinfile: + path: /etc/pacman.conf + regexp: '^IgnorePkg\s*=' + line: "IgnorePkg = {{ mesa_stack | join(' ') }}" + insertafter: '^\[options\]' diff --git a/roles/mesa/vars/main.yml b/roles/mesa/vars/main.yml new file mode 100644 index 0000000..cfc265f --- /dev/null +++ b/roles/mesa/vars/main.yml @@ -0,0 +1,9 @@ +mesa_stack: + - mesa + - opencl-mesa + - vulkan-radeon + - vulkan-mesa-implicit-layers + - lib32-mesa + - lib32-opencl-mesa + - lib32-vulkan-radeon + - lib32-vulkan-mesa-implicit-layers diff --git a/site.yml b/site.yml index 00b3586..c07388c 100644 --- a/site.yml +++ b/site.yml @@ -5,5 +5,9 @@ role: kernel - name: Install fan control and temperature driver role: fan + + # GPU stuff - name: Install GPU governor role: gpu_governor + - name: Install Mesa + role: mesa