VirtualBox

Changeset 71985 in vbox


Ignore:
Timestamp:
Apr 23, 2018 3:25:48 PM (7 years ago)
Author:
vboxsync
Message:

Additions/linux/drm: update drm driver for Linux 4.16. No bugref.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/vbox_ttm.c

    r71947 r71985  
    199199}
    200200
    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 #else
    212         r = ttm_bo_move_memcpy(bo, interruptible, no_wait_gpu, new_mem);
    213 #endif
    214         return r;
    215 }
    216 
    217201static void vbox_ttm_backend_destroy(struct ttm_tt *tt)
    218202{
     
    245229}
    246230
     231#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
     232# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
    247233static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
    248234{
    249235        return ttm_pool_populate(ttm);
    250236}
     237# else
     238static 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
    251244
    252245static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm)
     
    254247        ttm_pool_unpopulate(ttm);
    255248}
     249#endif
    256250
    257251struct ttm_bo_driver vbox_bo_driver = {
    258252        .ttm_tt_create = vbox_ttm_tt_create,
     253#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0)
    259254        .ttm_tt_populate = vbox_ttm_tt_populate,
    260255        .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
     256#endif
    261257        .init_mem_type = vbox_bo_init_mem_type,
    262258#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) || defined(RHEL_74)
     
    264260#endif
    265261        .evict_flags = vbox_bo_evict_flags,
    266         .move = vbox_bo_move,
    267262        .verify_access = vbox_bo_verify_access,
    268263        .io_mem_reserve = &vbox_ttm_io_mem_reserve,
    269264        .io_mem_free = &vbox_ttm_io_mem_free,
    270265#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL_75)
     266# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
    271267        .io_mem_pfn = ttm_bo_default_io_mem_pfn,
     268# endif
    272269#endif
    273270#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)) \
     
    425422int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
    426423{
     424#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
     425        struct ttm_operation_ctx ctx = { false, false };
     426#endif
    427427        int i, ret;
    428428
     
    440440                PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
    441441
     442#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
    442443        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
     444#else
     445        ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
     446#endif
    443447        if (ret)
    444448                return ret;
     
    454458int vbox_bo_unpin(struct vbox_bo *bo)
    455459{
     460#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
     461        struct ttm_operation_ctx ctx = { false, false };
     462#endif
    456463        int i, ret;
    457464
     
    467474                PLACEMENT_FLAGS(bo->placements[i]) &= ~TTM_PL_FLAG_NO_EVICT;
    468475
     476#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
    469477        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
     478#else
     479        ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
     480#endif
    470481        if (ret)
    471482                return ret;
     
    481492int vbox_bo_push_sysram(struct vbox_bo *bo)
    482493{
     494#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
     495        struct ttm_operation_ctx ctx = { false, false };
     496#endif
    483497        int i, ret;
    484498
     
    499513                PLACEMENT_FLAGS(bo->placements[i]) |= TTM_PL_FLAG_NO_EVICT;
    500514
     515#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
    501516        ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
     517#else
     518        ret = ttm_bo_validate(&bo->bo, &bo->placement, &ctx);
     519#endif
    502520        if (ret) {
    503521                DRM_ERROR("pushing to VRAM failed\n");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette