[packages/xorg-driver-video-nvidia-legacy-340xx] - fix building with kernel 5.0

baggins baggins at pld-linux.org
Sun Mar 10 19:38:01 CET 2019


commit d9f3077feaa2b0b1e736dfcb7f44f882ba0d7ee6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Mar 10 19:37:34 2019 +0100

    - fix building with kernel 5.0

 kernel-5.0.patch                           | 100 +++++++++++++++++++++++++++++
 xorg-driver-video-nvidia-legacy-340xx.spec |   2 +
 2 files changed, 102 insertions(+)
---
diff --git a/xorg-driver-video-nvidia-legacy-340xx.spec b/xorg-driver-video-nvidia-legacy-340xx.spec
index d46f5af..cea6d47 100644
--- a/xorg-driver-video-nvidia-legacy-340xx.spec
+++ b/xorg-driver-video-nvidia-legacy-340xx.spec
@@ -49,6 +49,7 @@ Patch0:		X11-driver-nvidia-GL.patch
 Patch1:		X11-driver-nvidia-desktop.patch
 Patch2:		linux-4.0.patch
 Patch3:		kernel-4.4.169.patch
+Patch4:		kernel-5.0.patch
 URL:		http://www.nvidia.com/object/unix.html
 BuildRequires:	rpmbuild(macros) >= 1.701
 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
@@ -252,6 +253,7 @@ rm -rf NVIDIA-Linux-x86*-%{version}*
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 echo 'EXTRA_CFLAGS += -Wno-pointer-arith -Wno-sign-compare -Wno-unused' >> kernel/Makefile.kbuild
 
 %build
diff --git a/kernel-5.0.patch b/kernel-5.0.patch
new file mode 100644
index 0000000..bd31dbe
--- /dev/null
+++ b/kernel-5.0.patch
@@ -0,0 +1,100 @@
+--- NVIDIA-Linux-x86_64-340.107-no-compat32/kernel/nv-drm.c~	2018-05-25 06:16:20.000000000 +0200
++++ NVIDIA-Linux-x86_64-340.107-no-compat32/kernel/nv-drm.c	2019-03-10 19:24:36.332454128 +0100
+@@ -252,7 +252,11 @@
+         goto done;
+     }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
+     drm_gem_object_unreference_unlocked(&nv_obj->base);
++#else
++    drm_gem_object_put_unlocked(&nv_obj->base);
++#endif
+ 
+     status = RM_OK;
+ 
+--- NVIDIA-Linux-x86_64-340.107-no-compat32/kernel/os-interface.c~	2018-05-25 06:16:20.000000000 +0200
++++ NVIDIA-Linux-x86_64-340.107-no-compat32/kernel/os-interface.c	2019-03-10 19:27:08.183087615 +0100
+@@ -13,6 +13,7 @@
+ 
+ #include "os-interface.h"
+ #include "nv-linux.h"
++#include <linux/ktime.h>
+ 
+ RM_STATUS NV_API_CALL os_disable_console_access(void)
+ {
+@@ -433,6 +433,21 @@
+ *   Name: osGetCurrentTime
+ *
+ *****************************************************************************/
++static inline void nv_gettimeofday(struct timeval *tv)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
++    do_gettimeofday(tv);
++#else
++    struct timespec64 now;
++
++    ktime_get_real_ts64(&now);
++
++    *tv = (struct timeval) {
++        .tv_sec = now.tv_sec,
++        .tv_usec = now.tv_nsec/1000,
++    };
++#endif
++}
+ 
+ RM_STATUS NV_API_CALL os_get_current_time(
+     NvU32 *seconds,
+@@ -441,7 +456,7 @@
+ {
+     struct timeval tm;
+ 
+-    do_gettimeofday(&tm);
++    nv_gettimeofday(&tm);
+ 
+     *seconds = tm.tv_sec;
+     *useconds = tm.tv_usec;
+@@ -485,7 +491,7 @@
+ #ifdef NV_CHECK_DELAY_ACCURACY
+     struct timeval tm1, tm2;
+ 
+-    do_gettimeofday(&tm1);
++    nv_gettimeofday(&tm1);
+ #endif
+ 
+     if (in_irq() && (MicroSeconds > NV_MAX_ISR_DELAY_US))
+@@ -500,7 +506,7 @@
+         udelay(usec);
+ 
+ #ifdef NV_CHECK_DELAY_ACCURACY
+-    do_gettimeofday(&tm2);
++    nv_gettimeofday(&tm2);
+     nv_printf(NV_DBG_ERRORS, "NVRM: osDelayUs %d: 0x%x 0x%x\n",
+         MicroSeconds, tm2.tv_sec - tm1.tv_sec, tm2.tv_usec - tm1.tv_usec);
+ #endif
+@@ -528,7 +534,7 @@
+     struct timeval tm_start;
+ #endif
+ 
+-    do_gettimeofday(&tm_aux);
++    nv_gettimeofday(&tm_aux);
+ #ifdef NV_CHECK_DELAY_ACCURACY
+     tm_start = tm_aux;
+ #endif
+@@ -562,7 +568,7 @@
+         do
+         {
+             schedule_timeout(jiffies);
+-            do_gettimeofday(&tm_aux);
++            nv_gettimeofday(&tm_aux);
+             if (NV_TIMERCMP(&tm_aux, &tm_end, <))
+             {
+                 NV_TIMERSUB(&tm_end, &tm_aux, &tm_aux);
+@@ -584,7 +590,7 @@
+         udelay(MicroSeconds);
+     }
+ #ifdef NV_CHECK_DELAY_ACCURACY
+-    do_gettimeofday(&tm_aux);
++    nv_gettimeofday(&tm_aux);
+     timersub(&tm_aux, &tm_start, &tm_aux);
+     nv_printf(NV_DBG_ERRORS, "NVRM: osDelay %dmsec: %d.%06dsec\n",
+         MilliSeconds, tm_aux.tv_sec, tm_aux.tv_usec);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-340xx.git/commitdiff/d9f3077feaa2b0b1e736dfcb7f44f882ba0d7ee6



More information about the pld-cvs-commit mailing list