Index: trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c
===================================================================
--- trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c	(revision 33459)
+++ trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c	(revision 33460)
@@ -1034,12 +1034,17 @@
  * cx and cy.
  */
-static void vboxFillDisplayMode(DisplayModePtr m, const char *pszName,
-                                unsigned cx, unsigned cy)
-{
+static void vboxFillDisplayMode(ScrnInfoPtr pScrn, DisplayModePtr m,
+                                const char *pszName, unsigned cx, unsigned cy)
+{
+    VBOXPtr pVBox = pScrn->driverPrivate;
     TRACE_LOG("pszName=%s, cx=%u, cy=%u\n", pszName, cx, cy);
     m->status        = MODE_OK;
     m->type          = M_T_BUILTIN;
-    /* VBox only supports screen widths which are a multiple of 8 */
-    m->HDisplay      = cx & ~7;
+    /* Older versions of VBox only support screen widths which are a multiple
+     * of 8 */
+    if (pVBox->fAnyX)
+        m->HDisplay  = cx;
+    else
+        m->HDisplay  = cx & ~7;
     m->HSyncStart    = m->HDisplay + 2;
     m->HSyncEnd      = m->HDisplay + 4;
@@ -1155,7 +1160,4 @@
         if ((cx == 0) || (cy == 0))
             found = false;
-        if (found)
-            /* Adjust to a multiple of eight */
-            cx &= ~7;
         if (!found)
             found = (vboxNextStandardMode(pScrn, 0, &cx, &cy, &cBits) != 0);
@@ -1236,7 +1238,7 @@
         {
             if (!found)
-                vboxFillDisplayMode(pMode, NULL, cx, cy);
+                vboxFillDisplayMode(pScrn, pMode, NULL, cx, cy);
             else if (pCurrent)
-                vboxFillDisplayMode(pMode, NULL, pCurrent->HDisplay,
+                vboxFillDisplayMode(pScrn, pMode, NULL, pCurrent->HDisplay,
                                     pCurrent->VDisplay);
             found = true;
@@ -1308,10 +1310,10 @@
      * be, and breaks the second assumption, we guarantee the first. */
     DisplayModePtr pMode = vboxAddEmptyScreenMode(pScrn);
-    vboxFillDisplayMode(pMode, "VBoxInitialMode", cxInit, cyInit);
+    vboxFillDisplayMode(pScrn, pMode, "VBoxInitialMode", cxInit, cyInit);
     /* Create our two dynamic modes. */
     pMode = vboxAddEmptyScreenMode(pScrn);
-    vboxFillDisplayMode(pMode, "VBoxDynamicMode", cxInit, cyInit);
+    vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit);
     pMode = vboxAddEmptyScreenMode(pScrn);
-    vboxFillDisplayMode(pMode, "VBoxDynamicMode", cxInit, cyInit);
+    vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit);
     /* Add standard modes supported by the host */
     for ( ; ; )
@@ -1323,5 +1325,5 @@
         sprintf(szName, "VBox-%ux%u", cx, cy);
         pMode = vboxAddEmptyScreenMode(pScrn);
-        vboxFillDisplayMode(pMode, szName, cx, cy);
+        vboxFillDisplayMode(pScrn, pMode, szName, cx, cy);
     }
     /* And finally any modes specified by the user.  We assume here that
@@ -1333,5 +1335,5 @@
         {
             pMode = vboxAddEmptyScreenMode(pScrn);
-            vboxFillDisplayMode(pMode, pScrn->display->modes[i], cx, cy);
+            vboxFillDisplayMode(pScrn, pMode, pScrn->display->modes[i], cx, cy);
         }
     }
Index: trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
===================================================================
--- trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h	(revision 33459)
+++ trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h	(revision 33460)
@@ -137,4 +137,5 @@
 #define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
 #define VBE_DISPI_ID2                   0xB0C2
+#define VBE_DISPI_ID_ANYX               0xBE02
 #define VBE_DISPI_DISABLED              0x00
 #define VBE_DISPI_ENABLED               0x01
@@ -220,4 +221,5 @@
     VMMDevMemory *pVMMDevMemory;
     VBVAMEMORY *pVbvaMemory;
+    Bool fAnyX;   /* Unrestricted horizontal resolution flag. */
 #ifdef VBOX_DRI
     Bool useDRI;
Index: trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c
===================================================================
--- trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c	(revision 33459)
+++ trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c	(revision 33460)
@@ -202,7 +202,4 @@
 
     TRACE_LOG("width=%d, height=%d\n", width, height);
-    /* We only support horizontal resolutions which are a multiple of 8.
-     * Round up if necessary. */
-    width = (width + 7) & ~7;
     if (width * height * bpp / 8 >= scrn->videoRam * 1024)
     {
@@ -261,22 +258,5 @@
 vbox_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode,
                       DisplayModePtr adjusted_mode)
-{
-    ScrnInfoPtr pScrn = crtc->scrn;
-    int xRes = adjusted_mode->HDisplay;
-
-    (void) mode;
-    TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d\n", adjusted_mode->name,
-           adjusted_mode->HDisplay, adjusted_mode->VDisplay);
-    /* We only support horizontal resolutions which are a multiple of 8.  Round down if
-       necessary. */
-    if (xRes % 8 != 0)
-    {
-        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-                   "VirtualBox only supports screen widths which are a multiple of 8.  Rounding down from %d to %d\n",
-                   xRes, xRes - (xRes % 8));
-        adjusted_mode->HDisplay = xRes - (xRes % 8);
-    }
-    return TRUE;
-}
+{ (void) crtc; (void) mode; (void) adjusted_mode; return TRUE; }
 
 static void
