Index: src/VBox/Additions/x11/vboxvideo/vboxvideo.c
===================================================================
--- src/VBox/Additions/x11/vboxvideo/vboxvideo.c	(revision 104001)
+++ src/VBox/Additions/x11/vboxvideo/vboxvideo.c	(working copy)
@@ -98,16 +98,25 @@
 # include <stdlib.h>
 # include <string.h>
 #endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+# define XSERVER_PLATFORM_BUS
+# include <xf86platformBus.h>
+#endif
 
 /* Mandatory functions */
 
 static const OptionInfoRec * VBOXAvailableOptions(int chipid, int busid);
 static void VBOXIdentify(int flags);
+#ifdef XORG_7X
+static Bool VBoxDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, void *pData);
+#endif
 #ifndef PCIACCESS
 static Bool VBOXProbe(DriverPtr drv, int flags);
 #else
 static Bool VBOXPciProbe(DriverPtr drv, int entity_num,
      struct pci_device *dev, intptr_t match_data);
+static Bool VBOXPlatformProbe(DriverPtr drv, int entity_num, int flags,
+                         struct xf86_platform_device *dev, intptr_t match_data);
 #endif
 static Bool VBOXPreInit(ScrnInfoPtr pScrn, int flags);
 static Bool VBOXScreenInit(ScreenPtr pScreen, int argc, char **argv);
@@ -197,12 +206,15 @@
     NULL,
     0,
 #ifdef XORG_7X
-    NULL,
+    VBoxDriverFunc,
 #endif
 #ifdef PCIACCESS
     vbox_device_match,
-    VBOXPciProbe
+    VBOXPciProbe,
 #endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+    VBOXPlatformProbe,
+#endif
 };
 
 /* No options for now */
@@ -717,6 +729,23 @@
     pScrn->FreeScreen    = SCRNINDEXAPI(VBOXFreeScreen);
 }
 
+#ifdef XORG_7X
+static Bool VBoxDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, void *pData)
+{
+    switch (op)
+    {
+# if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+        case SUPPORTS_SERVER_FDS:
+            TRACE_LOG("SUPPORTS_SERVER_FDS\n");
+            return TRUE;
+# endif
+        default:
+            TRACE_LOG("default\n");
+            return FALSE;
+    }
+}
+#endif
+
 /*
  * One of these functions is called once, at the start of the first server
  * generation to do a minimal probe for supported hardware.
@@ -746,8 +775,35 @@
     TRACE_LOG("returning %s\n", BOOL_STR(pScrn != NULL));
     return (pScrn != NULL);
 }
+
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+static Bool VBOXPlatformProbe(DriverPtr drv, int entity_num, int flags,
+                          struct xf86_platform_device *dev, intptr_t match_data)
+{
+    ScrnInfoPtr pScrn;
+    int scrnFlag = 0;
+
+    if (!dev->pdev)
+        return FALSE;
+
+    if (flags & PLATFORM_PROBE_GPU_SCREEN)
+        scrnFlag = XF86_ALLOCATE_GPU_SCREEN;
+
+    pScrn = xf86AllocateScreen(drv, scrnFlag);
+    if (!pScrn)
+        return FALSE;
+
+    if (xf86IsEntitySharable(entity_num))
+        xf86SetEntityShared(entity_num);
+
+    xf86AddEntityToScreen(pScrn, entity_num);
+    setScreenFunctions(pScrn, NULL);
+    return TRUE;
+}
 #endif
 
+#endif
+
 #ifndef PCIACCESS
 static Bool
 VBOXProbe(DriverPtr drv, int flags)
@@ -884,6 +940,14 @@
                            pVBox->pciInfo->func);
 #endif
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+    if (pVBox->pEnt->location.type == BUS_PLATFORM)
+    {
+        pVBox->pPlatformDevice = pVBox->pEnt->location.id.plat;
+        pVBox->pciInfo = xf86GetPciInfoForEntity(pVBox->pEnt->index);
+    }
+#endif
+
     /* Set up our ScrnInfoRec structure to describe our virtual
        capabilities to X. */
 
@@ -1393,7 +1457,11 @@
     if (pVBox->useDRI)
         DRIUnlock(xf86ScrnToScreen(pScrn));
 #elif defined(VBOX_DRI)  /* DRI2 */
