Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2024 01:49:05 GMT
From:      Gleb Popov <arrowd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: a9f65f905038 - main - graphics/nvidia-drm-510-kmod: Fix compilation with the v550 NVidia driver
Message-ID:  <202403160149.42G1n52Q093727@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a9f65f9050383d817ee3aa652bfdb07119647e7b

commit a9f65f9050383d817ee3aa652bfdb07119647e7b
Author:     Austin Shafer <ashafer@badland.io>
AuthorDate: 2024-03-16 01:22:52 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-03-16 01:47:15 +0000

    graphics/nvidia-drm-510-kmod: Fix compilation with the v550 NVidia driver
    
    Differential Revision: https://reviews.freebsd.org/D44305
---
 graphics/nvidia-drm-510-kmod/Makefile              |  6 ++
 .../files/extra-patch-conftest.sh                  | 83 ++++++++++++++++++++++
 .../files/patch-nvidia-drm-conftest.h              | 14 ++++
 3 files changed, 103 insertions(+)

diff --git a/graphics/nvidia-drm-510-kmod/Makefile b/graphics/nvidia-drm-510-kmod/Makefile
index 329241a95ff5..ae46d3bf2289 100644
--- a/graphics/nvidia-drm-510-kmod/Makefile
+++ b/graphics/nvidia-drm-510-kmod/Makefile
@@ -6,5 +6,11 @@ CONFLICTS_INSTALL=	nvidia-drm-515-kmod nvidia-drm-61-kmod
 
 .include "${.CURDIR}/../drm-510-kmod/Makefile.version"
 .include "${.CURDIR}/../nvidia-drm-kmod/Makefile.common"
+.include <bsd.port.options.mk>
+
+# handle incorrect get_user_pages definitions in 13.2
+.if ${OSVERSION} < 1303000
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-conftest.sh
+.endif
 
 .include <bsd.port.mk>
diff --git a/graphics/nvidia-drm-510-kmod/files/extra-patch-conftest.sh b/graphics/nvidia-drm-510-kmod/files/extra-patch-conftest.sh
new file mode 100644
index 000000000000..794b0a6647ae
--- /dev/null
+++ b/graphics/nvidia-drm-510-kmod/files/extra-patch-conftest.sh
@@ -0,0 +1,83 @@
+--- conftest.sh.orig	2024-03-14 18:29:50 UTC
++++ conftest.sh
+@@ -2627,7 +2627,7 @@ compile_test() {
+             #include <linux/mm.h>
+             long get_user_pages(unsigned long start,
+                                 unsigned long nr_pages,
+-                                unsigned int gup_flags,
++                                int gup_flags,
+                                 struct page **pages,
+                                 struct vm_area_struct **vmas) {
+                 return 0;
+@@ -2655,7 +2655,7 @@ compile_test() {
+                                 struct mm_struct *mm,
+                                 unsigned long start,
+                                 unsigned long nr_pages,
+-                                unsigned int gup_flags,
++                                int gup_flags,
+                                 struct page **pages,
+                                 struct vm_area_struct **vmas) {
+                 return 0;
+@@ -2679,7 +2679,7 @@ compile_test() {
+             #include <linux/mm.h>
+             long get_user_pages(unsigned long start,
+                                 unsigned long nr_pages,
+-                                unsigned int gup_flags,
++                                int gup_flags,
+                                 struct page **pages) {
+                 return 0;
+             }" > conftest$$.c
+@@ -2852,7 +2852,7 @@ compile_test() {
+                                        struct mm_struct *mm,
+                                        unsigned long start,
+                                        unsigned long nr_pages,
+-                                       unsigned int gup_flags,
++                                       int gup_flags,
+                                        struct page **pages,
+                                        struct vm_area_struct **vmas,
+                                        int *locked) {
+@@ -2877,7 +2877,7 @@ compile_test() {
+             long get_user_pages_remote(struct mm_struct *mm,
+                                        unsigned long start,
+                                        unsigned long nr_pages,
+-                                       unsigned int gup_flags,
++                                       int gup_flags,
+                                        struct page **pages,
+                                        struct vm_area_struct **vmas,
+                                        int *locked) {
+@@ -2901,7 +2901,7 @@ compile_test() {
+             long get_user_pages_remote(struct mm_struct *mm,
+                                        unsigned long start,
+                                        unsigned long nr_pages,
+-                                       unsigned int gup_flags,
++                                       int gup_flags,
+                                        struct page **pages,
+                                        int *locked) {
+                 return 0;
+@@ -2969,7 +2969,7 @@ compile_test() {
+             #include <linux/mm.h>
+             long pin_user_pages(unsigned long start,
+                                 unsigned long nr_pages,
+-                    		    unsigned int gup_flags,
++                    		    int gup_flags,
+                                 struct page **pages,
+                     		    struct vm_area_struct **vmas) {
+                 return 0;
+@@ -3055,7 +3055,7 @@ compile_test() {
+                                        struct mm_struct *mm,
+                                        unsigned long start,
+                                        unsigned long nr_pages,
+-                                       unsigned int gup_flags,
++                                       int gup_flags,
+                                        struct page **pages,
+                                        struct vm_area_struct **vmas,
+                                        int *locked) {
+@@ -3077,7 +3077,7 @@ compile_test() {
+             long pin_user_pages_remote(struct mm_struct *mm,
+                                        unsigned long start,
+                                        unsigned long nr_pages,
+-                                       unsigned int gup_flags,
++                                       int gup_flags,
+                                        struct page **pages,
+                                        struct vm_area_struct **vmas,
+                                        int *locked) {
diff --git a/graphics/nvidia-drm-510-kmod/files/patch-nvidia-drm-conftest.h b/graphics/nvidia-drm-510-kmod/files/patch-nvidia-drm-conftest.h
new file mode 100644
index 000000000000..f91a1595cda2
--- /dev/null
+++ b/graphics/nvidia-drm-510-kmod/files/patch-nvidia-drm-conftest.h
@@ -0,0 +1,14 @@
+--- nvidia-drm-conftest.h.orig	2024-03-11 17:52:16 UTC
++++ nvidia-drm-conftest.h
+@@ -122,11 +122,9 @@
+  */
+ #define drm_atomic_state_free drm_atomic_state_put
+ 
+-#if __FreeBSD_version < 1300000
+ /* redefine LIST_HEAD_INIT to the linux version */
+ #include <linux/list.h>
+ #define LIST_HEAD_INIT(name) LINUX_LIST_HEAD_INIT(name)
+-#endif
+ 
+ /*
+  * FreeBSD currently has only vmf_insert_pfn_prot defined, and it has a



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403160149.42G1n52Q093727>