@@ -379,5 +359,6 @@
 
 static void
-vbox_output_add_mode (DisplayModePtr *pModes, const char *pszName, int x, int y,
+vbox_output_add_mode (VBOXPtr pVBox, DisplayModePtr *pModes,
+                      const char *pszName, int x, int y,
                       Bool isPreferred, Bool isUserDef)
 {
@@ -391,6 +372,10 @@
     if (isPreferred)
         pMode->type     |= M_T_PREFERRED;
-    /* VBox only supports screen widths which are a multiple of 8 */
-    pMode->HDisplay      = (x + 7) & ~7;
+    /* Older versions of VBox only support screen widths which are a multiple
+     * of 8 */
+    if (pVBox->fAnyX)
+        pMode->HDisplay  = x;
+    else
+        pMode->HDisplay  = x & ~7;
     pMode->HSyncStart    = pMode->HDisplay + 2;
     pMode->HSyncEnd      = pMode->HDisplay + 4;
@@ -428,9 +413,6 @@
         if (!rc || (0 == x) || (0 == y))
             rc = vboxRetrieveVideoMode(pScrn, &x, &y, &bpp);
-        if (rc && (0 != x) && (0 != y)) {
-            /* We prefer a slightly smaller size to a slightly larger one */
-            x -= (x % 8);
-            vbox_output_add_mode(&pModes, NULL, x, y, TRUE, FALSE);
-        }
+        if (rc && (0 != x) && (0 != y))
+            vbox_output_add_mode(pVBox, &pModes, NULL, x, y, TRUE, FALSE);
     }
     /* Also report any modes the user may have requested in the xorg.conf
@@ -440,5 +422,5 @@
         int x, y;
         if (2 == sscanf(pScrn->display->modes[i], "%dx%d", &x, &y))
-            vbox_output_add_mode(&pModes, pScrn->display->modes[i], x, y,
+            vbox_output_add_mode(pVBox, &pModes, pScrn->display->modes[i], x, y,
                                  FALSE, TRUE);
     }
@@ -667,4 +649,5 @@
     rgb rzeros = {0, 0, 0};
     xf86OutputPtr output;
+    unsigned DispiId;
 
     /* Are we really starting the server, or is this just a dummy run? */
@@ -733,4 +716,13 @@
        sized video RAM configurations */
     pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024;
+
+    /* Check if the chip restricts horizontal resolution or not. */
+    outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
+    outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX);
+    DispiId = inw(VBE_DISPI_IOPORT_DATA);
+    if (DispiId == VBE_DISPI_ID_ANYX)
+        pVBox->fAnyX = TRUE;
+    else
+        pVBox->fAnyX = FALSE;
 
     /* Query the host for the preferred colour depth */
@@ -898,5 +890,4 @@
 
     /* Needed before we initialise DRI. */
-    pScrn->virtualX = (pScrn->virtualX + 7) & ~7;
     pScrn->displayWidth = pScrn->virtualX;
 
Index: trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c
===================================================================
--- trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c	(revision 33459)
+++ trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c	(revision 33460)
@@ -484,4 +484,5 @@
     rgb rzeros = {0, 0, 0};
     int i;
+    unsigned DispiId;
     DisplayModePtr pMode;
     enum { MODE_MIN_SIZE = 64 };
@@ -565,4 +566,13 @@
        sized video RAM configurations */
     pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024;
+
+    /* Check if the chip restricts horizontal resolution or not. */
+    outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
+    outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX);
+    DispiId = inw(VBE_DISPI_IOPORT_DATA);
+    if (DispiId == VBE_DISPI_ID_ANYX)
+        pVBox->fAnyX = TRUE;
+    else
+        pVBox->fAnyX = FALSE;
 
     /* Set up clock information that will support all modes we need. */
