Index: /trunk/src/VBox/Additions/linux/drm/vboxvideo.h
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vboxvideo.h	(revision 47387)
+++ /trunk/src/VBox/Additions/linux/drm/vboxvideo.h	(revision 47388)
@@ -53,4 +53,5 @@
     resource_size_t    aper_size;
     resource_size_t    aper_base;
+    char __iomem      *vram;
     u32                vram_size;
 };
Index: /trunk/src/VBox/Additions/linux/drm/vboxvideo_device.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vboxvideo_device.c	(revision 47387)
+++ /trunk/src/VBox/Additions/linux/drm/vboxvideo_device.c	(revision 47388)
@@ -53,4 +53,27 @@
 #include <VBox/VBoxVideoGuest.h>
 
+static int vboxvideo_vram_init(struct vboxvideo_device *gdev)
+{
+    /* work out accessible VRAM */
+    gdev->mc.aper_base = pci_resource_start(gdev->ddev->pdev, 1);
+    gdev->mc.aper_size = pci_resource_len(gdev->ddev->pdev, 1);
+
+    gdev->mc.vram = ioremap(gdev->mc.aper_base, gdev->mc.aper_size);
+    if (!gdev->mc.vram) {
+        VBOXVIDEO_ERROR("Unable to ioremap %lu MB of VRAM. Bailing out.\n", (unsigned long)gdev->mc.aper_size / MB);
+        return -1;
+    }
+    gdev->fAnyX        = VBoxVideoAnyWidthAllowed();
+    gdev->mc.vram_size = VBoxVideoGetVRAMSize();
+
+    return 0;
+}
+
+static void vboxvideo_vram_fini(struct vboxvideo_device *gdev)
+{
+    iounmap(gdev->mc.vram);
+    gdev->mc.vram = NULL;
+}
+
 int vboxvideo_device_init(struct vboxvideo_device *gdev,
               struct drm_device *ddev,
@@ -58,4 +81,6 @@
               uint32_t flags)
 {
+    int ret;
+
     gdev->dev      = &pdev->dev;
     gdev->ddev     = ddev;
@@ -67,6 +92,7 @@
      *        stuff.
      */
-    gdev->fAnyX        = VBoxVideoAnyWidthAllowed();
-    gdev->mc.vram_size = VBoxVideoGetVRAMSize();
+    ret = vboxvideo_vram_init(gdev);
+    if (ret)
+        return ret;
 
     return 0;
@@ -75,5 +101,5 @@
 void vboxvideo_device_fini(struct vboxvideo_device *gdev)
 {
-
+    vboxvideo_vram_fini(gdev);
 }
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
Index: /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.c	(revision 47387)
+++ /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.c	(revision 47388)
@@ -59,4 +59,11 @@
 #include "vboxvideo_drv.h"
 
+#ifndef __devinit
+#define __devinit
+#define __devinitdata
+#endif
+
+static struct drm_driver driver;
+
 static struct pci_device_id pciidlist[] = {
         vboxvideo_PCI_IDS
@@ -64,4 +71,22 @@
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+# define drm_get_dev drm_get_pci_dev
+#endif
+
+static int __devinit
+vboxvideo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+    return drm_get_dev(pdev, ent, &driver);
+}
+
+static void
+vboxvideo_pci_remove(struct pci_dev *pdev)
+{
+    struct drm_device *dev = pci_get_drvdata(pdev);
+
+    drm_put_dev(dev);
+}
 
 #if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
@@ -89,7 +114,19 @@
 #endif
 
+#define PCI_DRIVER \
+    { \
+        .name = DRIVER_NAME, \
+        .id_table = pciidlist, \
+        .probe = vboxvideo_pci_probe, \
+        .remove = vboxvideo_pci_remove, \
+    }
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+static struct pci_driver pci_driver = PCI_DRIVER;
+#endif
+
 static struct drm_driver driver =
 {
-    .driver_features = 0,
+    .driver_features = DRIVER_MODESET,
     .load = vboxvideo_driver_load,
     .unload = vboxvideo_driver_unload,
@@ -107,9 +144,5 @@
 #endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
-    .pci_driver =
-    {
-        .name = DRIVER_NAME,
-        .id_table = pciidlist,
-    },
+    .pci_driver = PCI_DRIVER,
 #endif
     .name = DRIVER_NAME,
@@ -120,12 +153,4 @@
     .patchlevel = DRIVER_PATCHLEVEL,
 };
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
-static struct pci_driver pci_driver =
-{
-    .name = DRIVER_NAME,
-    .id_table = pciidlist,
-};
-#endif
 
 static int __init vboxvideo_init(void)
Index: /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.h
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.h	(revision 47387)
+++ /trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.h	(revision 47388)
@@ -66,4 +66,6 @@
 #define VBOXVIDEO_ERROR(fmt, arg...) DRM_ERROR(DRIVER_NAME ": " fmt, ##arg)
 
+#define MB (1024 * 1024)
+
 /** @todo does this make sense?  What exactly is this connector? */
 #define VBOXVIDEOFB_CONN_LIMIT VBOX_VIDEO_MAX_SCREENS
