Hello,
On Fri, 05 Aug 2016, Mike Gilbert wrote:
>On Fri, Aug 5, 2016 at 3:10 PM, Natanael Olaiz <nol...@gmail.com> wrote:
>> I know that. But the patch should be applied *only* for versions of kernels
>> 4.7+. So, I'm asking how is the policy for that.
>
>If you're asking for policy: The Gentoo packaging policy is not to do
>conditional patching. Instead, modify the patch so that the resulting
>code works for both cases. This can generally be accomplished via
>pre-processor macros.
My patch does it like that. See
https://archives.gentoo.org/gentoo-user/message/baa36d14d8cdbf58404267ee2ffd34ea
Just dumping the attached patch into
/etc/portage/patches/x11-drivers/nvidia-drivers-367.35/
(and making it readable for the portage user) is sufficient.
HTH,
-dnh
--
Every feature is a bug, unless it can be turned off. -- Karl Heuer
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)