VirtualBox

Changeset 57092 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Jul 27, 2015 11:07:29 AM (9 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: make VT handling more systematic.

File:
1 edited

Legend:

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

    r56886 r57092  
    285285            return FALSE;
    286286        }
    287         vbvxClearVRAM(pScrn, ((size_t)pScrn->virtualX) * pScrn->virtualY * (pScrn->bitsPerPixel / 8),
    288                       ((size_t)adjustedWidth) * height * (pScrn->bitsPerPixel / 8));
     287        if (pScrn->vtSema)
     288            vbvxClearVRAM(pScrn, ((size_t)pScrn->virtualX) * pScrn->virtualY * (pScrn->bitsPerPixel / 8),
     289                          ((size_t)adjustedWidth) * height * (pScrn->bitsPerPixel / 8));
    289290        pScreen->ModifyPixmapHeader(pPixmap, adjustedWidth, height, pScrn->depth, pScrn->bitsPerPixel, cbLine, pVBox->base);
    290291    }
     
    300301/** Set a video mode to the hardware, RandR 1.1 version.  Since we no longer do
    301302 * virtual frame buffers, adjust the screen pixmap dimensions to match. */
    302 static void setModeRandR11(ScrnInfoPtr pScrn, DisplayModePtr pMode, bool fScreenInitTime)
     303static void setModeRandR11(ScrnInfoPtr pScrn, DisplayModePtr pMode, bool fScreenInitTime, bool fEnterVTTime)
    303304{
    304305    VBOXPtr pVBox = VBOXGetRec(pScrn);
     
    317318        xf86ScrnToScreen(pScrn)->width = pMode->HDisplay;
    318319        xf86ScrnToScreen(pScrn)->height = pMode->VDisplay;
     320        /* This prevents a crash in CentOS 3.  I was unable to debug it to
     321         * satisfaction, partly due to the lack of symbols.  My guess is that
     322         * pScrn->ModifyPixmapHeader() expects certain things to be set up when
     323         * it sees pScrn->vtSema set to true which are not quite done at this
     324         * point of the VT switch. */
     325        if (fEnterVTTime)
     326            pScrn->vtSema = FALSE;
    319327        adjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay);
    320     }
    321     if (pMode->HDisplay != 0 && pMode->VDisplay != 0)
     328        if (fEnterVTTime)
     329            pScrn->vtSema = TRUE;
     330    }
     331    if (pMode->HDisplay != 0 && pMode->VDisplay != 0 && pScrn->vtSema)
    322332        vbvxSetMode(pScrn, 0, pMode->HDisplay, pMode->VDisplay, 0, 0, true, true, &frameBuffer);
    323333    pScrn->currentMode = pMode;
     
    348358               originalX, originalY));
    349359    for (i = cFirst; i < cLast; ++i)
    350         if (pVBox->pScreens[i].paCrtcs->mode.HDisplay != 0 && pVBox->pScreens[i].paCrtcs->mode.VDisplay != 0)
     360        if (pVBox->pScreens[i].paCrtcs->mode.HDisplay != 0 && pVBox->pScreens[i].paCrtcs->mode.VDisplay != 0 && pScrn->vtSema)
    351361            vbvxSetMode(pScrn, i, pVBox->pScreens[i].paCrtcs->mode.HDisplay, pVBox->pScreens[i].paCrtcs->mode.VDisplay,
    352362                        pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, pVBox->pScreens[i].fPowerOn,
     
    372382
    373383    TRACE_LOG("width=%d, height=%d\n", cw, ch);
    374     /* Don't fiddle with the hardware if we are switched
    375      * to a virtual terminal. */
    376     if (!pScrn->vtSema) {
    377         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    378                    "We do not own the active VT, exiting.\n");
    379         return TRUE;
    380     }
    381384    rc = adjustScreenPixmap(pScrn, cw, ch);
    382385    /* Power-on all screens (the server expects this) and set the new pitch to them. */
     
    439442    pVBox->pScreens[cDisplay].aScreenLocation.x = x;
    440443    pVBox->pScreens[cDisplay].aScreenLocation.y = y;
    441     /* Don't fiddle with the hardware if we are switched
    442      * to a virtual terminal. */
    443     if (!crtc->scrn->vtSema)
    444     {
    445         xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
    446                    "We do not own the active VT, exiting.\n");
    447         return;
    448     }
    449444    setModeRandR12(crtc->scrn, cDisplay);
    450445}
     
    11691164    setSizesRandR11(pScrn);
    11701165#endif
     1166    /* This calls EnableDisableFBAccess(), so only use when switched in. */
    11711167    if (pScrn->vtSema)
    11721168        vbvxReprobeCursor(pScrn);
     
    13411337#else
    13421338    /* set first video mode */
    1343     setModeRandR11(pScrn, pScrn->currentMode, true);
     1339    setModeRandR11(pScrn, pScrn->currentMode, true, false);
    13441340#endif
    13451341
     
    14141410    setSizesAndCursorIntegration(pScrn, false);
    14151411#else
    1416     /* This prevents a crash in CentOS 3.  I was unable to debug it to
    1417      * satisfaction, partly due to the lack of symbols.  My guess is that
    1418      * pScrn->ModifyPixmapHeader() expects certain things to be set up when
    1419      * it sees pScrn->vtSema set to true which are not quite done at this
    1420      * point of the VT switch. */
    1421     pScrn->vtSema = FALSE;
    1422     setModeRandR11(pScrn, pScrn->currentMode, false);
    1423     pScrn->vtSema = TRUE;
     1412    setModeRandR11(pScrn, pScrn->currentMode, false, true);
    14241413#endif
    14251414#ifdef SET_HAVE_VT_PROPERTY
     
    15131502
    15141503    TRACE_LOG("HDisplay=%d, VDisplay=%d\n", pMode->HDisplay, pMode->VDisplay);
    1515     if (!pScrn->vtSema)
    1516     {
    1517         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    1518                    "We do not own the active VT, exiting.\n");
    1519         return TRUE;
    1520     }
    15211504#ifdef VBOXVIDEO_13
    15221505    rc = xf86SetSingleMode(pScrn, pMode, RR_Rotate_0);
    15231506#else
    1524     setModeRandR11(pScrn, pMode, false);
     1507    setModeRandR11(pScrn, pMode, false, false);
    15251508#endif
    15261509    TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE");
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