summaryrefslogtreecommitdiffstats
path: root/debian/patches/fix-vboxvideo-with-linux-5.0.patch
blob: e3cbec4f586027a36fac7ce2a072bcc33fee633e (plain)
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
Origin: Ubuntu
Index: virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h
===================================================================
--- virtualbox-6.0.4-dfsg.orig/src/VBox/Additions/linux/drm/vbox_drv.h
+++ virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_drv.h
@@ -114,6 +114,11 @@ static inline void drm_gem_object_put_un
 {
 	drm_gem_object_unreference_unlocked(obj);
 }
+
+static inline void drm_gem_object_put(struct drm_gem_object *obj)
+{
+	drm_gem_object_unreference(obj);
+}
 #endif
 
 #define DRIVER_AUTHOR       VBOX_VENDOR
@@ -174,8 +179,10 @@ struct vbox_private {
 	int fb_mtrr;
 
 	struct {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
 		struct drm_global_reference mem_global_ref;
 		struct ttm_bo_global_ref bo_global_ref;
+#endif
 		struct ttm_bo_device bdev;
 		bool mm_initialised;
 	} ttm;
Index: virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_main.c
===================================================================
--- virtualbox-6.0.4-dfsg.orig/src/VBox/Additions/linux/drm/vbox_main.c
+++ virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_main.c
@@ -652,7 +652,7 @@ vbox_dumb_mmap_offset(struct drm_file *f
 	bo = gem_to_vbox_bo(obj);
 	*offset = vbox_bo_mmap_offset(bo);
 
-	drm_gem_object_unreference(obj);
+	drm_gem_object_put(obj);
 	ret = 0;
 
 out_unlock:
Index: virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c
===================================================================
--- virtualbox-6.0.4-dfsg.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
+++ virtualbox-6.0.4-dfsg/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -46,6 +46,7 @@ static inline struct vbox_private *vbox_
 	return container_of(bd, struct vbox_private, ttm.bdev);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
 static int vbox_ttm_mem_global_init(struct drm_global_reference *ref)
 {
 	return ttm_mem_global_init(ref->object);
@@ -100,6 +101,16 @@ static void vbox_ttm_global_release(stru
 	drm_global_item_unref(&vbox->ttm.bo_global_ref.ref);
 	drm_global_item_unref(&vbox->ttm.mem_global_ref);
 }
+#else
+static inline int vbox_ttm_global_init(struct vbox_private *vbox)
+{
+	return 0;
+}
+
+static inline void vbox_ttm_global_release(struct vbox_private *vbox)
+{
+}
+#endif
 
 static void vbox_bo_ttm_destroy(struct ttm_buffer_object *tbo)
 {
@@ -292,7 +303,9 @@ int vbox_mm_init(struct vbox_private *vb
 		return ret;
 
 	ret = ttm_bo_device_init(&vbox->ttm.bdev,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
 				 vbox->ttm.bo_global_ref.ref.object,
+#endif
 				 &vbox_bo_driver,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL_71)
 				 dev->anon_inode->i_mapping,