Changeset 71985 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Apr 23, 2018 3:25:48 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_ttm.c
r71947 r71985 199 199 } 200 200 201 static int vbox_bo_move(struct ttm_buffer_object *bo,202 bool evict, bool interruptible,203 bool no_wait_gpu, struct ttm_mem_reg *new_mem)204 {205 int r;206 207 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) && !defined(RHEL_74)208 r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);209 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) && !defined(RHEL_74)210 r = ttm_bo_move_memcpy(bo, evict, interruptible, no_wait_gpu, new_mem);211 #else212 r = ttm_bo_move_memcpy(bo, interruptible, no_wait_gpu, new_mem);213 #endif214 return r;215 }216 217 201 static void vbox_ttm_backend_destroy(struct ttm_tt *tt) 218 202 { … … 245 229 } 246 230 231 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) 232 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) 247 233 static int vbox_ttm_tt_populate(struct ttm_tt *ttm) 248 234 { 249 235 return ttm_pool_populate(ttm); 250 236 } 237 # else 238 static int vbox_ttm_tt_populate(struct ttm_tt *ttm, 239 struct ttm_operation_ctx *ctx) 240 { 241 return ttm_pool_populate(ttm, ctx); 242 } 243 # endif 251 244 252 245 static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm) … … 254 247 ttm_pool_unpopulate(ttm); 255 248 } 249 #endif 256 250 257 251 struct ttm_bo_driver vbox_bo_driver = { 258 252 .ttm_tt_create = vbox_ttm_tt_create, 253 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) 259 254 .ttm_tt_populate = vbox_ttm_tt_populate, 260 255 .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate, 256 #endif 261 257 .init_mem_type = vbox_bo_init_mem_type, 262 258 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) || defined(RHEL_74) … … 264 260 #endif 265 261 .evict_flags = vbox_bo_evict_flags, 266 .move = vbox_bo_move,267 262 .verify_access = vbox_bo_verify_access, 268 263 .io_mem_reserve = &vbox_ttm_io_mem_reserve, 269 264 .io_mem_free = &vbox_ttm_io_mem_free, 270 265 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL_75) 266 # if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) 271 267 .io_mem_pfn = ttm_bo_default_io_mem_pfn, 268 # endif 272 269 #endif 273 270 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \ … … 425 422 int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr) 426 423 { 424 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) 425 struct ttm_operation_ctx ctx = { false, false }; 426 #endif 427 427 int i, ret; 428 428 … … 440 440 PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; 441 441 442 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) 442 443 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); 444 #else 445 ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); 446 #endif 443 447 if (ret) 444 448 return ret; … … 454 458 int vbox_bo_unpin(struct vbox_bo *bo) 455 459 { 460 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) 461 struct ttm_operation_ctx ctx = { false, false }; 462 #endif 456 463 int i, ret; 457 464 … … 467 474 PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT; 468 475 476 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) 469 477 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); 478 #else 479 ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); 480 #endif 470 481 if (ret) 471 482 return ret; … … 481 492 int vbox_bo_push_sysram(struct vbox_bo *bo) 482 493 { 494 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0) 495 struct ttm_operation_ctx ctx = { false, false }; 496 #endif 483 497 int i, ret; 484 498 … … 499 513 PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT; 500 514 515 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) 501 516 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); 517 #else 518 ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx); 519 #endif 502 520 if (ret) { 503 521 DRM_ERROR("pushing to VRAM failed\n");
Note:
See TracChangeset
for help on using the changeset viewer.