-    if (pVBox->drmFD >= 0)
+    if (   pVBox->drmFD >= 0
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+        && !(pVBox->pPlatformDevice && pVBox->pPlatformDevice->flags & XF86_PDEV_SERVER_FD)
+#endif
+        )
     {
         /* Tell the kernel driver, if present, that we are taking over. */
         drmSetMaster(pVBox->drmFD);
@@ -1436,7 +1504,11 @@
     if (pVBox->useDRI)
         DRILock(xf86ScrnToScreen(pScrn), 0);
 #elif defined(VBOX_DRI)  /* DRI2 */
-    if (pVBox->drmFD >= 0)
+    if (   pVBox->drmFD >= 0
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+        && !(pVBox->pPlatformDevice && pVBox->pPlatformDevice->flags & XF86_PDEV_SERVER_FD)
+#endif
+        )
         drmDropMaster(pVBox->drmFD);
 #endif
     VBOXRestoreMode(pScrn);
Index: src/VBox/Additions/x11/vboxvideo/vboxvideo.h
===================================================================
--- src/VBox/Additions/x11/vboxvideo/vboxvideo.h	(revision 104001)
+++ src/VBox/Additions/x11/vboxvideo/vboxvideo.h	(working copy)
@@ -234,6 +234,7 @@
 # endif
     int drmFD;
 #endif
+    struct xf86_platform_device *pPlatformDevice;
 } VBOXRec, *VBOXPtr;
 
 /* helpers.c */
Index: src/VBox/Additions/x11/vboxvideo/vboxvideo_dri2.c
===================================================================
--- src/VBox/Additions/x11/vboxvideo/vboxvideo_dri2.c	(revision 104001)
+++ src/VBox/Additions/x11/vboxvideo/vboxvideo_dri2.c	(working copy)
@@ -21,6 +21,10 @@
 #include <dri2.h>
 #include <fcntl.h>
 #include <unistd.h>
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+# define XSERVER_PLATFORM_BUS
+# include <xf86platformBus.h>
+#endif
 
 static void VBOXDRICopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
                               DRI2BufferPtr pDest, DRI2BufferPtr pSrc)
@@ -61,6 +65,14 @@
 
     memset(&DRI2Info, 0, sizeof(DRI2Info));
     pVBox->drmFD = -1;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+    if (pVBox->pPlatformDevice && (pVBox->pPlatformDevice->flags & XF86_PDEV_SERVER_FD))
+    {
+        pVBox->drmFD = xf86_platform_device_odev_attributes(pVBox->pPlatformDevice)->fd;
+        if (pVBox->drmFD == -1)
+            return FALSE;
+    }
+#endif
     for (i = 0; i < RT_ELEMENTS(devicePaths); ++i)
     {
         int fd = open(devicePaths[i], O_RDWR);
@@ -70,12 +82,15 @@
             if (   pVersion
                 && pVersion->name_len
                 && !strcmp(pVersion->name, VBOX_DRM_DRIVER_NAME)
-                && drmSetMaster(fd) == 0)
+                && (pVBox->drmFD != -1 || drmSetMaster(fd) == 0))
             {
                 TRACE_LOG("Opened drm device %s\n", devicePaths[i]);
                 DRI2Info.deviceName = devicePaths[i];
-                /* Keep the driver open and hope that the path won't change. */
-                pVBox->drmFD = fd;
+                if (pVBox->drmFD == -1)
+                {
+                    /* Keep the driver open and hope that the path won't change. */
+                    pVBox->drmFD = fd;
+                }
                 drmFreeVersion(pVersion);
                 break;
             }
@@ -98,6 +113,10 @@
 void VBOXDRICloseScreen(ScreenPtr pScreen, VBOXPtr pVBox)
 {
     DRI2CloseScreen(pScreen);
-    if (pVBox->drmFD >= 0)
+    if (   pVBox->drmFD >= 0
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 19
+        && !(pVBox->pPlatformDevice && pVBox->pPlatformDevice->flags & XF86_PDEV_SERVER_FD)
+#endif
+        )
         close(pVBox->drmFD);
 }
