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,