1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
diff -Naur evdi-1.6.4/module/evdi_drv.c evdi-1.6.4-p/module/evdi_drv.c
--- evdi-1.6.4/module/evdi_drv.c 2019-11-21 08:42:24.000000000 +0100
+++ evdi-1.6.4-p/module/evdi_drv.c 2019-11-30 04:46:06.140301023 +0100
@@ -81,8 +81,12 @@
}
static struct drm_driver driver = {
- .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
- | DRIVER_ATOMIC,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
+ | DRIVER_ATOMIC,
+#else
+ .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
+#endif
#if KERNEL_VERSION(4, 12, 0) > LINUX_VERSION_CODE
.load = evdi_driver_load,
#endif
diff -Naur evdi-1.6.4/module/evdi_drv.h evdi-1.6.4-p/module/evdi_drv.h
--- evdi-1.6.4/module/evdi_drv.h 2019-11-21 08:42:24.000000000 +0100
+++ evdi-1.6.4-p/module/evdi_drv.h 2019-11-30 04:46:06.140301023 +0100
@@ -20,7 +20,11 @@
#include <drm/drm_crtc_helper.h>
#include <drm/drm_rect.h>
#include <drm/drm_gem.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#include <linux/reservation.h>
+#else
+#include <linux/dma-resv.h>
+#endif
#include "evdi_debug.h"
#define DRIVER_NAME "evdi"
@@ -51,8 +55,13 @@
struct page **pages;
void *vmapping;
struct sg_table *sg;
- struct reservation_object *resv;
- struct reservation_object _resv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ struct reservation_object *resv;
+ struct reservation_object _resv;
+#else
+ struct dma_resv *resv;
+ struct dma_resv _resv;
+#endif
};
#define to_evdi_bo(x) container_of(x, struct evdi_gem_object, base)
@@ -112,8 +121,12 @@
struct drm_gem_object *evdi_gem_prime_import(struct drm_device *dev,
struct dma_buf *dma_buf);
-struct dma_buf *evdi_gem_prime_export(struct drm_device *dev,
- struct drm_gem_object *obj, int flags);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+struct dma_buf *evdi_gem_prime_export(__maybe_unused struct drm_device *dev,
+ struct drm_gem_object *obj, int flags)
+#else
+struct dma_buf *evdi_gem_prime_export(struct drm_gem_object *obj, int flags);
+#endif
int evdi_gem_vmap(struct evdi_gem_object *obj);
void evdi_gem_vunmap(struct evdi_gem_object *obj);
diff -Naur evdi-1.6.4/module/evdi_gem.c evdi-1.6.4-p/module/evdi_gem.c
--- evdi-1.6.4/module/evdi_gem.c 2019-11-21 08:42:24.000000000 +0100
+++ evdi-1.6.4-p/module/evdi_gem.c 2019-11-30 04:47:05.410984523 +0100
@@ -61,7 +61,11 @@
return NULL;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
reservation_object_init(&obj->_resv);
+#else
+ dma_resv_init(&obj->_resv);
+#endif
obj->resv = &obj->_resv;
return obj;
@@ -254,8 +258,11 @@
if (gem_obj->dev->vma_offset_manager)
drm_gem_free_mmap_offset(gem_obj);
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
reservation_object_fini(&obj->_resv);
+#else
+ dma_resv_fini(&obj->_resv);
+#endif
obj->resv = NULL;
}
@@ -569,8 +576,11 @@
return ERR_PTR(ret);
}
-struct dma_buf *evdi_gem_prime_export(__maybe_unused struct drm_device *dev,
- struct drm_gem_object *obj, int flags)
+struct dma_buf *evdi_gem_prime_export(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+ __maybe_unused struct drm_device *dev,
+#endif
+ struct drm_gem_object *obj, int flags)
{
struct evdi_gem_object *evdi_obj = to_evdi_bo(obj);
struct dma_buf_export_info exp_info = {
@@ -581,8 +591,7 @@
.resv = evdi_obj->resv,
.priv = obj
};
-
-#if KERNEL_VERSION(4, 9, 0) <= LINUX_VERSION_CODE
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 0)
return drm_gem_dmabuf_export(dev, &exp_info);
#else
return dma_buf_export(&exp_info);
diff -Naur evdi-1.6.4/module/Makefile evdi-1.6.4-p/module/Makefile
--- evdi-1.6.4/module/Makefile 2019-11-21 02:42:24.000000000 -0500
+++ evdi-1.6.4-p/module/Makefile 2019-12-05 10:18:30.513130412 -0500
@@ -19,11 +19,11 @@
KBUILD_VERBOSE ?= 1
all:
- $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) CONFIG_MODULE_SIG= -C $(KERN_DIR) modules
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) M=$(CURDIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) CONFIG_MODULE_SIG= -C $(KERN_DIR) modules
clean:
@echo $(KERN_DIR)
- $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) -C $(KERN_DIR) clean
+ $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) M=$(CURDIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) -C $(KERN_DIR) clean
else
|