VirtualBox

Changeset 83152 in vbox for trunk


Ignore:
Timestamp:
Feb 25, 2020 1:49:56 PM (5 years ago)
Author:
vboxsync
Message:

bugref:9637. moving the function vmsvgaR3PortReportMonitorPositions out of ifdef VBOX_WITH_VMSVGA3D.

File:
1 edited

Legend:

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

    r83142 r83152  
    767767# endif
    768768}
     769
     770/**
     771 * Updating screen information in API
     772 *
     773 * @param   pThis       The The shared VGA/VMSVGA instance data.
     774 * @param   pThisCC     The VGA/VMSVGA state for ring-3.
     775 */
     776void vmsvgaR3VBVAResize(PVGASTATE pThis, PVGASTATECC pThisCC)
     777{
     778    int rc;
     779
     780    PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
     781
     782    for (unsigned iScreen = 0; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen)
     783    {
     784        VMSVGASCREENOBJECT *pScreen = &pSVGAState->aScreens[iScreen];
     785        if (!pScreen->fModified)
     786            continue;
     787
     788        pScreen->fModified = false;
     789
     790        VBVAINFOVIEW view;
     791        RT_ZERO(view);
     792        view.u32ViewIndex     = pScreen->idScreen;
     793        // view.u32ViewOffset    = 0;
     794        view.u32ViewSize      = pThis->vram_size;
     795        view.u32MaxScreenSize = pThis->vram_size;
     796
     797        VBVAINFOSCREEN screen;
     798        RT_ZERO(screen);
     799        screen.u32ViewIndex   = pScreen->idScreen;
     800
     801        if (pScreen->fDefined)
     802        {
     803            if (   pScreen->cWidth  == VMSVGA_VAL_UNINITIALIZED
     804                || pScreen->cHeight == VMSVGA_VAL_UNINITIALIZED
     805                || pScreen->cBpp    == VMSVGA_VAL_UNINITIALIZED)
     806            {
     807                Assert(pThis->svga.fGFBRegisters);
     808                continue;
     809            }
     810
     811            screen.i32OriginX      = pScreen->xOrigin;
     812            screen.i32OriginY      = pScreen->yOrigin;
     813            screen.u32StartOffset  = pScreen->offVRAM;
     814            screen.u32LineSize     = pScreen->cbPitch;
     815            screen.u32Width        = pScreen->cWidth;
     816            screen.u32Height       = pScreen->cHeight;
     817            screen.u16BitsPerPixel = pScreen->cBpp;
     818            if (!(pScreen->fuScreen & SVGA_SCREEN_DEACTIVATE))
     819                screen.u16Flags    = VBVA_SCREEN_F_ACTIVE;
     820            if (pScreen->fuScreen & SVGA_SCREEN_BLANKING)
     821                screen.u16Flags   |= VBVA_SCREEN_F_BLANK2;
     822        }
     823        else
     824        {
     825            /* Screen is destroyed. */
     826            screen.u16Flags        = VBVA_SCREEN_F_DISABLED;
     827        }
     828
     829        rc = pThisCC->pDrv->pfnVBVAResize(pThisCC->pDrv, &view, &screen, pThisCC->pbVRam, /*fResetInputMapping=*/ true);
     830        AssertRC(rc);
     831    }
     832}
     833
     834/**
     835 * Used to update screen offsets (positions) since appearently vmwgfx fails to pass correct offsets thru FIFO.
     836 *
     837 * @param   pInterface  The device instance.
     838 * @param   cPosition   The size of the pPosition array
     839 * @param   pPosition   Monitor positions. We assume for the disable monitors the positions is (-1, -1)
     840 */
     841DECLCALLBACK(void) vmsvgaR3PortReportMonitorPositions(PPDMIDISPLAYPORT pInterface, uint32_t cPositions, PRTPOINT pPosition)
     842{
     843    PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort);
     844    PVGASTATE   pThis   = PDMDEVINS_2_DATA(pThisCC->pDevIns, PVGASTATE);
     845
     846
     847    PVMSVGAR3STATE  pSVGAState = pThisCC->svga.pSvgaR3State;
     848    size_t cScreenCount = RT_ELEMENTS(pSVGAState->aScreens);
     849
     850    VMSVGASCREENOBJECT *pScreens = pSVGAState->aScreens;
     851    /* We assume cPositions is the # of outputs Xserver reports and pPosition is (-1, -1) for disabled monitors. */
     852    for (unsigned i = 0; i < cPositions; ++i)
     853    {
     854        /* Stop walking the array once we go thru all the monitors. */
     855        if (i >= cScreenCount)
     856            break;
     857        if ( pScreens[i].xOrigin == -1
     858          || pScreens[i].yOrigin == -1)
     859            continue;
     860        if (   pScreens[i].xOrigin == pPosition[i].x
     861            && pScreens[i].yOrigin == pPosition[i].y)
     862            continue;
     863        pScreens[i].xOrigin = pPosition[i].x;
     864        pScreens[i].yOrigin = pPosition[i].y;
     865        pScreens[i].fModified = true;
     866    }
     867    vmsvgaR3VBVAResize(pThis, pThisCC);
     868}
    769869#endif /* IN_RING3 */
    770870
     
    12891389
    12901390#ifdef IN_RING3
    1291 /**
    1292  * Updating screen information in API
    1293  *
    1294  * @param   pThis       The The shared VGA/VMSVGA instance data.
    1295  * @param   pThisCC     The VGA/VMSVGA state for ring-3.
    1296  */
    1297 void vmsvgaR3VBVAResize(PVGASTATE pThis, PVGASTATECC pThisCC)
    1298 {
    1299     int rc;
    1300 
    1301     PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
    1302 
    1303     for (unsigned iScreen = 0; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen)
    1304     {
    1305         VMSVGASCREENOBJECT *pScreen = &pSVGAState->aScreens[iScreen];
    1306         if (!pScreen->fModified)
    1307             continue;
    1308 
    1309         pScreen->fModified = false;
    1310 
    1311         VBVAINFOVIEW view;
    1312         RT_ZERO(view);
    1313         view.u32ViewIndex     = pScreen->idScreen;
    1314         // view.u32ViewOffset    = 0;
    1315         view.u32ViewSize      = pThis->vram_size;
    1316         view.u32MaxScreenSize = pThis->vram_size;
    1317 
    1318         VBVAINFOSCREEN screen;
    1319         RT_ZERO(screen);
    1320         screen.u32ViewIndex   = pScreen->idScreen;
    1321 
    1322         if (pScreen->fDefined)
    1323         {
    1324             if (   pScreen->cWidth  == VMSVGA_VAL_UNINITIALIZED
    1325                 || pScreen->cHeight == VMSVGA_VAL_UNINITIALIZED
    1326                 || pScreen->cBpp    == VMSVGA_VAL_UNINITIALIZED)
    1327             {
    1328                 Assert(pThis->svga.fGFBRegisters);
    1329                 continue;
    1330             }
    1331 
    1332             screen.i32OriginX      = pScreen->xOrigin;
    1333             screen.i32OriginY      = pScreen->yOrigin;
    1334             screen.u32StartOffset  = pScreen->offVRAM;
    1335             screen.u32LineSize     = pScreen->cbPitch;
    1336             screen.u32Width        = pScreen->cWidth;
    1337             screen.u32Height       = pScreen->cHeight;
    1338             screen.u16BitsPerPixel = pScreen->cBpp;
    1339             if (!(pScreen->fuScreen & SVGA_SCREEN_DEACTIVATE))
    1340                 screen.u16Flags    = VBVA_SCREEN_F_ACTIVE;
    1341             if (pScreen->fuScreen & SVGA_SCREEN_BLANKING)
    1342                 screen.u16Flags   |= VBVA_SCREEN_F_BLANK2;
    1343         }
    1344         else
    1345         {
    1346             /* Screen is destroyed. */
    1347             screen.u16Flags        = VBVA_SCREEN_F_DISABLED;
    1348         }
    1349 
    1350         rc = pThisCC->pDrv->pfnVBVAResize(pThisCC->pDrv, &view, &screen, pThisCC->pbVRam, /*fResetInputMapping=*/ true);
    1351         AssertRC(rc);
    1352     }
    1353 }
    1354 
    13551391/**
    13561392 * Apply the current resolution settings to change the video mode.
     
    54745510
    54755511/**
    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  */
    5482 DECLCALLBACK(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 }
    5510 
    5511 /**
    55125512 * @callback_method_impl{FNDBGFHANDLERDEV, "vmsvga3dctx"}
    55135513 */
     
    55295529    vmsvga3dInfoContextWorker(PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC), pHlp, sid, fVerbose);
    55305530}
    5531 
    55325531# endif /* VBOX_WITH_VMSVGA3D */
    55335532
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