summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/linux/drm/vboxvideo_drm.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/linux/drm/vboxvideo_drm.c
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/linux/drm/vboxvideo_drm.c')
-rw-r--r--src/VBox/Additions/linux/drm/vboxvideo_drm.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c
index 02c23183..37b9df7e 100644
--- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c
+++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -64,11 +64,14 @@
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
# ifdef RHEL_RELEASE_CODE
-# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1)
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 1)
# define DRM_RHEL61
# endif
-# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,3)
-# define DRM_RHEL63
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)
+# define DRM_FOPS_AS_POINTER
+# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)
+# define DRM_NO_RECLAIM_BUFFERS
# endif
# endif
# endif
@@ -76,10 +79,30 @@
#include "drm/drmP.h"
#include "vboxvideo_drm.h"
+# ifndef RHEL_RELEASE_CODE
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+# if defined(DRM_MODE_OBJECT_PLANE) && defined(DRM_IOCTL_MODE_ADDFB2)
+# define DRM_FOPS_AS_POINTER
+# endif
+# endif
+# endif
+
+#ifdef CONFIG_SUSE_KERNEL
+/* This is to cover the SLES 11 SP3 kernel back-ports. */
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
+# define DRM_FOPS_AS_POINTER
+# define DRM_NO_RECLAIM_BUFFERS
+# endif
+# endif
+#endif
+
static struct pci_device_id pciidlist[] = {
vboxvideo_PCI_IDS
};
+MODULE_DEVICE_TABLE(pci, pciidlist);
+
int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags)
{
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
@@ -88,7 +111,7 @@ int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags)
return 0;
#endif
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER)
/* since linux-3.3.0-rc1 drm_driver::fops is pointer */
static struct file_operations driver_fops =
{
@@ -98,7 +121,6 @@ static struct file_operations driver_fops =
.unlocked_ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
- .fasync = drm_fasync,
};
#endif
@@ -106,7 +128,7 @@ static struct drm_driver driver =
{
/* .driver_features = DRIVER_USE_MTRR, */
.load = vboxvideo_driver_load,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_NO_RECLAIM_BUFFERS)
.reclaim_buffers = drm_core_reclaim_buffers,
#endif
/* As of Linux 2.6.37, always the internal functions are used. */
@@ -114,7 +136,7 @@ static struct drm_driver driver =
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
#endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_RHEL63)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_FOPS_AS_POINTER)
.fops =
{
.owner = THIS_MODULE,
@@ -129,12 +151,11 @@ static struct drm_driver driver =
#endif
.mmap = drm_mmap,
.poll = drm_poll,
- .fasync = drm_fasync,
},
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63) */
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) */
.fops = &driver_fops,
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61)
+#ifndef DRIVER_BUS_PCI
.pci_driver =
{
.name = DRIVER_NAME,
@@ -149,7 +170,7 @@ static struct drm_driver driver =
.patchlevel = DRIVER_PATCHLEVEL,
};
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(DRM_RHEL61)
+#ifdef DRIVER_BUS_PCI
static struct pci_driver pci_driver =
{
.name = DRIVER_NAME,
@@ -159,7 +180,7 @@ static struct pci_driver pci_driver =
static int __init vboxvideo_init(void)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61)
+#ifndef DRIVER_BUS_PCI
return drm_init(&driver);
#else
return drm_pci_init(&driver, &pci_driver);
@@ -168,7 +189,7 @@ static int __init vboxvideo_init(void)
static void __exit vboxvideo_exit(void)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61)
+#ifndef DRIVER_BUS_PCI
drm_exit(&driver);
#else
drm_pci_exit(&driver, &pci_driver);