Package Base Details: nvidia-340xx

Git Clone URL: https://aur.archlinux.org/nvidia-340xx.git (read-only, click to copy)
Submitter: simonsmh
Maintainer: JerryXiao (taz-007)
Last Packager: taz-007
Votes: 52
Popularity: 1.93
First Submitted: 2019-06-07 10:29
Last Updated: 2021-07-25 08:24

Pinned Comments

graysky commented on 2021-05-10 15:03

OK, I honestly forgot that I included an example config file. Since I don't have the hardware for testing, and since I still don't have a sense from users that it is a requirement, I will leave it in the post_install and depend on the user's ability to read pacman's output and manually copy the example over.

Latest Comments

1 2 3 4 5 6 ... Next › Last »

taz-007 commented on 2021-07-25 08:30

dup line should be fixed now

ismaail commented on 2021-07-24 16:35

in PKGBUILD, the line 32 is duplicated.

b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028'
        'a0266d62a742f8ecd96be767b66af169c09428ba3f718efa1e36f2c69303e35b6437503381b041dd3a88fa86eb82909f8cbf209dbba4a5658fd7bb220a852000'
        '7150233df867a55f57aa5e798b9c7618329d98459fecc35c4acfad2e9772236cb229703c4fa072381c509279d0588173d65f46297231f4d3bfc65a1ef52e65b1'
        'b436095b89d6e294995651a3680ff18b5af5e91582c3f1ec9b7b63be9282497f54f9bf9be3997a5af30eec9b8548f25ec5235d969ac00a667a9cddece63d8896'
        '947cb1f149b2db9c3c4f973f285d389790f73fc8c8a6865fc5b78d6a782f49513aa565de5c82a81c07515f1164e0e222d26c8212a14cf016e387bcc523e3fcb1'
        '665bf0e1fa22119592e7c75ff40f265e919955f228a3e3e3ebd76e9dffa5226bece5eb032922eb2c009572b31b28e80cd89656f5d0a4ad592277edd98967e68f'
        '344cd3a9888a9a61941906c198d3a480ce230119c96c72c72a74b711d23face2a7b1e53b9b4639465809b84762cdc53f38210e740318866705241bc4216e4f35')
        '344cd3a9888a9a61941906c198d3a480ce230119c96c72c72a74b711d23face2a7b1e53b9b4639465809b84762cdc53f38210e740318866705241bc4216e4f35')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"

removing the line 33 fixes the issue.

bigbruno commented on 2021-07-24 16:15

I tested it at that time:

Building nvidia-340xx... /var/tmp/pamac-build-bruno/nvidia-340xx/PKGBUILD: line 33: syntax error near unexpected token )' /var/tmp/pamac-build-bruno/nvidia-340xx/PKGBUILD: line 33: '344cd3a9888a9a61941906c198d3a480ce230119c96c72c72a74b711d23face2a7b1e53b9b4639465809b84762cdc53f38210e740318866705241bc4216e4f35')' ==> ERROR: Failed to source /var/tmp/pamac-build-bruno/nvidia-340xx/PKGBUILD

RottenSchnitzel commented on 2021-07-24 15:52

There is a Syntax Error in the PKGBUILD (line 32 duplicate)

taz-007 commented on 2021-07-24 10:08

for the lazy people who cant wait (like me), I've updated the repo with the mentioned patch from the comments and pushed it to a temp branch on https://gitlab.com/taz007/nvidia-340xx . Tested the dkms package on 5.13.4 kernel, sddm is working.

NSLW commented on 2021-07-18 19:26

@piquer Please look at the official repo at https://github.com/rpmfusion/nvidia-340xx-kmod and particulary at https://github.com/rpmfusion/nvidia-340xx-kmod/blob/master/kernel-5.11.patch The maintainer of this repo decided to reformat my two patches into a single patch, but other than that it should be the same content. The patch is already merged and public to all Fedora users, so it works.

alou-S commented on 2021-07-18 10:18

Okay the patch from the particular nuked commit you gave worked perfectly. Somebody needs to update the AUR package now.

