Index: /trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
===================================================================
--- /trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c	(revision 35930)
+++ /trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c	(revision 35931)
@@ -785,4 +785,6 @@
     /* Get our private data from the ScrnInfoRec structure. */
     pVBox = VBOXGetRec(pScrn);
+    if (!pVBox)
+        return FALSE;
 
     /* Initialise the guest library */
@@ -802,5 +804,5 @@
 
     /* The framebuffer module. */
-    if (xf86LoadSubModule(pScrn, "fb") == NULL)
+    if (!xf86LoadSubModule(pScrn, "fb"))
         return (FALSE);
 
@@ -831,8 +833,8 @@
 
     pScrn->chipset = "vbox";
+    /** @note needed during colourmap initialisation */
     pScrn->rgbBits = 8;
 
-    /* Let's create a nice, capable virtual monitor.
-     * This *is* still needed, at least for server version 1.3 */
+    /* Let's create a nice, capable virtual monitor. */
     pScrn->monitor = pScrn->confScreen->monitor;
     pScrn->monitor->DDC = NULL;
@@ -926,6 +928,12 @@
     xf86SetDpi(pScrn, 96, 96);
 
-    /* Framebuffer-related setup */
-    pScrn->bitmapBitOrder = BITMAP_BIT_ORDER;
+    if (pScrn->memPhysBase == 0) {
+#ifdef PCIACCESS
+        pScrn->memPhysBase = pVBox->pciInfo->regions[0].base_addr;
+#else
+        pScrn->memPhysBase = pVBox->pciInfo->memBase[0];
+#endif
+        pScrn->fbOffset = 0;
+    }
 
     TRACE_EXIT();
@@ -980,13 +988,4 @@
         return (FALSE);
 
-    if (pScrn->memPhysBase == 0) {
-#ifdef PCIACCESS
-        pScrn->memPhysBase = pVBox->pciInfo->regions[0].base_addr;
-#else
-        pScrn->memPhysBase = pVBox->pciInfo->memBase[0];
-#endif
-        pScrn->fbOffset = 0;
-    }
-
     if (!VBOXMapVidMem(pScrn))
         return (FALSE);
@@ -997,6 +996,4 @@
     /* mi layer - reset the visual list (?)*/
     miClearVisualTypes();
-    if (!xf86SetDefaultVisual(pScrn, -1))
-        return (FALSE);
     if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
                           pScrn->rgbBits, TrueColor))
@@ -1009,6 +1006,4 @@
 #endif
 
-    /* I checked in the sources, and XFree86 4.2 does seem to support
-       this function for 32bpp. */
     if (!fbScreenInit(pScreen, pVBox->base,
                       pScrn->virtualX, pScrn->virtualY,
@@ -1018,4 +1013,5 @@
 
     /* Fixup RGB ordering */
+    /** @note the X server uses this even in true colour. */
     visual = pScreen->visuals + pScreen->numVisuals;
     while (--visual >= pScreen->visuals) {
