From 48b35b44798661b59e04d4b2a428f0dca9756784 Mon Sep 17 00:00:00 2001 From: Ward Nakchbandi Date: Mon, 10 Apr 2023 12:34:37 +0300 Subject: [PATCH] fix amdvlk taking over --- pika-amdgpu-core/debian/changelog | 29 ++ pika-amdgpu-core/debian/control | 17 ++ pika-amdgpu-core/debian/copyright | 8 + .../debian/pika-amdgpu-core.install | 2 + pika-amdgpu-core/debian/postinst | 21 ++ pika-amdgpu-core/debian/prerm | 11 + .../debian/rules | 0 .../debian/source/format | 0 .../etc/apt/apt.conf.d/99amdgpu-firmware | 2 + .../etc/environment.d/20-pika-amdgpu.conf | 2 + .../etc/systemd/system/amdgpu-pro-lib.service | 8 + .../usr/bin/amdgpu-firmware-refresh | 5 + pika-amdgpu-core/usr/bin/amdgpu-lib-refresh | 289 ++++++++++++++++++ .../dpkg/scripts/amdgpu-firmware-hook.sh | 24 ++ pika-amdgpu-switcher/Makefile | 6 - pika-amdgpu-switcher/debian/changelog | 5 - pika-amdgpu-switcher/debian/control | 17 -- pika-amdgpu-switcher/usr/bin/cl_pro | 20 -- pika-amdgpu-switcher/usr/bin/gl_mesa | 36 --- pika-amdgpu-switcher/usr/bin/gl_pro | 36 --- pika-amdgpu-switcher/usr/bin/gl_zink | 36 --- pika-amdgpu-switcher/usr/bin/vk_amdvlk | 52 ---- pika-amdgpu-switcher/usr/bin/vk_legacy | 52 ---- pika-amdgpu-switcher/usr/bin/vk_pro | 52 ---- pika-amdgpu-switcher/usr/bin/vk_radv | 52 ---- .../share/bash-completion/completions/cl_pro | 1 - .../share/bash-completion/completions/gl_mesa | 3 - .../share/bash-completion/completions/gl_pro | 3 - .../share/bash-completion/completions/gl_zink | 3 - .../bash-completion/completions/vk_amdvlk | 4 - .../bash-completion/completions/vk_legacy | 4 - .../share/bash-completion/completions/vk_pro | 4 - .../share/bash-completion/completions/vk_radv | 4 - 33 files changed, 418 insertions(+), 390 deletions(-) create mode 100644 pika-amdgpu-core/debian/changelog create mode 100644 pika-amdgpu-core/debian/control create mode 100644 pika-amdgpu-core/debian/copyright create mode 100644 pika-amdgpu-core/debian/pika-amdgpu-core.install create mode 100755 pika-amdgpu-core/debian/postinst create mode 100644 pika-amdgpu-core/debian/prerm rename {pika-amdgpu-switcher => pika-amdgpu-core}/debian/rules (100%) rename {pika-amdgpu-switcher => pika-amdgpu-core}/debian/source/format (100%) create mode 100644 pika-amdgpu-core/etc/apt/apt.conf.d/99amdgpu-firmware create mode 100644 pika-amdgpu-core/etc/environment.d/20-pika-amdgpu.conf create mode 100644 pika-amdgpu-core/etc/systemd/system/amdgpu-pro-lib.service create mode 100755 pika-amdgpu-core/usr/bin/amdgpu-firmware-refresh create mode 100755 pika-amdgpu-core/usr/bin/amdgpu-lib-refresh create mode 100755 pika-amdgpu-core/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh delete mode 100644 pika-amdgpu-switcher/Makefile delete mode 100644 pika-amdgpu-switcher/debian/changelog delete mode 100644 pika-amdgpu-switcher/debian/control delete mode 100755 pika-amdgpu-switcher/usr/bin/cl_pro delete mode 100755 pika-amdgpu-switcher/usr/bin/gl_mesa delete mode 100755 pika-amdgpu-switcher/usr/bin/gl_pro delete mode 100755 pika-amdgpu-switcher/usr/bin/gl_zink delete mode 100755 pika-amdgpu-switcher/usr/bin/vk_amdvlk delete mode 100755 pika-amdgpu-switcher/usr/bin/vk_legacy delete mode 100755 pika-amdgpu-switcher/usr/bin/vk_pro delete mode 100755 pika-amdgpu-switcher/usr/bin/vk_radv delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/cl_pro delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_mesa delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_pro delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_zink delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_amdvlk delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_legacy delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_pro delete mode 100644 pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_radv diff --git a/pika-amdgpu-core/debian/changelog b/pika-amdgpu-core/debian/changelog new file mode 100644 index 0000000..60e81fc --- /dev/null +++ b/pika-amdgpu-core/debian/changelog @@ -0,0 +1,29 @@ +pika-amdgpu-core (100:22.40.50403-1538781~22.04-3) lunar; urgency=low + + * Update to 22.40.50403-1538781 + + -- Ward Nakchbandi Sat, 01 Oct 2022 14:50:00 +0200 + +pika-amdgpu-core (100:22.40.50401-1518373~22.04) kinetic; urgency=low + + * add a firmware apt hook + + -- Ward Nakchbandi Sat, 01 Oct 2022 14:50:00 +0200 + +pika-amdgpu-core (100:22.20.50205-1511376~22.04-14) kinetic; urgency=low + + * switch to systemd service + + -- Ward Nakchbandi Sat, 01 Oct 2022 14:50:00 +0200 + +pika-amdgpu-core (100:22.20.50205-1511376~22.04-13) kinetic; urgency=low + + * remove broken apt hook + + -- Ward Nakchbandi Sat, 01 Oct 2022 14:50:00 +0200 + +pika-amdgpu-core (100:22.40.50403-538781~22.04) lunar; urgency=low + + * Initial Creation + + -- Ward Nakchbandi Sat, 01 Oct 2022 14:50:00 +0200 diff --git a/pika-amdgpu-core/debian/control b/pika-amdgpu-core/debian/control new file mode 100644 index 0000000..d107e4d --- /dev/null +++ b/pika-amdgpu-core/debian/control @@ -0,0 +1,17 @@ +Source: pika-amdgpu-core +Section: metapackages +Priority: optional +Maintainer: Ward Nakchbandi +Build-Depends: debhelper-compat (= 13) +Standards-Version: 4.6.1 +Homepage: https://repo.radeon.com/ + +Package: pika-amdgpu-core +Section: metapackages +Architecture: all +Depends: ${misc:Depends}, libdrm-amdgpu-amdgpu1, libdrm-amdgpu-radeon1, libdrm2-amdgpu, libdrm-amdgpu-common, amdgpu-dkms-firmware +Suggests: amdgpu-vulkan-switcher, amdgpu-opengl-switcher, amdgpu-opencl-switcher, pika-amdgpu-config +Provides: amdgpu-core, amdgpu-pro-core, amdgpu-dkms, amdgpu-pro-lib32 +Multi-Arch: foreign +Description: Core meta package for Pro components of the unified amdgpu driver, with mesa priority. + diff --git a/pika-amdgpu-core/debian/copyright b/pika-amdgpu-core/debian/copyright new file mode 100644 index 0000000..d30c7d5 --- /dev/null +++ b/pika-amdgpu-core/debian/copyright @@ -0,0 +1,8 @@ +Files: * +Copyright: 2022 Ward Nakchbandi +License: GPL-2 + +Files: debian/* +Copyright: 2022 Ward Nakchbandi +License: GPL-2 + diff --git a/pika-amdgpu-core/debian/pika-amdgpu-core.install b/pika-amdgpu-core/debian/pika-amdgpu-core.install new file mode 100644 index 0000000..a75e237 --- /dev/null +++ b/pika-amdgpu-core/debian/pika-amdgpu-core.install @@ -0,0 +1,2 @@ +etc +usr diff --git a/pika-amdgpu-core/debian/postinst b/pika-amdgpu-core/debian/postinst new file mode 100755 index 0000000..1827149 --- /dev/null +++ b/pika-amdgpu-core/debian/postinst @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +# Enable systemd service + +systemctl enable --now amdgpu-pro-lib.service || echo "amdgpu-pro-lib service could not be enabled" + +# Add firmware + +rm -r /usr/src/amdgpu-official || echo + +ln -s /usr/src/"$(ls /usr/src/ | grep amdgpu- | sort -nr | head -n1)" /usr/src/amdgpu-official + +rm -r /usr/lib/firmware/amdgpu || echo + +ln -s /usr/src/amdgpu-official/firmware/amdgpu /usr/lib/firmware/ + +update-initramfs -c -k all + +# diff --git a/pika-amdgpu-core/debian/prerm b/pika-amdgpu-core/debian/prerm new file mode 100644 index 0000000..b44567f --- /dev/null +++ b/pika-amdgpu-core/debian/prerm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +systemctl disable --now amdgpu-pro-lib.service || echo "amdgpu-pro-lib service could not be disabled" + +rm -r /usr/lib/firmware/amdgpu || echo + +update-initramfs -c -k all + +# Add firmware diff --git a/pika-amdgpu-switcher/debian/rules b/pika-amdgpu-core/debian/rules similarity index 100% rename from pika-amdgpu-switcher/debian/rules rename to pika-amdgpu-core/debian/rules diff --git a/pika-amdgpu-switcher/debian/source/format b/pika-amdgpu-core/debian/source/format similarity index 100% rename from pika-amdgpu-switcher/debian/source/format rename to pika-amdgpu-core/debian/source/format diff --git a/pika-amdgpu-core/etc/apt/apt.conf.d/99amdgpu-firmware b/pika-amdgpu-core/etc/apt/apt.conf.d/99amdgpu-firmware new file mode 100644 index 0000000..d4d93c7 --- /dev/null +++ b/pika-amdgpu-core/etc/apt/apt.conf.d/99amdgpu-firmware @@ -0,0 +1,2 @@ +DPkg::Pre-Install-Pkgs {"/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh pre";}; +DPkg::Post-Invoke {"/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh post";}; diff --git a/pika-amdgpu-core/etc/environment.d/20-pika-amdgpu.conf b/pika-amdgpu-core/etc/environment.d/20-pika-amdgpu.conf new file mode 100644 index 0000000..a5bee9c --- /dev/null +++ b/pika-amdgpu-core/etc/environment.d/20-pika-amdgpu.conf @@ -0,0 +1,2 @@ +DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 +ROC_ENABLE_PRE_VEGA=1 diff --git a/pika-amdgpu-core/etc/systemd/system/amdgpu-pro-lib.service b/pika-amdgpu-core/etc/systemd/system/amdgpu-pro-lib.service new file mode 100644 index 0000000..c1a8bf9 --- /dev/null +++ b/pika-amdgpu-core/etc/systemd/system/amdgpu-pro-lib.service @@ -0,0 +1,8 @@ +[Unit] +Description=Prevents AMDGPU-PRO dangerous behaviour and symlinks its firmware and libraries to sytem path. + +[Service] +ExecStart=/usr/bin/amdgpu-lib-refresh + +[Install] +WantedBy=multi-user.target diff --git a/pika-amdgpu-core/usr/bin/amdgpu-firmware-refresh b/pika-amdgpu-core/usr/bin/amdgpu-firmware-refresh new file mode 100755 index 0000000..57eb985 --- /dev/null +++ b/pika-amdgpu-core/usr/bin/amdgpu-firmware-refresh @@ -0,0 +1,5 @@ +#! /bin/bash + + sudo /usr/bin/amdgpu-lib-refresh + sudo update-initramfs -c -k all + diff --git a/pika-amdgpu-core/usr/bin/amdgpu-lib-refresh b/pika-amdgpu-core/usr/bin/amdgpu-lib-refresh new file mode 100755 index 0000000..3435fcd --- /dev/null +++ b/pika-amdgpu-core/usr/bin/amdgpu-lib-refresh @@ -0,0 +1,289 @@ +#! /bin/bash + +# Disables amdgpu-pro libraries to fallback to mesa +# USE wrappers instead + +export PRO_DISABLED=0 +export AMD_DISABLED=0 +export BIN_AMD_DISABLED=0 +export BIN_INTEL_DISABLED=0 +export ENC_EXISTS=0 +export AMF_EXISTS=0 +export AMD64_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS=0 +export AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS=0 +export AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS=0 +export I386_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS=0 +export I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS=0 +export I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS=0 +export AMD64_LIBGL1_AMDGPU_PRO_OGLP_EXT_EXISTS=0 +export AMD64_LIBGL1_AMDGPU_PRO_OGLP_GBM_EXISTS=0 +export AMD64_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS=0 +export AMD64_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS=0 +export AMD64_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS=0 +export AMD64_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS=0 +export AMD64_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS=0 +export I386_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS=0 +export I386_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS=0 +export I386_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS=0 +export I386_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS=0 +export I386_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS=0 +export AMD64_VULKAN_AMDGPU_PRO_EXISTS=0 +export I386_VULKAN_AMDGPU_PRO_EXISTS=0 +export AMD64_AMDVLK_EXISTS=0 +export I386_AMDVLK_EXISTS=0 + +# Add firmware + +rm -r /usr/src/amdgpu-official || echo + +ln -s /usr/src/"$(ls /usr/src/ | grep amdgpu- | sort -nr | head -n1)" /usr/src/amdgpu-official + +rm -r /usr/lib/firmware/amdgpu || echo + +ln -s /usr/src/amdgpu-official/firmware/amdgpu /usr/lib/firmware/ + +# Check files and packages + +### Check if library paths are disables + +cat /etc/ld.so.conf.d/10-amdgpu-pro.conf | grep "#" && export PRO_DISABLED=1 + +cat /etc/ld.so.conf.d/20-amdgpu.conf | grep "#" && export AMD_DISABLED=1 + +cat /etc/ld.so.conf.d/10-amdgpu-pro-x86_64.conf | grep "#" && export BIN_AMD_DISABLED=1 + +cat /etc/ld.so.conf.d/10-amdgpu-pro-i386.conf | grep "#" && export BIN_INTEL_DISABLED=1 + +### Check if amf libraries exist + +ls /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdenc* && export ENC_EXISTS=1 + +ls /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamf* && export AMF_EXISTS=1 + +### Check if amd64 opencl packages exist + +dpkg -s opencl-legacy-amdgpu-pro-icd:amd64 && export AMD64_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS=1 + +dpkg -s ocl-icd-libopencl1-amdgpu-pro:amd64 && export AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS=1 + +dpkg -s ocl-icd-libopencl1-amdgpu-pro-dev:amd64 && export AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS=1 + +### Check if i386 opencl packages exist + +dpkg -s opencl-legacy-amdgpu-pro-icd:i386 && export I386_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS=1 + +dpkg -s ocl-icd-libopencl1-amdgpu-pro:i386 && export I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS=1 + +dpkg -s ocl-icd-libopencl1-amdgpu-pro-dev:i386 && export I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS=1 + + +### Check if amd64 opengl packages exist + +dpkg -s libgl1-amdgpu-pro-oglp-ext:amd64 && export AMD64_LIBGL1_AMDGPU_PRO_OGLP_EXT_EXISTS=1 + +dpkg -s libgl1-amdgpu-pro-oglp-gbm:amd64 && export AMD64_LIBGL1_AMDGPU_PRO_OGLP_GBM_EXISTS=1 + + +dpkg -s libegl1-amdgpu-pro-oglp:amd64 && export AMD64_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS=1 + +dpkg -s libgl1-amdgpu-pro-oglp-dri:amd64 && export AMD64_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS=1 + +dpkg -s libgl1-amdgpu-pro-oglp-glx:amd64 && export AMD64_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS=1 + +dpkg -s libgles1-amdgpu-pro-oglp:amd64 && export AMD64_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS=1 + +dpkg -s libgles2-amdgpu-pro-oglp:amd64 && export AMD64_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS=1 + +### Check if i386 opengl packages exist + +dpkg -s libegl1-amdgpu-pro-oglp:i386 && export I386_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS=1 + +dpkg -s libgl1-amdgpu-pro-oglp-dri:i386 && export I386_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS=1 + +dpkg -s libgl1-amdgpu-pro-oglp-glx:i386 && export I386_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS=1 + +dpkg -s libgles1-amdgpu-pro-oglp:i386 && export I386_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS=1 + +dpkg -s libgles2-amdgpu-pro-oglp:i386 && export I386_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS=1 + +### Check if amd64 vulkan packages exist + +dpkg -s vulkan-amdgpu-pro:amd64 && export AMD64_VULKAN_AMDGPU_PRO_EXISTS=1 + +### Check if i386 vulkan packages exist + +dpkg -s vulkan-amdgpu-pro:i386 && export I386_VULKAN_AMDGPU_PRO_EXISTS=1 + +### Check if amd64 free vulkan packages exist + +dpkg -s amdvlk:amd64 && export AMD64_AMDVLK_EXISTS=1 + +### Check if i386 free vulkan packages exist + +dpkg -s amdvlk:i386 && export I386_AMDVLK_EXISTS=1 + + +# Take Actions + +### Get rid of dangerous library paths + +if [[ "${PRODISABLED}" != 1 ]]; then + sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro.conf +fi + +if [[ "${AMDDISABLED}" != 1 ]]; then + sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/20-amdgpu.conf +fi + +if [[ "${BIN_AMD_DISABLED}" != 1 ]]; then + sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro-x86_64.conf +fi + +if [[ "${BIN_INTEL_DISABLED}" != 1 ]]; then + sed -i.old -e 's/^/#/' /etc/ld.so.conf.d/10-amdgpu-pro-i386.conf +fi + +### Link AMF libraries to system lib path + +if [[ "${ENC_EXISTS}" != 0 ]]; then + ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdenc* /usr/lib/x86_64-linux-gnu/ +fi + +if [[ "${AMF_EXISTS}" != 0 ]]; then + ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libamf* /usr/lib/x86_64-linux-gnu/ +fi + + +### Link amd64 opencl packages +rm -rf /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu || echo +if [[ "${AMD64_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu + for i in $(dpkg-query -L opencl-legacy-amdgpu-pro-icd:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu + for i in $(dpkg-query -L ocl-icd-libopencl1-amdgpu-pro:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu/ ; done +fi +if [[ "${AMD64_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu + for i in $(dpkg-query -L ocl-icd-libopencl1-amdgpu-pro-dev:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/x86_64-linux-gnu/ ; done +fi + +### Link i386 opencl packages +rm -rf /opt/amdgpu-pro/pika/opencl/i386-linux-gnu || echo +if [[ "${I386_OPENCL_LEGACY_AMDGPU_PRO_ICD_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/i386-linux-gnu + for i in $(dpkg-query -L opencl-legacy-amdgpu-pro-icd:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/i386-linux-gnu/ ; done +fi + +if [[ "${I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/i386-linux-gnu + for i in $(dpkg-query -L ocl-icd-libopencl1-amdgpu-pro:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/i386-linux-gnu/ ; done +fi +if [[ "${I386_OCL_ICD_LIBOPENCL1_AMDGPU_PRO_DEV_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opencl/i386-linux-gnu + for i in $(dpkg-query -L ocl-icd-libopencl1-amdgpu-pro-dev:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opencl/i386-linux-gnu/ ; done +fi + +### Link amd64 opengl packages +rm -rf /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu || echo + +if [[ "${AMD64_LIBGL1_AMDGPU_PRO_OGLP_EXT_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-ext:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_LIBGL1_AMDGPU_PRO_OGLP_GBM_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-gbm:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + + +if [[ "${AMD64_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libegl1-amdgpu-pro-oglp:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-dri:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-glx:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgles1-amdgpu-pro-oglp:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +if [[ "${AMD64_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu + for i in $(dpkg-query -L libgles2-amdgpu-pro-oglp:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/x86_64-linux-gnu/ ; done +fi + +### Link i386 opengl packages +rm -rf /opt/amdgpu-pro/pika/opengl/i386-linux-gnu || echo + +if [[ "${I386_LIBEGL1_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/i386-linux-gnu + for i in $(dpkg-query -L libegl1-amdgpu-pro-oglp:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/i386-linux-gnu/ ; done +fi + +if [[ "${I386_LIBGL1_AMDGPU_PRO_OGLP_DRI_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/i386-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-dri:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/i386-linux-gnu/ ; done +fi + +if [[ "${I386_LIBGL1_AMDGPU_PRO_OGLP_GLX_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/i386-linux-gnu + for i in $(dpkg-query -L libgl1-amdgpu-pro-oglp-glx:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/i386-linux-gnu/ ; done +fi + +if [[ "${I386_LIBGLES1_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/i386-linux-gnu + for i in $(dpkg-query -L libgles1-amdgpu-pro-oglp:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/i386-linux-gnu/ ; done +fi + +if [[ "${I386_LIBGLES2_AMDGPU_PRO_OGLP_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/opengl/i386-linux-gnu + for i in $(dpkg-query -L libgles2-amdgpu-pro-oglp:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu-pro/pika/opengl/i386-linux-gnu/ ; done +fi + +### Link amd64 vulkan packages +rm -rf /opt/amdgpu-pro/pika/vulkan/x86_64-linux-gnu || echo +if [[ "${AMD64_VULKAN_AMDGPU_PRO_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/vulkan/x86_64-linux-gnu + for i in $(dpkg-query -L vulkan-amdgpu-pro:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i //opt/amdgpu-pro/pika/vulkan/x86_64-linux-gnu/ ; done +fi + +### Link i386 vulkan packages +rm -rf /opt/amdgpu-pro/pika/vulkan/i386-linux-gnu || echo +if [[ "${I386_VULKAN_AMDGPU_PRO_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu-pro/pika/vulkan/i386-linux-gnu + for i in $(dpkg-query -L vulkan-amdgpu-pro:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i //opt/amdgpu-pro/pika/vulkan/i386-linux-gnu/ ; done +fi + +### Link amd64 free vulkan packages +rm -rf /opt/amdgpu/pika/vulkan/x86_64-linux-gnu || echo +if [[ "${AMD64_AMDVLK_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu/pika/vulkan/x86_64-linux-gnu + for i in $(dpkg-query -L amdvlk:amd64 | grep /x86_64-linux-gnu/ ); do ln -sfv $i /opt/amdgpu/pika/vulkan/x86_64-linux-gnu/ ; done + mkdir -p /opt/amdgpu/share/vulkan/icd.d/ + mv /etc/vulkan/icd.d/amd_icd*.json /opt/amdgpu/share/vulkan/icd.d/ || true +fi + +### Link i386 free vulkan packages +rm -rf /opt/amdgpu/pika/vulkan/i386-linux-gnu || echo +if [[ "${I386_AMDVLK_EXISTS}" != 0 ]]; then + mkdir -p /opt/amdgpu/pika/vulkan/i386-linux-gnu + for i in $(dpkg-query -L amdvlk:i386 | grep /i386-linux-gnu/ ); do ln -sfv $i /opt/amdgpu/pika/vulkan/i386-linux-gnu/ ; done + mkdir -p /opt/amdgpu/share/vulkan/icd.d/ + mv /etc/vulkan/icd.d/amd_icd*.json /opt/amdgpu/share/vulkan/icd.d/ || true + +fi + +ldconfig diff --git a/pika-amdgpu-core/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh b/pika-amdgpu-core/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh new file mode 100755 index 0000000..11c10a0 --- /dev/null +++ b/pika-amdgpu-core/usr/share/dpkg/scripts/amdgpu-firmware-hook.sh @@ -0,0 +1,24 @@ +#! /bin/bash + +if [[ $1 == pre ]] +then + if grep -q amdgpu-dkms-firmware + then + mkdir -p /var/lib/apt/hooks + touch /var/lib/apt/hooks/amdgpu-dkms-firmware +else + exit 0 + fi +fi + +if [[ $1 == post ]] +then + if [[ -f /var/lib/apt/hooks/amdgpu-dkms-firmware ]] + then + amdgpu-firmware-refresh + rm -rf /var/lib/apt/hooks/amdgpu-dkms-firmware + else + exit 0 + fi +fi + diff --git a/pika-amdgpu-switcher/Makefile b/pika-amdgpu-switcher/Makefile deleted file mode 100644 index 1073242..0000000 --- a/pika-amdgpu-switcher/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: - true - -install: - install -d $(DESTDIR)/ - cp -r usr $(DESTDIR)/ diff --git a/pika-amdgpu-switcher/debian/changelog b/pika-amdgpu-switcher/debian/changelog deleted file mode 100644 index d2606d5..0000000 --- a/pika-amdgpu-switcher/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -pika-amdgpu-switcher (1.0-99pika1) kinetic; urgency=low - - * Initial Creation - - -- Ward Nakchbandi Sun, 09 Oct 2022 18:34:00 +0300 diff --git a/pika-amdgpu-switcher/debian/control b/pika-amdgpu-switcher/debian/control deleted file mode 100644 index 1c2cd47..0000000 --- a/pika-amdgpu-switcher/debian/control +++ /dev/null @@ -1,17 +0,0 @@ -Source: pika-amdgpu-switcher -Section: misc -Priority: optional -Maintainer: Ward Nakchbandi -Build-Depends: debhelper-compat (= 13) -Standards-Version: 4.6.1 -Homepage: https://pikaproject.org/ - -Package: pika-amdgpu-switcher -Section: misc -Architecture: all -Provides: amdgpu-vulkan-switcher, amdgpu-opengl-switcher, amdgpu-opencl-switcher -Depends: ${misc:Depends} -Description: Prefix Scripts to choose the driver for OpenGL, OpenCL, and Vulkan on amdgpus. - - - diff --git a/pika-amdgpu-switcher/usr/bin/cl_pro b/pika-amdgpu-switcher/usr/bin/cl_pro deleted file mode 100755 index e9225b0..0000000 --- a/pika-amdgpu-switcher/usr/bin/cl_pro +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdocl-pro OpenGL driver for specific application. -# You can test the difference with clinfo utility. -# - - -cl_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:/opt/amdgpu-pro/lib/x86_64-linux-gnu:/opt/amdgpu-pro/lib/i386-linux-gnu:${LD_LIBRARY_PATH}" -} - -if [[ $(basename $0) == cl_pro ]]; then - cl_pro -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/gl_mesa b/pika-amdgpu-switcher/usr/bin/gl_mesa deleted file mode 100755 index f0f8dcd..0000000 --- a/pika-amdgpu-switcher/usr/bin/gl_mesa +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application. -# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility. -# -# Usage: -# -# For example: -# $ gl_pro davinci-resolve -# This will start davinci resolve with AMDGPU PRO OpenGL driver. - -gl_mesa() { - export __GLX_VENDOR_LIBRARY_NAME=mesa -} - -gl_zink() { - export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink -} - -gl_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:/opt/amdgpu-pro/lib/x86_64-linux-gnu:/opt/amdgpu-pro/lib/i386-linux-gnu:${LD_LIBRARY_PATH}" -} - -if [[ $(basename $0) == gl_mesa ]]; then - gl_mesa -elif [[ $(basename $0) == gl_zink ]]; then - gl_zink -elif [[ $(basename $0) == gl_pro ]]; then - gl_pro -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/gl_pro b/pika-amdgpu-switcher/usr/bin/gl_pro deleted file mode 100755 index f0f8dcd..0000000 --- a/pika-amdgpu-switcher/usr/bin/gl_pro +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application. -# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility. -# -# Usage: -# -# For example: -# $ gl_pro davinci-resolve -# This will start davinci resolve with AMDGPU PRO OpenGL driver. - -gl_mesa() { - export __GLX_VENDOR_LIBRARY_NAME=mesa -} - -gl_zink() { - export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink -} - -gl_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:/opt/amdgpu-pro/lib/x86_64-linux-gnu:/opt/amdgpu-pro/lib/i386-linux-gnu:${LD_LIBRARY_PATH}" -} - -if [[ $(basename $0) == gl_mesa ]]; then - gl_mesa -elif [[ $(basename $0) == gl_zink ]]; then - gl_zink -elif [[ $(basename $0) == gl_pro ]]; then - gl_pro -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/gl_zink b/pika-amdgpu-switcher/usr/bin/gl_zink deleted file mode 100755 index f0f8dcd..0000000 --- a/pika-amdgpu-switcher/usr/bin/gl_zink +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application. -# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility. -# -# Usage: -# -# For example: -# $ gl_pro davinci-resolve -# This will start davinci resolve with AMDGPU PRO OpenGL driver. - -gl_mesa() { - export __GLX_VENDOR_LIBRARY_NAME=mesa -} - -gl_zink() { - export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink -} - -gl_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:/opt/amdgpu-pro/lib/x86_64-linux-gnu:/opt/amdgpu-pro/lib/i386-linux-gnu:${LD_LIBRARY_PATH}" -} - -if [[ $(basename $0) == gl_mesa ]]; then - gl_mesa -elif [[ $(basename $0) == gl_zink ]]; then - gl_zink -elif [[ $(basename $0) == gl_pro ]]; then - gl_pro -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/vk_amdvlk b/pika-amdgpu-switcher/usr/bin/vk_amdvlk deleted file mode 100755 index fb92fe7..0000000 --- a/pika-amdgpu-switcher/usr/bin/vk_amdvlk +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdvlk-pro/amdvlk/radv Vulkan driver for specific application. -# You can see the list of available drivers with vulkaninfo utility, see the driverName and driverID lines. -# -# Usage: -# -# For example: -# $ vk_pro vkmark -# This will start vkmark with AMDGPU PRO vulkan driver. - -# When amdvlk is installed, then VK_ICD_FILENAMES is ignored and AMD_VULKAN_ICD is read instead. However, AMD_VULKAN_ICD does not allow you (afaics) select pro driver. -# So we revert this behavior to standard one. -export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 - -RADV_DIR="/usr/share/vulkan/icd.d" -PRO_DIR="/opt/amdgpu-pro/etc/vulkan/icd.d" -VLK_DIR="/etc/vulkan/icd.d" -LEGACY_DIR="/opt/amdgpu-pro/vulkan-legacy/etc/vulkan/icd.d" - -vk_radv() { - export VK_ICD_FILENAMES="${RADV_DIR}/radeon_icd.i686.json:${RADV_DIR}/radeon_icd.x86_64.json" -} - -vk_amdvlk() { - export VK_ICD_FILENAMES="${VLK_DIR}/amd_icd32.json:${VLK_DIR}/amd_icd64.json" -} - -vk_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:${LD_LIBRARY_PATH}" - export VK_ICD_FILENAMES="${PRO_DIR}/amd_icd32.json:${PRO_DIR}/amd_icd64.json" -} - -vk_legacy() { - export VK_ICD_FILENAMES="${LEGACY_DIR}/amd_icd32.json:${LEGACY_DIR}/amd_icd64.json" -} - -if [[ $(basename $0) == vk_radv ]]; then - vk_radv -elif [[ $(basename $0) == vk_amdvlk ]]; then - vk_amdvlk -elif [[ $(basename $0) == vk_pro ]]; then - vk_pro -elif [[ $(basename $0) == vk_legacy ]]; then - vk_legacy -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/vk_legacy b/pika-amdgpu-switcher/usr/bin/vk_legacy deleted file mode 100755 index fb92fe7..0000000 --- a/pika-amdgpu-switcher/usr/bin/vk_legacy +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdvlk-pro/amdvlk/radv Vulkan driver for specific application. -# You can see the list of available drivers with vulkaninfo utility, see the driverName and driverID lines. -# -# Usage: -# -# For example: -# $ vk_pro vkmark -# This will start vkmark with AMDGPU PRO vulkan driver. - -# When amdvlk is installed, then VK_ICD_FILENAMES is ignored and AMD_VULKAN_ICD is read instead. However, AMD_VULKAN_ICD does not allow you (afaics) select pro driver. -# So we revert this behavior to standard one. -export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 - -RADV_DIR="/usr/share/vulkan/icd.d" -PRO_DIR="/opt/amdgpu-pro/etc/vulkan/icd.d" -VLK_DIR="/etc/vulkan/icd.d" -LEGACY_DIR="/opt/amdgpu-pro/vulkan-legacy/etc/vulkan/icd.d" - -vk_radv() { - export VK_ICD_FILENAMES="${RADV_DIR}/radeon_icd.i686.json:${RADV_DIR}/radeon_icd.x86_64.json" -} - -vk_amdvlk() { - export VK_ICD_FILENAMES="${VLK_DIR}/amd_icd32.json:${VLK_DIR}/amd_icd64.json" -} - -vk_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:${LD_LIBRARY_PATH}" - export VK_ICD_FILENAMES="${PRO_DIR}/amd_icd32.json:${PRO_DIR}/amd_icd64.json" -} - -vk_legacy() { - export VK_ICD_FILENAMES="${LEGACY_DIR}/amd_icd32.json:${LEGACY_DIR}/amd_icd64.json" -} - -if [[ $(basename $0) == vk_radv ]]; then - vk_radv -elif [[ $(basename $0) == vk_amdvlk ]]; then - vk_amdvlk -elif [[ $(basename $0) == vk_pro ]]; then - vk_pro -elif [[ $(basename $0) == vk_legacy ]]; then - vk_legacy -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/vk_pro b/pika-amdgpu-switcher/usr/bin/vk_pro deleted file mode 100755 index fb92fe7..0000000 --- a/pika-amdgpu-switcher/usr/bin/vk_pro +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdvlk-pro/amdvlk/radv Vulkan driver for specific application. -# You can see the list of available drivers with vulkaninfo utility, see the driverName and driverID lines. -# -# Usage: -# -# For example: -# $ vk_pro vkmark -# This will start vkmark with AMDGPU PRO vulkan driver. - -# When amdvlk is installed, then VK_ICD_FILENAMES is ignored and AMD_VULKAN_ICD is read instead. However, AMD_VULKAN_ICD does not allow you (afaics) select pro driver. -# So we revert this behavior to standard one. -export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 - -RADV_DIR="/usr/share/vulkan/icd.d" -PRO_DIR="/opt/amdgpu-pro/etc/vulkan/icd.d" -VLK_DIR="/etc/vulkan/icd.d" -LEGACY_DIR="/opt/amdgpu-pro/vulkan-legacy/etc/vulkan/icd.d" - -vk_radv() { - export VK_ICD_FILENAMES="${RADV_DIR}/radeon_icd.i686.json:${RADV_DIR}/radeon_icd.x86_64.json" -} - -vk_amdvlk() { - export VK_ICD_FILENAMES="${VLK_DIR}/amd_icd32.json:${VLK_DIR}/amd_icd64.json" -} - -vk_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:${LD_LIBRARY_PATH}" - export VK_ICD_FILENAMES="${PRO_DIR}/amd_icd32.json:${PRO_DIR}/amd_icd64.json" -} - -vk_legacy() { - export VK_ICD_FILENAMES="${LEGACY_DIR}/amd_icd32.json:${LEGACY_DIR}/amd_icd64.json" -} - -if [[ $(basename $0) == vk_radv ]]; then - vk_radv -elif [[ $(basename $0) == vk_amdvlk ]]; then - vk_amdvlk -elif [[ $(basename $0) == vk_pro ]]; then - vk_pro -elif [[ $(basename $0) == vk_legacy ]]; then - vk_legacy -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/bin/vk_radv b/pika-amdgpu-switcher/usr/bin/vk_radv deleted file mode 100755 index fb92fe7..0000000 --- a/pika-amdgpu-switcher/usr/bin/vk_radv +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/bash - -# This script applies amdvlk-pro/amdvlk/radv Vulkan driver for specific application. -# You can see the list of available drivers with vulkaninfo utility, see the driverName and driverID lines. -# -# Usage: -# -# For example: -# $ vk_pro vkmark -# This will start vkmark with AMDGPU PRO vulkan driver. - -# When amdvlk is installed, then VK_ICD_FILENAMES is ignored and AMD_VULKAN_ICD is read instead. However, AMD_VULKAN_ICD does not allow you (afaics) select pro driver. -# So we revert this behavior to standard one. -export DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1 - -RADV_DIR="/usr/share/vulkan/icd.d" -PRO_DIR="/opt/amdgpu-pro/etc/vulkan/icd.d" -VLK_DIR="/etc/vulkan/icd.d" -LEGACY_DIR="/opt/amdgpu-pro/vulkan-legacy/etc/vulkan/icd.d" - -vk_radv() { - export VK_ICD_FILENAMES="${RADV_DIR}/radeon_icd.i686.json:${RADV_DIR}/radeon_icd.x86_64.json" -} - -vk_amdvlk() { - export VK_ICD_FILENAMES="${VLK_DIR}/amd_icd32.json:${VLK_DIR}/amd_icd64.json" -} - -vk_pro() { - export LD_LIBRARY_PATH="/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/i386-linux-gnu:${LD_LIBRARY_PATH}" - export VK_ICD_FILENAMES="${PRO_DIR}/amd_icd32.json:${PRO_DIR}/amd_icd64.json" -} - -vk_legacy() { - export VK_ICD_FILENAMES="${LEGACY_DIR}/amd_icd32.json:${LEGACY_DIR}/amd_icd64.json" -} - -if [[ $(basename $0) == vk_radv ]]; then - vk_radv -elif [[ $(basename $0) == vk_amdvlk ]]; then - vk_amdvlk -elif [[ $(basename $0) == vk_pro ]]; then - vk_pro -elif [[ $(basename $0) == vk_legacy ]]; then - vk_legacy -else - echo "Unknown function" - exit 1 -fi - -# applied variables, now execute the rest of the command -"$@" diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/cl_pro b/pika-amdgpu-switcher/usr/share/bash-completion/completions/cl_pro deleted file mode 100644 index 4a78a17..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/cl_pro +++ /dev/null @@ -1 +0,0 @@ -_have cl_pro && complete -F _command cl_pro diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_mesa b/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_mesa deleted file mode 100644 index fb26129..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_mesa +++ /dev/null @@ -1,3 +0,0 @@ -_have gl_mesa && complete -F _command gl_mesa -_have gl_zink && complete -F _command gl_zink -_have gl_pro && complete -F _command gl_pro diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_pro b/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_pro deleted file mode 100644 index fb26129..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_pro +++ /dev/null @@ -1,3 +0,0 @@ -_have gl_mesa && complete -F _command gl_mesa -_have gl_zink && complete -F _command gl_zink -_have gl_pro && complete -F _command gl_pro diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_zink b/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_zink deleted file mode 100644 index fb26129..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/gl_zink +++ /dev/null @@ -1,3 +0,0 @@ -_have gl_mesa && complete -F _command gl_mesa -_have gl_zink && complete -F _command gl_zink -_have gl_pro && complete -F _command gl_pro diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_amdvlk b/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_amdvlk deleted file mode 100644 index 545981b..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_amdvlk +++ /dev/null @@ -1,4 +0,0 @@ -_have vk_radv && complete -F _command vk_radv -_have vk_amdvlk && complete -F _command vk_amdvlk -_have vk_pro && complete -F _command vk_pro -_have vk_legacy && complete -F _command vk_legacy diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_legacy b/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_legacy deleted file mode 100644 index 545981b..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_legacy +++ /dev/null @@ -1,4 +0,0 @@ -_have vk_radv && complete -F _command vk_radv -_have vk_amdvlk && complete -F _command vk_amdvlk -_have vk_pro && complete -F _command vk_pro -_have vk_legacy && complete -F _command vk_legacy diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_pro b/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_pro deleted file mode 100644 index 545981b..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_pro +++ /dev/null @@ -1,4 +0,0 @@ -_have vk_radv && complete -F _command vk_radv -_have vk_amdvlk && complete -F _command vk_amdvlk -_have vk_pro && complete -F _command vk_pro -_have vk_legacy && complete -F _command vk_legacy diff --git a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_radv b/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_radv deleted file mode 100644 index 545981b..0000000 --- a/pika-amdgpu-switcher/usr/share/bash-completion/completions/vk_radv +++ /dev/null @@ -1,4 +0,0 @@ -_have vk_radv && complete -F _command vk_radv -_have vk_amdvlk && complete -F _command vk_amdvlk -_have vk_pro && complete -F _command vk_pro -_have vk_legacy && complete -F _command vk_legacy