Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
1029bfb2
Commit
1029bfb2
authored
Sep 27, 2019
by
Vladislav Yarmak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linux: patch.sh: new opmode - query for specific version support
parent
f25b0fd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
patch.sh
patch.sh
+26
-7
No files found.
patch.sh
View file @
1029bfb2
...
@@ -9,14 +9,16 @@ silent_flag=''
...
@@ -9,14 +9,16 @@ silent_flag=''
print_usage
()
{
printf
'
print_usage
()
{
printf
'
SYNOPSIS
SYNOPSIS
patch.sh [-s] [-r|-h]
patch.sh [-s] [-r|-h
|-c VERSION
]
DESCRIPTION
DESCRIPTION
The patch for Nvidia drivers to
increase encoder sessions
The patch for Nvidia drivers to
remove NVENC session limit
-s Silent mode (No output)
-s Silent mode (No output)
-r Rollback to original (Restore lib from backup)
-r Rollback to original (Restore lib from backup)
-h Print this help message
-h Print this help message
-c VERSION Check if version VERSION supported by this patch.
Returns true exit code (0) if version is supported.
'
'
}
}
...
@@ -24,11 +26,12 @@ DESCRIPTION
...
@@ -24,11 +26,12 @@ DESCRIPTION
# shellcheck disable=SC2209
# shellcheck disable=SC2209
opmode
=
"patch"
opmode
=
"patch"
while
getopts
'rsh'
flag
;
do
while
getopts
'rsh
c:
'
flag
;
do
case
"
${
flag
}
"
in
case
"
${
flag
}
"
in
r
)
opmode
=
"
${
opmode
}
rollback"
;;
r
)
opmode
=
"
${
opmode
}
rollback"
;;
s
)
silent_flag
=
'true'
;;
s
)
silent_flag
=
'true'
;;
h
)
opmode
=
"
${
opmode
}
help"
;;
h
)
opmode
=
"
${
opmode
}
help"
;;
c
)
opmode
=
"
${
opmode
}
checkversion"
;
checked_version
=
"
$OPTARG
"
;;
*
)
echo
"Incorrect option specified in command line"
;
exit
2
;;
*
)
echo
"Incorrect option specified in command line"
;
exit
2
;;
esac
esac
done
done
...
@@ -107,6 +110,11 @@ declare -A object_list=(
...
@@ -107,6 +110,11 @@ declare -A object_list=(
[
"435.21"
]=
'libnvcuvid.so'
[
"435.21"
]=
'libnvcuvid.so'
)
)
check_version_supported
()
{
local
ver
=
"
$1
"
[[
"
${
patch_list
[
$ver
]+isset
}
"
&&
"
${
object_list
[
$ver
]+isset
}
"
]]
}
patch_common
()
{
patch_common
()
{
NVIDIA_SMI
=
"
$(
command
-v
nvidia-smi
||
true
)
"
NVIDIA_SMI
=
"
$(
command
-v
nvidia-smi
||
true
)
"
if
[[
!
"
$NVIDIA_SMI
"
]]
;
then
if
[[
!
"
$NVIDIA_SMI
"
]]
;
then
...
@@ -121,7 +129,7 @@ patch_common () {
...
@@ -121,7 +129,7 @@ patch_common () {
echo
"Detected nvidia driver version:
$driver_version
"
echo
"Detected nvidia driver version:
$driver_version
"
if
[[
!
"
${
patch_list
[
$driver_version
]+isset
}
"
||
!
"
${
object_list
[
$driver_version
]+isset
}
"
]]
;
then
if
!
check_version_supported
"
$driver_version
"
;
then
echo
"Patch for this (
$driver_version
) nvidia driver not found."
1>&2
echo
"Patch for this (
$driver_version
) nvidia driver not found."
1>&2
echo
"Available patches for: "
1>&2
echo
"Available patches for: "
1>&2
for
drv
in
"
${
!patch_list[@]
}
"
;
do
for
drv
in
"
${
!patch_list[@]
}
"
;
do
...
@@ -180,9 +188,20 @@ patch () {
...
@@ -180,9 +188,20 @@ patch () {
echo
"Patched!"
echo
"Patched!"
}
}
query_version_support
()
{
if
check_version_supported
"
$checked_version
"
;
then
echo
"SUPPORTED"
exit
0
else
echo
"NOT SUPPORTED"
exit
1
fi
}
case
"
${
opmode
}
"
in
case
"
${
opmode
}
"
in
patch
)
patch
;;
patch
)
patch
;;
patchrollback
)
rollback
;;
patchrollback
)
rollback
;;
patchhelp
)
print_usage
;
exit
2
;;
patchhelp
)
print_usage
;
exit
2
;;
patchcheckversion
)
query_version_support
;;
*
)
echo
"Incorrect combination of flags"
;
exit
2
;;
*
)
echo
"Incorrect combination of flags"
;
exit
2
;;
esac
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment