fix amdvlk taking over

This commit is contained in:
Ward Nakchbandi 2023-04-10 12:34:37 +03:00
parent 0f698065e3
commit 48b35b4479
33 changed files with 418 additions and 390 deletions

View File

@ -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 <hotrod.master@hotmail.com> 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 <hotrod.master@hotmail.com> 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 <hotrod.master@hotmail.com> 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 <hotrod.master@hotmail.com> 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 <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200

View File

@ -0,0 +1,17 @@
Source: pika-amdgpu-core
Section: metapackages
Priority: optional
Maintainer: Ward Nakchbandi <hotrod.master@hotmail.com>
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.

View File

@ -0,0 +1,8 @@
Files: *
Copyright: 2022 Ward Nakchbandi <hotrod.master@hotmail.com>
License: GPL-2
Files: debian/*
Copyright: 2022 Ward Nakchbandi <hotrod.master@hotmail.com>
License: GPL-2

View File

@ -0,0 +1,2 @@
etc
usr

View File

@ -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
#

View File

@ -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

View File

@ -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";};

View File

@ -0,0 +1,2 @@
DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1=1
ROC_ENABLE_PRE_VEGA=1

View File

@ -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

View File

@ -0,0 +1,5 @@
#! /bin/bash
sudo /usr/bin/amdgpu-lib-refresh
sudo update-initramfs -c -k all

View File

@ -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

View File

@ -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

View File

@ -1,6 +0,0 @@
all:
true
install:
install -d $(DESTDIR)/
cp -r usr $(DESTDIR)/

View File

@ -1,5 +0,0 @@
pika-amdgpu-switcher (1.0-99pika1) kinetic; urgency=low
* Initial Creation
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sun, 09 Oct 2022 18:34:00 +0300

View File

@ -1,17 +0,0 @@
Source: pika-amdgpu-switcher
Section: misc
Priority: optional
Maintainer: Ward Nakchbandi <hotrod.master@hotmail.com>
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.

View File

@ -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
"$@"

View File

@ -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:
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <vk_radv|vk_amdvlk|vk_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <vk_radv|vk_amdvlk|vk_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <vk_radv|vk_amdvlk|vk_pro> <app and its parameters>
# 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
"$@"

View File

@ -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:
# <vk_radv|vk_amdvlk|vk_pro> <app and its parameters>
# 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
"$@"

View File

@ -1 +0,0 @@
_have cl_pro && complete -F _command cl_pro

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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