Skip to content

Commit

Permalink
graphics/nvidia-drm-510-kmod: Fix compilation with the v550 NVidia dr…
Browse files Browse the repository at this point in the history
…iver

Differential Revision: https://reviews.freebsd.org/D44305
  • Loading branch information
amshafer authored and arrowd committed Mar 16, 2024
1 parent ee1f930 commit a9f65f9
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
6 changes: 6 additions & 0 deletions graphics/nvidia-drm-510-kmod/Makefile
Expand Up @@ -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>
83 changes: 83 additions & 0 deletions 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) {
14 changes: 14 additions & 0 deletions 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

0 comments on commit a9f65f9

Please sign in to comment.