summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCabopust2021-01-22 21:41:52 +0300
committerCabopust2021-01-22 21:41:52 +0300
commitddaa4b9a7827d0bc470bc99b178c0a5aa71ca998 (patch)
treea3d3841114ef16b0f6b224e8b90e62232f44e34c
downloadaur-ddaa4b9a7827d0bc470bc99b178c0a5aa71ca998.tar.gz
Initial push
-rw-r--r--.SRCINFO36
-rw-r--r--.gitignore11
-rw-r--r--NVreg.patch34
-rw-r--r--PKGBUILD97
-rw-r--r--linux-rt.patch42
-rw-r--r--multithreaded-optimizations-opengl6
-rw-r--r--nvidia-dkms-conf.patch26
-rw-r--r--nvidia-drm-modeset.patch27
-rw-r--r--nvidia-settings-performance.desktop6
-rw-r--r--nvidia.hook13
10 files changed, 298 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..570ebb0b036a
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,36 @@
+pkgbase = nvidia-dkms-performance
+ pkgdesc = NVIDIA driver sources for linux with some optimizations
+ pkgver = 460.32.03
+ pkgrel = 1
+ url = https://www.nvidia.com/
+ arch = x86_64
+ license = custom
+ provides = nvidia=460.32.03
+ provides = nvidia-dkms=460.32.03
+ provides = nvidia-performance=460.32.03
+ provides = NVIDIA-MODULE
+ conflicts = nvidia
+ conflicts = nvidia-dkms
+ source = https://us.download.nvidia.com/XFree86/Linux-x86_64/460.32.03/NVIDIA-Linux-x86_64-460.32.03-no-compat32.run
+ source = nvidia.hook
+ source = multithreaded-optimizations-opengl
+ source = nvidia-settings-performance.desktop
+ source = nvidia-dkms-conf.patch
+ source = linux-rt.patch
+ source = nvidia-drm-modeset.patch
+ source = NVreg.patch
+ sha256sums = 45aa9d75e8d463d87dcf7ea78a1ea046b9ddc2e159dfab6e861cbf833e6b14cf
+ sha256sums = 717920f48b4d7ec50b83d2d096bab36449b30f1b5d144f0fe586627025367293
+ sha256sums = 1237c8270cd4e3ae64f83642fe49f230190c247e5bd0ec0783183fc51c015382
+ sha256sums = 28635a9b0808beebff7e7905ee3e664d895fe23e149d462397c0b429c6f7d091
+ sha256sums = c84a4158083600191da80c22da146505f89d03374b3e0a5f71f8f2df6ad88004
+ sha256sums = f1da48d4e1aa2854f33d181ea56357cf0a88788a051d4b65afab14cdbbebedfa
+ sha256sums = a9465149c336c8f0bded15a4d473f16156d6da3a9fe4965ebe8a9afba5519c9f
+ sha256sums = d24e341f9a0e38f03f4e425e5f59e407604463fc3daee36009ecbd0fefa8b801
+
+pkgname = nvidia-dkms-performance
+ depends = dkms
+ depends = nvidia-utils>=460.32.03
+ depends = nvidia-settings
+ depends = libglvnd
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..80799818d927
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+.*
+!.gitignore
+!.SRCINFO
+*~
+*.run
+*.pkg
+*.bak
+*.tar.gz
+*.tar.zst
+src/
+pkg/ \ No newline at end of file
diff --git a/NVreg.patch b/NVreg.patch
new file mode 100644
index 000000000000..501234d7a220
--- /dev/null
+++ b/NVreg.patch
@@ -0,0 +1,34 @@
+From da764206cd1f94225820c4508ac39dc3d851e1ce Mon Sep 17 00:00:00 2001
+From: Cabopust <cabopust@yandex.ru>
+Date: Sun, 10 Jan 2021 11:23:29 +0300
+Subject: [PATCH] NVreg
+
+---
+ kernel/nvidia/nv-reg.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/nvidia/nv-reg.h b/kernel/nvidia/nv-reg.h
+index 156ce69..db1cd89 100644
+--- a/kernel/nvidia/nv-reg.h
++++ b/kernel/nvidia/nv-reg.h
+@@ -719,13 +719,13 @@ NV_DEFINE_REG_ENTRY_GLOBAL(__NV_MODIFY_DEVICE_FILES, 1);
+ NV_DEFINE_REG_ENTRY(__NV_DEVICE_FILE_UID, 0);
+ NV_DEFINE_REG_ENTRY(__NV_DEVICE_FILE_GID, 0);
+ NV_DEFINE_REG_ENTRY(__NV_DEVICE_FILE_MODE, 0666);
+-NV_DEFINE_REG_ENTRY(__NV_INITIALIZE_SYSTEM_MEMORY_ALLOCATIONS, 1);
+-NV_DEFINE_REG_ENTRY(__NV_USE_PAGE_ATTRIBUTE_TABLE, ~0);
++NV_DEFINE_REG_ENTRY(__NV_INITIALIZE_SYSTEM_MEMORY_ALLOCATIONS, 0);
++NV_DEFINE_REG_ENTRY(__NV_USE_PAGE_ATTRIBUTE_TABLE, 1);
+ NV_DEFINE_REG_ENTRY(__NV_REGISTER_FOR_ACPI_EVENTS, 1);
+-NV_DEFINE_REG_ENTRY(__NV_ENABLE_PCIE_GEN3, 0);
++NV_DEFINE_REG_ENTRY(__NV_ENABLE_PCIE_GEN3, 1);
+ NV_DEFINE_REG_ENTRY(__NV_ENABLE_MSI, 1);
+ NV_DEFINE_REG_ENTRY(__NV_TCE_BYPASS_MODE, NV_TCE_BYPASS_MODE_DEFAULT);
+-NV_DEFINE_REG_ENTRY(__NV_ENABLE_STREAM_MEMOPS, 0);
++NV_DEFINE_REG_ENTRY(__NV_ENABLE_STREAM_MEMOPS, 1);
+ NV_DEFINE_REG_ENTRY(__NV_ENABLE_BACKLIGHT_HANDLER, 1);
+ NV_DEFINE_REG_ENTRY(__NV_RM_PROFILING_ADMIN_ONLY_PARAMETER, 1);
+ NV_DEFINE_REG_ENTRY(__NV_PRESERVE_VIDEO_MEMORY_ALLOCATIONS, 0);
+--
+2.30.0
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..077e5eed1dec
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,97 @@
+# Maintainer: Vasiliy Stelmachenok <cabopust@yandex.ru>
+# Contributor: Pavel Priluckiy <gerallitluis2@gmail.com>
+
+# Sets the "Prefer Maximum Performance" mode in the NVIDIA Settings at system startup.
+_pref_maximum_performance=
+
+pkgname=nvidia-dkms-performance
+pkgver=460.32.03
+pkgrel=1
+pkgdesc='NVIDIA driver sources for linux with some optimizations'
+arch=('x86_64')
+url='https://www.nvidia.com/'
+license=('custom')
+provides=("nvidia=${pkgver}" "nvidia-dkms=${pkgver}"
+ "nvidia-performance=${pkgver}" 'NVIDIA-MODULE')
+conflicts=('nvidia' 'nvidia-dkms')
+_pkg="NVIDIA-Linux-${CARCH}-${pkgver}-no-compat32"
+source=("https://us.download.nvidia.com/XFree86/Linux-${CARCH}/${pkgver}/${_pkg}.run"
+ 'nvidia.hook'
+ 'multithreaded-optimizations-opengl'
+ 'nvidia-settings-performance.desktop'
+ 'nvidia-dkms-conf.patch'
+ 'linux-rt.patch'
+ 'nvidia-drm-modeset.patch'
+ 'NVreg.patch')
+sha256sums=('45aa9d75e8d463d87dcf7ea78a1ea046b9ddc2e159dfab6e861cbf833e6b14cf'
+ '717920f48b4d7ec50b83d2d096bab36449b30f1b5d144f0fe586627025367293'
+ '1237c8270cd4e3ae64f83642fe49f230190c247e5bd0ec0783183fc51c015382'
+ '28635a9b0808beebff7e7905ee3e664d895fe23e149d462397c0b429c6f7d091'
+ 'c84a4158083600191da80c22da146505f89d03374b3e0a5f71f8f2df6ad88004'
+ 'f1da48d4e1aa2854f33d181ea56357cf0a88788a051d4b65afab14cdbbebedfa'
+ 'a9465149c336c8f0bded15a4d473f16156d6da3a9fe4965ebe8a9afba5519c9f'
+ 'd24e341f9a0e38f03f4e425e5f59e407604463fc3daee36009ecbd0fefa8b801')
+
+prepare() {
+ [ -d "$_pkg" ] && rm -rf "$_pkg"
+
+ sh "${_pkg}.run" --extract-only
+ cd "${_pkg}"
+
+ patch -Np1 -i "${srcdir}/nvidia-dkms-conf.patch"
+ # Fixing compatibility with the RT (Real-Time) kernel
+ patch -Np1 -i "${srcdir}/linux-rt.patch"
+ # This patch edits the default values of the NVIDIA kernel module parameters,
+ # and makes the following changes:
+ #
+ # NVreg_UsePageAttributeTable=1 (Default 0) - Activating the better memory management method (PAT).
+ # The PAT method creates a partition type table at a specific address mapped inside the register
+ # and utilizes the memory architecture and instruction set more efficiently and faster.
+ # If your system can support this feature, it should improve CPU performance.
+ #
+ # NVreg_EnablePCIeGen3=1 (Default 0) - Enable PCIe Gen 3.x support.
+ # If the system supports this 8GT high speed bus then enable it with this module option flag.
+ # By default the Nvidia driver is set to use PCIe Gen 2.x for compatibility reasons.
+ #
+ # NVreg_InitializeSystemMemoryAllocations=0 (Default 1) - Disables clearing system memory allocation
+ # before using it for the GPU. Potentially improves performance, but at the cost of increased security risks.
+ # Write "options nvidia NVreg_InitializeSystemMemoryAllocations=1" in /etc/modprobe.d/nvidia.conf,
+ # if you want to return the default value.
+ #
+ # NVreg_EnableStreamMemOPs=1 (Default 0) - Activates the support for CUDA Stream Memory Operations in user-mode applications.
+ # Note: May be disabled in future versions.
+ #
+ # If you want to learn more about the NVIDIA driver module parameters,
+ # you can go to the Gentoo Wiki or view the source code of the nv-reg.h file.
+ patch -Np1 -i "${srcdir}/NVreg.patch"
+ # Enable nvidia-drm.modeset=1 (DRM KMS) by default.
+ # This is necessary for NVIDIA PRIME to work correctly.
+ # Note: May cause problems with scaling in console mode.
+ patch -Np1 -i "${srcdir}/nvidia-drm-modeset.patch"
+}
+
+package() {
+ depends=('dkms' "nvidia-utils>=${pkgver}" 'nvidia-settings' 'libglvnd')
+
+ # Nvidia hook for update initramfs after an NVIDIA driver upgrade
+ install -D -m644 "${srcdir}/nvidia.hook" -t "${pkgdir}/usr/share/libalpm/hooks"
+
+ mkdir -p "${pkgdir}/usr/src"
+ cp -dr --no-preserve='ownership' "${_pkg}/kernel" "${pkgdir}/usr/src/nvidia-${pkgver}"
+
+ # Block Nouveau
+ install -D -m644 <(printf '%s\n%s\n' 'blacklist nouveau' 'options nouveau modeset=0') \
+ "${pkgdir}/usr/lib/modprobe.d/nvidia.conf"
+
+ # Enable multi-threaded OpenGL optimizations (env __GL_THREADED_OPTIMIZATIONS=1) by default for all applications.
+ # Note: If you encounter an application that is incompatible with these optimizations,
+ # please use the __GL_THREADED_OPTIMIZATIONS=0 environment variable.
+ install -D -m644 "${srcdir}/multithreaded-optimizations-opengl" -t "${pkgdir}/etc/nvidia/nvidia-application-profiles-rc.d"
+
+ if [ -n "$_pref_maximum_performance" ]; then
+ install -D -m644 "${srcdir}/nvidia-settings-performance.desktop" -t "${pkgdir}/etc/xdg/autostart"
+ fi
+
+ # license
+ install -D -m644 "${_pkg}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
+} \ No newline at end of file
diff --git a/linux-rt.patch b/linux-rt.patch
new file mode 100644
index 000000000000..e4e49c8aae8b
--- /dev/null
+++ b/linux-rt.patch
@@ -0,0 +1,42 @@
+From b274027917faa9cbb30283dec98980ed99f72d9c Mon Sep 17 00:00:00 2001
+From: Cabopust <cabopust@yandex.ru>
+Date: Wed, 13 Jan 2021 13:13:30 +0300
+Subject: [PATCH] Fixing compatibility with the RT kernel
+
+---
+ kernel/conftest.sh | 4 ++--
+ kernel/dkms.conf | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index 619c2cc..cba73f3 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -4526,9 +4526,9 @@ case "$5" in
+ fi
+
+ if test_configuration_option CONFIG_PREEMPT_RT; then
+- PREEMPT_RT_PRESENT=1
++ PREEMPT_RT_PRESENT=0
+ elif test_configuration_option CONFIG_PREEMPT_RT_FULL; then
+- PREEMPT_RT_PRESENT=1
++ PREEMPT_RT_PRESENT=0
+ fi
+
+ if [ "$PREEMPT_RT_PRESENT" != "0" ]; then
+diff --git a/kernel/dkms.conf b/kernel/dkms.conf
+index 427856e..f995848 100644
+--- a/kernel/dkms.conf
++++ b/kernel/dkms.conf
+@@ -6,7 +6,7 @@ AUTOINSTALL="yes"
+ # this will cause the kernel module build to infer that it was invoked via
+ # Kbuild directly instead of DKMS. The dkms(8) manual page recommends quoting
+ # the 'make' command name to suppress this behavior.
+-MAKE[0]="'make' -j`nproc` NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules"
++MAKE[0]="'make' -j`nproc` IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules"
+
+ # The list of kernel modules will be generated by nvidia-installer at runtime.
+ BUILT_MODULE_NAME[0]="nvidia"
+--
+2.30.0
+
diff --git a/multithreaded-optimizations-opengl b/multithreaded-optimizations-opengl
new file mode 100644
index 000000000000..0abc954951e5
--- /dev/null
+++ b/multithreaded-optimizations-opengl
@@ -0,0 +1,6 @@
+{
+ "rules" : [
+ { "pattern" : [],
+ "profile" : [ "GLThreadedOptimizations", true ] }
+ ]
+} \ No newline at end of file
diff --git a/nvidia-dkms-conf.patch b/nvidia-dkms-conf.patch
new file mode 100644
index 000000000000..2a16683f02f1
--- /dev/null
+++ b/nvidia-dkms-conf.patch
@@ -0,0 +1,26 @@
+--- a/kernel/dkms.conf
++++ b/kernel/dkms.conf
+@@ -1,12 +1,20 @@
+ PACKAGE_NAME="nvidia"
+-PACKAGE_VERSION="__VERSION_STRING"
++PACKAGE_VERSION="460.32.03"
+ AUTOINSTALL="yes"
+
+ # By default, DKMS will add KERNELRELEASE to the make command line; however,
+ # this will cause the kernel module build to infer that it was invoked via
+ # Kbuild directly instead of DKMS. The dkms(8) manual page recommends quoting
+ # the 'make' command name to suppress this behavior.
+-MAKE[0]="'make' -j__JOBS NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules"
++MAKE[0]="'make' -j`nproc` NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules"
+
+ # The list of kernel modules will be generated by nvidia-installer at runtime.
+-__DKMS_MODULES
++BUILT_MODULE_NAME[0]="nvidia"
++DEST_MODULE_LOCATION[0]="/kernel/drivers/video"
++BUILT_MODULE_NAME[1]="nvidia-uvm"
++DEST_MODULE_LOCATION[1]="/kernel/drivers/video"
++BUILT_MODULE_NAME[2]="nvidia-modeset"
++DEST_MODULE_LOCATION[2]="/kernel/drivers/video"
++BUILT_MODULE_NAME[3]="nvidia-drm"
++DEST_MODULE_LOCATION[3]="/kernel/drivers/video"
++
diff --git a/nvidia-drm-modeset.patch b/nvidia-drm-modeset.patch
new file mode 100644
index 000000000000..800ed1324dfe
--- /dev/null
+++ b/nvidia-drm-modeset.patch
@@ -0,0 +1,27 @@
+From c210b73e6c66054b34a5c5d87216504149cc94d9 Mon Sep 17 00:00:00 2001
+From: Cabopust <cabopust@yandex.ru>
+Date: Wed, 6 Jan 2021 21:55:05 +0300
+Subject: [PATCH] nvidia-drm.modeset=1 by default
+
+---
+ kernel/nvidia-drm/nvidia-drm-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-linux.c b/kernel/nvidia-drm/nvidia-drm-linux.c
+index f8fcde4..9b19ffb 100644
+--- a/kernel/nvidia-drm/nvidia-drm-linux.c
++++ b/kernel/nvidia-drm/nvidia-drm-linux.c
+@@ -41,8 +41,8 @@
+
+ MODULE_PARM_DESC(
+ modeset,
+- "Enable atomic kernel modesetting (1 = enable, 0 = disable (default))");
+-bool nv_drm_modeset_module_param = false;
++ "Enable atomic kernel modesetting (1 = enable (default), 0 = disable)");
++bool nv_drm_modeset_module_param = true;
+ module_param_named(modeset, nv_drm_modeset_module_param, bool, 0400);
+
+ void *nv_drm_calloc(size_t nmemb, size_t size)
+--
+2.30.0
+
diff --git a/nvidia-settings-performance.desktop b/nvidia-settings-performance.desktop
new file mode 100644
index 000000000000..b286fbedfc1a
--- /dev/null
+++ b/nvidia-settings-performance.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=NVIDIA Settings Performance Profile
+Comment=Pref Maximum performance for your NVIDIA GPU
+Exec=/usr/bin/nvidia-settings -a [gpu:0]/GpuPowerMizerMode=1
+Terminal=false \ No newline at end of file
diff --git a/nvidia.hook b/nvidia.hook
new file mode 100644
index 000000000000..18af4ad535a6
--- /dev/null
+++ b/nvidia.hook
@@ -0,0 +1,13 @@
+[Trigger]
+Operation=Install
+Operation=Upgrade
+Operation=Remove
+Type=Package
+Target=nvidia-dkms-performance
+
+[Action]
+Description=Update Nvidia module in initcpio
+Depends=mkinitcpio
+When=PostTransaction
+NeedsTargets
+Exec=/usr/bin/mkinitcpio -P \ No newline at end of file