VirtualBox

Changeset 83142 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 24, 2020 7:24:26 PM (5 years ago)
Author:
vboxsync
Message:

bugref:9637. Sending monitor positions (offsets) from GAs to svga device since vmwgfx fails to do so.

Location:
trunk/src/VBox/Devices
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r83061 r83142  
    12901290#ifdef IN_RING3
    12911291/**
    1292  * Apply the current resolution settings to change the video mode.
     1292 * Updating screen information in API
    12931293 *
    1294  * @returns VBox status code.
    1295  * @param   pThis       The shared VGA state.
    1296  * @param   pThisCC     The ring-3 VGA state.
    1297  */
    1298 static int vmsvgaR3ChangeMode(PVGASTATE pThis, PVGASTATECC pThisCC)
     1294 * @param   pThis       The The shared VGA/VMSVGA instance data.
     1295 * @param   pThisCC     The VGA/VMSVGA state for ring-3.
     1296 */
     1297void vmsvgaR3VBVAResize(PVGASTATE pThis, PVGASTATECC pThisCC)
    12991298{
    13001299    int rc;
    13011300
    1302     /* Always do changemode on FIFO thread. */
    1303     Assert(RTThreadSelf() == pThisCC->svga.pFIFOIOThread->Thread);
    1304 
    13051301    PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
    1306 
    1307     pThisCC->pDrv->pfnLFBModeChange(pThisCC->pDrv, true);
    1308 
    1309     if (pThis->svga.fGFBRegisters)
    1310     {
    1311         /* "For backwards compatibility, when the GFB mode registers (WIDTH,
    1312          * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
    1313          * deletes all screens other than screen #0, and redefines screen
    1314          * #0 according to the specified mode. Drivers that use
    1315          * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0."
    1316          */
    1317 
    1318         VMSVGASCREENOBJECT *pScreen = &pSVGAState->aScreens[0];
    1319         pScreen->fDefined  = true;
    1320         pScreen->fModified = true;
    1321         pScreen->fuScreen  = SVGA_SCREEN_MUST_BE_SET | SVGA_SCREEN_IS_PRIMARY;
    1322         pScreen->idScreen  = 0;
    1323         pScreen->xOrigin   = 0;
    1324         pScreen->yOrigin   = 0;
    1325         pScreen->offVRAM   = 0;
    1326         pScreen->cbPitch   = pThis->svga.cbScanline;
    1327         pScreen->cWidth    = pThis->svga.uWidth;
    1328         pScreen->cHeight   = pThis->svga.uHeight;
    1329         pScreen->cBpp      = pThis->svga.uBpp;
    1330 
    1331         for (unsigned iScreen = 1; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen)
    1332         {
    1333             /* Delete screen. */
    1334             pScreen = &pSVGAState->aScreens[iScreen];
    1335             if (pScreen->fDefined)
    1336             {
    1337                 pScreen->fModified = true;
    1338                 pScreen->fDefined = false;
    1339             }
    1340         }
    1341     }
    1342     else
    1343     {
    1344         /* "If Screen Objects are supported, they can be used to fully
    1345          * replace the functionality provided by the framebuffer registers
    1346          * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY."
    1347          */
    1348         pThis->svga.uWidth  = VMSVGA_VAL_UNINITIALIZED;
    1349         pThis->svga.uHeight = VMSVGA_VAL_UNINITIALIZED;
    1350         pThis->svga.uBpp    = VMSVGA_VAL_UNINITIALIZED;
    1351     }
    13521302
    13531303    for (unsigned iScreen = 0; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen)
     
    14011351        AssertRC(rc);
    14021352    }
     1353}
     1354
     1355/**
     1356 * Apply the current resolution settings to change the video mode.
     1357 *
     1358 * @returns VBox status code.
     1359 * @param   pThis       The shared VGA state.
     1360 * @param   pThisCC     The ring-3 VGA state.
     1361 */
     1362static int vmsvgaR3ChangeMode(PVGASTATE pThis, PVGASTATECC pThisCC)
     1363{
     1364    /* Always do changemode on FIFO thread. */
     1365    Assert(RTThreadSelf() == pThisCC->svga.pFIFOIOThread->Thread);
     1366
     1367    PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
     1368
     1369    pThisCC->pDrv->pfnLFBModeChange(pThisCC->pDrv, true);
     1370
     1371    if (pThis->svga.fGFBRegisters)
     1372    {
     1373        /* "For backwards compatibility, when the GFB mode registers (WIDTH,
     1374         * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
     1375         * deletes all screens other than screen #0, and redefines screen
     1376         * #0 according to the specified mode. Drivers that use
     1377         * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0."
     1378         */
     1379
     1380        VMSVGASCREENOBJECT *pScreen = &pSVGAState->aScreens[0];
     1381        pScreen->fDefined  = true;
     1382        pScreen->fModified = true;
     1383        pScreen->fuScreen  = SVGA_SCREEN_MUST_BE_SET | SVGA_SCREEN_IS_PRIMARY;
     1384        pScreen->idScreen  = 0;
     1385        pScreen->xOrigin   = 0;
     1386        pScreen->yOrigin   = 0;
     1387        pScreen->offVRAM   = 0;
     1388        pScreen->cbPitch   = pThis->svga.cbScanline;
     1389        pScreen->cWidth    = pThis->svga.uWidth;
     1390        pScreen->cHeight   = pThis->svga.uHeight;
     1391        pScreen->cBpp      = pThis->svga.uBpp;
     1392
     1393        for (unsigned iScreen = 1; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen)
     1394        {
     1395            /* Delete screen. */
     1396            pScreen = &pSVGAState->aScreens[iScreen];
     1397            if (pScreen->fDefined)
     1398            {
     1399                pScreen->fModified = true;
     1400                pScreen->fDefined = false;
     1401            }
     1402        }
     1403    }
     1404    else
     1405    {
     1406        /* "If Screen Objects are supported, they can be used to fully
     1407         * replace the functionality provided by the framebuffer registers
     1408         * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY."
     1409         */
     1410        pThis->svga.uWidth  = VMSVGA_VAL_UNINITIALIZED;
     1411        pThis->svga.uHeight = VMSVGA_VAL_UNINITIALIZED;
     1412        pThis->svga.uBpp    = VMSVGA_VAL_UNINITIALIZED;
     1413    }
     1414
     1415    vmsvgaR3VBVAResize(pThis, pThisCC);
    14031416
    14041417    /* Last stuff. For the VGA device screenshot. */
     
    54605473}
    54615474
     5475/**
     5476 * Used to update screen offsets (positions) since appearently vmwgfx fails to pass correct offsets thru FIFO.
     5477 *
     5478 * @param   pInterface  The device instance.
     5479 * @param   cPosition   The size of the pPosition array
     5480 * @param   pPosition   Monitor positions. We assume for the disable monitors the positions is (-1, -1)
     5481 */
     5482DECLCALLBACK(void) vmsvgaR3PortReportMonitorPositions(PPDMIDISPLAYPORT pInterface, uint32_t cPositions, PRTPOINT pPosition)
     5483{
     5484    PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort);
     5485    PVGASTATE   pThis   = PDMDEVINS_2_DATA(pThisCC->pDevIns, PVGASTATE);
     5486
     5487
     5488    PVMSVGAR3STATE  pSVGAState = pThisCC->svga.pSvgaR3State;
     5489    size_t cScreenCount = RT_ELEMENTS(pSVGAState->aScreens);
     5490
     5491    VMSVGASCREENOBJECT *pScreens = pSVGAState->aScreens;
     5492    /* We assume cPositions is the # of outputs Xserver reports and pPosition is (-1, -1) for disabled monitors. */
     5493    for (unsigned i = 0; i < cPositions; ++i)
     5494    {
     5495        /* Stop walking the array once we go thru all the monitors. */
     5496        if (i >= cScreenCount)
     5497            break;
     5498        if ( pScreens[i].xOrigin == -1
     5499          || pScreens[i].yOrigin == -1)
     5500            continue;
     5501        if (   pScreens[i].xOrigin == pPosition[i].x
     5502            && pScreens[i].yOrigin == pPosition[i].y)
     5503            continue;
     5504        pScreens[i].xOrigin = pPosition[i].x;
     5505        pScreens[i].yOrigin = pPosition[i].y;
     5506        pScreens[i].fModified = true;
     5507    }
     5508    vmsvgaR3VBVAResize(pThis, pThisCC);
     5509}
    54625510
    54635511/**
     
    65236571
    65246572#endif /* IN_RING3 */
    6525 
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h

    r82968 r83142  
    393393DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId,
    394394                                         uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
     395DECLCALLBACK(void) vmsvgaR3PortReportMonitorPositions(PPDMIDISPLAYPORT pInterface, uint32_t cPositions, PRTPOINT pPosition);
    395396
    396397int vmsvgaR3Init(PPDMDEVINS pDevIns);
     
    419420
    420421#endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h */
    421 
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r82968 r83142  
    65906590    pThisCC->IPort.pfnReportHostCursorCapabilities = vgaR3PortReportHostCursorCapabilities;
    65916591    pThisCC->IPort.pfnReportHostCursorPosition = vgaR3PortReportHostCursorPosition;
     6592# ifdef VBOX_WITH_VMSVGA
     6593    pThisCC->IPort.pfnReportMonitorPositions = vmsvgaR3PortReportMonitorPositions;
     6594# else
     6595    pThisCC->IPort.pfnReportMonitorPositions = NULL;
     6596# endif
     6597
    65926598
    65936599# if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r82968 r83142  
    19951995}
    19961996
     1997/**
     1998 * Handles VMMDevReq_VideoUpdateMonitorPositions.
     1999 *
     2000 * @returns VBox status code that the guest should see.
     2001 * @param   pThisCC         The VMMDev ring-3 instance data.
     2002 * @param   pReqHdr         The header of the request to handle.
     2003 */
     2004static int vmmdevReqHandler_VideoUpdateMonitorPositions(PVMMDEVCC pThisCC, VMMDevRequestHeader *pReqHdr)
     2005{
     2006    VMMDevVideoUpdateMonitorPositions *pReq = (VMMDevVideoUpdateMonitorPositions *)pReqHdr;
     2007    AssertMsgReturn(pReq->header.size + sizeof(RTRECT) >= sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
     2008    if (!pThisCC->pDrv)
     2009    {
     2010        Log(("VMMDevReq_VideoUpdateMonitorPositions: Connector is NULL!!!\n"));
     2011        return VERR_NOT_SUPPORTED;
     2012    }
     2013    if (   pReq->cPositions > _1M /* restrict to sane range */
     2014        || pReq->header.size != sizeof(VMMDevVideoUpdateMonitorPositions) + pReq->cPositions * sizeof(RTPOINT) - sizeof(RTPOINT))
     2015    {
     2016        Log(("VMMDevReq_VideoUpdateMonitorPositions: cRects=%#x doesn't match size=%#x or is out of bounds\n",
     2017             pReq->cPositions, pReq->header.size));
     2018        return VERR_INVALID_PARAMETER;
     2019    }
     2020    Log(("VMMDevReq_VideoUpdateMonitorPositions %d rectangles\n", pReq->cPositions));
     2021    /* forward the call */
     2022    return pThisCC->pDrv->pfnUpdateMonitorPositions(pThisCC->pDrv, pReq->cPositions, &(pReq->aPositions[0]));
     2023}
    19972024
    19982025/**
     
    26532680    int rcRet = VINF_SUCCESS;
    26542681    Assert(*pfPostOptimize == 0);
    2655 
    26562682    switch (pReqHdr->requestType)
    26572683    {
     
    28072833        case VMMDevReq_VideoSetVisibleRegion:
    28082834            pReqHdr->rc = vmmdevReqHandler_VideoSetVisibleRegion(pThisCC, pReqHdr);
     2835            break;
     2836
     2837        case VMMDevReq_VideoUpdateMonitorPositions:
     2838            pReqHdr->rc = vmmdevReqHandler_VideoUpdateMonitorPositions(pThisCC, pReqHdr);
    28092839            break;
    28102840
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