2016-07-15 09:31:30 +00:00
#!/bin/bash
2019-03-09 21:06:11 +00:00
# halt on any error for safety and proper pipe handling
set -euo pipefail ; # <- this semicolon and comment make options apply
# even when script is corrupt by CRLF line terminators (issue #75)
# empty line must follow this comment for immediate fail with CRLF newlines
2019-01-04 22:36:48 +00:00
2018-06-20 10:29:59 +00:00
backup_path = "/opt/nvidia/libnvidia-encode-backup"
silent_flag = ''
2020-11-01 22:50:29 +00:00
manual_driver_version = ''
2018-06-20 10:29:59 +00:00
print_usage( ) { printf '
SYNOPSIS
2019-09-27 19:27:37 +00:00
patch.sh [ -s] [ -r| -h| -c VERSION| -l]
2018-06-20 10:29:59 +00:00
DESCRIPTION
2019-09-27 17:00:31 +00:00
The patch for Nvidia drivers to remove NVENC session limit
2018-06-20 10:29:59 +00:00
2019-09-27 17:00:31 +00:00
-s Silent mode ( No output)
-r Rollback to original ( Restore lib from backup)
-h Print this help message
-c VERSION Check if version VERSION supported by this patch.
Returns true exit code ( 0) if version is supported.
2019-09-27 19:27:37 +00:00
-l List supported driver versions
2020-11-01 22:50:29 +00:00
-d VERSION Use VERSION driver version when looking for libraries
instead of using nvidia-smi to detect it.
2018-06-20 10:29:59 +00:00
'
}
2019-09-27 16:28:42 +00:00
# shellcheck disable=SC2209
opmode = "patch"
2020-11-01 22:50:29 +00:00
while getopts 'rshc:ld:' flag; do
2019-09-27 20:57:55 +00:00
case " ${ flag } " in
r) opmode = " ${ opmode } rollback " ; ;
s) silent_flag = 'true' ; ;
h) opmode = " ${ opmode } help " ; ;
c) opmode = " ${ opmode } checkversion " ; checked_version = " $OPTARG " ; ;
l) opmode = " ${ opmode } listversions " ; ;
2020-11-01 22:50:29 +00:00
d) manual_driver_version = " $OPTARG " ; ;
2019-09-27 20:57:55 +00:00
*) echo "Incorrect option specified in command line" ; exit 2 ; ;
esac
2018-06-20 10:29:59 +00:00
done
if [ [ $silent_flag ] ] ; then
exec 1> /dev/null
2016-07-15 09:31:30 +00:00
fi
2018-06-20 10:29:59 +00:00
declare -A patch_list = (
[ "375.39" ] = 's/\x85\xC0\x89\xC5\x75\x18/\x29\xC0\x89\xC5\x90\x90/g'
2019-01-19 17:35:33 +00:00
[ "390.77" ] = 's/\x85\xC0\x89\xC5\x75\x18/\x29\xC0\x89\xC5\x90\x90/g'
2018-12-25 21:27:27 +00:00
[ "390.87" ] = 's/\x85\xC0\x89\xC5\x75\x18/\x29\xC0\x89\xC5\x90\x90/g'
2018-06-20 10:29:59 +00:00
[ "396.24" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2018-07-04 22:26:38 +00:00
[ "396.26" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2018-09-06 22:38:55 +00:00
[ "396.37" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g' #added info from https://github.com/keylase/nvidia-patch/issues/6#issuecomment-406895356
2018-06-20 10:29:59 +00:00
# break nvenc.c:236,layout asm,step-mode,step,break *0x00007fff89f9ba45
# libnvidia-encode.so @ 0x15a45; test->sub, jne->nop-nop-nop-nop-nop-nop
2018-09-14 22:01:44 +00:00
[ "396.54" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2018-10-18 11:01:20 +00:00
[ "410.48" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2018-11-24 17:55:03 +00:00
[ "410.57" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
[ "410.73" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
[ "410.78" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2018-12-30 19:03:14 +00:00
[ "410.79" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2019-02-04 09:35:54 +00:00
[ "410.93" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2019-02-22 16:48:58 +00:00
[ "410.104" ] = 's/\x85\xC0\x89\xC5\x0F\x85\x96\x00\x00\x00/\x29\xC0\x89\xC5\x90\x90\x90\x90\x90\x90/g'
2019-01-04 19:59:11 +00:00
[ "415.18" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
[ "415.25" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-01-19 14:07:11 +00:00
[ "415.27" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-02-05 16:22:48 +00:00
[ "418.30" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-02-22 15:32:43 +00:00
[ "418.43" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-03-20 19:37:42 +00:00
[ "418.56" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-05-15 21:58:40 +00:00
[ "418.67" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x40\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-05-07 13:31:11 +00:00
[ "418.74" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-08-15 00:14:56 +00:00
[ "418.87.00" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-10-12 04:13:28 +00:00
[ "418.87.01" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-10-07 15:55:17 +00:00
[ "418.88" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2020-04-29 13:57:37 +00:00
[ "418.113" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-05-07 12:56:50 +00:00
[ "430.09" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-05-14 13:37:56 +00:00
[ "430.14" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-06-10 15:48:45 +00:00
[ "430.26" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-07-09 13:22:35 +00:00
[ "430.34" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-07-29 14:45:28 +00:00
[ "430.40" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-09-20 21:22:54 +00:00
[ "430.50" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-12-23 06:33:48 +00:00
[ "430.64" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-08-13 21:27:26 +00:00
[ "435.17" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-08-29 15:21:54 +00:00
[ "435.21" ] = 's/\x00\x00\x00\x84\xc0\x0f\x84\x0f\xfd\xff\xff/\x00\x00\x00\x84\xc0\x90\x90\x90\x90\x90\x90/g'
2019-12-01 16:32:34 +00:00
[ "435.27.08" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2019-12-03 14:13:39 +00:00
[ "440.26" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
[ "440.31" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
[ "440.33.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2019-11-23 09:46:42 +00:00
[ "440.36" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2019-12-15 09:24:48 +00:00
[ "440.43.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2019-12-11 21:02:25 +00:00
[ "440.44" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-01-17 20:18:03 +00:00
[ "440.48.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-02-16 09:13:30 +00:00
[ "440.58.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-02-20 07:03:36 +00:00
[ "440.58.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-02-03 15:59:09 +00:00
[ "440.59" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-02-28 15:13:00 +00:00
[ "440.64" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-03-10 16:02:02 +00:00
[ "440.64.00" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-03-18 13:10:17 +00:00
[ "440.66.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-03-19 12:33:37 +00:00
[ "440.66.03" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-03-24 18:48:59 +00:00
[ "440.66.04" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-04-03 19:37:37 +00:00
[ "440.66.08" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-04-18 15:51:02 +00:00
[ "440.66.09" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-04-24 16:20:29 +00:00
[ "440.66.11" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-05-04 19:52:41 +00:00
[ "440.66.12" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-05-11 16:22:23 +00:00
[ "440.66.14" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-05-26 20:50:58 +00:00
[ "440.66.15" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-06-23 18:12:47 +00:00
[ "440.66.17" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-04-07 13:56:13 +00:00
[ "440.82" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-06-26 13:30:46 +00:00
[ "440.95.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
[ "440.100" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-28 17:31:22 +00:00
[ "440.118.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-06-06 09:06:54 +00:00
[ "450.36.06" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-06-24 17:33:38 +00:00
[ "450.51" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-07-07 22:33:02 +00:00
[ "450.51.05" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-07-25 10:00:58 +00:00
[ "450.51.06" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-07-16 15:03:50 +00:00
[ "450.56.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-07-20 18:01:58 +00:00
[ "450.56.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-08-07 19:11:08 +00:00
[ "450.56.06" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-08-17 15:51:54 +00:00
[ "450.56.11" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-07-09 13:32:25 +00:00
[ "450.57" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-09-22 05:43:18 +00:00
[ "450.66" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-04 18:02:17 +00:00
[ "450.80.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-04 18:24:26 +00:00
[ "455.22.04" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-09-22 05:43:18 +00:00
[ "455.23.04" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-09-23 20:13:03 +00:00
[ "455.23.05" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-10 12:34:58 +00:00
[ "455.26.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-20 20:52:02 +00:00
[ "455.26.02" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-08 19:50:12 +00:00
[ "455.28" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-29 20:55:59 +00:00
[ "455.32.00" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-10-29 20:23:38 +00:00
[ "455.38" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-11-17 18:42:05 +00:00
[ "455.45.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2020-11-17 19:15:28 +00:00
[ "455.46.01" ] = 's/\x85\xc0\x41\x89\xc4\x75\x1f/\x31\xc0\x41\x89\xc4\x75\x1f/g'
2019-01-04 19:59:11 +00:00
)
declare -A object_list = (
[ "375.39" ] = 'libnvidia-encode.so'
2019-01-19 17:35:33 +00:00
[ "390.77" ] = 'libnvidia-encode.so'
2019-01-04 19:59:11 +00:00
[ "390.87" ] = 'libnvidia-encode.so'
[ "396.24" ] = 'libnvidia-encode.so'
[ "396.26" ] = 'libnvidia-encode.so'
[ "396.37" ] = 'libnvidia-encode.so'
[ "396.54" ] = 'libnvidia-encode.so'
[ "410.48" ] = 'libnvidia-encode.so'
[ "410.57" ] = 'libnvidia-encode.so'
[ "410.73" ] = 'libnvidia-encode.so'
[ "410.78" ] = 'libnvidia-encode.so'
[ "410.79" ] = 'libnvidia-encode.so'
2019-02-04 09:35:54 +00:00
[ "410.93" ] = 'libnvidia-encode.so'
2019-02-22 16:48:58 +00:00
[ "410.104" ] = 'libnvidia-encode.so'
2019-01-04 19:59:11 +00:00
[ "415.18" ] = 'libnvcuvid.so'
[ "415.25" ] = 'libnvcuvid.so'
2019-01-19 14:07:11 +00:00
[ "415.27" ] = 'libnvcuvid.so'
2019-02-05 16:22:48 +00:00
[ "418.30" ] = 'libnvcuvid.so'
2019-02-22 15:32:43 +00:00
[ "418.43" ] = 'libnvcuvid.so'
2019-03-20 19:37:42 +00:00
[ "418.56" ] = 'libnvcuvid.so'
2019-05-15 21:58:40 +00:00
[ "418.67" ] = 'libnvcuvid.so'
2019-05-07 13:31:11 +00:00
[ "418.74" ] = 'libnvcuvid.so'
2019-08-15 00:14:56 +00:00
[ "418.87.00" ] = 'libnvcuvid.so'
2019-10-12 04:13:28 +00:00
[ "418.87.01" ] = 'libnvcuvid.so'
2019-10-07 15:55:17 +00:00
[ "418.88" ] = 'libnvcuvid.so'
2020-04-29 13:57:37 +00:00
[ "418.113" ] = 'libnvcuvid.so'
2019-04-23 15:15:33 +00:00
[ "430.09" ] = 'libnvcuvid.so'
2019-05-14 13:37:56 +00:00
[ "430.14" ] = 'libnvcuvid.so'
2019-06-10 15:48:45 +00:00
[ "430.26" ] = 'libnvcuvid.so'
2019-07-09 13:22:35 +00:00
[ "430.34" ] = 'libnvcuvid.so'
2019-07-29 14:45:28 +00:00
[ "430.40" ] = 'libnvcuvid.so'
2019-09-20 21:22:54 +00:00
[ "430.50" ] = 'libnvcuvid.so'
2019-12-23 06:33:48 +00:00
[ "430.64" ] = 'libnvcuvid.so'
2019-08-13 21:27:26 +00:00
[ "435.17" ] = 'libnvcuvid.so'
2019-08-29 15:21:54 +00:00
[ "435.21" ] = 'libnvcuvid.so'
2019-12-01 16:32:34 +00:00
[ "435.27.08" ] = 'libnvidia-encode.so'
2019-12-03 14:13:39 +00:00
[ "440.26" ] = 'libnvidia-encode.so'
[ "440.31" ] = 'libnvidia-encode.so'
[ "440.33.01" ] = 'libnvidia-encode.so'
2019-11-23 09:46:42 +00:00
[ "440.36" ] = 'libnvidia-encode.so'
2019-12-15 09:24:48 +00:00
[ "440.43.01" ] = 'libnvidia-encode.so'
2019-12-11 21:02:25 +00:00
[ "440.44" ] = 'libnvidia-encode.so'
2020-01-17 20:18:03 +00:00
[ "440.48.02" ] = 'libnvidia-encode.so'
2020-02-16 09:13:30 +00:00
[ "440.58.01" ] = 'libnvidia-encode.so'
2020-02-20 07:03:36 +00:00
[ "440.58.02" ] = 'libnvidia-encode.so'
2020-02-03 15:59:09 +00:00
[ "440.59" ] = 'libnvidia-encode.so'
2020-02-28 15:13:00 +00:00
[ "440.64" ] = 'libnvidia-encode.so'
2020-03-10 16:02:02 +00:00
[ "440.64.00" ] = 'libnvidia-encode.so'
2020-03-18 13:10:17 +00:00
[ "440.66.02" ] = 'libnvidia-encode.so'
2020-03-19 12:33:37 +00:00
[ "440.66.03" ] = 'libnvidia-encode.so'
2020-03-24 18:48:59 +00:00
[ "440.66.04" ] = 'libnvidia-encode.so'
2020-04-03 19:37:37 +00:00
[ "440.66.08" ] = 'libnvidia-encode.so'
2020-04-18 15:51:02 +00:00
[ "440.66.09" ] = 'libnvidia-encode.so'
2020-04-24 16:20:29 +00:00
[ "440.66.11" ] = 'libnvidia-encode.so'
2020-05-04 19:52:41 +00:00
[ "440.66.12" ] = 'libnvidia-encode.so'
2020-05-11 16:22:23 +00:00
[ "440.66.14" ] = 'libnvidia-encode.so'
2020-05-26 20:50:58 +00:00
[ "440.66.15" ] = 'libnvidia-encode.so'
2020-06-23 18:12:47 +00:00
[ "440.66.17" ] = 'libnvidia-encode.so'
2020-04-07 13:56:13 +00:00
[ "440.82" ] = 'libnvidia-encode.so'
2020-06-26 13:30:46 +00:00
[ "440.95.01" ] = 'libnvidia-encode.so'
[ "440.100" ] = 'libnvidia-encode.so'
2020-10-28 17:31:22 +00:00
[ "440.118.02" ] = 'libnvidia-encode.so'
2020-06-06 09:06:54 +00:00
[ "450.36.06" ] = 'libnvidia-encode.so'
2020-06-24 17:33:38 +00:00
[ "450.51" ] = 'libnvidia-encode.so'
2020-07-07 22:33:02 +00:00
[ "450.51.05" ] = 'libnvidia-encode.so'
2020-07-25 10:00:58 +00:00
[ "450.51.06" ] = 'libnvidia-encode.so'
2020-07-16 15:03:50 +00:00
[ "450.56.01" ] = 'libnvidia-encode.so'
2020-07-20 18:01:58 +00:00
[ "450.56.02" ] = 'libnvidia-encode.so'
2020-08-07 19:11:08 +00:00
[ "450.56.06" ] = 'libnvidia-encode.so'
2020-08-17 15:51:54 +00:00
[ "450.56.11" ] = 'libnvidia-encode.so'
2020-07-09 13:32:25 +00:00
[ "450.57" ] = 'libnvidia-encode.so'
2020-09-22 05:43:18 +00:00
[ "450.66" ] = 'libnvidia-encode.so'
2020-10-04 18:02:17 +00:00
[ "450.80.02" ] = 'libnvidia-encode.so'
2020-10-04 18:24:26 +00:00
[ "455.22.04" ] = 'libnvidia-encode.so'
2020-09-22 05:43:18 +00:00
[ "455.23.04" ] = 'libnvidia-encode.so'
2020-09-23 20:13:03 +00:00
[ "455.23.05" ] = 'libnvidia-encode.so'
2020-10-10 12:34:58 +00:00
[ "455.26.01" ] = 'libnvidia-encode.so'
2020-10-20 20:52:02 +00:00
[ "455.26.02" ] = 'libnvidia-encode.so'
2020-10-08 19:50:12 +00:00
[ "455.28" ] = 'libnvidia-encode.so'
2020-10-29 20:55:59 +00:00
[ "455.32.00" ] = 'libnvidia-encode.so'
2020-10-29 20:23:38 +00:00
[ "455.38" ] = 'libnvidia-encode.so'
2020-11-17 18:42:05 +00:00
[ "455.45.01" ] = 'libnvidia-encode.so'
2020-11-17 19:15:28 +00:00
[ "455.46.01" ] = 'libnvidia-encode.so'
2018-06-20 10:29:59 +00:00
)
2019-09-27 17:00:31 +00:00
check_version_supported ( ) {
local ver = " $1 "
[ [ " ${ patch_list [ $ver ]+isset } " && " ${ object_list [ $ver ]+isset } " ] ]
}
2019-09-27 19:27:37 +00:00
get_supported_versions ( ) {
for drv in " ${ !patch_list[@] } " ; do
[ [ " ${ object_list [ $drv ]+isset } " ] ] && echo " $drv "
done | sort -t. -n
return 0
}
2019-09-27 16:28:42 +00:00
patch_common ( ) {
NVIDIA_SMI = " $( command -v nvidia-smi || true ) "
if [ [ ! " $NVIDIA_SMI " ] ] ; then
echo 'nvidia-smi utility not found. Probably driver is not installed.'
exit 1
fi
2019-01-04 22:36:48 +00:00
2020-11-01 22:50:29 +00:00
if [ [ " $manual_driver_version " ] ] ; then
driver_version = " $manual_driver_version "
2018-06-20 10:29:59 +00:00
2020-11-01 22:50:29 +00:00
echo " Using manually entered nvidia driver version: $driver_version "
else
cmd = " $NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits "
driver_versions_list = $( $cmd )
ret_code = $?
driver_version = $( echo " $driver_versions_list " | head -n 1)
if [ [ $ret_code -ne 0 ] ] ; then
echo "Can not detect nvidia driver version."
echo " CMD: \" $cmd \" "
echo " Result: \" $driver_versions_list \" "
echo " nvidia-smi retcode: $ret_code "
exit 1
fi
echo " Detected nvidia driver version: $driver_version "
fi
2018-06-20 10:29:59 +00:00
2019-09-27 17:00:31 +00:00
if ! check_version_supported " $driver_version " ; then
2019-09-27 19:27:37 +00:00
echo " Patch for this ( $driver_version ) nvidia driver not found. "
echo "Patch is available for versions: "
get_supported_versions
2019-09-27 16:28:42 +00:00
exit 1
fi
2019-01-04 22:36:48 +00:00
2019-09-27 16:28:42 +00:00
patch = " ${ patch_list [ $driver_version ] } "
object = " ${ object_list [ $driver_version ] } "
declare -a driver_locations = (
'/usr/lib/x86_64-linux-gnu'
'/usr/lib/x86_64-linux-gnu/nvidia/current/'
'/usr/lib64'
" /usr/lib/nvidia- ${ driver_version %%.* } "
)
dir_found = ''
for driver_dir in " ${ driver_locations [@] } " ; do
if [ [ -e " $driver_dir / $object . $driver_version " ] ] ; then
dir_found = 'true'
break
fi
done
2019-03-12 20:43:46 +00:00
2019-09-27 16:28:42 +00:00
[ [ " $dir_found " ] ] || { echo "ERROR: cannot detect driver directory" ; exit 1; }
2019-03-12 20:43:46 +00:00
2019-09-27 16:28:42 +00:00
}
2019-03-12 20:43:46 +00:00
2019-09-27 16:28:42 +00:00
rollback ( ) {
patch_common
2019-01-04 21:59:29 +00:00
if [ [ -f " $backup_path / $object . $driver_version " ] ] ; then
cp -p " $backup_path / $object . $driver_version " \
" $driver_dir / $object . $driver_version "
2019-01-04 19:59:11 +00:00
echo " Restore from backup $object . $driver_version "
2018-06-20 10:29:59 +00:00
else
echo "Backup not found. Try to patch first."
2019-09-27 16:28:42 +00:00
exit 1
2018-06-20 10:29:59 +00:00
fi
2019-09-27 16:28:42 +00:00
}
patch ( ) {
patch_common
2019-09-27 20:57:55 +00:00
if [ [ -f " $backup_path / $object . $driver_version " ] ] ; then
bkp_hash = " $( sha1sum " $backup_path / $object . $driver_version " | cut -f1 -d\ ) "
drv_hash = " $( sha1sum " $driver_dir / $object . $driver_version " | cut -f1 -d\ ) "
if [ [ " $bkp_hash " != " $drv_hash " ] ] ; then
echo "Backup exists and driver file differ from backup. Skipping patch."
return 0
fi
else
echo " Attention! Backup not found. Copying current $object to backup. "
2019-01-04 21:59:29 +00:00
mkdir -p " $backup_path "
cp -p " $driver_dir / $object . $driver_version " \
" $backup_path / $object . $driver_version "
2018-06-20 10:29:59 +00:00
fi
2019-01-04 21:59:29 +00:00
sha1sum " $backup_path / $object . $driver_version "
sed " $patch " " $backup_path / $object . $driver_version " > \
2019-07-10 23:44:17 +00:00
" ${ PATCH_OUTPUT_DIR - $driver_dir } / $object . $driver_version "
sha1sum " ${ PATCH_OUTPUT_DIR - $driver_dir } / $object . $driver_version "
2018-06-20 10:29:59 +00:00
ldconfig
echo "Patched!"
2019-09-27 16:28:42 +00:00
}
2019-09-27 17:00:31 +00:00
query_version_support ( ) {
if check_version_supported " $checked_version " ; then
echo "SUPPORTED"
exit 0
else
echo "NOT SUPPORTED"
exit 1
fi
}
2019-09-27 19:27:37 +00:00
list_supported_versions ( ) {
get_supported_versions
}
2019-09-27 16:28:42 +00:00
case " ${ opmode } " in
patch) patch ; ;
patchrollback) rollback ; ;
patchhelp) print_usage ; exit 2 ; ;
2019-09-27 17:00:31 +00:00
patchcheckversion) query_version_support ; ;
2019-09-27 19:27:37 +00:00
patchlistversions) list_supported_versions ; ;
*) echo "Incorrect combination of flags. Use option -h to get help."
exit 2 ; ;
2019-09-27 16:28:42 +00:00
esac