VirtualBox

Changeset 50946 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Apr 1, 2014 3:40:11 PM (11 years ago)
Author:
vboxsync
Message:

Additions/linux/drm: remove unneeded code from and simplify version dependencies in old driver.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/Makefile.kmk

    r50901 r50946  
    6262        KBUILD_BASENAME=KBUILD_STR\(vboxvideo\) \
    6363        DEBUG_HASH=2 DEBUG_HASH2=3
    64 # detect fc6 2.6.18
    65 vboxvideo_drm_DEFS           += \
    66         $(foreach inc,$(VBOX_LINUX_INCS),\
    67                 $(if $(wildcard $(inc)/linux/utsrelease.h),\
    68                  $(if $(shell if grep -q '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h;\
    69                                then echo yes; fi),KERNEL_FC6,),))
    70 # detect rhel5 2.6.18
    71 vboxvideo_drm_DEFS           += \
    72         $(foreach inc,$(VBOX_LINUX_INCS),\
    73                 $(if $(wildcard $(inc)/linux/utsrelease.h),\
    74                  $(if $(shell if grep -q '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h;\
    75                                then echo yes; fi),KERNEL_FC6,),))
    7664if !defined(VBOX_WITH_GUEST_KMS_DRIVER)
    7765 vboxvideo_drm_SOURCES         = vboxvideo_drm.c
  • trunk/src/VBox/Additions/linux/drm/vboxvideo_drm.c

    r49428 r50946  
    5050 */
    5151
    52 #include <linux/version.h>
    53 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
    54 # include <generated/autoconf.h>
    55 #else
    56 # ifndef AUTOCONF_INCLUDED
    57 #  include <linux/autoconf.h>
    58 # endif
    59 #endif
    60 #include <linux/module.h>
    6152#include "version-generated.h"
    6253
    63 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
    64 
    65 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
    66 #  ifdef RHEL_RELEASE_CODE
    67 #   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 1)
    68 #    define DRM_RHEL61
    69 #   endif
    70 #   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)
    71 #    define DRM_FOPS_AS_POINTER
    72 #   endif
    73 #   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)
    74 #    define DRM_NO_RECLAIM_BUFFERS
    75 #   endif
    76 #  endif
    77 # endif
    78 
    79 #include "drm/drmP.h"
     54#include <linux/module.h>
     55#include <drm/drmP.h>
    8056#include "vboxvideo_drm.h"
    8157
    82 # ifndef RHEL_RELEASE_CODE
    83 #  if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
    84 #   if defined(DRM_MODE_OBJECT_PLANE) && defined(DRM_IOCTL_MODE_ADDFB2)
    85 #    define DRM_FOPS_AS_POINTER
    86 #   endif
    87 #  endif
    88 # endif
    89 
    90 #ifdef CONFIG_SUSE_KERNEL
    91 /* This is to cover the SLES 11 SP3 kernel back-ports. */
    92 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61)
    93 #  if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
    94 #    define DRM_FOPS_AS_POINTER
    95 #    define DRM_NO_RECLAIM_BUFFERS
    96 #  endif
    97 # endif
     58/* This definition and the file-operations-as-pointer change were both added in
     59 * kernel 3.3.  All back-ports of the structure change to distribution kernels
     60 * that I have checked also back-ported the definition at the same time. */
     61#ifdef DRM_IOCTL_MODE_ADDFB2
     62# define DRM_FOPS_AS_POINTER
    9863#endif
    9964
     
    10671int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags)
    10772{
    108 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
    109     return drm_vblank_init(dev, 1);
    110 #else
    11173    return 0;
    112 #endif
    11374}
    114 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER)
     75
     76#ifdef DRM_FOPS_AS_POINTER
    11577/* since linux-3.3.0-rc1 drm_driver::fops is pointer */
    11678static struct file_operations driver_fops =
     
    12991    /* .driver_features = DRIVER_USE_MTRR, */
    13092    .load = vboxvideo_driver_load,
    131 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_NO_RECLAIM_BUFFERS)
    132     .reclaim_buffers = drm_core_reclaim_buffers,
    133 #endif
    134     /* As of Linux 2.6.37, always the internal functions are used. */
    135 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && !defined(DRM_RHEL61)
    136     .get_map_ofs = drm_core_get_map_ofs,
    137     .get_reg_ofs = drm_core_get_reg_ofs,
    138 #endif
    139 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_FOPS_AS_POINTER)
     93# ifndef DRM_FOPS_AS_POINTER
    14094    .fops =
    14195    {
     
    14599        /* This was changed with Linux 2.6.33 but Fedora backported this
    146100         * change to their 2.6.32 kernel. */
    147 #if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
     101#if defined(DRM_UNLOCKED)
    148102        .unlocked_ioctl = drm_ioctl,
    149103#else
     
    153107        .poll = drm_poll,
    154108    },
    155 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) */
     109#else /* defined(DRM_FOPS_AS_POINTER) */
    156110    .fops = &driver_fops,
    157111#endif
     
    202156MODULE_AUTHOR(DRIVER_AUTHOR);
    203157MODULE_DESCRIPTION(DRIVER_DESC);
    204 
    205 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
    206 
    207158#ifdef MODULE_VERSION
    208159MODULE_VERSION(VBOX_VERSION_STRING);
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