VirtualBox

Changeset 77850 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Mar 22, 2019 2:49:18 PM (6 years ago)
Author:
vboxsync
Message:

Additions/linux/vboxvideo: make driver work with Linux 5.0 and 5.1.
bugref:4567: Linux kernel driver maintenance.
This change mainly consists of adaptations of the parts of the following
kernel changes which affect staging/vboxvideo:

commit c58ac649e3553c23a9bafba8c2e5d040aee87484
Author: Cihangir Akturk <cakturk@…>
Date: Fri Aug 11 15:33:14 2017 +0300

drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

Author: Christian König <christian.koenig@…>
Date: Fri Oct 19 13:49:05 2018 +0200

drm/ttm: use a static ttm_mem_global instance

commit a64f784bb14a56bfdfad2dc397dd67e4564e3a29
Author: Christian König <christian.koenig@…>
Date: Fri Oct 19 16:55:26 2018 +0200

drm/ttm: initialize globals during device init (v2)

Location:
trunk/src/VBox/Additions/linux/drm
Files:
6 edited

Legend:

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

    r76976 r77850  
    4242#include "vbox_drv.h"
    4343
     44#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
     45#include <drm/drm_probe_helper.h>
     46#endif
     47
    4448#include "version-generated.h"
    4549#include "revision-generated.h"
     
    303307static struct drm_driver driver = {
    304308        .driver_features =
    305             DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
     309            DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ |
     310#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
     311            DRIVER_IRQ_SHARED |
     312#endif
    306313            DRIVER_PRIME,
    307314        .dev_priv_size = 0,
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r76976 r77850  
    117117#endif
    118118
     119#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && !defined(RHEL_75)
     120static inline void drm_gem_object_put(struct drm_gem_object *obj)
     121{
     122        drm_gem_object_unreference(obj);
     123}
     124#endif
     125
    119126#define DRIVER_AUTHOR       VBOX_VENDOR
    120127
     
    175182
    176183        struct {
     184#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    177185                struct drm_global_reference mem_global_ref;
    178186                struct ttm_bo_global_ref bo_global_ref;
     187#endif
    179188                struct ttm_bo_device bdev;
    180189                bool mm_initialised;
  • trunk/src/VBox/Additions/linux/drm/vbox_irq.c

    r76937 r77850  
    3434#include "vbox_drv.h"
    3535
     36#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
    3637#include <drm/drm_crtc_helper.h>
     38#else
     39#include <drm/drm_probe_helper.h>
     40#endif
    3741#include <VBoxVideo.h>
    3842
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r76976 r77850  
    606606#endif
    607607
     608#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
    608609static void vbox_bo_unref(struct vbox_bo **bo)
    609610{
     
    618619                *bo = NULL;
    619620}
     621#endif
    620622
    621623void vbox_gem_free_object(struct drm_gem_object *obj)
     
    623625        struct vbox_bo *vbox_bo = gem_to_vbox_bo(obj);
    624626
     627#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
    625628        vbox_bo_unref(&vbox_bo);
     629#else
     630        ttm_bo_put(&vbox_bo->bo);
     631#endif
    626632}
    627633
     
    658664        *offset = vbox_bo_mmap_offset(bo);
    659665
    660         drm_gem_object_unreference(obj);
     666        drm_gem_object_put(obj);
    661667        ret = 0;
    662668
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r76978 r77850  
    4242#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_72)
    4343#include <drm/drm_plane_helper.h>
     44#endif
     45#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
     46#include <drm/drm_probe_helper.h>
    4447#endif
    4548
  • trunk/src/VBox/Additions/linux/drm/vbox_ttm.c

    r76553 r77850  
    4747}
    4848
     49#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    4950static int vbox_ttm_mem_global_init(struct drm_global_reference *ref)
    5051{
     
    6566        int ret;
    6667
     68#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    6769        global_ref = &vbox->ttm.mem_global_ref;
    6870        global_ref->global_type = DRM_GLOBAL_TTM_MEM;
     
    7779
    7880        vbox->ttm.bo_global_ref.mem_glob = vbox->ttm.mem_global_ref.object;
     81#endif
    7982        global_ref = &vbox->ttm.bo_global_ref.ref;
    8083        global_ref->global_type = DRM_GLOBAL_TTM_BO;
     
    8689        if (ret) {
    8790                DRM_ERROR("Failed setting up TTM BO subsystem.\n");
     91#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    8892                drm_global_item_unref(&vbox->ttm.mem_global_ref);
     93#endif
    8994                return ret;
    9095        }
     
    101106        drm_global_item_unref(&vbox->ttm.mem_global_ref);
    102107}
     108#endif
    103109
    104110static void vbox_bo_ttm_destroy(struct ttm_buffer_object *tbo)
     
    288294        struct ttm_bo_device *bdev = &vbox->ttm.bdev;
    289295
     296#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    290297        ret = vbox_ttm_global_init(vbox);
    291298        if (ret)
    292299                return ret;
     300#endif
    293301
    294302        ret = ttm_bo_device_init(&vbox->ttm.bdev,
     303#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    295304                                 vbox->ttm.bo_global_ref.ref.object,
     305#endif
    296306                                 &vbox_bo_driver,
    297307#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL_71)
     
    301311        if (ret) {
    302312                DRM_ERROR("Error initialising bo driver; %d\n", ret);
     313#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    303314                goto err_ttm_global_release;
     315#else
     316                return ret;
     317#endif
    304318        }
    305319
     
    323337err_device_release:
    324338        ttm_bo_device_release(&vbox->ttm.bdev);
     339#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    325340err_ttm_global_release:
    326341        vbox_ttm_global_release(vbox);
     342#endif
    327343        return ret;
    328344}
     
    338354#endif
    339355        ttm_bo_device_release(&vbox->ttm.bdev);
     356#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
    340357        vbox_ttm_global_release(vbox);
     358#endif
    341359}
    342360
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