VirtualBox

Changeset 55384 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 22, 2015 4:46:42 PM (10 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: enable new mode hint handling code.

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

Legend:

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

    r55378 r55384  
    527527    ssize_t rc;
    528528
    529     pVBox->fHaveReadHGSMIModeHintData = false;
    530     RRGetInfo(pScreen
    531 # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
    532               , TRUE
    533 # endif
    534              );
    535     VBVXASSERT(pVBox->fHaveReadHGSMIModeHintData == true, ("fHaveReadHGSMIModeHintData not set.\n"));
    536529    do
    537530        rc = read(fd, &event, sizeof(event));
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r55377 r55384  
    8383#include "vboxvideo.h"
    8484#include <VBox/VBoxGuest.h>
     85#include <VBox/Hardware/VBoxVideoVBE.h>
    8586#include "version-generated.h"
    8687#include "product-generated.h"
     
    373374{
    374375    VBOXPtr pVBox = VBOXGetRec(pScrn);
     376    Bool rc;
     377    unsigned i;
     378
    375379    TRACE_LOG("width=%d, height=%d\n", cw, ch);
    376     /* Save the size in case we need to re-set it later. */
    377     pVBox->FBSize.cx = cw;
    378     pVBox->FBSize.cy = ch;
    379380    /* Don't fiddle with the hardware if we are switched
    380381     * to a virtual terminal. */
     
    384385        return TRUE;
    385386    }
    386     return VBOXAdjustScreenPixmap(pScrn, cw, ch);
     387    rc = adjustScreenPixmap(pScrn, cw, ch);
     388    /* Power-on all screens (the server expects this) and set the new pitch to them. */
     389    for (i = 0; i < pVBox->cScreens; ++i)
     390        pVBox->pScreens[i].fPowerOn = true;
     391    setAllModesRandR12(pScrn);
     392    vbvxSetSolarisMouseRange(cw, ch);
     393    return rc;
    387394}
    388395
     
    394401vbox_crtc_dpms(xf86CrtcPtr crtc, int mode)
    395402{
    396     VBOXPtr pVBox = VBOXGetRec(crtc->scrn);
     403    ScrnInfoPtr pScrn = crtc->scrn;
     404    VBOXPtr pVBox = VBOXGetRec(pScrn);
    397405    unsigned cDisplay = (uintptr_t)crtc->driver_private;
    398     bool fEnabled = (mode != DPMSModeOff);
    399 
    400     TRACE_LOG("cDisplay=%u, mode=%i\n", cDisplay, mode);
    401     pVBox->pScreens[cDisplay].fCrtcEnabled = fEnabled;
    402     /* Don't fiddle with the hardware if we are switched
    403      * to a virtual terminal. */
    404     if (!crtc->scrn->vtSema) {
    405         xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
    406                    "We do not own the active VT, exiting.\n");
    407         return;
    408     }
    409     if (   pVBox->pScreens[cDisplay].aScreenLocation.cx
    410         && pVBox->pScreens[cDisplay].aScreenLocation.cy)
    411         VBOXSetMode(crtc->scrn, cDisplay,
    412                     pVBox->pScreens[cDisplay].aScreenLocation.cx,
    413                     pVBox->pScreens[cDisplay].aScreenLocation.cy,
    414                     pVBox->pScreens[cDisplay].aScreenLocation.x,
    415                     pVBox->pScreens[cDisplay].aScreenLocation.y);
     406
     407    TRACE_LOG("mode=%d\n", mode);
     408    pVBox->pScreens[cDisplay].fPowerOn = (mode != DPMSModeOff);
     409    setModeRandR12(pScrn, cDisplay);
    416410}
    417411
     
    446440    TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d, x=%d, y=%d\n", adjusted_mode->name,
    447441           adjusted_mode->HDisplay, adjusted_mode->VDisplay, x, y);
    448     pVBox->pScreens[cDisplay].fCrtcEnabled = true;
    449     pVBox->pScreens[cDisplay].fOutputEnabled = true;
     442    pVBox->pScreens[cDisplay].fPowerOn = true;
    450443    pVBox->pScreens[cDisplay].aScreenLocation.cx = adjusted_mode->HDisplay;
    451444    pVBox->pScreens[cDisplay].aScreenLocation.cy = adjusted_mode->VDisplay;
     
    460453        return;
    461454    }
    462     VBOXSetMode(crtc->scrn, cDisplay, adjusted_mode->HDisplay,
    463                 adjusted_mode->VDisplay, x, y);
     455    setModeRandR12(crtc->scrn, cDisplay);
    464456}
    465457
     
    580572    uint32_t x, y, iScreen;
    581573    iScreen = (uintptr_t)output->driver_private;
    582     VBoxUpdateSizeHints(pScrn);
    583     pMode = vbox_output_add_mode(pVBox, &pModes, NULL, pVBox->pScreens[iScreen].aPreferredSize.cx,
    584                                  pVBox->pScreens[iScreen].aPreferredSize.cy, TRUE, FALSE);
     574    pMode = vbox_output_add_mode(pVBox, &pModes, NULL,
     575                                 RT_CLAMP(pVBox->pScreens[iScreen].aPreferredSize.cx, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL),
     576                                 RT_CLAMP(pVBox->pScreens[iScreen].aPreferredSize.cy, VBOX_VIDEO_MIN_SIZE, VBOX_VIDEO_MAX_VIRTUAL),
     577                                 TRUE, FALSE);
    585578    TRACE_EXIT();
    586579    return pModes;
     
    12881281        return FALSE;
    12891282    VBoxInitialiseSizeHints(pScrn);
     1283    /* Get any screen size hints from HGSMI.  Do not yet try to access X11
     1284     * properties, as they are not yet set up, and nor are the clients that
     1285     * might have set them. */
     1286    vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
    12901287
    12911288#ifdef VBOXVIDEO_13
     
    13311328    }
    13321329
    1333     /* Initialise randr 1.2 mode-setting functions and set first mode.
    1334      * Note that the mode won't be usable until the server has resized the
    1335      * framebuffer to something reasonable. */
     1330    /* Initialise randr 1.2 mode-setting functions. */
    13361331    if (!xf86CrtcScreenInit(pScreen)) {
    13371332        return FALSE;
    13381333    }
    13391334
    1340     if (!xf86SetDesiredModes(pScrn)) {
    1341         return FALSE;
    1342     }
    1343 #else /* !VBOXVIDEO_13 */
    1344     VBoxSetUpRandR11(pScreen);
     1335#endif
    13451336    /* set first video mode */
    1346     if (!VBOXSetMode(pScrn, 0, pScrn->currentMode->HDisplay,
    1347                      pScrn->currentMode->VDisplay, pScrn->frameX0,
    1348                      pScrn->frameY0))
    1349         return FALSE;
    1350     /* Save the size in case we need to re-set it later. */
    1351     pVBox->FBSize.cx = pScrn->currentMode->HDisplay;
    1352     pVBox->FBSize.cy = pScrn->currentMode->VDisplay;
    1353     pVBox->pScreens[0].aScreenLocation.cx = pScrn->currentMode->HDisplay;
    1354     pVBox->pScreens[0].aScreenLocation.cy = pScrn->currentMode->VDisplay;
    1355     pVBox->pScreens[0].aScreenLocation.x = pScrn->frameX0;
    1356     pVBox->pScreens[0].aScreenLocation.y = pScrn->frameY0;
    1357 #endif /* !VBOXVIDEO_13 */
     1337    setSizesAndCursorIntegration(pScrn, true);
     1338
     1339    /* Register block and wake-up handlers for getting new screen size hints. */
     1340    RegisterBlockAndWakeupHandlers(updateSizeHintsBlockHandler, (WakeupHandlerProcPtr)NoopDDA, (pointer)pScrn);
    13581341
    13591342    /* software cursor */
     
    14181401    vbvxSetUpHGSMIHeapInGuest(pVBox, pScrn->videoRam * 1024);
    14191402    vboxEnableVbva(pScrn);
    1420     /* Re-assert this in case we had a change request while switched out. */
    1421     if (pVBox->FBSize.cx && pVBox->FBSize.cy)
    1422         VBOXAdjustScreenPixmap(pScrn, pVBox->FBSize.cx, pVBox->FBSize.cy);
    1423 #ifdef VBOXVIDEO_13
    1424     if (!xf86SetDesiredModes(pScrn))
    1425         return FALSE;
    1426 #else
    1427     if (!VBOXSetMode(pScrn, 0, pScrn->currentMode->HDisplay,
    1428                      pScrn->currentMode->VDisplay, pScrn->frameX0,
    1429                      pScrn->frameY0))
    1430         return FALSE;
    1431 #endif
     1403    /* Re-set video mode */
     1404    vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
     1405    vbvxReadSizesAndCursorIntegrationFromProperties(pScrn, NULL);
     1406    /* This prevents a crash in CentOS 3.  I was unable to debug it to
     1407     * satisfaction, partly due to the lack of symbols.  My guess is that
     1408     * pScrn->ModifyPixmapHeader() expects certain things to be set up when
     1409     * it sees pScrn->vtSema set to true which are not quite done at this
     1410     * point of the VT switch. */
     1411    pScrn->vtSema = FALSE;
     1412    setSizesAndCursorIntegration(pScrn, false);
     1413    pScrn->vtSema = TRUE;
    14321414#ifdef SET_HAVE_VT_PROPERTY
    14331415    updateHasVTProperty(pScrn, TRUE);
     
    14491431#endif
    14501432    vboxDisableVbva(pScrn);
    1451     vboxClearVRAM(pScrn, 0, 0);
     1433    vbvxClearVRAM(pScrn, pScrn->virtualX * pScrn->virtualY * pScrn->bitsPerPixel / 8, 0);
    14521434#ifdef VBOX_DRI_OLD
    14531435    if (pVBox->useDRI)
     
    14801462#endif
    14811463        vboxDisableVbva(pScrn);
    1482         vboxClearVRAM(pScrn, 0, 0);
     1464        vbvxClearVRAM(pScrn, pScrn->virtualX * pScrn->virtualY * pScrn->bitsPerPixel / 8, 0);
    14831465    }
    14841466#ifdef VBOX_DRI
     
    15191501{
    15201502    VBOXPtr pVBox;
    1521     Bool rc;
     1503    Bool rc = TRUE;
    15221504
    15231505    TRACE_LOG("HDisplay=%d, VDisplay=%d\n", pMode->HDisplay, pMode->VDisplay);
    1524 #ifndef VBOXVIDEO_13
    1525     pVBox = VBOXGetRec(pScrn);
    1526     /* Save the size in case we need to re-set it later. */
    1527     pVBox->FBSize.cx = pMode->HDisplay;
    1528     pVBox->FBSize.cy = pMode->VDisplay;
    1529     pVBox->pScreens[0].aScreenLocation.cx = pMode->HDisplay;
    1530     pVBox->pScreens[0].aScreenLocation.cy = pMode->VDisplay;
    1531     pVBox->pScreens[0].aScreenLocation.x = pScrn->frameX0;
    1532     pVBox->pScreens[0].aScreenLocation.y = pScrn->frameY0;
    1533 #endif
    15341506    if (!pScrn->vtSema)
    15351507    {
     
    15411513    rc = xf86SetSingleMode(pScrn, pMode, RR_Rotate_0);
    15421514#else
    1543     VBOXAdjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay);
    1544     rc = VBOXSetMode(pScrn, 0, pMode->HDisplay, pMode->VDisplay,
    1545                      pScrn->frameX0, pScrn->frameY0);
     1515    setModeRandR11(pScrn, pMode, false);
    15461516#endif
    15471517    TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE");
     
    15501520
    15511521static void VBOXAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
    1552 {
    1553     VBOXPtr pVBox = VBOXGetRec(pScrn);
    1554 
    1555     TRACE_ENTRY();
    1556     pVBox->pScreens[0].aScreenLocation.x = x;
    1557     pVBox->pScreens[0].aScreenLocation.y = y;
    1558     /* Don't fiddle with the hardware if we are switched
    1559      * to a virtual terminal. */
    1560     if (!pScrn->vtSema)
    1561     {
    1562         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    1563                    "We do not own the active VT, exiting.\n");
    1564         return;
    1565     }
    1566     VBOXSetMode(pScrn, 0, pVBox->pScreens[0].aScreenLocation.cx,
    1567                 pVBox->pScreens[0].aScreenLocation.cy, x, y);
    1568     TRACE_EXIT();
    1569 }
     1522{ (void)pScrn; (void)x; (void)y; }
    15701523
    15711524static void VBOXFreeScreen(ScrnInfoPtr pScrn)
  • trunk/src/VBox/Additions/x11/vboxvideo/vbva.c

    r55373 r55384  
    231231    VBVXASSERT(rc, ("Failed to enable screen update reporting for at least one virtual monitor.\n"));
    232232#ifdef VBOXVIDEO_13
    233 # ifdef RT_OS_LINUX
    234     if (rc && pVBox->hACPIEventHandler != NULL)
    235         /* We ignore the return value as the fall-back should be active
    236          * anyway. */
    237         VBoxHGSMISendCapsInfo(&pVBox->guestCtx, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION);
    238 # endif
     233    VBoxHGSMISendCapsInfo(&pVBox->guestCtx, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION);
    239234    pVBox->fHaveHGSMIModeHints = haveHGSMIModeHintAndCursorReportingInterface(pVBox);
    240235    pVBox->fHostHasScreenBlankingFlag = hostHasScreenBlankingFlag(pVBox);
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