VirtualBox

Changeset 33460 in vbox for trunk/src


Ignore:
Timestamp:
Oct 26, 2010 11:39:37 AM (14 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: remove the requirement that horizontal resolutions are multiples of eight pixels where it is not needed

Location:
trunk/src/VBox/Additions/x11/vboxvideo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c

    r32831 r33460  
    10341034 * cx and cy.
    10351035 */
    1036 static void vboxFillDisplayMode(DisplayModePtr m, const char *pszName,
    1037                                 unsigned cx, unsigned cy)
    1038 {
     1036static void vboxFillDisplayMode(ScrnInfoPtr pScrn, DisplayModePtr m,
     1037                                const char *pszName, unsigned cx, unsigned cy)
     1038{
     1039    VBOXPtr pVBox = pScrn->driverPrivate;
    10391040    TRACE_LOG("pszName=%s, cx=%u, cy=%u\n", pszName, cx, cy);
    10401041    m->status        = MODE_OK;
    10411042    m->type          = M_T_BUILTIN;
    1042     /* VBox only supports screen widths which are a multiple of 8 */
    1043     m->HDisplay      = cx & ~7;
     1043    /* Older versions of VBox only support screen widths which are a multiple
     1044     * of 8 */
     1045    if (pVBox->fAnyX)
     1046        m->HDisplay  = cx;
     1047    else
     1048        m->HDisplay  = cx & ~7;
    10441049    m->HSyncStart    = m->HDisplay + 2;
    10451050    m->HSyncEnd      = m->HDisplay + 4;
     
    11551160        if ((cx == 0) || (cy == 0))
    11561161            found = false;
    1157         if (found)
    1158             /* Adjust to a multiple of eight */
    1159             cx &= ~7;
    11601162        if (!found)
    11611163            found = (vboxNextStandardMode(pScrn, 0, &cx, &cy, &cBits) != 0);
     
    12361238        {
    12371239            if (!found)
    1238                 vboxFillDisplayMode(pMode, NULL, cx, cy);
     1240                vboxFillDisplayMode(pScrn, pMode, NULL, cx, cy);
    12391241            else if (pCurrent)
    1240                 vboxFillDisplayMode(pMode, NULL, pCurrent->HDisplay,
     1242                vboxFillDisplayMode(pScrn, pMode, NULL, pCurrent->HDisplay,
    12411243                                    pCurrent->VDisplay);
    12421244            found = true;
     
    13081310     * be, and breaks the second assumption, we guarantee the first. */
    13091311    DisplayModePtr pMode = vboxAddEmptyScreenMode(pScrn);
    1310     vboxFillDisplayMode(pMode, "VBoxInitialMode", cxInit, cyInit);
     1312    vboxFillDisplayMode(pScrn, pMode, "VBoxInitialMode", cxInit, cyInit);
    13111313    /* Create our two dynamic modes. */
    13121314    pMode = vboxAddEmptyScreenMode(pScrn);
    1313     vboxFillDisplayMode(pMode, "VBoxDynamicMode", cxInit, cyInit);
     1315    vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit);
    13141316    pMode = vboxAddEmptyScreenMode(pScrn);
    1315     vboxFillDisplayMode(pMode, "VBoxDynamicMode", cxInit, cyInit);
     1317    vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit);
    13161318    /* Add standard modes supported by the host */
    13171319    for ( ; ; )
     
    13231325        sprintf(szName, "VBox-%ux%u", cx, cy);
    13241326        pMode = vboxAddEmptyScreenMode(pScrn);
    1325         vboxFillDisplayMode(pMode, szName, cx, cy);
     1327        vboxFillDisplayMode(pScrn, pMode, szName, cx, cy);
    13261328    }
    13271329    /* And finally any modes specified by the user.  We assume here that
     
    13331335        {
    13341336            pMode = vboxAddEmptyScreenMode(pScrn);
    1335             vboxFillDisplayMode(pMode, pScrn->display->modes[i], cx, cy);
     1337            vboxFillDisplayMode(pScrn, pMode, pScrn->display->modes[i], cx, cy);
    13361338        }
    13371339    }
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r32692 r33460  
    137137#define VBE_DISPI_INDEX_VIRT_HEIGHT     0x7
    138138#define VBE_DISPI_ID2                   0xB0C2
     139#define VBE_DISPI_ID_ANYX               0xBE02
    139140#define VBE_DISPI_DISABLED              0x00
    140141#define VBE_DISPI_ENABLED               0x01
     
    220221    VMMDevMemory *pVMMDevMemory;
    221222    VBVAMEMORY *pVbvaMemory;
     223    Bool fAnyX;   /* Unrestricted horizontal resolution flag. */
    222224#ifdef VBOX_DRI
    223225    Bool useDRI;
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c

    r32692 r33460  
    202202
    203203    TRACE_LOG("width=%d, height=%d\n", width, height);
    204     /* We only support horizontal resolutions which are a multiple of 8.
    205      * Round up if necessary. */
    206     width = (width + 7) & ~7;
    207204    if (width * height * bpp / 8 >= scrn->videoRam * 1024)
    208205    {
     
    261258vbox_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode,
    262259                      DisplayModePtr adjusted_mode)
    263 {
    264     ScrnInfoPtr pScrn = crtc->scrn;
    265     int xRes = adjusted_mode->HDisplay;
    266 
    267     (void) mode;
    268     TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d\n", adjusted_mode->name,
    269            adjusted_mode->HDisplay, adjusted_mode->VDisplay);
    270     /* We only support horizontal resolutions which are a multiple of 8.  Round down if
    271        necessary. */
    272     if (xRes % 8 != 0)
    273     {
    274         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
    275                    "VirtualBox only supports screen widths which are a multiple of 8.  Rounding down from %d to %d\n",
    276                    xRes, xRes - (xRes % 8));
    277         adjusted_mode->HDisplay = xRes - (xRes % 8);
    278     }
    279     return TRUE;
    280 }
     260{ (void) crtc; (void) mode; (void) adjusted_mode; return TRUE; }
    281261
    282262static void
     
    379359
    380360static void
    381 vbox_output_add_mode (DisplayModePtr *pModes, const char *pszName, int x, int y,
     361vbox_output_add_mode (VBOXPtr pVBox, DisplayModePtr *pModes,
     362                      const char *pszName, int x, int y,
    382363                      Bool isPreferred, Bool isUserDef)
    383364{
     
    391372    if (isPreferred)
    392373        pMode->type     |= M_T_PREFERRED;
    393     /* VBox only supports screen widths which are a multiple of 8 */
    394     pMode->HDisplay      = (x + 7) & ~7;
     374    /* Older versions of VBox only support screen widths which are a multiple
     375     * of 8 */
     376    if (pVBox->fAnyX)
     377        pMode->HDisplay  = x;
     378    else
     379        pMode->HDisplay  = x & ~7;
    395380    pMode->HSyncStart    = pMode->HDisplay + 2;
    396381    pMode->HSyncEnd      = pMode->HDisplay + 4;
     
    428413        if (!rc || (0 == x) || (0 == y))
    429414            rc = vboxRetrieveVideoMode(pScrn, &x, &y, &bpp);
    430         if (rc && (0 != x) && (0 != y)) {
    431             /* We prefer a slightly smaller size to a slightly larger one */
    432             x -= (x % 8);
    433             vbox_output_add_mode(&pModes, NULL, x, y, TRUE, FALSE);
    434         }
     415        if (rc && (0 != x) && (0 != y))
     416            vbox_output_add_mode(pVBox, &pModes, NULL, x, y, TRUE, FALSE);
    435417    }
    436418    /* Also report any modes the user may have requested in the xorg.conf
     
    440422        int x, y;
    441423        if (2 == sscanf(pScrn->display->modes[i], "%dx%d", &x, &y))
    442             vbox_output_add_mode(&pModes, pScrn->display->modes[i], x, y,
     424            vbox_output_add_mode(pVBox, &pModes, pScrn->display->modes[i], x, y,
    443425                                 FALSE, TRUE);
    444426    }
     
    667649    rgb rzeros = {0, 0, 0};
    668650    xf86OutputPtr output;
     651    unsigned DispiId;
    669652
    670653    /* Are we really starting the server, or is this just a dummy run? */
     
    733716       sized video RAM configurations */
    734717    pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024;
     718
     719    /* Check if the chip restricts horizontal resolution or not. */
     720    outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
     721    outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX);
     722    DispiId = inw(VBE_DISPI_IOPORT_DATA);
     723    if (DispiId == VBE_DISPI_ID_ANYX)
     724        pVBox->fAnyX = TRUE;
     725    else
     726        pVBox->fAnyX = FALSE;
    735727
    736728    /* Query the host for the preferred colour depth */
     
    898890
    899891    /* Needed before we initialise DRI. */
    900     pScrn->virtualX = (pScrn->virtualX + 7) & ~7;
    901892    pScrn->displayWidth = pScrn->virtualX;
    902893
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c

    r32692 r33460  
    484484    rgb rzeros = {0, 0, 0};
    485485    int i;
     486    unsigned DispiId;
    486487    DisplayModePtr pMode;
    487488    enum { MODE_MIN_SIZE = 64 };
     
    565566       sized video RAM configurations */
    566567    pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024;
     568
     569    /* Check if the chip restricts horizontal resolution or not. */
     570    outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID);
     571    outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX);
     572    DispiId = inw(VBE_DISPI_IOPORT_DATA);
     573    if (DispiId == VBE_DISPI_ID_ANYX)
     574        pVBox->fAnyX = TRUE;
     575    else
     576        pVBox->fAnyX = FALSE;
    567577
    568578    /* Set up clock information that will support all modes we need. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette