David Haller <gen...@dhaller.de> [16-07-30 13:24]:
> Hello,
> 
> On Sat, 30 Jul 2016, meino.cra...@gmx.de wrote:
> >trying the new kernel linux-4.7 (vanilla, downloaded from
> >ftp.kernel.org) with nvidia drivers 
> >(Installed versions:  367.35-r1^md(03:00:46 07/30/16)(X driver kms
> >multilib uvm -acpi -compat -gtk3 -pax_kernel -static-libs -tools
> >-wayland KERNEL="linux -FreeBSD")).
> >The kernel compiled fine, the nvidia-drivers does not.
> >
> >Anuone else with the same problem (read: This has to be
> >fixed by nvidia/Linus) or am I the only one (so it is
> >my problem...which does not neccessarily imply that I
> >know how to fix that ... ;) ???
> 
> I've got it working with the attached patch in
> /etc/portage/patches/x11-drivers/nvidia-drivers-367.35/
> 
> I've no idea though, if I hit that codepath yet. Should work though,
> as the patch makes the module use the kernel function and what I read
> about radix_tree_gang_lookup() it should be ok this way.
> 
> But do not expect anything to work ;)
> 
> I'm courious what the official patch will be ;) The first part
> (patching kernel/nvidia-drm/nvidia-drm-{fb,gem}.c) I've found online.
> 
> HTH,
> -dnh
> 
> -- 
> Please do not think so much about licenses, it will just make your head
> explode if not carefully studied over the years ;)
>                               -- Marcus Meissner

Content-Description: 
/etc/portage/patches/x11-drivers/nvidia-drivers-367.35/nvidia-drivers-367.35-kernel-4.7.0.patch
> diff -purN a/kernel/nvidia-drm/nvidia-drm-fb.c 
> b/kernel/nvidia-drm/nvidia-drm-fb.c
> --- a/kernel/nvidia-drm/nvidia-drm-fb.c       2016-07-12 06:53:45.000000000 
> +0200
> +++ b/kernel/nvidia-drm/nvidia-drm-fb.c       2016-07-28 09:43:11.494515158 
> +0200
> @@ -32,6 +32,8 @@
>  
>  #include <drm/drm_crtc_helper.h>
>  
> +#include <linux/version.h>
> +
>  static void nvidia_framebuffer_destroy(struct drm_framebuffer *fb)
>  {
>      struct nvidia_drm_device *nv_dev = fb->dev->dev_private;
> @@ -114,7 +116,11 @@ static struct drm_framebuffer *internal_
>       * We don't support any planar format, pick up first buffer only.
>       */
>  
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
> +    gem = drm_gem_object_lookup(file, cmd->handles[0]);
> +#else
>      gem = drm_gem_object_lookup(dev, file, cmd->handles[0]);
> +#endif
>  
>      if (gem == NULL)
>      {
> diff -purN a/kernel/nvidia-drm/nvidia-drm-gem.c 
> b/kernel/nvidia-drm/nvidia-drm-gem.c
> --- a/kernel/nvidia-drm/nvidia-drm-gem.c      2016-07-12 06:53:45.000000000 
> +0200
> +++ b/kernel/nvidia-drm/nvidia-drm-gem.c      2016-07-28 09:27:24.610637573 
> +0200
> @@ -28,6 +28,8 @@
>  #include "nvidia-drm-ioctl.h"
>  #include "nvidia-drm-gem.h"
>  
> +#include <linux/version.h>
> +
>  static struct nvidia_drm_gem_object *nvidia_drm_gem_new
>  (
>      struct drm_file *file_priv,
> @@ -408,7 +410,11 @@ int nvidia_drm_dumb_map_offset
>  
>      mutex_lock(&dev->struct_mutex);
>  
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
> +    gem = drm_gem_object_lookup(file, handle);
> +#else
>      gem = drm_gem_object_lookup(dev, file, handle);
> +#endif
>  
>      if (gem == NULL)
>      {
> diff -purN a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h
> --- a/kernel/nvidia-uvm/uvm_linux.h   2016-07-12 06:52:17.000000000 +0200
> +++ b/kernel/nvidia-uvm/uvm_linux.h   2016-07-28 09:29:21.096322608 +0200
> @@ -554,11 +554,13 @@ static void uvm_init_radix_tree_preloada
>      INIT_RADIX_TREE(tree, GFP_NOWAIT);
>  }
>  
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
>  static bool radix_tree_empty(struct radix_tree_root *tree)
>  {
>      void *dummy;
>      return radix_tree_gang_lookup(tree, &dummy, 0, 1) == 0;
>  }
> +#endif
>  
>  
>  #if !defined(NV_USLEEP_RANGE_PRESENT)


Hi David,

WHOW! Thanks a lot for the patch!

Short qyestion: How can I apply it...I mean...as soon as I do an
emerge, either the original source will be unpacked or my package
will be rejected for being modified an different from the one, which
does not compile...

?

Best regards,
Meino



Reply via email to