From 7aa669f887a113b95a8cdb1c069d61e26d19871e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 7 Jan 2021 00:24:46 +0000 Subject: x11-drivers/nvidia-drivers-legacy : version bump (v390.138) --- x11-drivers/nvidia-drivers-legacy/Manifest | 2 +- .../nvidia-drivers-legacy/files/kernel-4.16.patch | 33 -- .../nvidia-drivers-legacy/files/kernel-5.10.patch | 145 +++++++ .../nvidia-drivers-legacy/files/kernel-5.5.patch | 395 -------------------- .../nvidia-drivers-legacy/files/kernel-5.6.patch | 415 --------------------- .../nvidia-drivers-legacy/files/kernel-5.8.patch | 96 +++++ .../nvidia-drivers-legacy/files/kernel-5.9.patch | 364 ++++++++++++++++++ .../nvidia-drivers-legacy/files/nouveau.conf | 3 + .../files/nvidia-drivers-legacy-390.132-conf.patch | 28 -- .../files/nvidia-drivers-legacy-390.138-conf.patch | 28 ++ .../nvidia-drivers-legacy/files/nvidia.conf | 23 +- .../nvidia-drivers-legacy-390.132-r4.ebuild | 331 ---------------- .../nvidia-drivers-legacy-390.138.ebuild | 319 ++++++++++++++++ 13 files changed, 976 insertions(+), 1206 deletions(-) delete mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-4.16.patch create mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-5.10.patch delete mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-5.5.patch delete mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-5.6.patch create mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-5.8.patch create mode 100644 x11-drivers/nvidia-drivers-legacy/files/kernel-5.9.patch create mode 100644 x11-drivers/nvidia-drivers-legacy/files/nouveau.conf delete mode 100644 x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.132-conf.patch create mode 100644 x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.138-conf.patch delete mode 100644 x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.132-r4.ebuild create mode 100644 x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.138.ebuild (limited to 'x11-drivers/nvidia-drivers-legacy') diff --git a/x11-drivers/nvidia-drivers-legacy/Manifest b/x11-drivers/nvidia-drivers-legacy/Manifest index b796b9e4..b3070520 100644 --- a/x11-drivers/nvidia-drivers-legacy/Manifest +++ b/x11-drivers/nvidia-drivers-legacy/Manifest @@ -1 +1 @@ -DIST NVIDIA-Linux-x86_64-390.132.run 82900057 BLAKE2B e94cc2493701e34c4dd2f0fc4f89501d6b1d3e44abf80af2eff20c19a22c1160ce322c25d2b5b13e212bf48fb41f94d3c1bb6f9251302e6c8facb687d807a3dc SHA512 bad3453472e8af9ef0681b82db75f9c53816a7d57ff2bf1facd2ea010e757bf7fd4fb907317471934a0cb56510eaf2a90503a3a86ec80b76afdacfa2b9ee6c13 +DIST NVIDIA-Linux-x86_64-390.138.run 83780873 BLAKE2B 5e6a9d77dd2b9de17d923198105a9227ffe2adbc1ed7c9dd5ef3cc810358f71ae47ce9615cbe04f36090f052082a2066772505fd763cbfdbce272f0fb7c25dc7 SHA512 2984fb8f5de598fd3031ebd928942ceb09fd26ae9e61b40b2d348e3174e172a932a1b2a5c2e5534f299b883ade323932be4fdcd26d6f7235a17f6f5a04fa792c diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-4.16.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-4.16.patch deleted file mode 100644 index 67172815..00000000 --- a/x11-drivers/nvidia-drivers-legacy/files/kernel-4.16.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h -index 10fc418..22ef968 100644 ---- a/kernel/common/inc/nv-linux.h -+++ b/kernel/common/inc/nv-linux.h -@@ -175,7 +175,11 @@ static inline uid_t __kuid_val(kuid_t uid) - - #if defined(NV_VM_INSERT_PAGE_PRESENT) - #include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) - #include -+#else -+#include -+#endif - #endif - - #if defined(CONFIG_SWIOTLB) && defined(NVCPU_AARCH64) -diff --git a/kernel/conftest.sh b/kernel/conftest.sh -index b23dbb4..42dc576 100755 ---- a/kernel/conftest.sh -+++ b/kernel/conftest.sh -@@ -1906,7 +1906,12 @@ compile_test() { - # Determine if the phys_to_dma function is present. - # - CODE=" -+ #include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) - #include -+#else -+ #include -+#endif - void conftest_phys_to_dma(void) { - phys_to_dma(); - }" diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.10.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.10.patch new file mode 100644 index 00000000..7591802a --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.10.patch @@ -0,0 +1,145 @@ +diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h +index dd335b5..7eae890 100644 +--- a/kernel/common/inc/nv-linux.h ++++ b/kernel/common/inc/nv-linux.h +@@ -178,6 +178,10 @@ + #include + #endif + ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++#include ++#endif ++ + #if defined(CONFIG_SWIOTLB) && defined(NVCPU_AARCH64) + #include + #endif + +diff --git a/kernel/conftest.sh b/kernel/conftest.sh +index 9612796..1c1eb30 100755 +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -134,6 +134,7 @@ test_headers() { + FILES="$FILES linux/fence.h" + FILES="$FILES linux/ktime.h" + FILES="$FILES linux/dma-resv.h" ++ FILES="$FILES linux/dma-map-ops.h" + + # Arch specific headers which need testing + FILES_ARCH="asm/book3s/64/hash-64k.h" +@@ -2046,6 +2046,7 @@ + # + CODE=" + #include ++ #include + void conftest_phys_to_dma(void) { + phys_to_dma(); + }" +@@ -2064,6 +2068,9 @@ compile_test() { + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_dma_ops(void) { + (void)dma_ops; + }" +@@ -2078,6 +2085,9 @@ compile_test() { + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_dma_ops(void) { + (void)swiotlb_dma_ops; + }" +@@ -2088,22 +2098,28 @@ compile_test() { + dma_map_ops) + # + # Determine if the 'struct dma_map_ops' type is present. +- # ++ # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_dma_map_ops(void) { + struct dma_map_ops ops; + }" + + compile_check_conftest "$CODE" "NV_DMA_MAP_OPS_PRESENT" "" "types" + ;; +- ++ + get_dma_ops) + # + # Determine if the get_dma_ops() function is present. + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_get_dma_ops(void) { + get_dma_ops(); + }" +@@ -2117,6 +2133,9 @@ compile_test() { + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_noncoherent_swiotlb_dma_ops(void) { + (void)noncoherent_swiotlb_dma_ops; + }" +@@ -2133,6 +2152,9 @@ compile_test() { + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_dma_map_resource(void) { + dma_map_resource(); + }" +@@ -3961,6 +3983,9 @@ compile_test() { + # + CODE=" + #include ++#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT) ++ #include ++#endif + void conftest_dma_is_direct(void) { + dma_is_direct(); + }" +diff --git a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c +index 76dedba..92a5192 100644 +--- a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c ++++ b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c +@@ -20,6 +20,7 @@ + * DEALINGS IN THE SOFTWARE. + */ + ++#include + #include "nvidia-drm-conftest.h" + + #if defined(NV_DRM_AVAILABLE) +@@ -47,8 +48,13 @@ static struct sg_table *__nv_drm_gem_user_memory_prime_get_sg_table( + { + struct nv_drm_gem_user_memory *nv_user_memory = to_nv_user_memory(nv_gem); + +- return drm_prime_pages_to_sg(nv_user_memory->pages, +- nv_user_memory->pages_count); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) ++ return drm_prime_pages_to_sg(nv_gem->nv_dev->dev, nv_user_memory->pages, ++ nv_user_memory->pages_count); ++#else ++ return drm_prime_pages_to_sg(nv_user_memory->pages, ++ nv_user_memory->pages_count); ++#endif + } + + static void *__nv_drm_gem_user_memory_prime_vmap( diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.5.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.5.patch deleted file mode 100644 index bda326c0..00000000 --- a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.5.patch +++ /dev/null @@ -1,395 +0,0 @@ -diff --git a/.manifest b/.manifest -index a53265d..bc46234 100644 ---- a/.manifest -+++ b/.manifest -@@ -36,6 +36,7 @@ kernel/nvidia/nv-rsync.c 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resm - kernel/nvidia/nv-report-err.c 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman - kernel/conftest.sh 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman - kernel/common/inc/nv.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman -+kernel/common/inc/nv-drm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman - kernel/common/inc/nv-pgprot.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman - kernel/common/inc/nv-mm.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman - kernel/common/inc/nv-timer.h 0644 KERNEL_MODULE_SRC INHERIT_PATH_DEPTH:1 MODULE:resman -diff --git a/kernel/common/inc/nv-drm.h b/kernel/common/inc/nv-drm.h -new file mode 100644 -index 0000000..07e9f3c ---- /dev/null -+++ b/kernel/common/inc/nv-drm.h -@@ -0,0 +1,36 @@ -+#ifndef _NV_DRM_H_ -+#define _NV_DRM_H_ -+ -+#include "conftest.h" -+ -+#if defined(NV_DRM_DRMP_H_PRESENT) -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#endif -+ -+#endif -diff --git a/kernel/conftest.sh b/kernel/conftest.sh -index c9c2db3..dd22bb0 100755 ---- a/kernel/conftest.sh -+++ b/kernel/conftest.sh -@@ -1150,6 +1150,9 @@ compile_test() { - CODE=" - #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #include - #endif - #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE) - #error DRM not enabled -@@ -1781,6 +1784,8 @@ compile_test() { - echo "$CONFTEST_PREAMBLE - #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include - #endif - #include - #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE) -@@ -1909,7 +1914,11 @@ compile_test() { - # attached drivers") in v3.14 (2013-12-11) - # - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #endif - int conftest_drm_driver_has_legacy_dev_list(void) { - return offsetof(struct drm_driver, legacy_dev_list); - }" -@@ -1933,7 +1942,11 @@ compile_test() { - # 2017-07-23 e6fc3b68558e4c6d8d160b5daf2511b99afa8814 - # - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #endif - - int conftest_drm_crtc_init_with_planes_has_name_arg(void) { - return -@@ -1949,7 +1962,11 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DRM_CRTC_INIT_WITH_PLANES_HAS_NAME_ARG" "" "types" - - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #endif - - int conftest_drm_encoder_init_has_name_arg(void) { - return -@@ -1964,7 +1981,11 @@ compile_test() { - compile_check_conftest "$CODE" "NV_DRM_ENCODER_INIT_HAS_NAME_ARG" "" "types" - - echo "$CONFTEST_PREAMBLE -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #endif - - int conftest_drm_universal_plane_init_has_format_modifiers_arg(void) { - return -@@ -1991,7 +2012,11 @@ compile_test() { - echo "#undef NV_DRM_UNIVERSAL_PLANE_INIT_HAS_FORMAT_MODIFIERS_ARG" | append_conftest "types" - - echo "$CONFTEST_PREAMBLE -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #else -+ #include -+ #endif - - int conftest_drm_universal_plane_init_has_name_arg(void) { - return -@@ -3084,7 +3109,9 @@ compile_test() { - # drm_framebuffer_{get,put}()") in v4.12 (2017-02-28). - # - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #endif - #if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT) - #include - #endif -@@ -3103,7 +3130,9 @@ compile_test() { - # drm_gem_object_{get,put}()") in v4.12 (2017-02-28). - # - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #endif - #if defined(NV_DRM_DRM_GEM_H_PRESENT) - #include - #endif -@@ -3122,7 +3151,9 @@ compile_test() { - # functions") in v4.15 (2017-09-26). - # - CODE=" -+ #if defined(NV_DRM_DRMP_H_PRESENT) - #include -+ #endif - #if defined(NV_DRM_DRM_DRV_H_PRESENT) - #include - #endif -diff --git a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c -index 1553ebc..f851561 100644 ---- a/kernel/nvidia-drm/nvidia-drm-connector.c -+++ b/kernel/nvidia-drm/nvidia-drm-connector.c -@@ -20,6 +20,8 @@ - * DEALINGS IN THE SOFTWARE. - */ - -+#include -+ - #include "nvidia-drm-conftest.h" /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) -@@ -71,7 +73,11 @@ static enum drm_connector_status __nv_drm_connector_detect_internal( - struct nv_drm_encoder *nv_detected_encoder = NULL; - - struct NvKmsKapiDynamicDisplayParams *pDetectParams = NULL; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) - unsigned int i; -+#else -+ struct drm_encoder *encoder = NULL; -+#endif - - BUG_ON(!mutex_is_locked(&dev->mode_config.mutex)); - -@@ -87,11 +93,16 @@ static enum drm_connector_status __nv_drm_connector_detect_internal( - goto done; - } - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) - for (i = 0; - i < DRM_CONNECTOR_MAX_ENCODER && detected_encoder == NULL; i++) { - struct drm_encoder *encoder; -+#else -+ drm_connector_for_each_possible_encoder(connector, encoder) { -+#endif - struct nv_drm_encoder *nv_encoder; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) - if (connector->encoder_ids[i] == 0) { - break; - } -@@ -102,6 +113,7 @@ static enum drm_connector_status __nv_drm_connector_detect_internal( - BUG_ON(encoder != NULL); - continue; - } -+#endif - - /* - * DVI-I connectors can drive both digital and analog -@@ -169,6 +181,8 @@ static enum drm_connector_status __nv_drm_connector_detect_internal( - } - - detected_encoder = encoder; -+ -+ break; - } - } - -diff --git a/kernel/nvidia-drm/nvidia-drm-connector.h b/kernel/nvidia-drm/nvidia-drm-connector.h -index f74e22c..099390d 100644 ---- a/kernel/nvidia-drm/nvidia-drm-connector.h -+++ b/kernel/nvidia-drm/nvidia-drm-connector.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#include -+#include "nv-drm.h" - - #include "nvtypes.h" - #include "nvkms-api-types.h" -diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.h b/kernel/nvidia-drm/nvidia-drm-crtc.h -index 31ef3b5..5de3a51 100644 ---- a/kernel/nvidia-drm/nvidia-drm-crtc.h -+++ b/kernel/nvidia-drm/nvidia-drm-crtc.h -@@ -29,7 +29,7 @@ - - #include "nvidia-drm-helper.h" - --#include -+#include "nv-drm.h" - #include "nvtypes.h" - #include "nvkms-kapi.h" - -diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c -index a66d3cc..06bf859 100644 ---- a/kernel/nvidia-drm/nvidia-drm-drv.c -+++ b/kernel/nvidia-drm/nvidia-drm-drv.c -@@ -39,7 +39,7 @@ - - #include "nvidia-drm-ioctl.h" - --#include -+#include "nv-drm.h" - - /* - * Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h") -diff --git a/kernel/nvidia-drm/nvidia-drm-encoder.h b/kernel/nvidia-drm/nvidia-drm-encoder.h -index bbaf986..af341a8 100644 ---- a/kernel/nvidia-drm/nvidia-drm-encoder.h -+++ b/kernel/nvidia-drm/nvidia-drm-encoder.h -@@ -32,7 +32,7 @@ - #if defined(NV_DRM_DRM_ENCODER_H_PRESENT) - #include - #else --#include -+#include "nv-drm.h" - #endif - - #include "nvkms-kapi.h" -diff --git a/kernel/nvidia-drm/nvidia-drm-fb.h b/kernel/nvidia-drm/nvidia-drm-fb.h -index 7f292ce..d13bc4c 100644 ---- a/kernel/nvidia-drm/nvidia-drm-fb.h -+++ b/kernel/nvidia-drm/nvidia-drm-fb.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#include -+#include "nv-drm.h" - #include "nvidia-drm-gem-nvkms-memory.h" - #include "nvkms-kapi.h" - -diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h -index b621969..326f810 100644 ---- a/kernel/nvidia-drm/nvidia-drm-gem.h -+++ b/kernel/nvidia-drm/nvidia-drm-gem.h -@@ -29,7 +29,7 @@ - - #include "nvidia-drm-priv.h" - --#include -+#include "nv-drm.h" - #include "nvkms-kapi.h" - - #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) -diff --git a/kernel/nvidia-drm/nvidia-drm-helper.c b/kernel/nvidia-drm/nvidia-drm-helper.c -index da602ac..e5d6daa 100644 ---- a/kernel/nvidia-drm/nvidia-drm-helper.c -+++ b/kernel/nvidia-drm/nvidia-drm-helper.c -@@ -31,7 +31,7 @@ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#include -+#include "nv-drm.h" - #if defined(NV_DRM_DRM_ATOMIC_UAPI_H_PRESENT) - #include - #endif -diff --git a/kernel/nvidia-drm/nvidia-drm-helper.h b/kernel/nvidia-drm/nvidia-drm-helper.h -index 8f050d8..71c4b90 100644 ---- a/kernel/nvidia-drm/nvidia-drm-helper.h -+++ b/kernel/nvidia-drm/nvidia-drm-helper.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_AVAILABLE) - --#include -+#include "nv-drm.h" - - /* - * drm_dev_put() is added by commit 9a96f55034e41b4e002b767e9218d55f03bdff7d -diff --git a/kernel/nvidia-drm/nvidia-drm-modeset.h b/kernel/nvidia-drm/nvidia-drm-modeset.h -index 06659c5..e9d7b70 100644 ---- a/kernel/nvidia-drm/nvidia-drm-modeset.h -+++ b/kernel/nvidia-drm/nvidia-drm-modeset.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#include -+#include "nv-drm.h" - - struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev); - void nv_drm_atomic_state_clear(struct drm_atomic_state *state); -diff --git a/kernel/nvidia-drm/nvidia-drm-os-interface.h b/kernel/nvidia-drm/nvidia-drm-os-interface.h -index f43f851..7f4ff8b 100644 ---- a/kernel/nvidia-drm/nvidia-drm-os-interface.h -+++ b/kernel/nvidia-drm/nvidia-drm-os-interface.h -@@ -29,7 +29,7 @@ - - #if defined(NV_DRM_AVAILABLE) - --#include -+#include "nv-drm.h" - - /* Set to true when the atomic modeset feature is enabled. */ - extern bool nv_drm_modeset_module_param; -diff --git a/kernel/nvidia-drm/nvidia-drm-prime-fence.h b/kernel/nvidia-drm/nvidia-drm-prime-fence.h -index 20da923..f3cc2b4 100644 ---- a/kernel/nvidia-drm/nvidia-drm-prime-fence.h -+++ b/kernel/nvidia-drm/nvidia-drm-prime-fence.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_AVAILABLE) - --#include -+#include "nv-drm.h" - - #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) - -diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h -index 9076835..77a95f3 100644 ---- a/kernel/nvidia-drm/nvidia-drm-priv.h -+++ b/kernel/nvidia-drm/nvidia-drm-priv.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_AVAILABLE) - --#include -+#include "nv-drm.h" - - #if defined(NV_DRM_DRM_GEM_H_PRESENT) - #include -diff --git a/kernel/nvidia-drm/nvidia-drm-utils.h b/kernel/nvidia-drm/nvidia-drm-utils.h -index 6d24120..95190c4 100644 ---- a/kernel/nvidia-drm/nvidia-drm-utils.h -+++ b/kernel/nvidia-drm/nvidia-drm-utils.h -@@ -27,7 +27,7 @@ - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#include -+#include "nv-drm.h" - #include "nvkms-kapi.h" - - struct NvKmsKapiConnectorInfo* diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.6.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.6.patch deleted file mode 100644 index bc1968d7..00000000 --- a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.6.patch +++ /dev/null @@ -1,415 +0,0 @@ -diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h -index 85041c2..ac5bb95 100644 ---- a/kernel/common/inc/nv-linux.h -+++ b/kernel/common/inc/nv-linux.h -@@ -553,7 +553,11 @@ static inline void *nv_ioremap(NvU64 phys, NvU64 size) - - static inline void *nv_ioremap_nocache(NvU64 phys, NvU64 size) - { -+#if defined(NV_IOREMAP_NOCACHE_PRESENT) - void *ptr = ioremap_nocache(phys, size); -+#else -+ void *ptr = ioremap(phys, size); -+#endif - if (ptr) - NV_MEMDBG_ADD(ptr, size); - return ptr; -diff --git a/kernel/common/inc/nv-procfs.h b/kernel/common/inc/nv-procfs.h -index 3c812ea..e57c4f9 100644 ---- a/kernel/common/inc/nv-procfs.h -+++ b/kernel/common/inc/nv-procfs.h -@@ -52,6 +52,19 @@ - }) - #endif - -+#if defined(NV_HAVE_PROC_OPS) -+#define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \ -+ ({ \ -+ struct proc_dir_entry *__entry; \ -+ int mode = (S_IFREG | S_IRUGO); \ -+ const struct proc_ops *fops = &nv_procfs_##__name##_fops; \ -+ if (fops->proc_write != 0) \ -+ mode |= S_IWUSR; \ -+ __entry = NV_CREATE_PROC_ENTRY(filename, mode, parent, fops, \ -+ __data); \ -+ __entry; \ -+ }) -+#else - #define NV_CREATE_PROC_FILE(filename,parent,__name,__data) \ - ({ \ - struct proc_dir_entry *__entry; \ -@@ -63,6 +76,7 @@ - __data); \ - __entry; \ - }) -+#endif - - /* - * proc_mkdir_mode exists in Linux 2.6.9, but isn't exported until Linux 3.0. -@@ -104,6 +118,24 @@ - remove_proc_entry(entry->name, entry->parent); - #endif - -+#if defined(NV_HAVE_PROC_OPS) -+#define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \ -+ static int nv_procfs_open_##__name( \ -+ struct inode *inode, \ -+ struct file *filep \ -+ ) \ -+ { \ -+ return single_open(filep, nv_procfs_read_##__name, \ -+ NV_PDE_DATA(inode)); \ -+ } \ -+ \ -+ static const struct proc_ops nv_procfs_##__name##_fops = { \ -+ .proc_open = nv_procfs_open_##__name, \ -+ .proc_read = seq_read, \ -+ .proc_lseek = seq_lseek, \ -+ .proc_release = single_release, \ -+ }; -+#else - #define NV_DEFINE_PROCFS_SINGLE_FILE(__name) \ - static int nv_procfs_open_##__name( \ - struct inode *inode, \ -@@ -121,6 +153,7 @@ - .llseek = seq_lseek, \ - .release = single_release, \ - }; -+#endif - - #endif /* CONFIG_PROC_FS */ - -diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h -index 2c799c9..0206062 100644 ---- a/kernel/common/inc/nv-time.h -+++ b/kernel/common/inc/nv-time.h -@@ -30,7 +30,12 @@ - #include - #endif - --static inline void nv_gettimeofday(struct timeval *tv) -+struct nv_timeval { -+ __kernel_long_t tv_sec; -+ __kernel_suseconds_t tv_usec; -+}; -+ -+static inline void nv_gettimeofday(struct nv_timeval *tv) - { - #ifdef NV_DO_GETTIMEOFDAY_PRESENT - do_gettimeofday(tv); -@@ -39,7 +44,7 @@ static inline void nv_gettimeofday(struct timeval *tv) - - ktime_get_real_ts64(&now); - -- *tv = (struct timeval) { -+ *tv = (struct nv_timeval) { - .tv_sec = now.tv_sec, - .tv_usec = now.tv_nsec/1000, - }; -diff --git a/kernel/conftest.sh b/kernel/conftest.sh -index ec9e093..463a464 100755 ---- a/kernel/conftest.sh -+++ b/kernel/conftest.sh -@@ -1197,6 +1197,22 @@ compile_test() { - compile_check_conftest "$CODE" "NV_IOREMAP_CACHE_PRESENT" "" "functions" - ;; - -+ ioremap_nocache) -+ # -+ # Determine if the ioremap_nocache() function is present. -+ # -+ # Removed by commit 4bdc0d676a64 ("remove ioremap_nocache and -+ # devm_ioremap_nocache") in v5.6 (2020-01-06) -+ # -+ CODE=" -+ #include -+ void conftest_ioremap_nocache(void) { -+ ioremap_nocache(); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_IOREMAP_NOCACHE_PRESENT" "" "functions" -+ ;; -+ - ioremap_wc) - # - # Determine if the ioremap_wc() function is present. -@@ -1430,6 +1446,31 @@ compile_test() { - compile_check_conftest "$CODE" "NV_SG_ALLOC_TABLE_FROM_PAGES_PRESENT" "" "functions" - ;; - -+ proc_ops) -+ CODE=" -+ #include -+ int conftest_proc_ops(void) { -+ return offsetof(struct proc_ops, proc_open); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types" -+ ;; -+ -+ ktime_get_raw_ts64) -+ # -+ # Determine if the ktime_get_raw_ts64() function is present. -+ # -+ CODE=" -+ #include -+ int conftest_ktime_get_raw_ts64(void) { -+ struct timespec64 ts = {0}; -+ -+ ktime_get_raw_ts64(&ts64); -+ }" -+ -+ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions" -+ ;; -+ - efi_enabled) - # - # Determine if the efi_enabled symbol is present, or if -diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c -index d42aabb..f0404fb 100644 ---- a/kernel/nvidia-modeset/nvidia-modeset-linux.c -+++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c -@@ -216,7 +216,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec) - - NvU64 NVKMS_API_CALL nvkms_get_usec(void) - { -- struct timeval tv; -+ struct nv_timeval tv; - - nv_gettimeofday(&tv); - -diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h -index 8784a82..c256cdb 100644 ---- a/kernel/nvidia-uvm/uvm_linux.h -+++ b/kernel/nvidia-uvm/uvm_linux.h -@@ -329,7 +329,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r - } - #endif - --#if defined(CLOCK_MONOTONIC_RAW) -+#if defined(NV_KTIME_GET_RAW_TS64_PRESENT) -+static inline NvU64 NV_GETTIME(void) -+{ -+ struct timespec64 ts64 = {0}; -+ -+ ktime_get_raw_ts64(&ts64); -+ -+ return (ts64.tv_sec * 1000000000ULL + ts64.tv_nsec); -+} -+#elif defined(CLOCK_MONOTONIC_RAW) - /* Return a nanosecond-precise value */ - static inline NvU64 NV_GETTIME(void) - { -@@ -345,7 +354,7 @@ static inline NvU64 NV_GETTIME(void) - * available non-GPL symbols. */ - static inline NvU64 NV_GETTIME(void) - { -- struct timeval tv = {0}; -+ struct nv_timeval tv = {0}; - - nv_gettimeofday(&tv); - -diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c -index 5808a88..bc60a08 100644 ---- a/kernel/nvidia/nv-procfs.c -+++ b/kernel/nvidia/nv-procfs.c -@@ -414,6 +414,15 @@ done: - return ((status < 0) ? status : (int)count); - } - -+#if defined(NV_HAVE_PROC_OPS) -+static struct proc_ops nv_procfs_registry_fops = { -+ .proc_open = nv_procfs_open_registry, -+ .proc_read = seq_read, -+ .proc_write = nv_procfs_write_file, -+ .proc_lseek = seq_lseek, -+ .proc_release = nv_procfs_close_registry, -+}; -+#else - static struct file_operations nv_procfs_registry_fops = { - .owner = THIS_MODULE, - .open = nv_procfs_open_registry, -@@ -422,6 +431,7 @@ static struct file_operations nv_procfs_registry_fops = { - .llseek = seq_lseek, - .release = nv_procfs_close_registry, - }; -+#endif - - /* - * Forwards error to nv_log_error which exposes data to vendor callback -@@ -517,12 +527,20 @@ done: - return status; - } - -+#if defined(NV_HAVE_PROC_OPS) -+static struct proc_ops nv_procfs_exercise_error_forwarding_fops = { -+ .proc_open = nv_procfs_open_exercise_error_forwarding, -+ .proc_write = nv_procfs_write_file, -+ .proc_release = nv_procfs_close_exercise_error_forwarding, -+}; -+#else - static struct file_operations nv_procfs_exercise_error_forwarding_fops = { - .owner = THIS_MODULE, - .open = nv_procfs_open_exercise_error_forwarding, - .write = nv_procfs_write_file, - .release = nv_procfs_close_exercise_error_forwarding, - }; -+#endif - - static int - nv_procfs_read_unbind_lock( -@@ -650,6 +668,15 @@ done: - return rc; - } - -+#if defined(NV_HAVE_PROC_OPS) -+static struct proc_ops nv_procfs_unbind_lock_fops = { -+ .proc_open = nv_procfs_open_unbind_lock, -+ .proc_read = seq_read, -+ .proc_write = nv_procfs_write_file, -+ .proc_lseek = seq_lseek, -+ .proc_release = nv_procfs_close_unbind_lock, -+}; -+#else - static struct file_operations nv_procfs_unbind_lock_fops = { - .owner = THIS_MODULE, - .open = nv_procfs_open_unbind_lock, -@@ -658,6 +685,7 @@ static struct file_operations nv_procfs_unbind_lock_fops = { - .llseek = seq_lseek, - .release = nv_procfs_close_unbind_lock, - }; -+#endif - - static int - nv_procfs_read_text_file( -diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild -index 8ae1016..da7f135 100644 ---- a/kernel/nvidia/nvidia.Kbuild -+++ b/kernel/nvidia/nvidia.Kbuild -@@ -117,6 +117,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += on_each_cpu - NV_CONFTEST_FUNCTION_COMPILE_TESTS += smp_call_function - NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_evaluate_integer - NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_cache -+NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_nocache - NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_wc - NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_walk_namespace - NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_domain_nr -@@ -169,7 +170,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all - NV_CONFTEST_TYPE_COMPILE_TESTS += proc_dir_entry - NV_CONFTEST_TYPE_COMPILE_TESTS += scatterlist - NV_CONFTEST_TYPE_COMPILE_TESTS += sg_table -+NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops - NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations -+NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64 - NV_CONFTEST_TYPE_COMPILE_TESTS += vm_operations_struct - NV_CONFTEST_TYPE_COMPILE_TESTS += atomic_long_type - NV_CONFTEST_TYPE_COMPILE_TESTS += pci_save_state -diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c -index 0014280..537b257 100644 ---- a/kernel/nvidia/nvlink_linux.c -+++ b/kernel/nvidia/nvlink_linux.c -@@ -518,8 +518,8 @@ void * NVLINK_API_CALL nvlink_memcpy(void *dest, void *src, NvLength size) - - static NvBool nv_timer_less_than - ( -- const struct timeval *a, -- const struct timeval *b -+ const struct nv_timeval *a, -+ const struct nv_timeval *b - ) - { - return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec) -@@ -528,9 +528,9 @@ static NvBool nv_timer_less_than - - static void nv_timeradd - ( -- const struct timeval *a, -- const struct timeval *b, -- struct timeval *result -+ const struct nv_timeval *a, -+ const struct nv_timeval *b, -+ struct nv_timeval *result - ) - { - result->tv_sec = a->tv_sec + b->tv_sec; -@@ -544,9 +544,9 @@ static void nv_timeradd - - static void nv_timersub - ( -- const struct timeval *a, -- const struct timeval *b, -- struct timeval *result -+ const struct nv_timeval *a, -+ const struct nv_timeval *b, -+ struct nv_timeval *result - ) - { - result->tv_sec = a->tv_sec - b->tv_sec; -@@ -566,7 +566,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms) - unsigned long us; - unsigned long jiffies; - unsigned long mdelay_safe_msec; -- struct timeval tm_end, tm_aux; -+ struct nv_timeval tm_end, tm_aux; - - nv_gettimeofday(&tm_aux); - -diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c -index 344daa8..39d0a19 100644 ---- a/kernel/nvidia/os-interface.c -+++ b/kernel/nvidia/os-interface.c -@@ -430,7 +430,7 @@ NV_STATUS NV_API_CALL os_get_current_time( - NvU32 *useconds - ) - { -- struct timeval tm; -+ struct nv_timeval tm; - - nv_gettimeofday(&tm); - -@@ -444,9 +444,15 @@ NV_STATUS NV_API_CALL os_get_current_time( - - void NV_API_CALL os_get_current_tick(NvU64 *nseconds) - { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) -+ struct timespec64 ts; -+ -+ jiffies_to_timespec64(jiffies, &ts); -+#else - struct timespec ts; - - jiffies_to_timespec(jiffies, &ts); -+#endif - - *nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec); - } -@@ -502,7 +508,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds) - unsigned long usec; - - #ifdef NV_CHECK_DELAY_ACCURACY -- struct timeval tm1, tm2; -+ struct nv_timeval tm1, tm2; - - nv_gettimeofday(&tm1); - #endif -@@ -542,9 +548,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds) - unsigned long MicroSeconds; - unsigned long jiffies; - unsigned long mdelay_safe_msec; -- struct timeval tm_end, tm_aux; -+ struct nv_timeval tm_end, tm_aux; - #ifdef NV_CHECK_DELAY_ACCURACY -- struct timeval tm_start; -+ struct nv_timeval tm_start; - #endif - - nv_gettimeofday(&tm_aux); -@@ -1926,7 +1932,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp - { - struct ipmi_recv_msg *rx_msg; - int err_no; -- struct timeval tv; -+ struct nv_timeval tv; - NvU64 start_time; - - nv_gettimeofday(&tv); diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.8.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.8.patch new file mode 100644 index 00000000..66d3ef8d --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.8.patch @@ -0,0 +1,96 @@ +diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h +index ac5bb95..3d2f0b7 100644 +--- a/kernel/common/inc/nv-linux.h ++++ b/kernel/common/inc/nv-linux.h +@@ -531,7 +531,11 @@ extern int nv_pat_mode; + + static inline void *nv_vmalloc(unsigned long size) + { ++#if defined(NV_VMALLOC_HAS_PGPROT_T_ARG) + void *ptr = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL); ++#else ++ void *ptr = __vmalloc(size, GFP_KERNEL); ++#endif + if (ptr) + NV_MEMDBG_ADD(ptr, size); + return ptr; +diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h +index 1270bf3..d2d7657 100644 +--- a/kernel/common/inc/nv-mm.h ++++ b/kernel/common/inc/nv-mm.h +@@ -29,6 +29,10 @@ + typedef int vm_fault_t; + #endif + ++#if defined(NV_MM_HAS_MMAP_LOCK) ++#define mmap_sem mmap_lock ++#endif ++ + /* get_user_pages + * + * The 8-argument version of get_user_pages was deprecated by commit +diff --git a/kernel/conftest.sh b/kernel/conftest.sh +index 7da7505..7793dd6 100755 +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -4067,6 +4067,44 @@ compile_test() { + compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions" + ;; + ++ vmalloc_has_pgprot_t_arg) ++ # ++ # Determine if __vmalloc has the 'pgprot' argument. ++ # ++ # The third argument to __vmalloc, page protection ++ # 'pgprot_t prot', was removed by commit 88dca4ca5a93 ++ # (mm: remove the pgprot argument to __vmalloc) ++ # in v5.8-rc1 (2020-06-01). ++ CODE=" ++ #include ++ ++ void conftest_vmalloc_has_pgprot_t_arg(void) { ++ pgprot_t prot; ++ (void)__vmalloc(0, 0, prot); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_VMALLOC_HAS_PGPROT_T_ARG" "" "types" ++ ++ ;; ++ ++ mm_has_mmap_lock) ++ # ++ # Determine if the 'mm_struct' structure has a 'mmap_lock' field. ++ # ++ # Kernel commit da1c55f1b272 ("mmap locking API: rename mmap_sem ++ # to mmap_lock") replaced the field 'mmap_sem' by 'mmap_lock' ++ # in v5.8-rc1 (2020-06-08). ++ CODE=" ++ #include ++ ++ int conftest_mm_has_mmap_lock(void) { ++ return offsetof(struct mm_struct, mmap_lock); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_MM_HAS_MMAP_LOCK" "" "types" ++ ++ ;; ++ + pci_dev_has_skip_bus_pm) + # + # Determine if skip_bus_pm flag is present in struct pci_dev. +diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild +index 63e369f..656db7b 100644 +--- a/kernel/nvidia/nvidia.Kbuild ++++ b/kernel/nvidia/nvidia.Kbuild +@@ -192,7 +192,9 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += iterate_dir + NV_CONFTEST_TYPE_COMPILE_TESTS += kstrtoull + NV_CONFTEST_TYPE_COMPILE_TESTS += backlight_properties_type + NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops ++NV_CONFTEST_TYPE_COMPILE_TESTS += vmalloc_has_pgprot_t_arg + NV_CONFTEST_TYPE_COMPILE_TESTS += timeval ++NV_CONFTEST_TYPE_COMPILE_TESTS += mm_has_mmap_lock + NV_CONFTEST_TYPE_COMPILE_TESTS += kmem_cache_has_kobj_remove_work + NV_CONFTEST_TYPE_COMPILE_TESTS += sysfs_slab_unlink + NV_CONFTEST_TYPE_COMPILE_TESTS += pci_dev_has_skip_bus_pm +-- +2.25.1 diff --git a/x11-drivers/nvidia-drivers-legacy/files/kernel-5.9.patch b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.9.patch new file mode 100644 index 00000000..d01eba7a --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/files/kernel-5.9.patch @@ -0,0 +1,364 @@ +diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h +index ab06dbc..dd335b5 100644 +--- a/kernel/common/inc/nv-linux.h ++++ b/kernel/common/inc/nv-linux.h +@@ -159,7 +159,7 @@ static inline uid_t __kuid_val(kuid_t uid) + } + #endif + +-#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL) ++#if defined(NVCPU_X86_64) && !defined(NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL) + #include /* sys_ioctl() */ + #include /* register_ioctl32_conversion() */ + #endif +diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h +index d2d7657..a5325fe 100644 +--- a/kernel/common/inc/nv-mm.h ++++ b/kernel/common/inc/nv-mm.h +@@ -144,9 +144,13 @@ typedef int vm_fault_t; + flags |= FOLL_FORCE; + + #if defined(NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG) +- ++ #if defined (NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG) + return get_user_pages_remote(tsk, mm, start, nr_pages, flags, + pages, vmas, NULL); ++ #else ++ return get_user_pages_remote(mm, start, nr_pages, flags, ++ pages, vmas, NULL); ++ #endif + + #else + +@@ -159,7 +163,7 @@ typedef int vm_fault_t; + #endif + #else + #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS) +- #define NV_GET_USER_PAGES_REMOTE NV_GET_USER_PAGES ++ #define NV_GET_USER_PAGES_REMOTE get_user_pages + #else + #include + #include +diff --git a/kernel/conftest.sh b/kernel/conftest.sh +index e900963..ef82dee 100755 +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -3043,6 +3043,7 @@ compile_test() { + + if [ -f conftest$$.o ]; then + echo "#undef NV_GET_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions" ++ echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions" + echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" + echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions" + rm -f conftest$$.o +@@ -3070,14 +3071,20 @@ compile_test() { + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then ++ echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions" + echo "#define NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" + echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions" + rm -f conftest$$.o + return + fi + ++ echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" ++ ++ # + # conftest #3: check if get_user_pages_remote() has locked argument +- ++ # Return if these arguments are present. Fall through to conftest #4 ++ # if these args are absent. ++ # + echo "$CONFTEST_PREAMBLE + #include + long get_user_pages_remote(struct task_struct *tsk, +@@ -3095,13 +3102,40 @@ compile_test() { + rm -f conftest$$.c + + if [ -f conftest$$.o ]; then ++ echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions" ++ echo "#define NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions" ++ rm -f conftest$$.o ++ return ++ fi ++ ++ # ++ # conftest #4: check if get_user_pages_remote() does not take ++ # tsk argument. ++ # ++ echo "$CONFTEST_PREAMBLE ++ #include ++ long get_user_pages_remote(struct mm_struct *mm, ++ unsigned long start, ++ unsigned long nr_pages, ++ unsigned int gup_flags, ++ struct page **pages, ++ struct vm_area_struct **vmas, ++ int *locked) { ++ return 0; ++ }" > conftest$$.c ++ ++ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 ++ rm -f conftest$$.c ++ ++ if [ -f conftest$$.o ]; then ++ echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions" + echo "#define NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions" + rm -f conftest$$.o + else ++ ++ echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions" + echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions" + fi +- echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions" +- + ;; + + usleep_range) +@@ -4131,6 +4165,115 @@ compile_test() { + compile_check_conftest "$CODE" "NV_PCI_DEV_HAS_SKIP_BUS_PM" "" "types" + ;; + ++ drm_gem_object_put_unlocked) ++ # ++ # Determine if the function drm_gem_object_put_unlocked() is present. ++ # ++ # In v5.9-rc1, commit 2f4dd13d4bb8 ("drm/gem: add ++ # drm_gem_object_put helper") removes drm_gem_object_put_unlocked() ++ # function and replace its definition by transient macro. Commit ++ # ab15d56e27be ("drm: remove transient ++ # drm_gem_object_put_unlocked()") finally removes ++ # drm_gem_object_put_unlocked() macro. ++ # ++ CODE=" ++ #if defined(NV_DRM_DRMP_H_PRESENT) ++ #include ++ #endif ++ ++ #if defined(NV_DRM_DRM_GEM_H_PRESENT) ++ #include ++ #endif ++ void conftest_drm_gem_object_put_unlocked(void) { ++ drm_gem_object_put_unlocked(); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_PUT_UNLOCK_PRESENT" "" "functions" ++ ;; ++ ++ drm_display_mode_has_vrefresh) ++ # ++ # Determine if the 'drm_display_mode' structure has a 'vrefresh' ++ # field. ++ # ++ # Removed by commit 0425662fdf05 ("drm: Nuke mode->vrefresh") in ++ # v5.9-rc1. ++ # ++ CODE=" ++ #include ++ ++ int conftest_drm_display_mode_has_vrefresh(void) { ++ return offsetof(struct drm_display_mode, vrefresh); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_DISPLAY_MODE_HAS_VREFRESH" "types" ++ ++ ;; ++ ++ drm_driver_master_set_has_int_return_type) ++ # ++ # Determine if drm_driver::master_set() returns integer value ++ # ++ # Changed to void by commit 907f53200f98 ("drm: vmwgfx: remove ++ # drm_driver::master_set() return type") in v5.9-rc1. ++ # ++ CODE=" ++ #if defined(NV_DRM_DRMP_H_PRESENT) ++ #include ++ #endif ++ ++ #if defined(NV_DRM_DRM_DRV_H_PRESENT) ++ #include ++ #endif ++ ++ int conftest_drm_driver_master_set_has_int_return_type(struct drm_driver *drv, ++ struct drm_device *dev, struct drm_file *file_priv, bool from_open) { ++ ++ return drv->master_set(dev, file_priv, from_open); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_DRIVER_SET_MASTER_HAS_INT_RETURN_TYPE" "" "types" ++ ;; ++ ++ drm_driver_has_gem_free_object) ++ # ++ # Determine if the 'drm_driver' structure has a 'gem_free_object' ++ # function pointer. ++ # ++ # drm_driver::gem_free_object is removed by commit 1a9458aeb8eb ++ # ("drm: remove drm_driver::gem_free_object") in v5.9-rc1. ++ # ++ CODE=" ++ #if defined(NV_DRM_DRMP_H_PRESENT) ++ #include ++ #endif ++ ++ #if defined(NV_DRM_DRM_DRV_H_PRESENT) ++ #include ++ #endif ++ ++ int conftest_drm_driver_has_gem_free_object(void) { ++ return offsetof(struct drm_driver, gem_free_object); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_GEM_FREE_OBJECT" "" "types" ++ ;; ++ ++ vga_tryget) ++ # ++ # Determine if vga_tryget() is present ++ # ++ # vga_tryget() was removed by commit f369bc3f9096 ("vgaarb: mark ++ # vga_tryget static") in v5.9-rc1 (2020-08-01). ++ # ++ CODE=" ++ #include ++ void conftest_vga_tryget(void) { ++ vga_tryget(); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_VGA_TRYGET_PRESENT" "" "functions" ++ ;; + esac + } + +diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c +index 17e377d..85d9798 100644 +--- a/kernel/nvidia-drm/nvidia-drm-drv.c ++++ b/kernel/nvidia-drm/nvidia-drm-drv.c +@@ -466,8 +466,8 @@ static void nv_drm_unload(struct drm_device *dev) + + #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) + +-static int nv_drm_master_set(struct drm_device *dev, +- struct drm_file *file_priv, bool from_open) ++static int __nv_drm_master_set(struct drm_device *dev, ++ struct drm_file *file_priv, bool from_open) + { + struct nv_drm_device *nv_dev = to_nv_device(dev); + +@@ -478,6 +478,22 @@ static int nv_drm_master_set(struct drm_device *dev, + return 0; + } + ++#include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) ++static int nv_drm_master_set(struct drm_device *dev, ++ struct drm_file *file_priv, bool from_open) ++{ ++ return __nv_drm_master_set(dev, file_priv, from_open); ++} ++#else ++static void nv_drm_master_set(struct drm_device *dev, ++ struct drm_file *file_priv, bool from_open) ++{ ++ WARN_ON(__nv_drm_master_set(dev, file_priv, from_open) != 0); ++} ++#endif ++ ++ + #if defined(NV_DRM_MASTER_DROP_HAS_FROM_RELEASE_ARG) + static + void nv_drm_master_drop(struct drm_device *dev, +@@ -677,7 +693,9 @@ static struct drm_driver nv_drm_driver = { + #endif + DRIVER_GEM | DRIVER_RENDER, + ++#if defined(NV_DRM_DRIVER_HAS_GEM_FREE_OBJECT) + .gem_free_object = nv_drm_gem_free, ++#endif + + .ioctls = nv_drm_ioctls, + .num_ioctls = ARRAY_SIZE(nv_drm_ioctls), +diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h +index 5691a7a..18c50ca 100644 +--- a/kernel/nvidia-drm/nvidia-drm-gem.h ++++ b/kernel/nvidia-drm/nvidia-drm-gem.h +@@ -87,7 +87,13 @@ static inline void + nv_drm_gem_object_unreference_unlocked(struct nv_drm_gem_object *nv_gem) + { + #if defined(NV_DRM_GEM_OBJECT_GET_PRESENT) ++ ++#if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCK_PRESENT) + drm_gem_object_put_unlocked(&nv_gem->base); ++#else ++ drm_gem_object_put(&nv_gem->base); ++#endif ++ + #else + drm_gem_object_unreference_unlocked(&nv_gem->base); + #endif +diff --git a/kernel/nvidia-drm/nvidia-drm-utils.c b/kernel/nvidia-drm/nvidia-drm-utils.c +index 8cb2d5e..e30b2b6 100644 +--- a/kernel/nvidia-drm/nvidia-drm-utils.c ++++ b/kernel/nvidia-drm/nvidia-drm-utils.c +@@ -103,7 +103,9 @@ void + nvkms_display_mode_to_drm_mode(const struct NvKmsKapiDisplayMode *displayMode, + struct drm_display_mode *mode) + { ++#if defined(NV_DRM_DISPLAY_MODE_HAS_VREFRESH) + mode->vrefresh = (displayMode->timings.refreshRate + 500) / 1000; /* In Hz */ ++#endif + + mode->clock = (displayMode->timings.pixelClockHz + 500) / 1000; /* In Hz */ + +@@ -189,7 +191,11 @@ bool drm_format_to_nvkms_format(u32 format, + void drm_mode_to_nvkms_display_mode(const struct drm_display_mode *src, + struct NvKmsKapiDisplayMode *dst) + { ++#if defined(NV_DRM_DISPLAY_MODE_HAS_VREFRESH) + dst->timings.refreshRate = src->vrefresh * 1000; ++#else ++ dst->timings.refreshRate = drm_mode_vrefresh(src) * 1000; ++#endif + + dst->timings.pixelClockHz = src->clock * 1000; /* In Hz */ + +diff --git a/kernel/nvidia-uvm/uvm8_tools.c b/kernel/nvidia-uvm/uvm8_tools.c +index 86dbb77..63d0b64 100644 +--- a/kernel/nvidia-uvm/uvm8_tools.c ++++ b/kernel/nvidia-uvm/uvm8_tools.c +@@ -190,7 +190,6 @@ static uvm_tools_event_tracker_t *tools_event_tracker(struct file *filp) + { + long event_tracker = atomic_long_read((atomic_long_t *)&filp->private_data); + +- smp_read_barrier_depends(); + return (uvm_tools_event_tracker_t *)event_tracker; + } + +diff --git a/kernel/nvidia-uvm/uvm8_va_range.h b/kernel/nvidia-uvm/uvm8_va_range.h +index 8cae357..6166cc8 100644 +--- a/kernel/nvidia-uvm/uvm8_va_range.h ++++ b/kernel/nvidia-uvm/uvm8_va_range.h +@@ -717,7 +717,6 @@ static uvm_va_block_t *uvm_va_range_block(uvm_va_range_t *va_range, size_t index + // make sure that any initialization of this block by the creating thread is + // visible to later accesses in this thread, which requires a data + // dependency barrier. +- smp_read_barrier_depends(); + return block; + } + +diff --git a/kernel/nvidia/nv.c b/kernel/nvidia/nv.c +index 15983f6..cfb2375 100644 +--- a/kernel/nvidia/nv.c ++++ b/kernel/nvidia/nv.c +@@ -3872,7 +3872,9 @@ nvidia_probe + + #if defined(CONFIG_VGA_ARB) && !defined(NVCPU_PPC64LE) + #if defined(VGA_DEFAULT_DEVICE) ++#if defined(NV_VGA_TRYGET_PRESENT) + vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK); ++#endif + #endif + vga_set_legacy_decoding(dev, VGA_RSRC_NONE); + #endif diff --git a/x11-drivers/nvidia-drivers-legacy/files/nouveau.conf b/x11-drivers/nvidia-drivers-legacy/files/nouveau.conf new file mode 100644 index 00000000..00c6f588 --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/files/nouveau.conf @@ -0,0 +1,3 @@ +blacklist nouveau +options nouveau modeset=0 +alias nouveau off diff --git a/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.132-conf.patch b/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.132-conf.patch deleted file mode 100644 index 98bdd0bd..00000000 --- a/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.132-conf.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -Nur a/kernel/dkms.conf b/kernel/dkms.conf ---- a/kernel/dkms.conf 2018-03-22 05:39:53.000000000 +0000 -+++ b/kernel/dkms.conf 2018-04-09 16:18:23.177125417 +0100 -@@ -1,12 +1,20 @@ --PACKAGE_NAME="nvidia" --PACKAGE_VERSION="__VERSION_STRING" -+PACKAGE_NAME="nvidia-drivers-legacy-dkms" -+PACKAGE_VERSION="390.132" - 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} modules" -+MAKE[0]="'make' -j`nproc` NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} 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]="/extra/dkms" -+BUILT_MODULE_NAME[1]="nvidia-uvm" -+DEST_MODULE_LOCATION[1]="/extra/dkms" -+BUILT_MODULE_NAME[2]="nvidia-modeset" -+DEST_MODULE_LOCATION[2]="/extra/dkms" -+BUILT_MODULE_NAME[3]="nvidia-drm" -+DEST_MODULE_LOCATION[3]="/extra/dkms" -+ diff --git a/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.138-conf.patch b/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.138-conf.patch new file mode 100644 index 00000000..8bd7c1ce --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/files/nvidia-drivers-legacy-390.138-conf.patch @@ -0,0 +1,28 @@ +diff -Nur a/kernel/dkms.conf b/kernel/dkms.conf +--- a/kernel/dkms.conf 2018-03-22 05:39:53.000000000 +0000 ++++ b/kernel/dkms.conf 2018-04-09 16:18:23.177125417 +0100 +@@ -1,12 +1,20 @@ +-PACKAGE_NAME="nvidia" +-PACKAGE_VERSION="__VERSION_STRING" ++PACKAGE_NAME="nvidia-drivers-legacy-dkms" ++PACKAGE_VERSION="390.138" + 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} modules" ++MAKE[0]="'make' -j`nproc` NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} 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]="/extra/dkms" ++BUILT_MODULE_NAME[1]="nvidia-uvm" ++DEST_MODULE_LOCATION[1]="/extra/dkms" ++BUILT_MODULE_NAME[2]="nvidia-modeset" ++DEST_MODULE_LOCATION[2]="/extra/dkms" ++BUILT_MODULE_NAME[3]="nvidia-drm" ++DEST_MODULE_LOCATION[3]="/extra/dkms" ++ diff --git a/x11-drivers/nvidia-drivers-legacy/files/nvidia.conf b/x11-drivers/nvidia-drivers-legacy/files/nvidia.conf index 00c6f588..17351377 100644 --- a/x11-drivers/nvidia-drivers-legacy/files/nvidia.conf +++ b/x11-drivers/nvidia-drivers-legacy/files/nvidia.conf @@ -1,3 +1,20 @@ -blacklist nouveau -options nouveau modeset=0 -alias nouveau off +# Nvidia drivers support +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 + +# To tweak the driver the following options can be used, note that +# you should be careful, as it could cause instability!! For more +# options see /usr/share/doc/PACKAGE/README +# +# !!! SECURITY WARNING !!! +# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW +# WHAT YOU ARE DOING. +# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH, +# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE. +options nvidia \ + NVreg_DeviceFileGID=VIDEOGID \ + NVreg_DeviceFileMode=432 \ + NVreg_DeviceFileUID=0 \ + NVreg_ModifyDeviceFiles=1 \ + NVreg_PreserveVideoMemoryAllocations=1 \ + NVreg_TemporaryFilePath=/tmp diff --git a/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.132-r4.ebuild b/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.132-r4.ebuild deleted file mode 100644 index 82990b3e..00000000 --- a/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.132-r4.ebuild +++ /dev/null @@ -1,331 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -inherit eutils flag-o-matic multilib-minimal portability toolchain-funcs unpacker - -NV_URI="http://http.download.nvidia.com/XFree86/" -AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" - -DESCRIPTION="NVIDIA Accelerated Graphics Driver" -HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx" -SRC_URI="amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )" - -LICENSE="GPL-2 NVIDIA-r2" -SLOT="0" -KEYWORDS="-* ~amd64" -RESTRICT="bindist mirror" -EMULTILIB_PKG="true" - -IUSE="acpi compat +dkms libglvnd multilib +tools wayland +X" - -COMMON=" - X? ( - !libglvnd? ( >=app-eselect/eselect-opengl-1.0.9 ) - libglvnd? ( - media-libs/libglvnd[${MULTILIB_USEDEP}] - !app-eselect/eselect-opengl - ) - app-misc/pax-utils - )" -DEPEND="${COMMON}" -PDEPEND=" - tools? ( ~x11-misc/nvidia-settings-legacy-${PV}:${SLOT} )" -RDEPEND=" - ${COMMON} - !!x11-drivers/nvidia-drivers - acpi? ( sys-power/acpid ) - dkms? ( ~sys-kernel/${PN}-dkms-${PV}:${SLOT} ) - wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] ) - X? ( - =x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] - >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] - >=x11-libs/libvdpau-1.0[${MULTILIB_USEDEP}] - sys-libs/zlib[${MULTILIB_USEDEP}] - ) -" - -QA_PREBUILT="opt/* usr/lib*" - -PATCHES=( - "${FILESDIR}"/kernel-4.16.patch - "${FILESDIR}"/kernel-5.5.patch - "${FILESDIR}"/kernel-5.6.patch - "${FILESDIR}"/"${P}"-conf.patch -) - -S=${WORKDIR}/ - -pkg_setup() { - export DISTCC_DISABLE=1 - export CCACHE_DISABLE=1 - - NV_DOC="${S}" - NV_OBJ="${S}" - NV_SRC="${S}/kernel" - NV_MAN="${S}" - NV_X11="${S}" - NV_SOVER=${PV} -} - -src_prepare() { - default - local man_file - for man_file in "${NV_MAN}"/*1.gz; do - gunzip $man_file || die - done - - if ! [ -f nvidia_icd.json ]; then - cp nvidia_icd.json.template nvidia_icd.json || die - sed -i -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:g' nvidia_icd.json || die - fi -} - -# Install nvidia library: -# the first parameter is the library to install -# the second parameter is the provided soversion -# the third parameter is the target directory if it is not /usr/lib -donvidia() { - # Full path to library - nv_LIB="${1}" - - # SOVER to use - nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})" - - # Where to install - nv_DEST="${2}" - - # Get just the library name - nv_LIBNAME=$(basename "${nv_LIB}") - - if [[ "${nv_DEST}" ]]; then - exeinto ${nv_DEST} - action="doexe" - else - nv_DEST="/usr/$(get_libdir)" - action="dolib.so" - fi - - # Install the library - ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}" - - # If the library has a SONAME and SONAME does not match the library name, - # then we need to create a symlink - if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then - dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} - fi - - dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} -} - -src_install() { - # Xorg DDX && GLX, GLVND, Vulkan ICD - if use X; then - insinto /usr/$(get_libdir)/xorg/modules/drivers - doins ${NV_X11}/nvidia_drv.so - - donvidia ${NV_X11}/libglx.so.${NV_SOVER} \ - /usr/$(get_libdir)/nvidia/xorg - - if has_version '>=x11-base/xorg-server-1.16'; then - insinto /usr/share/X11/xorg.conf.d - newins "${FILESDIR}"/nvidia-drm-outputclass.conf 50-nvidia-drm-outputclass.conf - fi - - insinto /usr/share/glvnd/egl_vendor.d - doins ${NV_X11}/10_nvidia.json - - insinto /etc/vulkan/icd.d - doins ${NV_X11}/nvidia_icd.json - fi - - # Wayland - if use wayland; then - insinto /usr/share/egl/egl_external_platform.d - doins ${NV_X11}/10_nvidia_wayland.json - fi - - insinto /lib/modprobe.d - doins "${FILESDIR}"/nvidia.conf - - # NVIDIA kernel <-> userspace driver config lib - donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER} - - # NVIDIA framebuffer capture library - donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER} - - # NVIDIA video encode/decode <-> CUDA - donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER} - donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER} - - # OpenCL ICD for NVIDIA - insinto /etc/OpenCL/vendors - doins ${NV_OBJ}/nvidia.icd - - # Helper Apps - exeinto /opt/bin/ - - if use X; then - doexe ${NV_OBJ}/nvidia-xconfig - fi - - doexe ${NV_OBJ}/nvidia-cuda-mps-control - doexe ${NV_OBJ}/nvidia-cuda-mps-server - doexe ${NV_OBJ}/nvidia-debugdump - doexe ${NV_OBJ}/nvidia-persistenced - doexe ${NV_OBJ}/nvidia-smi - - # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092) - doexe ${NV_OBJ}/nvidia-modprobe - fowners root:video /opt/bin/nvidia-modprobe - fperms 4710 /opt/bin/nvidia-modprobe - dosym /{opt,usr}/bin/nvidia-modprobe - - # init - newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi - newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced - newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced - - # manpages - if use X ; then - doman "${NV_MAN}"/nvidia-xconfig.1 - fi - - doman "${NV_MAN}"/nvidia-smi.1 - doman "${NV_MAN}"/nvidia-cuda-mps-control.1 - doman "${NV_MAN}"/nvidia-modprobe.1 - doman "${NV_MAN}"/nvidia-persistenced.1 - - if has_multilib_profile && use multilib; then - local OABI=${ABI} - for ABI in $(get_install_abis); do - src_install-libs - done - ABI=${OABI} - unset OABI - else - src_install-libs - fi - - is_final_abi || die "failed to iterate through all ABIs" -} - -src_install-libs() { - local inslibdir=$(get_libdir) - if use libglvnd; then - local GL_ROOT="/usr/$(get_libdir)" - else - local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib" - fi - local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia" - local nv_libdir="${NV_OBJ}" - - if has_multilib_profile && [[ ${ABI} == "x86" ]]; then - nv_libdir="${NV_OBJ}"/32 - fi - - if use X; then - NV_GLX_LIBRARIES=( - "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}" - "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}" - "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}" - "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}" - "libOpenCL.so.1.0.0 ${CL_ROOT}" - "libcuda.so.${NV_SOVER}" - "libnvcuvid.so.${NV_SOVER}" - "libnvidia-compiler.so.${NV_SOVER}" - "libnvidia-eglcore.so.${NV_SOVER}" - "libnvidia-encode.so.${NV_SOVER}" - "libnvidia-fatbinaryloader.so.${NV_SOVER}" - "libnvidia-fbc.so.${NV_SOVER}" - "libnvidia-glcore.so.${NV_SOVER}" - "libnvidia-glsi.so.${NV_SOVER}" - "libnvidia-ifr.so.${NV_SOVER}" - "libnvidia-opencl.so.${NV_SOVER}" - "libnvidia-ptxjitcompiler.so.${NV_SOVER}" - "libvdpau_nvidia.so.${NV_SOVER}" - "libnvidia-ml.so.${NV_SOVER}" - "tls/libnvidia-tls.so.${NV_SOVER}" - ) - - if ! use libglvnd; then - NV_GLX_LIBRARIES+=( - "libEGL.so.$( [[ ${ABI} == "amd64" ]] && usex compat ${NV_SOVER} 1.1.0 || echo 1.1.0) ${GL_ROOT}" - "libGL.so.1.7.0 ${GL_ROOT}" - "libGLESv1_CM.so.1.2.0 ${GL_ROOT}" - "libGLESv2.so.2.1.0 ${GL_ROOT}" - "libGLX.so.0 ${GL_ROOT}" - "libGLdispatch.so.0 ${GL_ROOT}" - "libOpenGL.so.0 ${GL_ROOT}" - ) - fi - - if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]]; - then - NV_GLX_LIBRARIES+=( - "libnvidia-egl-wayland.so.1.0.2" - ) - fi - - if has_multilib_profile && [[ ${ABI} == "amd64" ]]; - then - NV_GLX_LIBRARIES+=( - "libnvidia-wfb.so.${NV_SOVER}" - ) - fi - - for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do - donvidia "${nv_libdir}"/${NV_LIB} - done - fi -} - -_dracut_initramfs_regen() { - if [ -x $(which dracut) ]; then - dracut -N -f --no-hostonly-cmdline - fi -} - -pkg_preinst() { - if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then - rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* - fi - - if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then - rm -f "${ROOT}"/etc/env.d/09nvidia - fi -} - -pkg_postinst() { - if ! use libglvnd; then - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia - fi - if ! use X; then - elog "You have selected to not install the X.org driver. Along with" - elog "this the OpenGL libraries and VDPAU libraries were not" - elog "installed. Additionally, once the driver is loaded your card" - elog "and fan will run at max speed which may not be desirable." - elog "Use the 'nvidia-smi' init script to have your card and fan" - elog "speed scale appropriately." - elog - fi - if [ $(stat -c %d:%i /) == $(stat -c %d:%i /proc/1/root/.) ]; then - _dracut_initramfs_regen - fi -} - -pkg_prerm() { - if ! use libglvnd; then - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 - fi -} - -pkg_postrm() { - if ! use libglvnd; then - use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 - fi - if [ $(stat -c %d:%i /) == $(stat -c %d:%i /proc/1/root/.) ]; then - _dracut_initramfs_regen - fi -} diff --git a/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.138.ebuild b/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.138.ebuild new file mode 100644 index 00000000..029b7f56 --- /dev/null +++ b/x11-drivers/nvidia-drivers-legacy/nvidia-drivers-legacy-390.138.ebuild @@ -0,0 +1,319 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +inherit eutils flag-o-matic multilib-minimal portability toolchain-funcs unpacker + +NV_URI="http://http.download.nvidia.com/XFree86/" +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" + +DESCRIPTION="NVIDIA Accelerated Graphics Driver" +HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx" +SRC_URI="amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )" + +LICENSE="GPL-2 NVIDIA-r2" +SLOT="0" +KEYWORDS="-* ~amd64" +RESTRICT="bindist mirror" +EMULTILIB_PKG="true" + +IUSE="acpi compat +dkms +libglvnd multilib +tools wayland +X" + +COMMON=" + X? ( + libglvnd? ( + media-libs/libglvnd[${MULTILIB_USEDEP}] + !app-eselect/eselect-opengl + ) + app-misc/pax-utils + )" +DEPEND="${COMMON}" +PDEPEND=" + tools? ( ~x11-misc/nvidia-settings-legacy-${PV}:${SLOT} )" +RDEPEND=" + ${COMMON} + !!x11-drivers/nvidia-drivers + acpi? ( sys-power/acpid ) + dkms? ( ~sys-kernel/${PN}-dkms-${PV}:${SLOT} ) + wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] ) + X? ( + =x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] + >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] + >=x11-libs/libvdpau-1.0[${MULTILIB_USEDEP}] + sys-libs/zlib[${MULTILIB_USEDEP}] + ) +" + +QA_PREBUILT="opt/* usr/lib*" + +PATCHES=( + "${FILESDIR}"/kernel-5.8.patch + "${FILESDIR}"/kernel-5.9.patch + "${FILESDIR}"/kernel-5.10.patch + "${FILESDIR}"/"${P}"-conf.patch +) + +S=${WORKDIR}/ + +pkg_setup() { + export DISTCC_DISABLE=1 + export CCACHE_DISABLE=1 + + NV_DOC="${S}" + NV_OBJ="${S}" + NV_SRC="${S}/kernel" + NV_MAN="${S}" + NV_X11="${S}" + NV_SOVER=${PV} +} + +src_prepare() { + default + local man_file + for man_file in "${NV_MAN}"/*1.gz; do + gunzip $man_file || die + done + + if ! [ -f nvidia_icd.json ]; then + cp nvidia_icd.json.template nvidia_icd.json || die + sed -i -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:g' nvidia_icd.json || die + fi +} + +# Install nvidia library: +# the first parameter is the library to install +# the second parameter is the provided soversion +# the third parameter is the target directory if it is not /usr/lib +donvidia() { + # Full path to library + nv_LIB="${1}" + + # SOVER to use + nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})" + + # Where to install + nv_DEST="${2}" + + # Get just the library name + nv_LIBNAME=$(basename "${nv_LIB}") + + if [[ "${nv_DEST}" ]]; then + exeinto ${nv_DEST} + action="doexe" + else + nv_DEST="/usr/$(get_libdir)" + action="dolib.so" + fi + + # Install the library + ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}" + + # If the library has a SONAME and SONAME does not match the library name, + # then we need to create a symlink + if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} + fi + + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} +} + +src_install() { + # Xorg DDX && GLX, GLVND, Vulkan ICD + if use X; then + insinto /usr/$(get_libdir)/xorg/modules/drivers + doins ${NV_X11}/nvidia_drv.so + + donvidia ${NV_X11}/libglx.so.${NV_SOVER} \ + /usr/$(get_libdir)/nvidia/xorg + + if has_version '>=x11-base/xorg-server-1.16'; then + insinto /usr/share/X11/xorg.conf.d + newins "${FILESDIR}"/nvidia-drm-outputclass.conf 50-nvidia-drm-outputclass.conf + fi + + insinto /usr/share/glvnd/egl_vendor.d + doins ${NV_X11}/10_nvidia.json + + insinto /etc/vulkan/icd.d + doins ${NV_X11}/nvidia_icd.json + fi + + # Wayland + if use wayland; then + insinto /usr/share/egl/egl_external_platform.d + doins ${NV_X11}/10_nvidia_wayland.json + fi + + insinto /etc/modprobe.d + doins "${FILESDIR}"/nvidia.conf + doins "${FILESDIR}"/nouveau.conf + + # NVIDIA kernel <-> userspace driver config lib + donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER} + + # NVIDIA framebuffer capture library + donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER} + + # NVIDIA video encode/decode <-> CUDA + donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER} + donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER} + + # OpenCL ICD for NVIDIA + insinto /etc/OpenCL/vendors + doins ${NV_OBJ}/nvidia.icd + + # Helper Apps + exeinto /opt/bin/ + + if use X; then + doexe ${NV_OBJ}/nvidia-xconfig + fi + + doexe ${NV_OBJ}/nvidia-cuda-mps-control + doexe ${NV_OBJ}/nvidia-cuda-mps-server + doexe ${NV_OBJ}/nvidia-debugdump + doexe ${NV_OBJ}/nvidia-persistenced + doexe ${NV_OBJ}/nvidia-smi + + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092) + doexe ${NV_OBJ}/nvidia-modprobe + fowners root:video /opt/bin/nvidia-modprobe + fperms 4710 /opt/bin/nvidia-modprobe + dosym /{opt,usr}/bin/nvidia-modprobe + + # init + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced + + # manpages + if use X ; then + doman "${NV_MAN}"/nvidia-xconfig.1 + fi + + doman "${NV_MAN}"/nvidia-smi.1 + doman "${NV_MAN}"/nvidia-cuda-mps-control.1 + doman "${NV_MAN}"/nvidia-modprobe.1 + doman "${NV_MAN}"/nvidia-persistenced.1 + + if has_multilib_profile && use multilib; then + local OABI=${ABI} + for ABI in $(get_install_abis); do + src_install-libs + done + ABI=${OABI} + unset OABI + else + src_install-libs + fi + + is_final_abi || die "failed to iterate through all ABIs" +} + +src_install-libs() { + local inslibdir=$(get_libdir) + if use libglvnd; then + local GL_ROOT="/usr/$(get_libdir)" + else + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib" + fi + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia" + local nv_libdir="${NV_OBJ}" + + if has_multilib_profile && [[ ${ABI} == "x86" ]]; then + nv_libdir="${NV_OBJ}"/32 + fi + + if use X; then + NV_GLX_LIBRARIES=( + "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libOpenCL.so.1.0.0 ${CL_ROOT}" + "libcuda.so.${NV_SOVER}" + "libnvcuvid.so.${NV_SOVER}" + "libnvidia-compiler.so.${NV_SOVER}" + "libnvidia-eglcore.so.${NV_SOVER}" + "libnvidia-encode.so.${NV_SOVER}" + "libnvidia-fatbinaryloader.so.${NV_SOVER}" + "libnvidia-fbc.so.${NV_SOVER}" + "libnvidia-glcore.so.${NV_SOVER}" + "libnvidia-glsi.so.${NV_SOVER}" + "libnvidia-ifr.so.${NV_SOVER}" + "libnvidia-opencl.so.${NV_SOVER}" + "libnvidia-ptxjitcompiler.so.${NV_SOVER}" + "libvdpau_nvidia.so.${NV_SOVER}" + "libnvidia-ml.so.${NV_SOVER}" + "tls/libnvidia-tls.so.${NV_SOVER}" + ) + + if ! use libglvnd; then + NV_GLX_LIBRARIES+=( + "libEGL.so.$( [[ ${ABI} == "amd64" ]] && usex compat ${NV_SOVER} 1.1.0 || echo 1.1.0) ${GL_ROOT}" + "libGL.so.1.7.0 ${GL_ROOT}" + "libGLESv1_CM.so.1.2.0 ${GL_ROOT}" + "libGLESv2.so.2.1.0 ${GL_ROOT}" + "libGLX.so.0 ${GL_ROOT}" + "libGLdispatch.so.0 ${GL_ROOT}" + "libOpenGL.so.0 ${GL_ROOT}" + ) + fi + + if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]]; + then + NV_GLX_LIBRARIES+=( + "libnvidia-egl-wayland.so.1.0.2" + ) + fi + + if has_multilib_profile && [[ ${ABI} == "amd64" ]]; + then + NV_GLX_LIBRARIES+=( + "libnvidia-wfb.so.${NV_SOVER}" + ) + fi + + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do + donvidia "${nv_libdir}"/${NV_LIB} + done + fi +} + +_dracut_initramfs_regen() { + if [ -x $(which dracut) ]; then + dracut -N -f --no-hostonly-cmdline + fi +} + +pkg_preinst() { + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* + fi + + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then + rm -f "${ROOT}"/etc/env.d/09nvidia + fi +} + +pkg_postinst() { + if ! use X; then + elog "You have selected to not install the X.org driver. Along with" + elog "this the OpenGL libraries and VDPAU libraries were not" + elog "installed. Additionally, once the driver is loaded your card" + elog "and fan will run at max speed which may not be desirable." + elog "Use the 'nvidia-smi' init script to have your card and fan" + elog "speed scale appropriately." + elog + fi + if [ $(stat -c %d:%i /) == $(stat -c %d:%i /proc/1/root/.) ]; then + _dracut_initramfs_regen + fi +} + +pkg_postrm() { + if [ $(stat -c %d:%i /) == $(stat -c %d:%i /proc/1/root/.) ]; then + _dracut_initramfs_regen + fi +} -- cgit v1.2.3