Gentoo Archives: gentoo-user

From: Meino.Cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] NVidia drivers and vanilla kernel Linux 4.7.0 anyone?
Date: Sat, 30 Jul 2016 17:54:39
Message-Id: 20160730175424.GH4615@solfire
In Reply to: Re: [gentoo-user] NVidia drivers and vanilla kernel Linux 4.7.0 anyone? by David Haller
1 David Haller <gentoo@×××××××.de> [16-07-30 13:24]:
2 > Hello,
3 >
4 > On Sat, 30 Jul 2016, Meino.Cramer@×××.de wrote:
5 > >trying the new kernel linux-4.7 (vanilla, downloaded from
6 > >ftp.kernel.org) with nvidia drivers
7 > >(Installed versions: 367.35-r1^md(03:00:46 07/30/16)(X driver kms
8 > >multilib uvm -acpi -compat -gtk3 -pax_kernel -static-libs -tools
9 > >-wayland KERNEL="linux -FreeBSD")).
10 > >The kernel compiled fine, the nvidia-drivers does not.
11 > >
12 > >Anuone else with the same problem (read: This has to be
13 > >fixed by nvidia/Linus) or am I the only one (so it is
14 > >my problem...which does not neccessarily imply that I
15 > >know how to fix that ... ;) ???
16 >
17 > I've got it working with the attached patch in
18 > /etc/portage/patches/x11-drivers/nvidia-drivers-367.35/
19 >
20 > I've no idea though, if I hit that codepath yet. Should work though,
21 > as the patch makes the module use the kernel function and what I read
22 > about radix_tree_gang_lookup() it should be ok this way.
23 >
24 > But do not expect anything to work ;)
25 >
26 > I'm courious what the official patch will be ;) The first part
27 > (patching kernel/nvidia-drm/nvidia-drm-{fb,gem}.c) I've found online.
28 >
29 > HTH,
30 > -dnh
31 >
32 > --
33 > Please do not think so much about licenses, it will just make your head
34 > explode if not carefully studied over the years ;)
35 > -- Marcus Meissner
36
37 Content-Description: /etc/portage/patches/x11-drivers/nvidia-drivers-367.35/nvidia-drivers-367.35-kernel-4.7.0.patch
38 > diff -purN a/kernel/nvidia-drm/nvidia-drm-fb.c b/kernel/nvidia-drm/nvidia-drm-fb.c
39 > --- a/kernel/nvidia-drm/nvidia-drm-fb.c 2016-07-12 06:53:45.000000000 +0200
40 > +++ b/kernel/nvidia-drm/nvidia-drm-fb.c 2016-07-28 09:43:11.494515158 +0200
41 > @@ -32,6 +32,8 @@
42 >
43 > #include <drm/drm_crtc_helper.h>
44 >
45 > +#include <linux/version.h>
46 > +
47 > static void nvidia_framebuffer_destroy(struct drm_framebuffer *fb)
48 > {
49 > struct nvidia_drm_device *nv_dev = fb->dev->dev_private;
50 > @@ -114,7 +116,11 @@ static struct drm_framebuffer *internal_
51 > * We don't support any planar format, pick up first buffer only.
52 > */
53 >
54 > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
55 > + gem = drm_gem_object_lookup(file, cmd->handles[0]);
56 > +#else
57 > gem = drm_gem_object_lookup(dev, file, cmd->handles[0]);
58 > +#endif
59 >
60 > if (gem == NULL)
61 > {
62 > diff -purN a/kernel/nvidia-drm/nvidia-drm-gem.c b/kernel/nvidia-drm/nvidia-drm-gem.c
63 > --- a/kernel/nvidia-drm/nvidia-drm-gem.c 2016-07-12 06:53:45.000000000 +0200
64 > +++ b/kernel/nvidia-drm/nvidia-drm-gem.c 2016-07-28 09:27:24.610637573 +0200
65 > @@ -28,6 +28,8 @@
66 > #include "nvidia-drm-ioctl.h"
67 > #include "nvidia-drm-gem.h"
68 >
69 > +#include <linux/version.h>
70 > +
71 > static struct nvidia_drm_gem_object *nvidia_drm_gem_new
72 > (
73 > struct drm_file *file_priv,
74 > @@ -408,7 +410,11 @@ int nvidia_drm_dumb_map_offset
75 >
76 > mutex_lock(&dev->struct_mutex);
77 >
78 > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
79 > + gem = drm_gem_object_lookup(file, handle);
80 > +#else
81 > gem = drm_gem_object_lookup(dev, file, handle);
82 > +#endif
83 >
84 > if (gem == NULL)
85 > {
86 > diff -purN a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
87 > --- a/kernel/nvidia-uvm/uvm_linux.h 2016-07-12 06:52:17.000000000 +0200
88 > +++ b/kernel/nvidia-uvm/uvm_linux.h 2016-07-28 09:29:21.096322608 +0200
89 > @@ -554,11 +554,13 @@ static void uvm_init_radix_tree_preloada
90 > INIT_RADIX_TREE(tree, GFP_NOWAIT);
91 > }
92 >
93 > +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
94 > static bool radix_tree_empty(struct radix_tree_root *tree)
95 > {
96 > void *dummy;
97 > return radix_tree_gang_lookup(tree, &dummy, 0, 1) == 0;
98 > }
99 > +#endif
100 >
101 >
102 > #if !defined(NV_USLEEP_RANGE_PRESENT)
103
104
105 Hi David,
106
107 WHOW! Thanks a lot for the patch!
108
109 Short qyestion: How can I apply it...I mean...as soon as I do an
110 emerge, either the original source will be unpacked or my package
111 will be rejected for being modified an different from the one, which
112 does not compile...
113
114 ?
115
116 Best regards,
117 Meino

Replies