piquer commented on 2021-07-18 07:49

There seems to have been a force push on https://github.com/wojnilowicz/nvidia-340xx-kmod master a couple of days after I pulled it. I'm using

commit 621934ffcc439c9873e2ebe8acda7ad440813981 (HEAD -> master)
Author: Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
Date:   Mon May 24 21:00:11 2021 +0200

    Initialize nvidia-drm on kernel-5.11

    Makes /dev/dri/card0 appear again and enables sddm to show greeter.

which is the file posted below, except editing the diff headers as mentioned in https://aur.archlinux.org/pkgbase/nvidia-340xx/?O=10&PP=10#comment-809967.

The current head of master is

commit 148afb60f2bc4850b50cb8c2cc9455885dff1ac9 (origin/master, origin/HEAD)                                                                                                                                 
Author: Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
Date:   Mon May 24 21:00:11 2021 +0200

    Initialize nvidia-drm on kernel-5.11

    Makes /dev/dri/card0 appear again and enables sddm to show greeter.

    Code in import-files-from-390.143.patch and conftest.Kbuild comes from
    NVIDIA-Linux-x86_64-390.143.run.

About this change one would have to ask Łukasz I guess.

└─>  git --no-pager diff --stat 148afb6 621934f                                                                                                                                                        129 <
 import-files-from-390.143.patch | 7221 --------------------------------------------------------------------------------------------------------------------------------------------------------------------
 kernel-5.11.patch               | 1490 +++-------------------------------
 nvidia-340xx-kmod.spec          |   11 +-
 3 files changed, 122 insertions(+), 8600 deletions(-)

alou-S commented on 2021-07-18 05:58

@piquer The patch you have mentioned is different from the one found in https://github.com/wojnilowicz/nvidia-340xx-kmod

I also checked the original repo by rpmfusion but even that is not similar to the patch you used.

Is it possible for you to give the source you got yours from or just give your particular patch since the one on rpmfusion doesn't work neither does the fork by wojnilowicz.

piquer commented on 2021-07-17 14:47

No, I didn't see rejected hunks. For reference, I used this patch as 0005-kernel-5.11.patch:

diff -Naur ./a/kernel/conftest.sh ./b/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-340.108-old/kernel/conftest.sh  2021-05-24 20:08:18.743742335 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/conftest.sh  2021-05-24 20:13:18.019314390 +0200
@@ -1578,21 +1578,21 @@
             #include <drm/drm_drv.h>
             #endif

-            #if defined(NV_DRM_DRM_PRIME_H_PRESENT)
-            #include <drm/drm_prime.h>
-            #endif
-
             #if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
             #error DRM not enabled
             #endif
+
             void conftest_drm_available(void) {
                 struct drm_driver drv;
-                drv.gem_prime_pin = 0;
-                drv.gem_prime_get_sg_table = 0;
-                drv.gem_prime_vmap = 0;
-                drv.gem_prime_vunmap = 0;
-                (void)drm_gem_prime_import;
-                (void)drm_gem_prime_export;
+
+                /* 2013-10-02 1bb72532ac260a2d3982b40bdd4c936d779d0d16 */
+                (void)drm_dev_alloc;
+
+                /* 2013-10-02 c22f0ace1926da399d9a16dfaf09174c1b03594c */
+                (void)drm_dev_register;
+
+                /* 2013-10-02 c3a49737ef7db0bdd4fcf6cf0b7140a883e32b2a */
+                (void)drm_dev_unregister;
             }"

             compile_check_conftest "$CODE" "NV_DRM_AVAILABLE" "" "generic"
diff -Naur ./a/kernel/nv-drm.c ./b/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-drm.c 2021-05-24 20:08:18.779739237 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2021-05-24 20:42:13.443288819 +0200
@@ -60,6 +60,8 @@
 #else
 #include <drm/drm_agpsupport.h>

