Changeset 85704 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Aug 11, 2020 7:05:24 PM (4 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_drv.c
r85649 r85704 41 41 #include <drm/drm_crtc_helper.h> 42 42 43 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1,0) || defined(RHEL_81)43 #if RTLNX_VER_MIN(5,1,0) || defined(RHEL_81) 44 44 #include <drm/drm_probe_helper.h> 45 45 #endif … … 63 63 static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 64 64 { 65 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)65 #if RTLNX_VER_MAX(4,19,0) 66 66 return drm_get_pci_dev(pdev, ent, &driver); 67 67 #else … … 99 99 struct drm_device *dev = pci_get_drvdata(pdev); 100 100 101 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)101 #if RTLNX_VER_MAX(4,19,0) 102 102 drm_put_dev(dev); 103 103 #else … … 108 108 } 109 109 110 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9,0) && !defined(RHEL_74)110 #if RTLNX_VER_MAX(4,9,0) && !defined(RHEL_74) 111 111 static void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, 112 112 bool suspend) … … 226 226 }; 227 227 228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0) && !defined(RHEL_74)228 #if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74) 229 229 /* This works around a bug in X servers prior to 1.18.4, which sometimes 230 230 * submit more dirty rectangles than the kernel is willing to handle and … … 242 242 return rc; 243 243 } 244 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0) && !RHEL_74 */244 #endif /* RTLNX_VER_MAX(4,7,0) && !RHEL_74 */ 245 245 246 246 static const struct file_operations vbox_fops = { … … 248 248 .open = drm_open, 249 249 .release = drm_release, 250 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0) && !defined(RHEL_74)250 #if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74) 251 251 .unlocked_ioctl = vbox_ioctl, 252 252 #else … … 255 255 .mmap = vbox_mmap, 256 256 .poll = drm_poll, 257 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12,0) && !defined(RHEL_70)257 #if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_70) 258 258 .fasync = drm_fasync, 259 259 #endif … … 286 286 } 287 287 288 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8,0) && !defined(RHEL_74)288 #if RTLNX_VER_MAX(4,8,0) && !defined(RHEL_74) 289 289 static void vbox_master_drop(struct drm_device *dev, 290 290 struct drm_file *file_priv, bool from_release) … … 305 305 306 306 static struct drm_driver driver = { 307 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4,0)307 #if RTLNX_VER_MAX(5,4,0) 308 308 .driver_features = 309 309 DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | 310 # if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1,0) && !defined(RHEL_81)310 # if RTLNX_VER_MAX(5,1,0) && !defined(RHEL_81) 311 311 DRIVER_IRQ_SHARED | 312 # endif /* < KERNEL_VERSION(5, 1, 0)&& !defined(RHEL_81) */312 # endif /* < 5.1.0 && !defined(RHEL_81) */ 313 313 DRIVER_PRIME, 314 #else /* >= KERNEL_VERSION(5, 4, 0)*/314 #else /* >= 5.4.0 */ 315 315 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ, 316 #endif /* < KERNEL_VERSION(5, 4, 0)*/316 #endif /* < 5.4.0 */ 317 317 .dev_priv_size = 0, 318 318 319 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)319 #if RTLNX_VER_MAX(4,19,0) 320 320 /* Legacy hooks, but still supported. */ 321 321 .load = vbox_driver_load, … … 325 325 .master_set = vbox_master_set, 326 326 .master_drop = vbox_master_drop, 327 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_72)328 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14,0) && !defined(RHEL_75) \327 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72) 328 # if RTLNX_VER_MAX(4,14,0) && !defined(RHEL_75) \ 329 329 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 330 330 .set_busid = drm_pci_set_busid, … … 341 341 .patchlevel = DRIVER_PATCHLEVEL, 342 342 343 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0)343 #if RTLNX_VER_MAX(4,7,0) 344 344 .gem_free_object = vbox_gem_free_object, 345 345 #else … … 348 348 .dumb_create = vbox_dumb_create, 349 349 .dumb_map_offset = vbox_dumb_mmap_offset, 350 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12,0) && !defined(RHEL_73)350 #if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73) 351 351 .dumb_destroy = vbox_dumb_destroy, 352 352 #else … … 368 368 static int __init vbox_init(void) 369 369 { 370 #if defined(CONFIG_VGA_CONSOLE) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0)370 #if defined(CONFIG_VGA_CONSOLE) || RTLNX_VER_MIN(4,7,0) 371 371 if (vgacon_text_force() && vbox_modeset == -1) 372 372 return -EINVAL; … … 376 376 return -EINVAL; 377 377 378 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_73)378 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_73) 379 379 return pci_register_driver(&vbox_pci_driver); 380 380 #else … … 385 385 static void __exit vbox_exit(void) 386 386 { 387 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_73)387 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_73) 388 388 pci_unregister_driver(&vbox_pci_driver); 389 389 #else -
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r85684 r85704 41 41 42 42 #include <linux/version.h> 43 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) 43 44 /* iprt/linux/version.h copy - start */ 45 /** @def RTLNX_VER_MIN 46 * Evaluates to true if the linux kernel version is equal or higher to the 47 * one specfied. */ 48 #define RTLNX_VER_MIN(a_Major, a_Minor, a_Patch) \ 49 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_Major, a_Minor, a_Patch)) 50 51 /** @def RTLNX_VER_MAX 52 * Evaluates to true if the linux kernel version is less to the one specfied 53 * (exclusive). */ 54 #define RTLNX_VER_MAX(a_Major, a_Minor, a_Patch) \ 55 (LINUX_VERSION_CODE < KERNEL_VERSION(a_Major, a_Minor, a_Patch)) 56 57 /** @def RTLNX_VER_RANGE 58 * Evaluates to true if the linux kernel version is equal or higher to the given 59 * minimum version and less (but not equal) to the maximum version (exclusive). */ 60 #define RTLNX_VER_RANGE(a_MajorMin, a_MinorMin, a_PatchMin, a_MajorMax, a_MinorMax, a_PatchMax) \ 61 ( LINUX_VERSION_CODE >= KERNEL_VERSION(a_MajorMin, a_MinorMin, a_PatchMin) \ 62 && LINUX_VERSION_CODE < KERNEL_VERSION(a_MajorMax, a_MinorMax, a_PatchMax) ) 63 64 65 /** @def RTLNX_RHEL_MIN 66 * Require a minium RedHat release. 67 * @param a_iMajor The major release number (RHEL_MAJOR). 68 * @param a_iMinor The minor release number (RHEL_MINOR). 69 * @sa RTLNX_RHEL_MAX, RTLNX_RHEL_RANGE, RTLNX_RHEL_MAJ_PREREQ 70 */ 71 #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) 72 # define RTLNX_RHEL_MIN(a_iMajor, a_iMinor) \ 73 ((RHEL_MAJOR) > (a_iMajor) || ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor))) 74 #else 75 # define RTLNX_RHEL_MIN(a_iMajor, a_iMinor) (0) 76 #endif 77 78 /** @def RTLNX_RHEL_MAX 79 * Require a maximum RedHat release, true for all RHEL versions below it. 80 * @param a_iMajor The major release number (RHEL_MAJOR). 81 * @param a_iMinor The minor release number (RHEL_MINOR). 82 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_RANGE, RTLNX_RHEL_MAJ_PREREQ 83 */ 84 #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) 85 # define RTLNX_RHEL_MAX(a_iMajor, a_iMinor) \ 86 ((RHEL_MAJOR) < (a_iMajor) || ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) < (a_iMinor))) 87 #else 88 # define RTLNX_RHEL_MAX(a_iMajor, a_iMinor) (0) 89 #endif 90 91 /** @define RTLNX_RHEL_RANGE 92 * Check that it's a RedHat kernel in the given version range. 93 * The max version is exclusive, the minimum inclusive. 94 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_MAX, RTLNX_RHEL_MAJ_PREREQ 95 */ 96 #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) 97 # define RTLNX_RHEL_RANGE(a_iMajorMin, a_iMinorMin, a_iMajorMax, a_iMinorMax) \ 98 (RTLNX_RHEL_MIN(a_iMajorMin, a_iMinorMin) && RTLNX_RHEL_MAX(a_iMajorMax, a_iMinorMax)) 99 #else 100 # define RTLNX_RHEL_RANGE(a_iMajorMin, a_iMinorMin, a_iMajorMax, a_iMinorMax) (0) 101 #endif 102 103 /** @def RTLNX_RHEL_MAJ_PREREQ 104 * Require a minimum minor release number for the given RedHat release. 105 * @param a_iMajor RHEL_MAJOR must _equal_ this. 106 * @param a_iMinor RHEL_MINOR must be greater or equal to this. 107 * @sa RTLNX_RHEL_MIN, RTLNX_RHEL_MAX 108 */ 109 #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) 110 # define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor)) 111 #else 112 # define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) (0) 113 #endif 114 115 116 /** @def RTLNX_SUSE_MAJ_PREREQ 117 * Require a minimum minor release number for the given SUSE release. 118 * @param a_iMajor CONFIG_SUSE_VERSION must _equal_ this. 119 * @param a_iMinor CONFIG_SUSE_PATCHLEVEL must be greater or equal to this. 120 */ 121 #if defined(CONFIG_SUSE_VERSION) && defined(CONFIG_SUSE_PATCHLEVEL) 122 # define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) ((CONFIG_SUSE_VERSION) == (a_iMajor) && (CONFIG_SUSE_PATCHLEVEL) >= (a_iMinor)) 123 #else 124 # define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) (0) 125 #endif 126 /* iprt/linux/version.h copy - end */ 127 128 #if RTLNX_VER_MAX(4,5,0) 44 129 # include <linux/types.h> 45 130 # include <linux/spinlock_types.h> … … 104 189 #endif 105 190 106 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14,0) || defined(RHEL_71)191 #if RTLNX_VER_MAX(3,14,0) || defined(RHEL_71) 107 192 #define U8_MAX ((u8)~0U) 108 193 #define S8_MAX ((s8)(U8_MAX>>1)) … … 119 204 #endif 120 205 121 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5,0)206 #if RTLNX_VER_MAX(5,5,0) 122 207 #include <drm/drmP.h> 123 #else /* >= KERNEL_VERSION(5, 5, 0)*/208 #else /* >= 5.5.0 */ 124 209 #include <drm/drm_file.h> 125 210 #include <drm/drm_drv.h> … … 129 214 #include <drm/drm_irq.h> 130 215 #include <drm/drm_vblank.h> 131 #endif /* >= KERNEL_VERSION(5, 5, 0)*/132 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)216 #endif /* >= 5.5.0 */ 217 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 133 218 #include <drm/drm_encoder.h> 134 219 #endif 135 220 #include <drm/drm_fb_helper.h> 136 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_72)221 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72) 137 222 #include <drm/drm_gem.h> 138 223 #endif … … 150 235 #include "product-generated.h" 151 236 152 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12,0) && !defined(RHEL_75)237 #if RTLNX_VER_MAX(4,12,0) && !defined(RHEL_75) 153 238 static inline void drm_gem_object_put_unlocked(struct drm_gem_object *obj) 154 239 { … … 157 242 #endif 158 243 159 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12,0) && !defined(RHEL_75)244 #if RTLNX_VER_MAX(4,12,0) && !defined(RHEL_75) 160 245 static inline void drm_gem_object_put(struct drm_gem_object *obj) 161 246 { … … 191 276 #define VBOX_REFRESH_PERIOD (HZ / 2) 192 277 193 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13,0) && !defined(RHEL_72)278 #if RTLNX_VER_MAX(3,13,0) && !defined(RHEL_72) 194 279 static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size, 195 280 gfp_t flags) … … 222 307 223 308 struct { 224 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)309 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 225 310 struct drm_global_reference mem_global_ref; 226 311 struct ttm_bo_global_ref bo_global_ref; … … 266 351 #undef CURSOR_DATA_SIZE 267 352 268 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)353 #if RTLNX_VER_MAX(4,19,0) 269 354 int vbox_driver_load(struct drm_device *dev, unsigned long flags); 270 355 #else 271 356 int vbox_driver_load(struct drm_device *dev); 272 357 #endif 273 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)358 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 274 359 void vbox_driver_unload(struct drm_device *dev); 275 360 #else … … 333 418 void vbox_mode_fini(struct drm_device *dev); 334 419 335 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)420 #if RTLNX_VER_MAX(3,3,0) 336 421 #define DRM_MODE_FB_CMD drm_mode_fb_cmd 337 422 #else … … 339 424 #endif 340 425 341 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15,0) && !defined(RHEL_71)426 #if RTLNX_VER_MAX(3,15,0) && !defined(RHEL_71) 342 427 #define CRTC_FB(crtc) ((crtc)->fb) 343 428 #else … … 355 440 int vbox_framebuffer_init(struct drm_device *dev, 356 441 struct vbox_framebuffer *vbox_fb, 357 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0) || defined(RHEL_73)442 #if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73) 358 443 const struct DRM_MODE_FB_CMD *mode_cmd, 359 444 #else … … 371 456 struct ttm_bo_kmap_obj kmap; 372 457 struct drm_gem_object gem; 373 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0) && !defined(RHEL_72)458 #if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72) 374 459 u32 placements[3]; 375 460 #else … … 391 476 struct drm_device *dev, 392 477 struct drm_mode_create_dumb *args); 393 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12,0) && !defined(RHEL_73)478 #if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73) 394 479 int vbox_dumb_destroy(struct drm_file *file, 395 480 struct drm_device *dev, u32 handle); … … 419 504 int ret; 420 505 421 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0) || defined(RHEL_74)506 #if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74) 422 507 ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL); 423 508 #else … … 445 530 void vbox_gem_prime_unpin(struct drm_gem_object *obj); 446 531 struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj); 447 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0) && !defined(RHEL_72)532 #if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72) 448 533 struct drm_gem_object *vbox_gem_prime_import_sg_table( 449 534 struct drm_device *dev, size_t size, struct sg_table *table); -
trunk/src/VBox/Additions/linux/drm/vbox_fb.c
r85684 r85704 51 51 #include <VBoxVideo.h> 52 52 53 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0) && !defined(RHEL_74)53 #if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74) 54 54 /** 55 55 * Tell the host about dirty rectangles to update. … … 127 127 128 128 #ifdef CONFIG_FB_DEFERRED_IO 129 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7,0) && !defined(RHEL_74)129 # if RTLNX_VER_MAX(4,7,0) && !defined(RHEL_74) 130 130 static void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagelist) 131 131 { … … 160 160 #endif 161 161 162 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3,0) && !defined(RHEL_73)162 #if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73) 163 163 static void drm_fb_helper_sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 164 164 { … … 208 208 u32 size; 209 209 struct drm_gem_object *gobj; 210 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)210 #if RTLNX_VER_MAX(3,3,0) 211 211 u32 pitch = mode_cmd->pitch; 212 212 #else … … 226 226 } 227 227 228 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3,0) && !defined(RHEL_73)228 #if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73) 229 229 static struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *helper) 230 230 { … … 268 268 mode_cmd.height = sizes->surface_height; 269 269 pitch = mode_cmd.width * ((sizes->surface_bpp + 7) / 8); 270 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3,0)270 #if RTLNX_VER_MAX(3,3,0) 271 271 mode_cmd.bpp = sizes->surface_bpp; 272 272 mode_cmd.depth = sizes->surface_depth; … … 336 336 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0); 337 337 338 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2,0) || defined(RHEL_82)338 #if RTLNX_VER_MIN(5,2,0) || defined(RHEL_82) 339 339 /* 340 340 * The corresponding 5.2-rc1 Linux DRM kernel changes have been … … 342 342 */ 343 343 drm_fb_helper_fill_info(info, &fbdev->helper, sizes); 344 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || VBOX_RHEL_MAJ_PREREQ(7, 5)344 #elif RTLNX_VER_MIN(4,11,0) || VBOX_RHEL_MAJ_PREREQ(7, 5) 345 345 drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth); 346 346 #else 347 347 drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); 348 348 #endif 349 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2,0) && !defined(RHEL_82)349 #if RTLNX_VER_MAX(5,2,0) && !defined(RHEL_82) 350 350 drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width, 351 351 sizes->fb_height); … … 371 371 }; 372 372 373 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3,0) && !defined(RHEL_73)373 #if RTLNX_VER_MAX(4,3,0) && !defined(RHEL_73) 374 374 static void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper) 375 375 { … … 411 411 drm_fb_helper_fini(&fbdev->helper); 412 412 413 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9,0)413 #if RTLNX_VER_MIN(3,9,0) 414 414 drm_framebuffer_unregister_private(&afb->base); 415 415 #endif … … 430 430 spin_lock_init(&fbdev->dirty_lock); 431 431 432 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0) && !defined(RHEL_72)432 #if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72) 433 433 fbdev->helper.funcs = &vbox_fb_helper_funcs; 434 434 #else 435 435 drm_fb_helper_prepare(dev, &fbdev->helper, &vbox_fb_helper_funcs); 436 436 #endif 437 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7,0)437 #if RTLNX_VER_MIN(5,7,0) 438 438 ret = drm_fb_helper_init(dev, &fbdev->helper); 439 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)439 #elif RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 440 440 ret = drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs); 441 #else /* KERNEL_VERSION< 4.11.0 */441 #else /* < 4.11.0 */ 442 442 ret = 443 443 drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs, … … 447 447 return ret; 448 448 449 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7,0)449 #if RTLNX_VER_MAX(5,7,0) 450 450 ret = drm_fb_helper_single_add_all_connectors(&fbdev->helper); 451 451 if (ret) -
trunk/src/VBox/Additions/linux/drm/vbox_hgsmi.c
r82968 r85704 69 69 } 70 70 71 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13,0)71 #if RTLNX_VER_MAX(3,13,0) 72 72 void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size, dma_addr_t *dma) 73 73 { -
trunk/src/VBox/Additions/linux/drm/vbox_irq.c
r82968 r85704 34 34 #include "vbox_drv.h" 35 35 36 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1,0)36 #if RTLNX_VER_MAX(5,1,0) 37 37 #include <drm/drm_crtc_helper.h> 38 38 # if defined(RHEL_81) … … 152 152 153 153 validate_or_set_position_hints(vbox); 154 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9,0)154 #if RTLNX_VER_MIN(3,9,0) 155 155 drm_modeset_lock_all(dev); 156 156 #else … … 186 186 vbox_conn->vbox_crtc->disconnected = disconnected; 187 187 } 188 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9,0)188 #if RTLNX_VER_MIN(3,9,0) 189 189 drm_modeset_unlock_all(dev); 190 190 #else … … 206 206 INIT_WORK(&vbox->hotplug_work, vbox_hotplug_worker); 207 207 vbox_update_mode_hints(vbox); 208 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0) || defined(RHEL_71)208 #if RTLNX_VER_MIN(3,16,0) || defined(RHEL_71) 209 209 return drm_irq_install(vbox->dev, vbox->dev->pdev->irq); 210 210 #else -
trunk/src/VBox/Additions/linux/drm/vbox_main.c
r85649 r85704 164 164 int vbox_framebuffer_init(struct drm_device *dev, 165 165 struct vbox_framebuffer *vbox_fb, 166 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0) || defined(RHEL_73)166 #if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73) 167 167 const struct DRM_MODE_FB_CMD *mode_cmd, 168 168 #else … … 173 173 int ret; 174 174 175 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)175 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 176 176 drm_helper_mode_fill_fb_struct(dev, &vbox_fb->base, mode_cmd); 177 177 #else … … 191 191 struct drm_device *dev, 192 192 struct drm_file *filp, 193 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0) || defined(RHEL_73)193 #if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73) 194 194 const struct drm_mode_fb_cmd2 *mode_cmd) 195 195 #else … … 201 201 int ret = -ENOMEM; 202 202 203 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0) || defined(RHEL_74)203 #if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74) 204 204 obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]); 205 205 #else … … 230 230 }; 231 231 232 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0,0) && !defined(RHEL_73)232 #if RTLNX_VER_MAX(4,0,0) && !defined(RHEL_73) 233 233 #define pci_iomap_range(dev, bar, offset, maxlen) \ 234 234 ioremap(pci_resource_start(dev, bar) + (offset), maxlen) … … 448 448 } 449 449 450 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0)450 #if RTLNX_VER_MAX(4,19,0) 451 451 int vbox_driver_load(struct drm_device *dev, unsigned long flags) 452 452 #else … … 512 512 } 513 513 514 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)514 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 515 515 void vbox_driver_unload(struct drm_device *dev) 516 516 #else … … 526 526 vbox_mm_fini(vbox); 527 527 vbox_hw_fini(vbox); 528 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11,0) && !defined(RHEL_75)528 #if RTLNX_VER_MAX(4,11,0) && !defined(RHEL_75) 529 529 return 0; 530 530 #endif … … 539 539 struct vbox_private *vbox = dev->dev_private; 540 540 541 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16,0) || defined(RHEL_71)541 #if RTLNX_VER_MIN(3,16,0) || defined(RHEL_71) 542 542 if (vbox->fbdev) 543 543 drm_fb_helper_restore_fbdev_mode_unlocked(&vbox->fbdev->helper); … … 598 598 } 599 599 600 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12,0) && !defined(RHEL_73)600 #if RTLNX_VER_MAX(3,12,0) && !defined(RHEL_73) 601 601 int vbox_dumb_destroy(struct drm_file *file, 602 602 struct drm_device *dev, u32 handle) … … 606 606 #endif 607 607 608 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19,0) && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) \608 #if RTLNX_VER_MAX(4,19,0) && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) \ 609 609 && !defined(RHEL_77) && !defined(RHEL_81) 610 610 static void ttm_bo_put(struct ttm_buffer_object *bo) … … 623 623 static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo) 624 624 { 625 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4,0)625 #if RTLNX_VER_MIN(5,4,0) 626 626 return drm_vma_node_offset_addr(&bo->bo.base.vma_node); 627 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 12,0) && !defined(RHEL_70)627 #elif RTLNX_VER_MAX(3,12,0) && !defined(RHEL_70) 628 628 return bo->bo.addr_space_offset; 629 629 #else 630 630 return drm_vma_node_offset_addr(&bo->bo.vma_node); 631 #endif /* >= KERNEL_VERSION(5, 4, 0)*/631 #endif /* >= 5.4.0 */ 632 632 } 633 633 … … 642 642 643 643 mutex_lock(&dev->struct_mutex); 644 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0) || defined(RHEL_74)644 #if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74) 645 645 obj = drm_gem_object_lookup(file, handle); 646 646 #else -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r85649 r85704 40 40 #include <linux/export.h> 41 41 #include <drm/drm_crtc_helper.h> 42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_72)42 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72) 43 43 #include <drm/drm_plane_helper.h> 44 44 #endif 45 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1,0) || defined(RHEL_81)45 #if RTLNX_VER_MIN(5,1,0) || defined(RHEL_81) 46 46 #include <drm/drm_probe_helper.h> 47 47 #endif … … 70 70 width = mode->hdisplay ? mode->hdisplay : 640; 71 71 height = mode->vdisplay ? mode->vdisplay : 480; 72 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)72 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 73 73 bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32; 74 74 pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8; 75 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3,0)75 #elif RTLNX_VER_MIN(3,3,0) 76 76 bpp = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32; 77 77 pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8; … … 94 94 VBoxVideoSetModeRegisters( 95 95 width, height, pitch * 8 / bpp, 96 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0) || defined(RHEL_75)96 #if RTLNX_VER_MIN(4,11,0) || defined(RHEL_75) 97 97 CRTC_FB(crtc)->format->cpp[0] * 8, 98 98 #else … … 285 285 static int vbox_crtc_page_flip(struct drm_crtc *crtc, 286 286 struct drm_framebuffer *fb, 287 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0) || defined(RHEL_75)287 #if RTLNX_VER_MIN(4,12,0) || defined(RHEL_75) 288 288 struct drm_pending_vblank_event *event, 289 289 uint32_t page_flip_flags, 290 290 struct drm_modeset_acquire_ctx *ctx) 291 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12,0) || defined(RHEL_70)291 #elif RTLNX_VER_MIN(3,12,0) || defined(RHEL_70) 292 292 struct drm_pending_vblank_event *event, 293 293 uint32_t page_flip_flags) … … 311 311 312 312 if (event) 313 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19,0) || defined(RHEL_72)313 #if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72) 314 314 drm_crtc_send_vblank_event(crtc, event); 315 315 #else … … 386 386 } 387 387 388 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13,0) && !defined(RHEL_71)388 #if RTLNX_VER_MAX(3,13,0) && !defined(RHEL_71) 389 389 static struct drm_encoder *drm_encoder_find(struct drm_device *dev, u32 id) 390 390 { … … 399 399 *connector) 400 400 { 401 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5,0)401 #if RTLNX_VER_MIN(5,5,0) 402 402 struct drm_encoder *encoder; 403 403 … … 405 405 drm_connector_for_each_possible_encoder(connector, encoder) 406 406 return encoder; 407 #else /* KERNEL_VERSION< 5.5 */407 #else /* < 5.5 */ 408 408 int enc_id = connector->encoder_ids[0]; 409 409 410 410 /* pick the encoder ids */ 411 411 if (enc_id) 412 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15,0) || \412 # if RTLNX_VER_MIN(4,15,0) || \ 413 413 (defined(CONFIG_SUSE_VERSION) && \ 414 LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)) || \414 RTLNX_VER_MIN(4,12,0)) || \ 415 415 defined(RHEL_76) 416 416 return drm_encoder_find(connector->dev, NULL, enc_id); … … 418 418 return drm_encoder_find(connector->dev, enc_id); 419 419 # endif 420 #endif /* KERNEL_VERSION< 5.5 */420 #endif /* < 5.5 */ 421 421 return NULL; 422 422 } … … 469 469 470 470 drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs, 471 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0) || defined(RHEL_73)471 #if RTLNX_VER_MIN(4,5,0) || defined(RHEL_73) 472 472 DRM_MODE_ENCODER_DAC, NULL); 473 473 #else … … 548 548 sum += edid[i]; 549 549 edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF; 550 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \550 #if RTLNX_VER_MIN(4,19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \ 551 551 || defined(RHEL_77) || defined(RHEL_81) 552 552 drm_connector_update_edid_property(connector, (struct edid *)edid); … … 607 607 vbox_set_edid(connector, preferred_width, preferred_height); 608 608 609 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19,0) || defined(RHEL_72)609 #if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72) 610 610 if (vbox_connector->vbox_crtc->x_hint != -1) 611 611 drm_object_property_set_value(&connector->base, … … 628 628 } 629 629 630 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14,0) && !defined(RHEL_71)630 #if RTLNX_VER_MAX(3,14,0) && !defined(RHEL_71) 631 631 static int vbox_mode_valid(struct drm_connector *connector, 632 632 #else … … 640 640 static void vbox_connector_destroy(struct drm_connector *connector) 641 641 { 642 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0) && !defined(RHEL_72)642 #if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72) 643 643 drm_sysfs_connector_remove(connector); 644 644 #else … … 711 711 connector->doublescan_allowed = 0; 712 712 713 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19,0) || defined(RHEL_72)713 #if RTLNX_VER_MIN(3,19,0) || defined(RHEL_72) 714 714 drm_mode_create_suggested_offset_properties(dev); 715 715 drm_object_attach_property(&connector->base, … … 718 718 dev->mode_config.suggested_y_property, 0); 719 719 #endif 720 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0) && !defined(RHEL_72)720 #if RTLNX_VER_MAX(3,17,0) && !defined(RHEL_72) 721 721 drm_sysfs_connector_add(connector); 722 722 #else … … 724 724 #endif 725 725 726 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \726 #if RTLNX_VER_MIN(4,19,0) || defined(OPENSUSE_151) || defined(OPENSUSE_125) \ 727 727 || defined(RHEL_77) || defined(RHEL_81) 728 728 drm_connector_attach_encoder(connector, encoder); … … 833 833 } 834 834 835 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7,0) || defined(RHEL_74)835 #if RTLNX_VER_MIN(4,7,0) || defined(RHEL_74) 836 836 obj = drm_gem_object_lookup(file_priv, handle); 837 837 #else -
trunk/src/VBox/Additions/linux/drm/vbox_prime.c
r82968 r85704 50 50 } 51 51 52 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0) && !defined(RHEL_72)52 #if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72) 53 53 struct drm_gem_object *vbox_gem_prime_import_sg_table( 54 54 struct drm_device *dev, size_t size, struct sg_table *table) -
trunk/src/VBox/Additions/linux/drm/vbox_ttm.c
r85649 r85704 36 36 #include <drm/ttm/ttm_page_alloc.h> 37 37 38 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0) && !defined(RHEL_72)38 #if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72) 39 39 #define PLACEMENT_FLAGS(placement) (placement) 40 40 #else … … 47 47 } 48 48 49 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)49 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 50 50 static int vbox_ttm_mem_global_init(struct drm_global_reference *ref) 51 51 { … … 66 66 int ret; 67 67 68 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0)68 #if RTLNX_VER_MAX(5,0,0) 69 69 global_ref = &vbox->ttm.mem_global_ref; 70 70 global_ref->global_type = DRM_GLOBAL_TTM_MEM; … … 89 89 if (ret) { 90 90 DRM_ERROR("Failed setting up TTM BO subsystem.\n"); 91 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0)91 #if RTLNX_VER_MAX(5,0,0) 92 92 drm_global_item_unref(&vbox->ttm.mem_global_ref); 93 93 #endif … … 211 211 }; 212 212 213 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0)) && !defined(RHEL_76) \213 #if (RTLNX_VER_MAX(4,17,0)) && !defined(RHEL_76) \ 214 214 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 215 215 static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev, … … 229 229 230 230 tt->func = &vbox_tt_backend_func; 231 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0)) && !defined(RHEL_76) \231 #if (RTLNX_VER_MAX(4,17,0)) && !defined(RHEL_76) \ 232 232 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 233 233 if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) { … … 242 242 } 243 243 244 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0)245 # if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 16,0)) && !defined(RHEL_76) \244 #if RTLNX_VER_MAX(4,17,0) 245 # if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \ 246 246 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 247 247 static int vbox_ttm_tt_populate(struct ttm_tt *ttm) … … 265 265 static struct ttm_bo_driver vbox_bo_driver = { 266 266 .ttm_tt_create = vbox_ttm_tt_create, 267 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0)267 #if RTLNX_VER_MAX(4,17,0) 268 268 .ttm_tt_populate = vbox_ttm_tt_populate, 269 269 .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate, 270 270 #endif 271 271 .init_mem_type = vbox_bo_init_mem_type, 272 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10,0) || defined(RHEL_74)272 #if RTLNX_VER_MIN(4,10,0) || defined(RHEL_74) 273 273 .eviction_valuable = ttm_bo_eviction_valuable, 274 274 #endif … … 277 277 .io_mem_reserve = &vbox_ttm_io_mem_reserve, 278 278 .io_mem_free = &vbox_ttm_io_mem_free, 279 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0) || defined(RHEL_75)280 # if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 16,0)) && !defined(RHEL_76) \279 #if RTLNX_VER_MIN(4,12,0) || defined(RHEL_75) 280 # if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \ 281 281 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 282 282 .io_mem_pfn = ttm_bo_default_io_mem_pfn, 283 283 # endif 284 284 #endif 285 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \ 286 || defined(RHEL_74) 287 # ifndef RHEL_75 285 #if (RTLNX_VER_RANGE(4,7,0, 4,11,0) || defined(RHEL_74)) && !defined(RHEL_75) 288 286 .lru_tail = &ttm_bo_default_lru_tail, 289 287 .swap_lru_tail = &ttm_bo_default_swap_lru_tail, 290 # endif291 288 #endif 292 289 }; … … 298 295 struct ttm_bo_device *bdev = &vbox->ttm.bdev; 299 296 300 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)297 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 301 298 ret = vbox_ttm_global_init(vbox); 302 299 if (ret) … … 304 301 #endif 305 302 ret = ttm_bo_device_init(&vbox->ttm.bdev, 306 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)303 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 307 304 vbox->ttm.bo_global_ref.ref.object, 308 305 #endif 309 306 &vbox_bo_driver, 310 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15,0) || defined(RHEL_71)307 #if RTLNX_VER_MIN(3,15,0) || defined(RHEL_71) 311 308 dev->anon_inode->i_mapping, 312 309 #endif 313 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5,0)310 #if RTLNX_VER_MIN(5,5,0) 314 311 dev->vma_offset_manager, 315 #elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 2,0) && !defined(RHEL_82)312 #elif RTLNX_VER_MAX(5,2,0) && !defined(RHEL_82) 316 313 DRM_FILE_PAGE_OFFSET, 317 314 #endif … … 319 316 if (ret) { 320 317 DRM_ERROR("Error initialising bo driver; %d\n", ret); 321 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)318 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 322 319 goto err_ttm_global_release; 323 320 #else … … 345 342 err_device_release: 346 343 ttm_bo_device_release(&vbox->ttm.bdev); 347 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)344 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 348 345 err_ttm_global_release: 349 346 vbox_ttm_global_release(vbox); … … 362 359 #endif 363 360 ttm_bo_device_release(&vbox->ttm.bdev); 364 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0,0) && !defined(RHEL_77) && !defined(RHEL_81)361 #if RTLNX_VER_MAX(5,0,0) && !defined(RHEL_77) && !defined(RHEL_81) 365 362 vbox_ttm_global_release(vbox); 366 363 #endif … … 370 367 { 371 368 u32 c = 0; 372 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18,0) && !defined(RHEL_72)369 #if RTLNX_VER_MAX(3,18,0) && !defined(RHEL_72) 373 370 bo->placement.fpfn = 0; 374 371 bo->placement.lpfn = 0; … … 393 390 bo->placement.num_busy_placement = c; 394 391 395 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_72)392 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72) 396 393 for (i = 0; i < c; ++i) { 397 394 bo->placements[i].fpfn = 0; … … 418 415 419 416 vboxbo->bo.bdev = &vbox->ttm.bdev; 420 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15,0) && !defined(RHEL_71)417 #if RTLNX_VER_MAX(3,15,0) && !defined(RHEL_71) 421 418 vboxbo->bo.bdev->dev_mapping = dev->dev_mapping; 422 419 #endif … … 429 426 ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size, 430 427 ttm_bo_type_device, &vboxbo->placement, 431 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17,0) && !defined(RHEL_76) \428 #if RTLNX_VER_MAX(4,17,0) && !defined(RHEL_76) \ 432 429 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 433 430 align >> PAGE_SHIFT, false, NULL, acc_size, … … 435 432 align >> PAGE_SHIFT, false, acc_size, 436 433 #endif 437 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18,0) || defined(RHEL_72)434 #if RTLNX_VER_MIN(3,18,0) || defined(RHEL_72) 438 435 NULL, NULL, vbox_bo_ttm_destroy); 439 436 #else … … 459 456 int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr) 460 457 { 461 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16,0)) || defined(RHEL_76) \458 #if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \ 462 459 || defined(OPENSUSE_151) || defined(OPENSUSE_125) 463 460 struct ttm_operation_ctx ctx = { false, false }; … … 478 475 PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; 479 476 480 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 16,0)) && !defined(RHEL_76) \477 #if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \ 481 478 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 482 479 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); … … 497 494 int vbox_bo_unpin(struct vbox_bo *bo) 498 495 { 499 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16,0)) || defined(RHEL_76) \496 #if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \ 500 497 || defined(OPENSUSE_151) || defined(OPENSUSE_125) 501 498 struct ttm_operation_ctx ctx = { false, false }; … … 514 511 PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT; 515 512 516 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 16,0)) && !defined(RHEL_76) \513 #if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \ 517 514 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 518 515 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); … … 533 530 int vbox_bo_push_sysram(struct vbox_bo *bo) 534 531 { 535 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16,0)) || defined(RHEL_76) \532 #if (RTLNX_VER_MIN(4,16,0)) || defined(RHEL_76) \ 536 533 || defined(OPENSUSE_151) || defined(OPENSUSE_125) 537 534 struct ttm_operation_ctx ctx = { false, false }; … … 555 552 PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; 556 553 557 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4, 16,0)) && !defined(RHEL_76) \554 #if (RTLNX_VER_MAX(4,16,0)) && !defined(RHEL_76) \ 558 555 && !defined(OPENSUSE_151) && !defined(OPENSUSE_125) 559 556 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
Note:
See TracChangeset
for help on using the changeset viewer.