VirtualBox

Ignore:
Timestamp:
Feb 27, 2008 12:47:42 PM (17 years ago)
Author:
vboxsync
Message:

Additions/X11: updated mode setting in the X11 additions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_68.c

    r6643 r7168  
    371371        return (FALSE);
    372372
    373     xf86Msg(X_INFO,
    374             "VirtualBox guest additions video driver version "
    375             VBOX_VERSION_STRING "\n");
     373    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
     374               "VirtualBox guest additions video driver version "
     375               VBOX_VERSION_STRING "\n");
    376376
    377377    /* Get our private data from the ScrnInfoRec structure. */
     
    453453                         Support32bppFb))
    454454        return FALSE;
    455     if (pScrn->depth != 24 && pScrn->depth != 16)
     455    if (pScrn->bitsPerPixel != 32 && pScrn->bitsPerPixel != 16)
    456456    {
    457457        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
     
    497497    }
    498498
    499     /* Determine the virtual screen resolution from the first mode (which will be selected) */
    500     sscanf(pScrn->display->modes[0], "%dx%d",
    501            &pScrn->display->virtualX, &pScrn->display->virtualY);
    502     pScrn->display->virtualX = (pScrn->display->virtualX + 7) & ~7;
    503 
    504499    /* Create a builtin mode for every specified mode. This allows to specify arbitrary
    505500     * screen resolutions */
     
    511506
    512507        sscanf(pScrn->display->modes[i], "%dx%d", &x, &y);
    513         /* sanity check, smaller resolutions does not make sense */
    514         if (x < 64 || y < 64)
    515         {
    516             xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring mode \"%s\"\n",
    517                        pScrn->display->modes[i]);
    518             continue;
    519         }
    520508        m                = xnfcalloc(sizeof(DisplayModeRec), 1);
    521509        m->status        = MODE_OK;
     
    533521    }
    534522
     523    /* Set a sane minimum mode size and the maximum allowed by the available VRAM */
     524    {
     525        unsigned maxSize, trySize = 512;
     526
     527        do {
     528            maxSize = trySize;
     529            trySize += 128;
     530        } while (trySize * trySize * pScrn->bitsPerPixel / 8 < pScrn->videoRam * 1024);
     531
     532        /* I don't know exactly what these are for (and they are only used in a couple
     533           of places in the X server code). */
     534        pScrn->display->virtualX = maxSize;
     535        pScrn->display->virtualY = maxSize;
     536        xf86DrvMsg(pScrn->scrnIndex, X_INFO,
     537                   "The maximum supported resolution is currently %dx%d\n", maxSize, maxSize);
     538    }
     539
    535540    /* Filter out video modes not supported by the virtual hardware
    536        we described.  All modes used by the Windows additions should
    537        work fine. */
     541       we described. */
    538542    i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
    539543                          pScrn->display->modes,
    540                           clockRanges, NULL, 0, 6400, 1, 0, 1440,
    541                           pScrn->display->virtualX,
    542                           pScrn->display->virtualY,
    543                           pScrn->videoRam, LOOKUP_BEST_REFRESH);
     544                          clockRanges, NULL, 64, pScrn->display->virtualX, 1,
     545                          64, pScrn->display->virtualY, 0, 0,
     546                          pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH);
    544547
    545548    if (i <= 0) {
     
    554557    xf86PrintModes(pScrn);
    555558
    556     /* Set display resolution.  This was arbitrarily chosen to be about the same as my monitor. */
    557     xf86SetDpi(pScrn, 100, 100);
     559    /* Set display resolution.  Perhaps we should read this from the host. */
     560    xf86SetDpi(pScrn, 96, 96);
    558561
    559562    if (pScrn->modes == NULL) {
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