+#include "linux/dma-buf.h"
+
 struct nv_drm_agp_head {
     struct agp_kern_info agp_info;
     struct list_head memory;
@@ -210,8 +212,10 @@

     /* No locking needed since shadow-attach is single-threaded since it may
      * only be called from the per-driver module init hook. */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
     if (drm_core_check_feature(dev, DRIVER_LEGACY))
         list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
+#endif

     return 0;

@@ -239,8 +243,10 @@
     if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
         return -EINVAL;

+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
     /* If not using KMS, fall back to stealth mode manual scanning. */
     INIT_LIST_HEAD(&driver->legacy_dev_list);
+#endif
     for (i = 0; pdriver->id_table[i].vendor != 0; i++) {
         pid = &pdriver->id_table[i];

@@ -273,11 +279,13 @@
     if (!(driver->driver_features & DRIVER_LEGACY)) {
         WARN_ON(1);
     } else {
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
         list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
                      legacy_dev_list) {
             list_del(&dev->legacy_dev_list);
             drm_put_dev(dev);
         }
+#endif
     }
     DRM_INFO("Module unloaded\n");
 }
@@ -402,6 +410,39 @@
     .llseek = noop_llseek,
 };

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+struct sg_table *nv_drm_gem_prime_get_sg_table(struct drm_gem_object *gem)
+{
+    return nv_gem_prime_get_sg_table(gem);
+}
+
+static int nv_drm_gem_vmap(struct drm_gem_object *gem,
+                           struct dma_buf_map *map)
+{
+    map->vaddr = nv_gem_prime_vmap(gem);
+    if (map->vaddr == NULL) {
+        return -ENOMEM;
+    }
+    map->is_iomem = true;
+    return 0;
+}
+
+static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
+                              struct dma_buf_map *map)
+{
+    nv_gem_prime_vunmap(gem, map->vaddr);
+    map->vaddr = NULL;
+}
+
+static struct drm_gem_object_funcs nv_drm_gem_object_funcs = {
+  .free = nv_gem_free,
+  .export = drm_gem_prime_export,
+  .get_sg_table = nv_drm_gem_prime_get_sg_table,
+  .vmap = nv_drm_gem_vmap,
+  .vunmap = nv_drm_gem_vunmap,
+};
+#endif
+
 static struct drm_driver nv_drm_driver = {

     .driver_features = DRIVER_GEM
@@ -420,17 +461,19 @@
     .set_busid = drm_pci_set_busid,
 #endif

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
-    .gem_free_object_unlocked = nv_gem_free,
-#else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 8, 0)
     .gem_free_object = nv_gem_free,
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
+    .gem_free_object_unlocked = nv_gem_free,
 #endif

     .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
     .gem_prime_export = drm_gem_prime_export,
     .gem_prime_get_sg_table = nv_gem_prime_get_sg_table,
     .gem_prime_vmap = nv_gem_prime_vmap,
     .gem_prime_vunmap = nv_gem_prime_vunmap,
+#endif

     .name = "nvidia-drm",
     .desc = "NVIDIA DRM driver",
diff -Naur ./a/kernel/nv-linux.h ./b/kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h   2021-05-24 20:08:18.775739581 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h   2021-05-24 20:09:18.748287771 +0200
@@ -119,7 +119,9 @@
 #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
 #include <linux/cpu.h>              /* CPU hotplug support              */
 #endif
-#include <asm/kmap_types.h>         /* page table entry lookup          */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+   #include <asm/kmap_types.h>         /* page table entry lookup          */
+#endif

 #include <linux/pci.h>              /* pci_find_class, etc              */
 #include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
diff -Naur ./a/kernel/uvm/nvidia_uvm_linux.h ./b/kernel/uvm/nvidia_uvm_linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/uvm/nvidia_uvm_linux.h   2021-05-24 20:08:18.775739581 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/uvm/nvidia_uvm_linux.h   2021-05-24 20:09:18.749287739 +0200
@@ -141,7 +141,9 @@
 #if !defined(NV_VMWARE)
 #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
 #endif
-#include <asm/kmap_types.h>         /* page table entry lookup          */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
+   #include <asm/kmap_types.h>         /* page table entry lookup          */
+#endif

 #include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
 #include <linux/timer.h>