Changeset 83142 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 24, 2020 7:24:26 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r83061 r83142 1290 1290 #ifdef IN_RING3 1291 1291 /** 1292 * Apply the current resolution settings to change the video mode.1292 * Updating screen information in API 1293 1293 * 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 */ 1297 void vmsvgaR3VBVAResize(PVGASTATE pThis, PVGASTATECC pThisCC) 1299 1298 { 1300 1299 int rc; 1301 1300 1302 /* Always do changemode on FIFO thread. */1303 Assert(RTThreadSelf() == pThisCC->svga.pFIFOIOThread->Thread);1304 1305 1301 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 device1313 * deletes all screens other than screen #0, and redefines screen1314 * #0 according to the specified mode. Drivers that use1315 * 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 else1343 {1344 /* "If Screen Objects are supported, they can be used to fully1345 * replace the functionality provided by the framebuffer registers1346 * (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 }1352 1302 1353 1303 for (unsigned iScreen = 0; iScreen < RT_ELEMENTS(pSVGAState->aScreens); ++iScreen) … … 1401 1351 AssertRC(rc); 1402 1352 } 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 */ 1362 static 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); 1403 1416 1404 1417 /* Last stuff. For the VGA device screenshot. */ … … 5460 5473 } 5461 5474 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 */ 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 } 5462 5510 5463 5511 /** … … 6523 6571 6524 6572 #endif /* IN_RING3 */ 6525 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r82968 r83142 393 393 DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId, 394 394 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy); 395 DECLCALLBACK(void) vmsvgaR3PortReportMonitorPositions(PPDMIDISPLAYPORT pInterface, uint32_t cPositions, PRTPOINT pPosition); 395 396 396 397 int vmsvgaR3Init(PPDMDEVINS pDevIns); … … 419 420 420 421 #endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h */ 421 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r82968 r83142 6590 6590 pThisCC->IPort.pfnReportHostCursorCapabilities = vgaR3PortReportHostCursorCapabilities; 6591 6591 pThisCC->IPort.pfnReportHostCursorPosition = vgaR3PortReportHostCursorPosition; 6592 # ifdef VBOX_WITH_VMSVGA 6593 pThisCC->IPort.pfnReportMonitorPositions = vmsvgaR3PortReportMonitorPositions; 6594 # else 6595 pThisCC->IPort.pfnReportMonitorPositions = NULL; 6596 # endif 6597 6592 6598 6593 6599 # if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r82968 r83142 1995 1995 } 1996 1996 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 */ 2004 static 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 } 1997 2024 1998 2025 /** … … 2653 2680 int rcRet = VINF_SUCCESS; 2654 2681 Assert(*pfPostOptimize == 0); 2655 2656 2682 switch (pReqHdr->requestType) 2657 2683 { … … 2807 2833 case VMMDevReq_VideoSetVisibleRegion: 2808 2834 pReqHdr->rc = vmmdevReqHandler_VideoSetVisibleRegion(pThisCC, pReqHdr); 2835 break; 2836 2837 case VMMDevReq_VideoUpdateMonitorPositions: 2838 pReqHdr->rc = vmmdevReqHandler_VideoUpdateMonitorPositions(pThisCC, pReqHdr); 2809 2839 break; 2810 2840
Note:
See TracChangeset
for help on using the changeset viewer.