mirror of
https://github.com/Frogging-Family/nvidia-all
synced 2024-10-30 15:20:10 +00:00
parent
07c11ffa15
commit
701c823e16
46
PKGBUILD
46
PKGBUILD
@ -379,6 +379,9 @@ source=($_source_name
|
||||
'legacy-kernel-6.6.diff'
|
||||
'6.1-6-7-8-gpl.diff'
|
||||
'kernel-6.8.patch'
|
||||
'make-modeset-fbdev-default.diff'
|
||||
'6.11-fbdev.diff'
|
||||
'nvidia-sleep.conf'
|
||||
)
|
||||
|
||||
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
|
||||
@ -432,7 +435,10 @@ md5sums=("$_md5sum"
|
||||
'b81cac7573842ebd7af30fdf851c63f9'
|
||||
'd11cb3bd76ab61a0f086aea9a0c53087'
|
||||
'f7f95287eb18be63bfad0427f13b6d43'
|
||||
'7481cb7f52b76c426d579b115e4c84b6')
|
||||
'7481cb7f52b76c426d579b115e4c84b6'
|
||||
'c06a9359969ba331bc9fac91fe0eeff2'
|
||||
'adfcf56ea4a4a420d9ef07b9d4b451dc'
|
||||
'2b5b62c1265b3b6b18022a0a716e5fcd')
|
||||
|
||||
if [ "$_open_source_modules" = "true" ]; then
|
||||
if [[ "$_srcbase" == "NVIDIA-kernel-module-source" ]]; then
|
||||
@ -899,6 +905,24 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
_whitelist68=(525*)
|
||||
fi
|
||||
|
||||
# 6.11
|
||||
if (( $(vercmp "$_kernel" "6.11") >= 0 )); then
|
||||
if [[ $pkgver = 560.* ]]; then
|
||||
cd "$srcdir"/"$_pkg"/kernel-$_kernel
|
||||
# Enable modeset and fbdev as default
|
||||
# This avoids various issue, when Simplefb is used
|
||||
# https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/issues/14
|
||||
# https://github.com/rpmfusion/nvidia-kmod/blob/master/make_modeset_default.patch
|
||||
msg2 "Applying make-modeset-fbdev-default.diff for $_kernel..."
|
||||
patch -Np2 -i "$srcdir"/make-modeset-fbdev-default.diff
|
||||
# Add fix for fbdev "phantom" monitor with 6.11
|
||||
# https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/80
|
||||
msg2 "Applying 6.11-fbdev.diff for $_kernel..."
|
||||
patch -Np2 -i "$srcdir"/6.11-fbdev.diff
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$_gcc14" = "true" ]; then
|
||||
cd "$srcdir"/"$_pkg"/kernel-$_kernel
|
||||
msg2 "Applying gcc-14 patch..."
|
||||
@ -1446,6 +1470,22 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# 6.11
|
||||
if (( $(vercmp "$_kernel" "6.1") >= 0 )); then
|
||||
if [[ $pkgver = 560.* ]]; then
|
||||
# Enable modeset and fbdev as default
|
||||
# This avoids various issue, when Simplefb is used
|
||||
# https://gitlab.archlinux.org/archlinux/packaging/packages/nvidia-utils/-/issues/14
|
||||
# https://github.com/rpmfusion/nvidia-kmod/blob/master/make_modeset_default.patch
|
||||
msg2 "Applying make-modeset-fbdev-default.diff for dkms..."
|
||||
patch -Np1 -i "$srcdir"/make-modeset-fbdev-default.diff
|
||||
# Add fix for fbdev "phantom" monitor with 6.11
|
||||
# https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/80
|
||||
msg2 "Applying 6.11-fbdev.diff for dkms..."
|
||||
patch -Np1 -i "$srcdir"/6.11-fbdev.diff
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$_gcc14" = "true" ]; then
|
||||
msg2 "Applying gcc-14 patch..."
|
||||
if [[ $pkgver = 470* ]]; then
|
||||
@ -1878,6 +1918,10 @@ nvidia-utils-tkg() {
|
||||
|
||||
install -Dm644 "$srcdir"/60-nvidia.rules "$pkgdir"/usr/lib/udev/rules.d/60-nvidia.rules
|
||||
|
||||
# Enable PreserveVideoMemoryAllocations and TemporaryFilePath
|
||||
# Fixes Wayland Sleep, when restoring the session
|
||||
install -Dm644 "$srcdir"/nvidia-sleep.conf "$pkgdir"/usr/lib/modprobe.d/nvidia-sleep.conf
|
||||
|
||||
_create_links
|
||||
}
|
||||
source /dev/stdin <<EOF
|
||||
|
199
patches/6.11-fbdev.diff
Normal file
199
patches/6.11-fbdev.diff
Normal file
@ -0,0 +1,199 @@
|
||||
From 772eaa91e1e79fb0a4a7e9d80abd99db7a0c0b61 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jung <admin@ptr1337.dev>
|
||||
Date: Thu, 26 Sep 2024 14:52:57 +0200
|
||||
Subject: [PATCH 4/5] 6.11: Add fix for fbdev
|
||||
|
||||
---
|
||||
kernel/conftest.sh | 23 ++++++++++++++++++-
|
||||
kernel/header-presence-tests.mk | 1 +
|
||||
kernel/nvidia-drm/nvidia-drm-drv.c | 22 +++++++++++-------
|
||||
kernel/nvidia-drm/nvidia-drm-linux.c | 2 +-
|
||||
.../nvidia-drm/nvidia-drm-os-interface.h | 8 ++++++-
|
||||
kernel/nvidia-drm/nvidia-drm-sources.mk | 1 +
|
||||
6 files changed, 46 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/kernel-dkms/conftest.sh b/kernel-dkms/conftest.sh
|
||||
index 1226cea2..4a239e63 100755
|
||||
--- a/kernel-dkms/conftest.sh
|
||||
+++ b/kernel-dkms/conftest.sh
|
||||
@@ -6596,7 +6596,9 @@ compile_test() {
|
||||
# Determine whether drm_fbdev_generic_setup is present.
|
||||
#
|
||||
# Added by commit 9060d7f49376 ("drm/fb-helper: Finish the
|
||||
- # generic fbdev emulation") in v4.19.
|
||||
+ # generic fbdev emulation") in v4.19. Removed by commit
|
||||
+ # aae4682e5d66 ("drm/fbdev-generic: Convert to fbdev-ttm")
|
||||
+ # in v6.11.
|
||||
#
|
||||
CODE="
|
||||
#include <drm/drm_fb_helper.h>
|
||||
@@ -6610,6 +6612,25 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_DRM_FBDEV_GENERIC_SETUP_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
+ drm_fbdev_ttm_setup)
|
||||
+ #
|
||||
+ # Determine whether drm_fbdev_ttm_setup is present.
|
||||
+ #
|
||||
+ # Added by commit aae4682e5d66 ("drm/fbdev-generic:
|
||||
+ # Convert to fbdev-ttm") in v6.11.
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <drm/drm_fb_helper.h>
|
||||
+ #if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT)
|
||||
+ #include <drm/drm_fbdev_ttm.h>
|
||||
+ #endif
|
||||
+ void conftest_drm_fbdev_ttm_setup(void) {
|
||||
+ drm_fbdev_ttm_setup();
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_DRM_FBDEV_TTM_SETUP_PRESENT" "" "functions"
|
||||
+ ;;
|
||||
+
|
||||
drm_aperture_remove_conflicting_pci_framebuffers)
|
||||
#
|
||||
# Determine whether drm_aperture_remove_conflicting_pci_framebuffers is present.
|
||||
diff --git a/kernel-dkms/header-presence-tests.mk b/kernel-dkms/header-presence-tests.mk
|
||||
index e8d2e02b..40204ae4 100644
|
||||
--- a/kernel-dkms/header-presence-tests.mk
|
||||
+++ b/kernel-dkms/header-presence-tests.mk
|
||||
@@ -15,6 +15,7 @@ NV_HEADER_PRESENCE_TESTS = \
|
||||
drm/drm_atomic_uapi.h \
|
||||
drm/drm_drv.h \
|
||||
drm/drm_fbdev_generic.h \
|
||||
+ drm/drm_fbdev_ttm.h \
|
||||
drm/drm_framebuffer.h \
|
||||
drm/drm_connector.h \
|
||||
drm/drm_probe_helper.h \
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
index 359ff0c4..50028c26 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
@@ -64,12 +64,14 @@
|
||||
#include <drm/drm_ioctl.h>
|
||||
#endif
|
||||
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
#include <drm/drm_aperture.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#endif
|
||||
|
||||
-#if defined(NV_DRM_DRM_FBDEV_GENERIC_H_PRESENT)
|
||||
+#if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT)
|
||||
+#include <drm/drm_fbdev_ttm.h>
|
||||
+#elif defined(NV_DRM_DRM_FBDEV_GENERIC_H_PRESENT)
|
||||
#include <drm/drm_fbdev_generic.h>
|
||||
#endif
|
||||
|
||||
@@ -476,7 +478,7 @@ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
/*
|
||||
* If fbdev is enabled, take modeset ownership now before other DRM clients
|
||||
* can take master (and thus NVKMS ownership).
|
||||
@@ -610,7 +612,7 @@ static void __nv_drm_unload(struct drm_device *dev)
|
||||
|
||||
/* Release modeset ownership if fbdev is enabled */
|
||||
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
if (nv_dev->hasFramebufferConsole) {
|
||||
drm_atomic_helper_shutdown(dev);
|
||||
nvKms->releaseOwnership(nv_dev->pDevice);
|
||||
@@ -1838,7 +1840,7 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
|
||||
goto failed_drm_register;
|
||||
}
|
||||
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
if (nv_drm_fbdev_module_param &&
|
||||
drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
|
||||
@@ -1851,9 +1853,13 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
|
||||
drm_aperture_remove_conflicting_pci_framebuffers(pdev, nv_drm_driver.name);
|
||||
#endif
|
||||
}
|
||||
+ #if defined(NV_DRM_FBDEV_TTM_AVAILABLE)
|
||||
+ drm_fbdev_ttm_setup(dev, 32);
|
||||
+ #elif defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
drm_fbdev_generic_setup(dev, 32);
|
||||
+ #endif
|
||||
}
|
||||
-#endif /* defined(NV_DRM_FBDEV_GENERIC_AVAILABLE) */
|
||||
+#endif /* defined(NV_DRM_FBDEV_AVAILABLE) */
|
||||
|
||||
/* Add NVIDIA-DRM device into list */
|
||||
|
||||
@@ -1995,12 +2001,12 @@ void nv_drm_suspend_resume(NvBool suspend)
|
||||
|
||||
if (suspend) {
|
||||
drm_kms_helper_poll_disable(dev);
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
|
||||
#endif
|
||||
drm_mode_config_reset(dev);
|
||||
} else {
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
||||
#endif
|
||||
drm_kms_helper_poll_enable(dev);
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-linux.c b/kernel-dkms/nvidia-drm/nvidia-drm-linux.c
|
||||
index c7f4a239..83d40983 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-linux.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-linux.c
|
||||
@@ -34,7 +34,7 @@ MODULE_PARM_DESC(
|
||||
"Enable atomic kernel modesetting (1 = enable (default), 0 = disable)");
|
||||
module_param_named(modeset, nv_drm_modeset_module_param, bool, 0400);
|
||||
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
MODULE_PARM_DESC(
|
||||
fbdev,
|
||||
"Create a framebuffer device (1 = enable (default), 0 = disable) (EXPERIMENTAL)");
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.h b/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.h
|
||||
index 6f8cfea9..a6b0f947 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.h
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.h
|
||||
@@ -59,14 +59,20 @@ typedef struct nv_timer nv_drm_timer;
|
||||
#endif
|
||||
|
||||
#if defined(NV_DRM_FBDEV_GENERIC_SETUP_PRESENT) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT)
|
||||
+#define NV_DRM_FBDEV_AVAILABLE
|
||||
#define NV_DRM_FBDEV_GENERIC_AVAILABLE
|
||||
#endif
|
||||
|
||||
+#if defined(NV_DRM_FBDEV_TTM_SETUP_PRESENT) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT)
|
||||
+#define NV_DRM_FBDEV_AVAILABLE
|
||||
+#define NV_DRM_FBDEV_TTM_AVAILABLE
|
||||
+#endif
|
||||
+
|
||||
struct page;
|
||||
|
||||
/* Set to true when the atomic modeset feature is enabled. */
|
||||
extern bool nv_drm_modeset_module_param;
|
||||
-#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
+#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||
/* Set to true when the nvidia-drm driver should install a framebuffer device */
|
||||
extern bool nv_drm_fbdev_module_param;
|
||||
#endif
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-sources.mk b/kernel-dkms/nvidia-drm/nvidia-drm-sources.mk
|
||||
index 7ef0c5b8..247096b7 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-sources.mk
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-sources.mk
|
||||
@@ -67,6 +67,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += fence_set_error
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += sync_file_get_fence
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_conflicting_pci_framebuffers
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_generic_setup
|
||||
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_ttm_setup
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_attach_hdr_output_metadata_property
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_helper_crtc_enable_color_mgmt
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_crtc_enable_color_mgmt
|
||||
--
|
||||
2.46.2
|
||||
|
31
patches/make-modeset-fbdev-default.diff
Normal file
31
patches/make-modeset-fbdev-default.diff
Normal file
@ -0,0 +1,31 @@
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-linux.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-linux.c
|
||||
@@ -31,13 +31,13 @@
|
||||
|
||||
MODULE_PARM_DESC(
|
||||
modeset,
|
||||
- "Enable atomic kernel modesetting (1 = enable, 0 = disable (default))");
|
||||
+ "Enable atomic kernel modesetting (1 = enable (default), 0 = disable)");
|
||||
module_param_named(modeset, nv_drm_modeset_module_param, bool, 0400);
|
||||
|
||||
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||
MODULE_PARM_DESC(
|
||||
fbdev,
|
||||
- "Create a framebuffer device (1 = enable, 0 = disable (default)) (EXPERIMENTAL)");
|
||||
+ "Create a framebuffer device (1 = enable (default), 0 = disable) (EXPERIMENTAL)");
|
||||
module_param_named(fbdev, nv_drm_fbdev_module_param, bool, 0400);
|
||||
#endif
|
||||
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-os-interface.c
|
||||
@@ -41,8 +41,8 @@
|
||||
#include <drm/drmP.h>
|
||||
#endif
|
||||
|
||||
-bool nv_drm_modeset_module_param = false;
|
||||
-bool nv_drm_fbdev_module_param = false;
|
||||
+bool nv_drm_modeset_module_param = true;
|
||||
+bool nv_drm_fbdev_module_param = true;
|
||||
|
||||
void *nv_drm_calloc(size_t nmemb, size_t size)
|
||||
{
|
7
system/nvidia-sleep.conf
Normal file
7
system/nvidia-sleep.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# https://download.nvidia.com/XFree86/Linux-x86_64/560.35.03/README/powermanagement.html#PreserveAllVide719f0
|
||||
# Save and restore all video memory allocations.
|
||||
options nvidia NVreg_PreserveVideoMemoryAllocations=1
|
||||
#
|
||||
# The destination should not be using tmpfs, so we prefer
|
||||
# /var/tmp instead of /tmp
|
||||
options nvidia NVreg_TemporaryFilePath=/var/tmp
|
@ -1,6 +1,7 @@
|
||||
post_upgrade() {
|
||||
echo "If you run into trouble with CUDA not being available, run nvidia-modprobe first."
|
||||
echo "If you use GDM on Wayland, you might have to run systemctl enable --now nvidia-resume.service"
|
||||
echo "If you use sleep on wayland, you might have to run systemctl enable nvidia-resume nvidia-hibernate nvidia-suspend"
|
||||
}
|
||||
# https://gitlab.gnome.org/GNOME/gdm/-/issues/784
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user