Changeset 82109 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Nov 22, 2019 8:24:21 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r82089 r82109 548 548 *********************************************************************************************************************************/ 549 549 #ifdef IN_RING3 550 static void vmsvgaR3SetTraces(P VGASTATE pThis, bool fTraces);550 static void vmsvgaR3SetTraces(PPDMDEVINS pDevIns, PVGASTATE pThis, bool fTraces); 551 551 static int vmsvgaR3LoadExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass); 552 552 static int vmsvgaR3SaveExecFifo(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PSSMHANDLE pSSM); … … 575 575 * 576 576 * @returns Index register string or "UNKNOWN" 577 * @param pThis VMSVGA State577 * @param pThis The shared VGA/VMSVGA state. 578 578 * @param idxReg The index register. 579 579 */ … … 718 718 DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t idScreen, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 719 719 { 720 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IPort); 720 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 721 PVGASTATE pThis = PDMDEVINS_2_DATA(pThisCC->pDevIns, PVGASTATE); 721 722 722 723 Log(("vmsvgaPortSetViewPort: screen %d (%d,%d)(%d,%d)\n", idScreen, x, y, cx, cy)); … … 772 773 * @returns VBox status code. 773 774 * @param pDevIns The device instance. 774 * @param pThis VMSVGA State775 * @param pThis The shared VGA/VMSVGA state. 775 776 * @param pu32 Where to store the read value 776 777 */ 777 778 static int vmsvgaReadPort(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t *pu32) 778 779 { 780 #ifdef IN_RING3 781 PVGASTATER3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 782 #endif 779 783 int rc = VINF_SUCCESS; 780 784 *pu32 = 0; … … 823 827 rc = VINF_IOM_R3_IOPORT_READ; 824 828 #else 825 *pu32 = pThis ->pDrv->cx;829 *pu32 = pThisCC->pDrv->cx; 826 830 #endif 827 831 } … … 840 844 rc = VINF_IOM_R3_IOPORT_READ; 841 845 #else 842 *pu32 = pThis ->pDrv->cy;846 *pu32 = pThisCC->pDrv->cy; 843 847 #endif 844 848 } … … 884 888 rc = VINF_IOM_R3_IOPORT_READ; 885 889 #else 886 *pu32 = pThis ->pDrv->cBits;890 *pu32 = pThisCC->pDrv->cBits; 887 891 #endif 888 892 } … … 899 903 rc = VINF_IOM_R3_IOPORT_READ; 900 904 #else 901 *pu32 = (pThis ->pDrv->cBits + 7) & ~7;905 *pu32 = (pThisCC->pDrv->cBits + 7) & ~7; 902 906 #endif 903 907 } … … 926 930 break; 927 931 #else 928 uBpp = pThis ->pDrv->cBits;932 uBpp = pThisCC->pDrv->cBits; 929 933 #endif 930 934 } … … 989 993 rc = VINF_IOM_R3_IOPORT_READ; 990 994 #else 991 *pu32 = pThis ->pDrv->cbScanline;995 *pu32 = pThisCC->pDrv->cbScanline; 992 996 #endif 993 997 } … … 1027 1031 } 1028 1032 else 1029 *pu32 = RT_MAX(0x100000, (uint32_t)pThis ->pDrv->cy * pThis->pDrv->cbScanline);1033 *pu32 = RT_MAX(0x100000, (uint32_t)pThisCC->pDrv->cy * pThisCC->pDrv->cbScanline); 1030 1034 1031 1035 *pu32 = RT_MIN(pThis->vram_size, *pu32); 1032 Log(("h=%d w=%d bpp=%d\n", pThis ->pDrv->cy, pThis->pDrv->cx, pThis->pDrv->cBits));1036 Log(("h=%d w=%d bpp=%d\n", pThisCC->pDrv->cy, pThisCC->pDrv->cx, pThisCC->pDrv->cBits)); 1033 1037 #endif 1034 1038 break; … … 1076 1080 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1077 1081 STAM_REL_PROFILE_START(&pSVGAState->StatBusyDelayEmts, EmtDelay); 1078 PVM pVM = PDMDevHlpGetVM(p This->pDevInsR3);1079 VMCPUID idCpu = PDMDevHlpGetCurrentCpuId(p This->pDevInsR3);1082 PVM pVM = PDMDevHlpGetVM(pDevIns); 1083 VMCPUID idCpu = PDMDevHlpGetCurrentCpuId(pDevIns); 1080 1084 VMCPUSET_ATOMIC_ADD(&pSVGAState->BusyDelayedEmts, idCpu); 1081 1085 ASMAtomicIncU32(&pSVGAState->cBusyDelayedEmts); … … 1107 1111 * code in VMEmt.cpp here, otherwise all kind of EMT interaction will 1108 1112 * suffer when the guest is polling on a busy FIFO. */ 1109 uint64_t cNsMaxWait = TMVirtualSyncGetNsToDeadline(PDMDevHlpGetVM(p This->pDevInsR3));1113 uint64_t cNsMaxWait = TMVirtualSyncGetNsToDeadline(PDMDevHlpGetVM(pDevIns)); 1110 1114 if (cNsMaxWait >= RT_NS_100US) 1111 1115 RTSemEventMultiWaitEx(pSVGAState->hBusyDelayedEmts, … … 1288 1292 * 1289 1293 * @returns VBox status code. 1290 * @param pThis VMSVGA State 1294 * @param pThis The shared VGA state. 1295 * @param pThisCC The ring-3 VGA state. 1291 1296 */ 1292 static int vmsvgaR3ChangeMode(PVGASTATE pThis )1297 static int vmsvgaR3ChangeMode(PVGASTATE pThis, PVGASTATECC pThisCC) 1293 1298 { 1294 1299 int rc; … … 1299 1304 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1300 1305 1301 pThis ->pDrv->pfnLFBModeChange(pThis->pDrv, true);1306 pThisCC->pDrv->pfnLFBModeChange(pThisCC->pDrv, true); 1302 1307 1303 1308 if (pThis->svga.fGFBRegisters) … … 1392 1397 } 1393 1398 1394 rc = pThis ->pDrv->pfnVBVAResize(pThis->pDrv, &view, &screen, pThis->CTX_SUFF(vram_ptr), /*fResetInputMapping=*/ true);1399 rc = pThisCC->pDrv->pfnVBVAResize(pThisCC->pDrv, &view, &screen, pThisCC->pbVRam, /*fResetInputMapping=*/ true); 1395 1400 AssertRC(rc); 1396 1401 } … … 1417 1422 } 1418 1423 1419 int vmsvgaR3UpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h)1424 int vmsvgaR3UpdateScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h) 1420 1425 { 1421 1426 VBVACMDHDR cmd; … … 1425 1430 cmd.h = (uint16_t)h; 1426 1431 1427 pThis ->pDrv->pfnVBVAUpdateBegin(pThis->pDrv, pScreen->idScreen);1428 pThis ->pDrv->pfnVBVAUpdateProcess(pThis->pDrv, pScreen->idScreen, &cmd, sizeof(cmd));1429 pThis ->pDrv->pfnVBVAUpdateEnd(pThis->pDrv, pScreen->idScreen,1430 pScreen->xOrigin + x, pScreen->yOrigin + y, w, h);1432 pThisCC->pDrv->pfnVBVAUpdateBegin(pThisCC->pDrv, pScreen->idScreen); 1433 pThisCC->pDrv->pfnVBVAUpdateProcess(pThisCC->pDrv, pScreen->idScreen, &cmd, sizeof(cmd)); 1434 pThisCC->pDrv->pfnVBVAUpdateEnd(pThisCC->pDrv, pScreen->idScreen, 1435 pScreen->xOrigin + x, pScreen->yOrigin + y, w, h); 1431 1436 1432 1437 return VINF_SUCCESS; … … 1464 1469 * width/bpp. 1465 1470 * 1466 * @param pThis VMSVGA State1471 * @param pThis The shared VGA/VMSVGA state. 1467 1472 */ 1468 1473 DECLINLINE(void) vmsvgaHCUpdatePitch(PVGASTATE pThis) … … 1505 1510 * 1506 1511 * @returns Strict VBox status code. 1507 * @param pThis VMSVGA State 1512 * @param pDevIns The device instance. 1513 * @param pThis The shared VGA/VMSVGA state. 1514 * @param pThisC The VGA/VMSVGA state for the current context. 1508 1515 * @param u32 Value to write 1509 1516 */ 1510 static VBOXSTRICTRC vmsvgaWritePort(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t u32)1517 static VBOXSTRICTRC vmsvgaWritePort(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t u32) 1511 1518 { 1512 1519 #ifdef IN_RING3 … … 1514 1521 #endif 1515 1522 VBOXSTRICTRC rc = VINF_SUCCESS; 1523 RT_NOREF(pThisCC); 1516 1524 1517 1525 /* Rough index register validation. */ … … 1557 1565 pThis->svga.u32SVGAId = u32; 1558 1566 else 1559 PDMDevHlpDBGFStop(p This->CTX_SUFF(pDevIns), RT_SRC_POS, "Trying to set SVGA_REG_ID to %#x (%d)\n", u32, u32);1567 PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "Trying to set SVGA_REG_ID to %#x (%d)\n", u32, u32); 1560 1568 break; 1561 1569 … … 1568 1576 /* Make a backup copy of the first 512kb in order to save font data etc. */ 1569 1577 /** @todo should probably swap here, rather than copy + zero */ 1570 memcpy(pThis->svga.pbVgaFrameBufferR3, pThis ->vram_ptrR3, VMSVGA_VGA_FB_BACKUP_SIZE);1571 memset(pThis ->vram_ptrR3, 0, VMSVGA_VGA_FB_BACKUP_SIZE);1578 memcpy(pThis->svga.pbVgaFrameBufferR3, pThisCC->pbVRam, VMSVGA_VGA_FB_BACKUP_SIZE); 1579 memset(pThisCC->pbVRam, 0, VMSVGA_VGA_FB_BACKUP_SIZE); 1572 1580 } 1573 1581 … … 1580 1588 { 1581 1589 /* Keep the current mode. */ 1582 pThis->svga.uWidth = pThis ->pDrv->cx;1583 pThis->svga.uHeight = pThis ->pDrv->cy;1584 pThis->svga.uBpp = (pThis ->pDrv->cBits + 7) & ~7;1590 pThis->svga.uWidth = pThisCC->pDrv->cx; 1591 pThis->svga.uHeight = pThisCC->pDrv->cy; 1592 pThis->svga.uBpp = (pThisCC->pDrv->cBits + 7) & ~7; 1585 1593 } 1586 1594 … … 1596 1604 1597 1605 /* Disable or enable dirty page tracking according to the current fTraces value. */ 1598 vmsvgaR3SetTraces(p This, !!pThis->svga.fTraces);1606 vmsvgaR3SetTraces(pDevIns, pThis, !!pThis->svga.fTraces); 1599 1607 1600 1608 /* bird: Whatever this is was added to make screenshot work, ask sunlover should explain... */ 1601 1609 for (uint32_t idScreen = 0; idScreen < pThis->cMonitors; ++idScreen) 1602 pThis ->pDrv->pfnVBVAEnable(pThis->pDrv, idScreen, NULL /*pHostFlags*/);1610 pThisCC->pDrv->pfnVBVAEnable(pThisCC->pDrv, idScreen, NULL /*pHostFlags*/); 1603 1611 } 1604 1612 else 1605 1613 { 1606 1614 /* Restore the text mode backup. */ 1607 memcpy(pThis ->vram_ptrR3, pThis->svga.pbVgaFrameBufferR3, VMSVGA_VGA_FB_BACKUP_SIZE);1608 1609 pThis ->pDrv->pfnLFBModeChange(pThis->pDrv, false);1615 memcpy(pThisCC->pbVRam, pThis->svga.pbVgaFrameBufferR3, VMSVGA_VGA_FB_BACKUP_SIZE); 1616 1617 pThisCC->pDrv->pfnLFBModeChange(pThisCC->pDrv, false); 1610 1618 1611 1619 /* Enable dirty page tracking again when going into legacy mode. */ 1612 vmsvgaR3SetTraces(p This, true);1620 vmsvgaR3SetTraces(pDevIns, pThis, true); 1613 1621 1614 1622 /* bird: Whatever this is was added to make screenshot work, ask sunlover should explain... */ 1615 1623 for (uint32_t idScreen = 0; idScreen < pThis->cMonitors; ++idScreen) 1616 pThis ->pDrv->pfnVBVADisable(pThis->pDrv, idScreen);1624 pThisCC->pDrv->pfnVBVADisable(pThisCC->pDrv, idScreen); 1617 1625 1618 1626 /* Clear the pitch lock. */ … … 1683 1691 if (!pThis->svga.fConfigured) 1684 1692 pThis->svga.fTraces = true; 1685 vmsvgaR3SetTraces(p This, !!pThis->svga.fTraces);1693 vmsvgaR3SetTraces(pDevIns, pThis, !!pThis->svga.fTraces); 1686 1694 #else 1687 1695 rc = VINF_IOM_R3_IOPORT_WRITE; … … 1735 1743 { 1736 1744 Log(("SVGA_REG_IRQMASK: Trigger interrupt with status %x\n", pThis->svga.u32IrqStatus)); 1737 PDMDevHlpPCISetIrqNoWait(p This->CTX_SUFF(pDevIns), 0, 1);1745 PDMDevHlpPCISetIrqNoWait(pDevIns, 0, 1); 1738 1746 } 1739 1747 else 1740 PDMDevHlpPCISetIrqNoWait(p This->CTX_SUFF(pDevIns), 0, 0);1748 PDMDevHlpPCISetIrqNoWait(pDevIns, 0, 0); 1741 1749 break; 1742 1750 … … 1814 1822 /* Read descriptor. */ 1815 1823 SVGAGuestMemDescriptor desc; 1816 rc = PDMDevHlpPhysRead(p This->CTX_SUFF(pDevIns), GCPhys, &desc, sizeof(desc));1824 rc = PDMDevHlpPhysRead(pDevIns, GCPhys, &desc, sizeof(desc)); 1817 1825 AssertRCBreak(VBOXSTRICTRC_VAL(rc)); 1818 1826 … … 1873 1881 1874 1882 #ifdef IN_RING3 1875 vmsvgaR3SetTraces(p This, !!u32);1883 vmsvgaR3SetTraces(pDevIns, pThis, !!u32); 1876 1884 #else 1877 1885 rc = VINF_IOM_R3_IOPORT_WRITE; … … 1958 1966 DECLCALLBACK(VBOXSTRICTRC) vmsvgaIORead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb) 1959 1967 { 1960 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);1968 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 1961 1969 RT_NOREF_PV(pvUser); 1962 1970 … … 2002 2010 DECLCALLBACK(VBOXSTRICTRC) vmsvgaIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 2003 2011 { 2004 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 2012 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2013 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 2005 2014 RT_NOREF_PV(pvUser); 2006 2015 … … 2014 2023 2015 2024 case SVGA_VALUE_PORT: 2016 return vmsvgaWritePort(pDevIns, pThis, u32);2025 return vmsvgaWritePort(pDevIns, pThis, pThisCC, u32); 2017 2026 2018 2027 case SVGA_BIOS_PORT: … … 2048 2057 * @returns VBox status code. 2049 2058 * @param pVM VM handle. 2050 * @param pThis VGA deviceinstance data.2059 * @param pThis The shared VGA/VMSVGA instance data. 2051 2060 * @param GCPhys The access physical address. 2052 2061 * @param fWriteAccess Read or write access … … 2497 2506 static DECLCALLBACK(int) vmsvgaR3RegisterGmr(PPDMDEVINS pDevIns, uint32_t gmrId) 2498 2507 { 2499 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);2508 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2500 2509 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 2501 2510 PGMR pGMR = &pSVGAState->paGMR[gmrId]; … … 2504 2513 for (uint32_t i = 0; i < pGMR->numDescriptors; i++) 2505 2514 { 2506 rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(p This->pDevInsR3),2515 rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), 2507 2516 pGMR->paDesc[i].GCPhys, pGMR->paDesc[i].GCPhys + pGMR->paDesc[i].numPages * PAGE_SIZE - 1, 2508 2517 pThis->svga.hGmrAccessHandlerType, pThis, NIL_RTR0PTR, NIL_RTRCPTR, "VMSVGA GMR"); … … 2515 2524 static DECLCALLBACK(int) vmsvgaR3DeregisterGmr(PPDMDEVINS pDevIns, uint32_t gmrId) 2516 2525 { 2517 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);2526 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2518 2527 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 2519 2528 PGMR pGMR = &pSVGAState->paGMR[gmrId]; … … 2521 2530 for (uint32_t i = 0; i < pGMR->numDescriptors; i++) 2522 2531 { 2523 int rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(p This->pDevInsR3), pGMR->paDesc[i].GCPhys);2532 int rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns), pGMR->paDesc[i].GCPhys); 2524 2533 AssertRC(rc); 2525 2534 } … … 2540 2549 for (uint32_t j = 0; j < pGMR->numDescriptors; j++) 2541 2550 { 2542 int rc = PGMHandlerPhysicalReset(PDMDevHlpGetVM(p This->pDevInsR3), pGMR->paDesc[j].GCPhys);2551 int rc = PGMHandlerPhysicalReset(PDMDevHlpGetVM(pDevIns), pGMR->paDesc[j].GCPhys); 2543 2552 AssertRC(rc); 2544 2553 } … … 2559 2568 * Common worker for changing the pointer shape. 2560 2569 * 2561 * @param pThis The VGA instance data.2570 * @param pThisCC The VGA/VMSVGA state for ring-3. 2562 2571 * @param pSVGAState The VMSVGA ring-3 instance data. 2563 2572 * @param fAlpha Whether there is alpha or not. … … 2569 2578 * @param cbData The size of the data. 2570 2579 */ 2571 static void vmsvgaR3InstallNewCursor(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, bool fAlpha,2580 static void vmsvgaR3InstallNewCursor(PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, bool fAlpha, 2572 2581 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, uint8_t *pbData, uint32_t cbData) 2573 2582 { … … 2616 2625 # endif 2617 2626 2618 int rc = pThis ->pDrv->pfnVBVAMousePointerShape(pThis->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData);2627 int rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData); 2619 2628 AssertRC(rc); 2620 2629 … … 2635 2644 * Handles the SVGA_CMD_DEFINE_CURSOR command. 2636 2645 * 2637 * @param pThis The VGA instance data. 2646 * @param pThis The shared VGA/VMSVGA state. 2647 * @param pThisCC The VGA/VMSVGA state for ring-3. 2638 2648 * @param pSVGAState The VMSVGA ring-3 instance data. 2639 2649 * @param pCursor The cursor. … … 2643 2653 * @param cbSrcXorLine The scanline length of the XOR mask. 2644 2654 */ 2645 static void vmsvgaR3CmdDefineCursor(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, SVGAFifoCmdDefineCursor const *pCursor, 2655 static void vmsvgaR3CmdDefineCursor(PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, 2656 SVGAFifoCmdDefineCursor const *pCursor, 2646 2657 uint8_t const *pbSrcAndMask, uint32_t cbSrcAndLine, 2647 2658 uint8_t const *pbSrcXorMask, uint32_t cbSrcXorLine) … … 2874 2885 * Pass it to the frontend/whatever. 2875 2886 */ 2876 vmsvgaR3InstallNewCursor(pThis , pSVGAState, false /*fAlpha*/, pCursor->hotspotX, pCursor->hotspotY, cx, cy, pbCopy, cbCopy);2887 vmsvgaR3InstallNewCursor(pThisCC, pSVGAState, false /*fAlpha*/, pCursor->hotspotX, pCursor->hotspotY, cx, cy, pbCopy, cbCopy); 2877 2888 } 2878 2889 … … 2881 2892 * Worker for vmsvgaR3FifoThread that handles an external command. 2882 2893 * 2883 * @param pThis VGA device instance data. 2894 * @param pDevIns The device instance. 2895 * @param pThis The shared VGA/VMSVGA instance data. 2896 * @param pThisCC The VGA/VMSVGA state for ring-3. 2884 2897 */ 2885 static void vmsvgaR3FifoHandleExtCmd(P VGASTATE pThis)2898 static void vmsvgaR3FifoHandleExtCmd(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 2886 2899 { 2887 2900 uint8_t uExtCmd = pThis->svga.u8FIFOExtCommand; … … 2917 2930 PSSMHANDLE pSSM = (PSSMHANDLE)pThis->svga.pvFIFOExtCmdParam; 2918 2931 AssertLogRelMsgBreak(RT_VALID_PTR(pSSM), ("pSSM=%p\n", pSSM)); 2919 vmsvgaR3SaveExecFifo(p This->pDevInsR3->pHlpR3, pThis, pSSM);2932 vmsvgaR3SaveExecFifo(pDevIns->pHlpR3, pThis, pSSM); 2920 2933 # ifdef VBOX_WITH_VMSVGA3D 2921 2934 if (pThis->svga.f3DEnabled) 2922 vmsvga3dSaveExec(p This->pDevInsR3, pThis, pSSM);2935 vmsvga3dSaveExec(pDevIns, pThis, pSSM); 2923 2936 # endif 2924 2937 break; … … 2930 2943 PVMSVGA_STATE_LOAD pLoadState = (PVMSVGA_STATE_LOAD)pThis->svga.pvFIFOExtCmdParam; 2931 2944 AssertLogRelMsgBreak(RT_VALID_PTR(pLoadState), ("pLoadState=%p\n", pLoadState)); 2932 vmsvgaR3LoadExecFifo(p This->pDevInsR3->pHlpR3, pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);2945 vmsvgaR3LoadExecFifo(pDevIns->pHlpR3, pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass); 2933 2946 # ifdef VBOX_WITH_VMSVGA3D 2934 2947 if (pThis->svga.f3DEnabled) 2935 vmsvga3dLoadExec(p This->pDevInsR3, pThis, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass);2948 vmsvga3dLoadExec(pDevIns, pThis, pThisCC, pLoadState->pSSM, pLoadState->uVersion, pLoadState->uPass); 2936 2949 # endif 2937 2950 break; … … 2970 2983 * @returns VBox status code (fully asserted). 2971 2984 * @param pDevIns The device instance. 2972 * @param pThis VGA deviceinstance data.2985 * @param pThis The shared VGA/VMSVGA instance data. 2973 2986 * @param uExtCmd The command to execute on the FIFO thread. 2974 2987 * @param pvParam Pointer to command parameters. … … 3064 3077 * Marks the FIFO non-busy, notifying any waiting EMTs. 3065 3078 * 3066 * @param pThis The VGA state. 3079 * @param pDevIns The device instance. 3080 * @param pThis The shared VGA/VMSVGA instance data. 3067 3081 * @param pSVGAState Pointer to the ring-3 only SVGA state data. 3068 3082 * @param offFifoMin The start byte offset of the command FIFO. 3069 3083 */ 3070 static void vmsvgaR3FifoSetNotBusy(P VGASTATE pThis, PVMSVGAR3STATE pSVGAState, uint32_t offFifoMin)3084 static void vmsvgaR3FifoSetNotBusy(PPDMDEVINS pDevIns, PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, uint32_t offFifoMin) 3071 3085 { 3072 3086 ASMAtomicAndU32(&pThis->svga.fBusy, ~VMSVGA_BUSY_F_FIFO); … … 3078 3092 { 3079 3093 # ifdef VMSVGA_USE_EMT_HALT_CODE 3080 PVM pVM = PDMDevHlpGetVM(p This->pDevInsR3);3094 PVM pVM = PDMDevHlpGetVM(pDevIns); 3081 3095 VMCPUID idCpu = VMCpuSetFindLastPresentInternal(&pSVGAState->BusyDelayedEmts); 3082 3096 if (idCpu != NIL_VMCPUID) … … 3111 3125 * buffer. (We will NEVER re-read anything.) 3112 3126 * @param pThread The calling PDM thread handle. 3113 * @param pThis The VGA state.3127 * @param pThis The shared VGA/VMSVGA instance data. 3114 3128 * @param pSVGAState Pointer to the ring-3 only SVGA state data. For 3115 3129 * statistics collection. … … 3258 3272 */ 3259 3273 static uint32_t 3260 vmsvgaR3FifoUpdateCursor(PVGASTATE pVGAState, PVMSVGAR3STATE pSVGAState, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO,3274 vmsvgaR3FifoUpdateCursor(PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO, 3261 3275 uint32_t offFifoMin, uint32_t uCursorUpdateCount, 3262 3276 uint32_t *pxLast, uint32_t *pyLast, uint32_t *pfLastVisible) … … 3308 3322 LogRel2(("vmsvgaR3FifoUpdateCursor: fVisible %d fLastVisible %d (%d,%d)\n", fVisible, *pfLastVisible, x, y)); 3309 3323 *pfLastVisible = fVisible; 3310 p VGAState->pDrv->pfnVBVAMousePointerShape(pVGAState->pDrv, RT_BOOL(fVisible), false, 0, 0, 0, 0, NULL);3324 pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, RT_BOOL(fVisible), false, 0, 0, 0, 0, NULL); 3311 3325 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoCursorVisiblity); 3312 3326 } 3313 p VGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, fFlags, idScreen, x, y);3327 pThisCC->pDrv->pfnVBVAReportCursorPosition(pThisCC->pDrv, fFlags, idScreen, x, y); 3314 3328 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoCursorPosition); 3315 3329 } … … 3347 3361 * Called by the VGA refresh timer to wake up the FIFO thread when needed. 3348 3362 * 3349 * @param pThis The VGA state.3363 * @param pThis The shared VGA/VMSVGA instance data. 3350 3364 */ 3351 3365 void vmsvgaR3FifoWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis) … … 3370 3384 static DECLCALLBACK(int) vmsvgaR3FifoLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 3371 3385 { 3372 PVGASTATE pThis = (PVGASTATE)pThread->pvUser; 3386 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3387 PVGASTATER3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3373 3388 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3374 3389 int rc; … … 3384 3399 if (pThis->svga.fFifoExtCommandWakeup) 3385 3400 { 3386 vmsvgaR3FifoHandleExtCmd(p This);3401 vmsvgaR3FifoHandleExtCmd(pDevIns, pThis, pThisCC); 3387 3402 while (pThread->enmState == PDMTHREADSTATE_RUNNING) 3388 3403 if (pThis->svga.u8FIFOExtCommand == VMSVGA_FIFO_EXTCMD_NONE) 3389 3404 PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pThis->svga.hFIFORequestSem, RT_MS_1MIN); 3390 3405 else 3391 vmsvgaR3FifoHandleExtCmd(p This);3406 vmsvgaR3FifoHandleExtCmd(pDevIns, pThis, pThisCC); 3392 3407 return VINF_SUCCESS; 3393 3408 } … … 3515 3530 if (pThis->svga.u8FIFOExtCommand != VMSVGA_FIFO_EXTCMD_NONE) 3516 3531 { 3517 vmsvgaR3FifoHandleExtCmd(p This);3532 vmsvgaR3FifoHandleExtCmd(pDevIns, pThis, pThisCC); 3518 3533 continue; 3519 3534 } … … 3525 3540 || !pThis->svga.fConfigured) 3526 3541 { 3527 vmsvgaR3FifoSetNotBusy(p This, pSVGAState, pFIFO[SVGA_FIFO_MIN]);3542 vmsvgaR3FifoSetNotBusy(pDevIns, pThis, pSVGAState, pFIFO[SVGA_FIFO_MIN]); 3528 3543 fBadOrDisabledFifo = true; 3529 3544 cMsSleep = cMsMaxSleep; /* cheat */ … … 3551 3566 STAM_REL_COUNTER_INC(&pSVGAState->StatFifoErrors); 3552 3567 LogRelMax(8, ("vmsvgaR3FifoLoop: Bad fifo: min=%#x stop=%#x max=%#x\n", offFifoMin, offCurrentCmd, offFifoMax)); 3553 vmsvgaR3FifoSetNotBusy(p This, pSVGAState, offFifoMin);3568 vmsvgaR3FifoSetNotBusy(pDevIns, pThis, pSVGAState, offFifoMin); 3554 3569 fBadOrDisabledFifo = true; 3555 3570 continue; … … 3574 3589 else 3575 3590 { 3576 uint32_t const u LastCursorCount = vmsvgaR3FifoUpdateCursor(pThis, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount,3577 3578 ASMAtomicWriteU32(&pThis->svga.uLastCursorUpdateCount, u LastCursorCount);3591 uint32_t const uNewCount = vmsvgaR3FifoUpdateCursor(pThisCC, pSVGAState, pFIFO, offFifoMin, uCursorUpdateCount, 3592 &xLastCursor, &yLastCursor, &fLastCursorVisible); 3593 ASMAtomicWriteU32(&pThis->svga.uLastCursorUpdateCount, uNewCount); 3579 3594 } 3580 3595 } … … 3637 3652 if (ASMBitTestAndClear(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE_BIT)) 3638 3653 { 3639 vmsvgaR3ChangeMode(pThis );3654 vmsvgaR3ChangeMode(pThis, pThisCC); 3640 3655 # ifdef VBOX_WITH_VMSVGA3D 3641 3656 if (pThis->svga.p3dState != NULL) … … 3703 3718 VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThis, 0); 3704 3719 AssertBreak(pScreen); 3705 vmsvgaR3UpdateScreen(pThis , pScreen, pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height);3720 vmsvgaR3UpdateScreen(pThisCC, pScreen, pUpdate->x, pUpdate->y, pUpdate->width, pUpdate->height); 3706 3721 break; 3707 3722 } … … 3728 3743 VMSVGAFIFO_GET_MORE_CMD_BUFFER_BREAK(pCursor, SVGAFifoCmdDefineCursor, sizeof(*pCursor) + cbAndMask + cbXorMask); 3729 3744 3730 vmsvgaR3CmdDefineCursor(pThis, p SVGAState, pCursor, (uint8_t const *)(pCursor + 1), cbAndLine,3745 vmsvgaR3CmdDefineCursor(pThis, pThisCC, pSVGAState, pCursor, (uint8_t const *)(pCursor + 1), cbAndLine, 3731 3746 (uint8_t const *)(pCursor + 1) + cbAndMask, cbXorLine); 3732 3747 break; … … 3768 3783 memcpy(pCursorCopy + cbAndMask, (pCursor + 1), pCursor->width * pCursor->height * sizeof(uint32_t)); 3769 3784 3770 vmsvgaR3InstallNewCursor(pThis , pSVGAState, true /*fAlpha*/, pCursor->hotspotX, pCursor->hotspotY,3785 vmsvgaR3InstallNewCursor(pThisCC, pSVGAState, true /*fAlpha*/, pCursor->hotspotX, pCursor->hotspotY, 3771 3786 pCursor->width, pCursor->height, pCursorCopy, cbCursorShape); 3772 3787 break; … … 4017 4032 4018 4033 # ifdef DEBUG_GMR_ACCESS 4019 VMR3ReqCallWaitU(PDMDevHlpGetUVM(p This->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3RegisterGmr, 2, pThis->pDevInsR3, pCmd->gmrId);4034 VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3RegisterGmr, 2, pDevIns, pCmd->gmrId); 4020 4035 # endif 4021 4036 break; … … 4088 4103 4089 4104 pThis->svga.fGFBRegisters = false; 4090 vmsvgaR3ChangeMode(pThis );4105 vmsvgaR3ChangeMode(pThis, pThisCC); 4091 4106 break; 4092 4107 } … … 4109 4124 pScreen->idScreen = idScreen; 4110 4125 4111 vmsvgaR3ChangeMode(pThis );4126 vmsvgaR3ChangeMode(pThis, pThisCC); 4112 4127 break; 4113 4128 } … … 4172 4187 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer. 4173 4188 */ 4174 uint8_t * const pbHstBuf = (uint8_t *)pThis ->CTX_SUFF(vram_ptr)+ pScreen->offVRAM;4189 uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM; 4175 4190 uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch : 4176 4191 width * (RT_ALIGN(pScreen->cBpp, 8) / 8); … … 4188 4203 int32_t const cbGstPitch = pSVGAState->GMRFB.bytesPerLine; 4189 4204 4190 rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_WRITE_HOST_VRAM,4191 pbHstBuf, cbHstBuf, offHst, cbHstPitch,4192 gstPtr, offGst, cbGstPitch,4193 (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);4205 rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_WRITE_HOST_VRAM, 4206 pbHstBuf, cbHstBuf, offHst, cbHstPitch, 4207 gstPtr, offGst, cbGstPitch, 4208 (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height); 4194 4209 AssertRC(rc); 4195 vmsvgaR3UpdateScreen(pThis , pScreen, clipRect.left, clipRect.top, width, height);4210 vmsvgaR3UpdateScreen(pThisCC, pScreen, clipRect.left, clipRect.top, width, height); 4196 4211 break; 4197 4212 } … … 4244 4259 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer. 4245 4260 */ 4246 uint8_t * const pbHstBuf = (uint8_t *)pThis ->CTX_SUFF(vram_ptr)+ pScreen->offVRAM;4261 uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM; 4247 4262 uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch : 4248 4263 width * (RT_ALIGN(pScreen->cBpp, 8) / 8); … … 4260 4275 int32_t const cbGstPitch = pSVGAState->GMRFB.bytesPerLine; 4261 4276 4262 rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_READ_HOST_VRAM,4277 rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_READ_HOST_VRAM, 4263 4278 pbHstBuf, cbHstBuf, offHst, cbHstPitch, 4264 4279 gstPtr, offGst, cbGstPitch, … … 4336 4351 SVGA3D_TEX_FILTER_NONE, cMipLevels, (SVGA3dSize *)(pCmd + 1)); 4337 4352 # ifdef DEBUG_GMR_ACCESS 4338 VMR3ReqCallWaitU(PDMDevHlpGetUVM(p This->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);4353 VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis); 4339 4354 # endif 4340 4355 break; … … 4395 4410 cCopyBoxes = (pHdr->size - sizeof(*pCmd)) / sizeof(SVGA3dCopyBox); 4396 4411 STAM_PROFILE_START(&pSVGAState->StatR3Cmd3dSurfaceDmaProf, a); 4397 rc = vmsvga3dSurfaceDMA(pThis, pCmd->guest, pCmd->host, pCmd->transfer, cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1)); 4412 rc = vmsvga3dSurfaceDMA(pThis, pThisCC, pCmd->guest, pCmd->host, pCmd->transfer, 4413 cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1)); 4398 4414 STAM_PROFILE_STOP(&pSVGAState->StatR3Cmd3dSurfaceDmaProf, a); 4399 4415 break; … … 4408 4424 4409 4425 cRects = (pHdr->size - sizeof(*pCmd)) / sizeof(SVGASignedRect); 4410 rc = vmsvga3dSurfaceBlitToScreen(pThis, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage, pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1)); 4426 rc = vmsvga3dSurfaceBlitToScreen(pThis, pThisCC, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage, 4427 pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1)); 4411 4428 break; 4412 4429 } … … 4560 4577 4561 4578 STAM_PROFILE_START(&pSVGAState->StatR3Cmd3dPresentProf, a); 4562 rc = vmsvga3dCommandPresent(pThis, p Cmd->sid, cRects, (SVGA3dCopyRect *)(pCmd + 1));4579 rc = vmsvga3dCommandPresent(pThis, pThisCC, pCmd->sid, cRects, (SVGA3dCopyRect *)(pCmd + 1)); 4563 4580 STAM_PROFILE_STOP(&pSVGAState->StatR3Cmd3dPresentProf, a); 4564 4581 break; … … 4671 4688 STAM_REL_COUNTER_INC(&pSVGAState->StatR3Cmd3dWaitForQuery); 4672 4689 4673 rc = vmsvga3dQueryWait(pThis, p Cmd->cid, pCmd->type, pCmd->guestResult);4690 rc = vmsvga3dQueryWait(pThis, pThisCC, pCmd->cid, pCmd->type, pCmd->guestResult); 4674 4691 break; 4675 4692 } … … 4754 4771 { 4755 4772 Log(("vmsvgaR3FifoLoop: emptied the FIFO next=%x stop=%x\n", pFIFO[SVGA_FIFO_NEXT_CMD], offCurrentCmd)); 4756 vmsvgaR3FifoSetNotBusy(p This, pSVGAState, offFifoMin);4773 vmsvgaR3FifoSetNotBusy(pDevIns, pThis, pSVGAState, offFifoMin); 4757 4774 } 4758 4775 } … … 4769 4786 * Free the specified GMR 4770 4787 * 4771 * @param pThis VGA deviceinstance data.4788 * @param pThis The shared VGA/VMSVGA instance data. 4772 4789 * @param idGMR GMR id 4773 4790 */ … … 4782 4799 { 4783 4800 # ifdef DEBUG_GMR_ACCESS 4784 VMR3ReqCallWaitU(PDMDevHlpGetUVM(p This->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pThis->pDevInsR3, idGMR);4801 VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pDevIns, idGMR); 4785 4802 # endif 4786 4803 … … 4800 4817 * 4801 4818 * @returns VBox status code. 4802 * @param pThis VGA device instance data. 4819 * @param pThis The shared VGA/VMSVGA instance data. 4820 * @param pThisCC The VGA/VMSVGA state for ring-3. 4803 4821 * @param enmTransferType Transfer type (read/write) 4804 4822 * @param pbHstBuf Host buffer pointer (valid) … … 4812 4830 * @param cHeight Number of scanllines to copy 4813 4831 */ 4814 int vmsvgaR3GmrTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,4832 int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType, 4815 4833 uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch, 4816 4834 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, 4817 4835 uint32_t cbWidth, uint32_t cHeight) 4818 4836 { 4819 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 4820 int rc; 4837 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 4838 PPDMDEVINS pDevIns = pThisCC->pDevIns; /* simpler */ 4839 int rc; 4821 4840 4822 4841 LogFunc(("%s host %p size=%d offset %d pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n", … … 4937 4956 if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER) 4938 4957 { 4939 uint8_t *pbGst = pThis ->CTX_SUFF(vram_ptr)+ offGmr;4958 uint8_t *pbGst = pThisCC->pbVRam + offGmr; 4940 4959 4941 4960 uint8_t const *pbSrc; … … 5020 5039 5021 5040 if (enmTransferType == SVGA3D_WRITE_HOST_VRAM) 5022 rc = PDMDevHlpPhysRead(p This->CTX_SUFF(pDevIns), GCPhys, pbCurrentHost, cbToCopy);5041 rc = PDMDevHlpPhysRead(pDevIns, GCPhys, pbCurrentHost, cbToCopy); 5023 5042 else 5024 rc = PDMDevHlpPhysWrite(p This->CTX_SUFF(pDevIns), GCPhys, pbCurrentHost, cbToCopy);5043 rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, pbCurrentHost, cbToCopy); 5025 5044 AssertRCBreak(rc); 5026 5045 … … 5197 5216 * Enables or disables dirty page tracking for the framebuffer 5198 5217 * 5199 * @param pThis VGA device instance data. 5218 * @param pDevIns The device instance. 5219 * @param pThis The shared VGA/VMSVGA instance data. 5200 5220 * @param fTraces Enable/disable traces 5201 5221 */ 5202 static void vmsvgaR3SetTraces(P VGASTATE pThis, bool fTraces)5222 static void vmsvgaR3SetTraces(PPDMDEVINS pDevIns, PVGASTATE pThis, bool fTraces) 5203 5223 { 5204 5224 if ( (!pThis->svga.fConfigured || !pThis->svga.fEnabled) … … 5230 5250 { 5231 5251 Log(("vmsvgaR3SetTraces: enable frame buffer dirty page tracking. (%x bytes; vram %x)\n", cbFrameBuffer, pThis->vram_size)); 5232 vgaR3RegisterVRAMHandler(p This, cbFrameBuffer);5252 vgaR3RegisterVRAMHandler(pDevIns, pThis, cbFrameBuffer); 5233 5253 pThis->svga.fVRAMTracking = true; 5234 5254 } … … 5239 5259 { 5240 5260 Log(("vmsvgaR3SetTraces: disable frame buffer dirty page tracking\n")); 5241 vgaR3UnregisterVRAMHandler(p This);5261 vgaR3UnregisterVRAMHandler(pDevIns, pThis); 5242 5262 pThis->svga.fVRAMTracking = false; 5243 5263 } … … 5251 5271 RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType) 5252 5272 { 5253 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);5273 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5254 5274 int rc; 5255 5275 RT_NOREF(pPciDev); … … 5309 5329 * 5310 5330 * @param pDevIns The device instance. 5311 * @param pThis The VGA deviceinstance data.5331 * @param pThis The The shared VGA/VMSVGA instance data. 5312 5332 * @param sid Either UINT32_MAX or the ID of a specific 5313 5333 * surface. If UINT32_MAX is used, all surfaces … … 5361 5381 fInvY = true; 5362 5382 5363 vmsvga3dInfoSurfaceWorker(pDevIns, PDM INS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose, cxAscii, fInvY, NULL);5383 vmsvga3dInfoSurfaceWorker(pDevIns, PDMDEVINS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose, cxAscii, fInvY, NULL); 5364 5384 } 5365 5385 … … 5386 5406 const uint32_t cxAscii = 0; /* No ASCII */ 5387 5407 const bool fInvY = false; /* Do not invert. */ 5388 vmsvga3dInfoSurfaceWorker(pDevIns, PDM INS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose, cxAscii, fInvY, pszBitmapPath);5408 vmsvga3dInfoSurfaceWorker(pDevIns, PDMDEVINS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose, cxAscii, fInvY, pszBitmapPath); 5389 5409 } 5390 5410 … … 5408 5428 fVerbose = false; 5409 5429 5410 vmsvga3dInfoContextWorker(PDM INS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose);5430 vmsvga3dInfoContextWorker(PDMDEVINS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose); 5411 5431 } 5412 5432 … … 5418 5438 static DECLCALLBACK(void) vmsvgaR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 5419 5439 { 5420 RT_NOREF(pszArgs);5421 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);5440 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5441 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5422 5442 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 5423 5443 uint32_t RT_UNTRUSTED_VOLATILE_GUEST *pFIFO = pThis->svga.pFIFOR3; 5444 RT_NOREF(pszArgs); 5424 5445 5425 5446 pHlp->pfnPrintf(pHlp, "Extension enabled: %RTbool\n", pThis->svga.fEnabled); … … 5457 5478 pHlp->pfnPrintf(pHlp, "3D enabled: %RTbool\n", pThis->svga.f3DEnabled); 5458 5479 # endif 5459 if (pThis ->pDrv)5460 { 5461 pHlp->pfnPrintf(pHlp, "Driver mode: %ux%u %ubpp\n", pThis ->pDrv->cx, pThis->pDrv->cy, pThis->pDrv->cBits);5462 pHlp->pfnPrintf(pHlp, "Driver pitch: %u (%#x)\n", pThis ->pDrv->cbScanline, pThis->pDrv->cbScanline);5480 if (pThisCC->pDrv) 5481 { 5482 pHlp->pfnPrintf(pHlp, "Driver mode: %ux%u %ubpp\n", pThisCC->pDrv->cx, pThisCC->pDrv->cy, pThisCC->pDrv->cBits); 5483 pHlp->pfnPrintf(pHlp, "Driver pitch: %u (%#x)\n", pThisCC->pDrv->cbScanline, pThisCC->pDrv->cbScanline); 5463 5484 } 5464 5485 } … … 5529 5550 { 5530 5551 RT_NOREF(uPass); 5531 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);5552 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5532 5553 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 5533 5554 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; … … 5616 5637 5617 5638 # ifdef RT_OS_DARWIN /** @todo r=bird: this is normally done on the EMT, so for DARWIN we do that when loading saved state too now. See DevVGA-SVGA3d-shared.h. */ 5618 vmsvga3dPowerOn(p This);5639 vmsvga3dPowerOn(pDevIns, pThis, pThisCC); 5619 5640 # endif 5620 5641 … … 5634 5655 int vmsvgaR3LoadDone(PPDMDEVINS pDevIns) 5635 5656 { 5636 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 5657 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5658 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5637 5659 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 5638 5660 … … 5642 5664 if (pSVGAState->Cursor.fActive) 5643 5665 { 5644 int rc; 5645 5646 rc = pThis->pDrv->pfnVBVAMousePointerShape(pThis->pDrv, 5647 true, 5648 true, 5649 pSVGAState->Cursor.xHotspot, 5650 pSVGAState->Cursor.yHotspot, 5651 pSVGAState->Cursor.width, 5652 pSVGAState->Cursor.height, 5653 pSVGAState->Cursor.pData); 5666 int rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, 5667 true /*fVisible*/, 5668 true /*fAlpha*/, 5669 pSVGAState->Cursor.xHotspot, 5670 pSVGAState->Cursor.yHotspot, 5671 pSVGAState->Cursor.width, 5672 pSVGAState->Cursor.height, 5673 pSVGAState->Cursor.pData); 5654 5674 AssertRC(rc); 5655 5675 } … … 5692 5712 int vmsvgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5693 5713 { 5694 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);5714 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5695 5715 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 5696 5716 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; … … 5991 6011 int vmsvgaR3Reset(PPDMDEVINS pDevIns) 5992 6012 { 5993 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);6013 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5994 6014 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 5995 6015 … … 6043 6063 int vmsvgaR3Destruct(PPDMDEVINS pDevIns) 6044 6064 { 6045 PVGASTATE pThis = PDM INS_2_DATA(pDevIns, PVGASTATE);6065 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6046 6066 6047 6067 /* … … 6099 6119 int vmsvgaR3Init(PPDMDEVINS pDevIns) 6100 6120 { 6101 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 6121 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6122 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6102 6123 PVMSVGAR3STATE pSVGAState; 6103 6124 int rc; … … 6134 6155 if (pThis->svga.f3DEnabled) 6135 6156 { 6136 rc = vmsvga3dInit(p This);6157 rc = vmsvga3dInit(pDevIns, pThis, pThisCC); 6137 6158 if (RT_FAILURE(rc)) 6138 6159 { … … 6162 6183 # ifdef DEBUG_GMR_ACCESS 6163 6184 /* Register the GMR access handler type. */ 6164 rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(p This->pDevInsR3), PGMPHYSHANDLERKIND_WRITE,6185 rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pDevIns), PGMPHYSHANDLERKIND_WRITE, 6165 6186 vmsvgaR3GmrAccessHandler, 6166 6187 NULL, NULL, NULL, … … 6174 6195 debugging FIFO access, this is also used to facilitate 6175 6196 extended fifo thread sleeps. */ 6176 rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(p This->pDevInsR3),6197 rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pDevIns), 6177 6198 # ifdef DEBUG_FIFO_ACCESS 6178 6199 PGMPHYSHANDLERKIND_ALL, … … 6395 6416 { 6396 6417 # ifdef VBOX_WITH_VMSVGA3D 6397 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 6418 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6419 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6398 6420 if (pThis->svga.f3DEnabled) 6399 6421 { 6400 int rc = vmsvga3dPowerOn(p This);6422 int rc = vmsvga3dPowerOn(pDevIns, pThis, pThisCC); 6401 6423 6402 6424 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h
r82089 r82109 359 359 } VMSVGAState; 360 360 361 typedef struct VGAState *PVGASTATE; 361 typedef struct VGAState *PVGASTATE; 362 typedef struct VGASTATER3 *PVGASTATER3; 363 typedef struct VGASTATER0 *PVGASTATER0; 364 typedef struct VGASTATERC *PVGASTATERC; 365 typedef CTX_SUFF(PVGASTATE) PVGASTATECC; 362 366 363 367 DECLCALLBACK(int) vmsvgaR3PciIORegionFifoMapUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, … … 381 385 #ifdef IN_RING3 382 386 VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATE pThis, uint32_t idScreen); 383 int vmsvgaR3UpdateScreen(PVGASTATE pThis, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h);387 int vmsvgaR3UpdateScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h); 384 388 #endif 385 389 386 390 void vmsvgaR3GmrFree(PVGASTATE pThis, uint32_t idGMR); 387 int vmsvgaR3GmrTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,391 int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType, 388 392 uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch, 389 393 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp
r82099 r82109 512 512 * Updates the heap buffers for all surfaces or one specific one. 513 513 * 514 * @param pThis The VGA deviceinstance data.514 * @param pThis The shared VGA instance data. 515 515 * @param sid The surface ID, UINT32_MAX if all. 516 516 * @thread VMSVGAFIFO -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h
r82101 r82109 1228 1228 PVMSVGA3DSURFACE pSrcSurface, uint32_t uSrcFace, uint32_t uSrcMipmap, SVGA3dBox const *pSrcBox, 1229 1229 SVGA3dStretchBltMode enmMode, PVMSVGA3DCONTEXT pContext); 1230 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PV MSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface,1230 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface, 1231 1231 PVMSVGA3DMIPMAPLEVEL pMipLevel, uint32_t uHostFace, uint32_t uHostMipmap, 1232 1232 SVGAGuestPtr GuestPtr, uint32_t cbGuestPitch, SVGA3dTransferType transfer, -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r82101 r82109 583 583 * 584 584 * @returns VBox status code. 585 * @param pThis The VGA device state where svga.p3dState will be modified. 585 * @param pDevIns The device instance. 586 * @param pThis The shared VGA/VMSVGA state where svga.p3dState will be 587 * modified. 588 * @param pThisCC The VGA/VMSVGA state for ring-3. 586 589 */ 587 int vmsvga3dInit(P VGASTATE pThis)590 int vmsvga3dInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 588 591 { 589 592 int rc; 593 RT_NOREF(pThisCC); 590 594 591 595 AssertCompile(GL_TRUE == 1); … … 593 597 594 598 #ifdef VMSVGA3D_DYNAMIC_LOAD 595 rc = glLdrInit(p This->pDevInsR3);599 rc = glLdrInit(pDevIns); 596 600 if (RT_FAILURE(rc)) 597 601 { … … 809 813 810 814 /* We must delay window creation until the PowerOn phase. Init is too early and will cause failures. */ 811 int vmsvga3dPowerOn(P VGASTATE pThis)815 int vmsvga3dPowerOn(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 812 816 { 813 817 PVMSVGA3DSTATE pState = pThis->svga.p3dState; … … 818 822 #endif 819 823 int rc; 824 RT_NOREF(pDevIns, pThisCC); 820 825 821 826 if (pState->rsGLVersion != 0.0) … … 833 838 #ifdef VMSVGA3D_DYNAMIC_LOAD 834 839 /* Context is set and it is possible now to resolve extension functions. */ 835 rc = glLdrGetExtFunctions(p This->pDevInsR3);840 rc = glLdrGetExtFunctions(pDevIns); 836 841 if (RT_FAILURE(rc)) 837 842 { … … 2812 2817 * 2813 2818 * @returns Failure status code or @a rc. 2814 * @param pThis The VGA device instance data. 2819 * @param pThis The shared VGA instance data. 2820 * @param pThisCC The VGA/VMSVGA state for ring-3. 2815 2821 * @param pState The VMSVGA3d state. 2816 2822 * @param pSurface The host surface. … … 2826 2832 * @param iBox The current box number (for Direct 3D). 2827 2833 */ 2828 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PV MSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface,2834 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface, 2829 2835 PVMSVGA3DMIPMAPLEVEL pMipLevel, uint32_t uHostFace, uint32_t uHostMipmap, 2830 2836 SVGAGuestPtr GuestPtr, uint32_t cbGuestPitch, SVGA3dTransferType transfer, … … 2924 2930 2925 2931 rc = vmsvgaR3GmrTransfer(pThis, 2932 pThisCC, 2926 2933 transfer, 2927 2934 pDoubleBuffer, … … 3072 3079 3073 3080 rc = vmsvgaR3GmrTransfer(pThis, 3081 pThisCC, 3074 3082 transfer, 3075 3083 pbData, … … 3200 3208 * 3201 3209 * @returns VBox status code. 3202 * @param pThis VGA deviceinstance data.3210 * @param pThis The shared VGA instance data. 3203 3211 * @param cid Context id 3204 3212 * @param fFlags VMSVGA3D_DEF_CTX_F_XXX. … … 3435 3443 * 3436 3444 * @returns VBox status code. 3437 * @param pThis VGA deviceinstance data.3445 * @param pThis The shared VGA instance data. 3438 3446 * @param cid Context id 3439 3447 */ … … 3447 3455 * 3448 3456 * @returns VBox status code. 3449 * @param pThis VGA deviceinstance data.3457 * @param pThis The shared VGA instance data. 3450 3458 * @param pContext The context to destroy. 3451 3459 * @param cid Context id … … 3545 3553 * 3546 3554 * @returns VBox status code. 3547 * @param pThis VGA deviceinstance data.3555 * @param pThis The shared VGA instance data. 3548 3556 * @param cid Context id 3549 3557 */ … … 3567 3575 * Worker for vmsvga3dChangeMode that resizes a context. 3568 3576 * 3569 * @param pThis The VGA deviceinstance data.3577 * @param pThis The shared VGA instance data. 3570 3578 * @param pState The VMSVGA3d state. 3571 3579 * @param pContext The context. -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp
r82095 r82109 147 147 } 148 148 149 int vmsvga3dLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, P SSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)149 int vmsvga3dLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 150 150 { 151 151 RT_NOREF(uPass); … … 159 159 #ifndef RT_OS_DARWIN /** @todo r=bird: this is normally done on the EMT, so for DARWIN we do that when loading saved state too now. See DevVGA-SVGA.cpp */ 160 160 /* Must initialize now as the recreation calls below rely on an initialized 3d subsystem. */ 161 vmsvga3dPowerOn(p This);161 vmsvga3dPowerOn(pDevIns, pThis, pThisCC); 162 162 #endif 163 163 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r82095 r82109 161 161 162 162 163 int vmsvga3dInit(PVGASTATE pThis) 164 { 163 int vmsvga3dInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 164 { 165 RT_NOREF(pDevIns, pThisCC); 166 165 167 PVMSVGA3DSTATE pState; 166 int rc;167 168 168 pThis->svga.p3dState = pState = (PVMSVGA3DSTATE)RTMemAllocZ(sizeof(VMSVGA3DSTATE)); 169 169 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 170 170 171 171 /* Create event semaphore. */ 172 rc = RTSemEventCreate(&pState->WndRequestSem);172 int rc = RTSemEventCreate(&pState->WndRequestSem); 173 173 if (RT_FAILURE(rc)) 174 174 { … … 188 188 } 189 189 190 int vmsvga3dPowerOn(P VGASTATE pThis)190 int vmsvga3dPowerOn(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 191 191 { 192 192 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 193 193 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 194 194 HRESULT hr; 195 RT_NOREF(pDevIns, pThisCC); 195 196 196 197 if (pState->pD3D9) … … 205 206 PFNDIRECT3DCREATE9EX pfnDirect3dCreate9Ex = (PFNDIRECT3DCREATE9EX)RTLdrGetSystemSymbol("d3d9.dll", "Direct3DCreate9Ex"); 206 207 if (!pfnDirect3dCreate9Ex) 207 return PDMDevHlpVMSetError(p This->CTX_SUFF(pDevIns), VERR_SYMBOL_NOT_FOUND, RT_SRC_POS,208 return PDMDevHlpVMSetError(pDevIns, VERR_SYMBOL_NOT_FOUND, RT_SRC_POS, 208 209 "vmsvga3d: Unable to locate Direct3DCreate9Ex. This feature requires Vista and later."); 209 210 hr = pfnDirect3dCreate9Ex(D3D_SDK_VERSION, &pState->pD3D9); … … 2319 2320 * 2320 2321 * @returns Failure status code or @a rc. 2321 * @param pThis The VGA device instance data. 2322 * @param pThis The shared VGA instance data. 2323 * @param pThisCC The VGA/VMSVGA state for ring-3. 2322 2324 * @param pState The VMSVGA3d state. 2323 2325 * @param pSurface The host surface. … … 2333 2335 * @param iBox The current box number (for Direct 3D). 2334 2336 */ 2335 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PV MSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface,2337 int vmsvga3dBackSurfaceDMACopyBox(PVGASTATE pThis, PVGASTATECC pThisCC, PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface, 2336 2338 PVMSVGA3DMIPMAPLEVEL pMipLevel, uint32_t uHostFace, uint32_t uHostMipmap, 2337 2339 SVGAGuestPtr GuestPtr, uint32_t cbGuestPitch, SVGA3dTransferType transfer, … … 2414 2416 2415 2417 rc = vmsvgaR3GmrTransfer(pThis, 2418 pThisCC, 2416 2419 transfer, 2417 2420 pu8LockedBuf, … … 2481 2484 /* Copy data between the guest and the host buffer. */ 2482 2485 rc = vmsvgaR3GmrTransfer(pThis, 2486 pThisCC, 2483 2487 transfer, 2484 2488 (uint8_t *)pMipLevel->pSurfaceData, … … 2558 2562 * 2559 2563 * @returns VBox status code. 2560 * @param pThis VGA deviceinstance data.2564 * @param pThis The shared VGA instance data. 2561 2565 * @param cid Context id 2562 2566 */ … … 2656 2660 * 2657 2661 * @returns VBox status code. 2658 * @param pThis VGA deviceinstance data.2662 * @param pThis The shared VGA instance data. 2659 2663 * @param cid Context id 2660 2664 */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r82095 r82109 46 46 * 47 47 * @returns VBox status code (currently ignored). 48 * @param pThis The VGA deviceinstance data.48 * @param pThis The shared VGA instance data. 49 49 * @param sid The ID of the surface to (re-)define. 50 50 * @param surfaceFlags . … … 330 330 * 331 331 * @returns VBox status code (currently ignored). 332 * @param pThis The VGA deviceinstance data.332 * @param pThis The shared VGA instance data. 333 333 * @param sid The ID of the surface to destroy. 334 334 */ … … 379 379 * 380 380 * @returns VBox status code (currently ignored). 381 * @param pThis The VGA deviceinstance data.381 * @param pThis The shared VGA instance data. 382 382 * @param pDstSfcImg 383 383 * @param pDstBox … … 472 472 * 473 473 * @returns VBox status code (currently ignored). 474 * @param pThis The VGA device instance data. 474 * @param pThis The shared VGA instance data. 475 * @param pThisCC The VGA/VMSVGA state for ring-3. 475 476 * @param guest . 476 477 * @param host . … … 479 480 * @param paBoxes . 480 481 */ 481 int vmsvga3dSurfaceDMA(PVGASTATE pThis, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer,482 uint32_t cCopyBoxes, SVGA3dCopyBox *paBoxes)482 int vmsvga3dSurfaceDMA(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, 483 SVGA3dTransferType transfer, uint32_t cCopyBoxes, SVGA3dCopyBox *paBoxes) 483 484 { 484 485 PVMSVGA3DSTATE pState = pThis->svga.p3dState; … … 629 630 { 630 631 rc = vmsvgaR3GmrTransfer(pThis, 632 pThisCC, 631 633 transfer, 632 634 (uint8_t *)pMipLevel->pSurfaceData, … … 661 663 clipBox.srcy = srcy; 662 664 clipBox.srcz = srcz; 663 rc = vmsvga3dBackSurfaceDMACopyBox(pThis, p State, pSurface, pMipLevel, host.face, host.mipmap,665 rc = vmsvga3dBackSurfaceDMACopyBox(pThis, pThisCC, pState, pSurface, pMipLevel, host.face, host.mipmap, 664 666 guest.ptr, cbGuestPitch, transfer, 665 667 &clipBox, pContext, rc, i); … … 677 679 } 678 680 679 static int vmsvga3dQueryWriteResult(PVGASTATE pThis, SVGAGuestPtr guestResult, SVGA3dQueryState enmState, uint32_t u32Result) 681 static int vmsvga3dQueryWriteResult(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAGuestPtr guestResult, 682 SVGA3dQueryState enmState, uint32_t u32Result) 680 683 { 681 684 SVGA3dQueryResult queryResult; … … 684 687 queryResult.result32 = u32Result; 685 688 686 int rc = vmsvgaR3GmrTransfer(pThis, SVGA3D_READ_HOST_VRAM,689 int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_READ_HOST_VRAM, 687 690 (uint8_t *)&queryResult, sizeof(queryResult), 0, sizeof(queryResult), 688 691 guestResult, 0, sizeof(queryResult), sizeof(queryResult), 1); … … 756 759 } 757 760 758 int vmsvga3dQueryWait(PVGASTATE pThis, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult)761 int vmsvga3dQueryWait(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult) 759 762 { 760 763 PVMSVGA3DSTATE pState = pThis->svga.p3dState; … … 789 792 { 790 793 /* Return data to the guest. */ 791 vmsvga3dQueryWriteResult(pThis, guestResult, SVGA3D_QUERYSTATE_SUCCEEDED, p->u32QueryResult);794 vmsvga3dQueryWriteResult(pThis, pThisCC, guestResult, SVGA3D_QUERYSTATE_SUCCEEDED, p->u32QueryResult); 792 795 return VINF_SUCCESS; 793 796 } … … 805 808 } 806 809 807 vmsvga3dQueryWriteResult(pThis, guestResult, SVGA3D_QUERYSTATE_FAILED, 0);810 vmsvga3dQueryWriteResult(pThis, pThisCC, guestResult, SVGA3D_QUERYSTATE_FAILED, 0); 808 811 AssertFailedReturn(rc); 809 812 } 810 813 811 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t idDstScreen, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect) 814 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t idDstScreen, SVGASignedRect destRect, 815 SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect) 812 816 { 813 817 /* Requires SVGA_FIFO_CAP_SCREEN_OBJECT support */ … … 859 863 box.srcy = destRect.top; 860 864 861 int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);865 int rc = vmsvga3dSurfaceDMA(pThis, pThisCC, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box); 862 866 AssertRCReturn(rc, rc); 863 867 864 868 /* Update the guest image, which is at box.src. */ 865 vmsvgaR3UpdateScreen(pThis , pScreen, box.srcx, box.srcy, box.w, box.h);869 vmsvgaR3UpdateScreen(pThisCC, pScreen, box.srcx, box.srcy, box.w, box.h); 866 870 } 867 871 else … … 884 888 box.srcy = destRect.top + pRect[i].top; 885 889 886 int rc = vmsvga3dSurfaceDMA(pThis, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box);890 int rc = vmsvga3dSurfaceDMA(pThis, pThisCC, dest, src, SVGA3D_READ_HOST_VRAM, 1, &box); 887 891 AssertRCReturn(rc, rc); 888 892 889 893 /* Update the guest image, which is at box.src. */ 890 vmsvgaR3UpdateScreen(pThis , pScreen, box.srcx, box.srcy, box.w, box.h);894 vmsvgaR3UpdateScreen(pThisCC, pScreen, box.srcx, box.srcy, box.w, box.h); 891 895 } 892 896 } … … 895 899 } 896 900 897 int vmsvga3dCommandPresent(PVGASTATE pThis, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect)901 int vmsvga3dCommandPresent(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect) 898 902 { 899 903 /* Deprecated according to svga3d_reg.h. */ … … 949 953 950 954 /* Entire rect. */ 951 rc = vmsvga3dSurfaceBlitToScreen(pThis, idDstScreen, destRect, src, srcRect, 0, NULL);955 rc = vmsvga3dSurfaceBlitToScreen(pThis, pThisCC, idDstScreen, destRect, src, srcRect, 0, NULL); 952 956 AssertRCReturn(rc, rc); 953 957 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r82089 r82109 56 56 57 57 /* DevVGA-SVGA3d-ogl.cpp & DevVGA-SVGA3d-win.cpp: */ 58 int vmsvga3dInit(P VGASTATE pThis);59 int vmsvga3dPowerOn(P VGASTATE pThis);60 int vmsvga3dLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, P SSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);58 int vmsvga3dInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 59 int vmsvga3dPowerOn(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 60 int vmsvga3dLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass); 61 61 int vmsvga3dSaveExec(PPDMDEVINS pDevIns, PVGASTATE pThis, PSSMHANDLE pSSM); 62 62 int vmsvga3dTerminate(PVGASTATE pThis); … … 70 70 int vmsvga3dSurfaceStretchBlt(PVGASTATE pThis, SVGA3dSurfaceImageId const *pDstSfcImg, SVGA3dBox const *pDstBox, 71 71 SVGA3dSurfaceImageId const *pSrcSfcImg, SVGA3dBox const *pSrcBox, SVGA3dStretchBltMode enmMode); 72 int vmsvga3dSurfaceDMA(PVGASTATE pThis, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer, uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes);73 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, uint32_t dest, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect);72 int vmsvga3dSurfaceDMA(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dGuestImage guest, SVGA3dSurfaceImageId host, SVGA3dTransferType transfer, uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes); 73 int vmsvga3dSurfaceBlitToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t dest, SVGASignedRect destRect, SVGA3dSurfaceImageId src, SVGASignedRect srcRect, uint32_t cRects, SVGASignedRect *pRect); 74 74 75 75 int vmsvga3dContextDefine(PVGASTATE pThis, uint32_t cid); … … 89 89 int vmsvga3dSetClipPlane(PVGASTATE pThis, uint32_t cid, uint32_t index, float plane[4]); 90 90 int vmsvga3dCommandClear(PVGASTATE pThis, uint32_t cid, SVGA3dClearFlag clearFlag, uint32_t color, float depth, uint32_t stencil, uint32_t cRects, SVGA3dRect *pRect); 91 int vmsvga3dCommandPresent(PVGASTATE pThis, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect);91 int vmsvga3dCommandPresent(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect); 92 92 int vmsvga3dDrawPrimitives(PVGASTATE pThis, uint32_t cid, uint32_t numVertexDecls, SVGA3dVertexDecl *pVertexDecl, uint32_t numRanges, SVGA3dPrimitiveRange *pNumRange, uint32_t cVertexDivisor, SVGA3dVertexDivisor *pVertexDivisor); 93 93 int vmsvga3dSetScissorRect(PVGASTATE pThis, uint32_t cid, SVGA3dRect *pRect); … … 101 101 int vmsvga3dQueryBegin(PVGASTATE pThis, uint32_t cid, SVGA3dQueryType type); 102 102 int vmsvga3dQueryEnd(PVGASTATE pThis, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult); 103 int vmsvga3dQueryWait(PVGASTATE pThis, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult);103 int vmsvga3dQueryWait(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult); 104 104 105 105 /* DevVGA-SVGA3d-shared.h: */ -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r82102 r82109 54 54 #define PCIDEV_2_VGASTATE(pPciDev) ((PVGASTATE)((uintptr_t)pPciDev - RT_OFFSETOF(VGASTATE, Dev))) 55 55 #endif /* VBOX_WITH_HGSMI */ 56 /** Converts a vga adaptor state pointer to a device instance pointer. */57 #define VGASTATE2DEVINS(pVgaState) ((pVgaState)->CTX_SUFF(pDevIns))58 56 59 57 /* VGA text mode blinking constants (cursor and blinking chars). */ … … 514 512 } 515 513 516 static uint8_t vga_retrace(P VGASTATE pThis)514 static uint8_t vga_retrace(PPDMDEVINS pDevIns, PVGASTATE pThis) 517 515 { 518 516 vga_retrace_s *r = &pThis->retrace_state; … … 523 521 uint64_t time_ns; 524 522 525 time_ns = PDMDevHlpTMTimeVirtGetNano( VGASTATE2DEVINS(pThis));523 time_ns = PDMDevHlpTMTimeVirtGetNano(pDevIns); 526 524 527 525 /* Determine the time within the frame. */ … … 558 556 } 559 557 560 static uint32_t vga_ioport_read(P VGASTATE pThis, uint32_t addr)558 static uint32_t vga_ioport_read(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t addr) 561 559 { 562 560 int val, index; … … 630 628 case 0x3ba: 631 629 case 0x3da: 632 val = pThis->st01 = vga_retrace(p This);630 val = pThis->st01 = vga_retrace(pDevIns, pThis); 633 631 pThis->ar_flip_flop = 0; 634 632 break; … … 642 640 } 643 641 644 static void vga_ioport_write(P VGASTATE pThis, uint32_t addr, uint32_t val)642 static void vga_ioport_write(PPDMDEVINS pDevIns, PVGASTATE pThis, uint32_t addr, uint32_t val) 645 643 { 646 644 int index; … … 715 713 if (pThis->fRemappedVGA) 716 714 { 717 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);718 715 IOMMmioResetRegion(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy); 719 716 pThis->fRemappedVGA = false; … … 755 752 if (pThis->fRemappedVGA) 756 753 { 757 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);758 754 IOMMmioResetRegion(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy); 759 755 pThis->fRemappedVGA = false; … … 961 957 } 962 958 963 static VBOXSTRICTRC vbe_ioport_write_data(P VGASTATE pThis, uint32_t addr, uint32_t val)959 static VBOXSTRICTRC vbe_ioport_write_data(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t addr, uint32_t val) 964 960 { 965 961 uint32_t max_bank; 966 NOREF(addr);962 RT_NOREF(pThisCC, addr); 967 963 968 964 if (pThis->vbe_index <= VBE_DISPI_INDEX_NB) { … … 1027 1023 if (pThis->fRemappedVGA) 1028 1024 { 1029 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);1030 1025 IOMMmioResetRegion(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy); 1031 1026 pThis->fRemappedVGA = false; … … 1071 1066 pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT]); 1072 1067 uint16_t cbLinePitch = pThis->vbe_line_offset; 1073 memset(pThis ->CTX_SUFF(vram_ptr), 0,1068 memset(pThisCC->pbVRam, 0, 1074 1069 cY * cbLinePitch); 1075 1070 } … … 1129 1124 * and reset VBVA. 1130 1125 */ 1131 pThis ->pDrv->pfnLFBModeChange(pThis->pDrv, (val & VBE_DISPI_ENABLED) != 0);1126 pThisCC->pDrv->pfnLFBModeChange(pThisCC->pDrv, (val & VBE_DISPI_ENABLED) != 0); 1132 1127 # ifdef VBOX_WITH_HGSMI 1133 VBVAOnVBEChanged(pThis );1128 VBVAOnVBEChanged(pThis, pThisCC); 1134 1129 # endif 1135 1130 … … 1137 1132 if (pThis->fRemappedVGA) 1138 1133 { 1139 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);1140 1134 IOMMmioResetRegion(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy); 1141 1135 pThis->fRemappedVGA = false; … … 1158 1152 /* Changes in the VGA device are minimal. The device is bypassed. The driver does all work. */ 1159 1153 if (val == VBOX_VIDEO_DISABLE_ADAPTER_MEMORY) 1160 pThis ->pDrv->pfnProcessAdapterData(pThis->pDrv, NULL, 0);1154 pThisCC->pDrv->pfnProcessAdapterData(pThisCC->pDrv, NULL, 0); 1161 1155 else if (val == VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY) 1162 pThis ->pDrv->pfnProcessAdapterData(pThis->pDrv, pThis->CTX_SUFF(vram_ptr), pThis->vram_size);1156 pThisCC->pDrv->pfnProcessAdapterData(pThisCC->pDrv, pThisCC->pbVRam, pThis->vram_size); 1163 1157 else if ((val & 0xFFFF0000) == VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE) 1164 pThis ->pDrv->pfnProcessDisplayData(pThis->pDrv, pThis->CTX_SUFF(vram_ptr), val & 0xFFFF);1158 pThisCC->pDrv->pfnProcessDisplayData(pThisCC->pDrv, pThisCC->pbVRam, val & 0xFFFF); 1165 1159 # endif /* IN_RING3 */ 1166 1160 break; … … 1181 1175 1182 1176 /* called for accesses between 0xa0000 and 0xc0000 */ 1183 static uint32_t vga_mem_readb(P VGASTATE pThis, RTGCPHYS addr, int *prc)1177 static uint32_t vga_mem_readb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, RTGCPHYS addr, int *prc) 1184 1178 { 1185 1179 int plane; … … 1239 1233 /** @todo only allow read access (doesn't work now) */ 1240 1234 STAM_COUNTER_INC(&pThis->StatMapPage); 1241 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);1242 1235 IOMMmioMapMmio2Page(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy, GCPhys - 0xa0000, 1243 1236 pThis->hMmio2VRam, addr, X86_PTE_RW | X86_PTE_P); … … 1249 1242 VERIFY_VRAM_READ_OFF_RETURN(pThis, addr, *prc); 1250 1243 #ifdef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1251 ret = !pThis->svga.fEnabled ? pThis ->CTX_SUFF(vram_ptr)[addr]1244 ret = !pThis->svga.fEnabled ? pThisCC->pbVRam[addr] 1252 1245 : addr < VMSVGA_VGA_FB_BACKUP_SIZE ? pThis->svga.pbVgaFrameBufferR3[addr] : 0xff; 1253 1246 #else 1254 ret = pThis ->CTX_SUFF(vram_ptr)[addr];1247 ret = pThisCC->pbVRam[addr]; 1255 1248 #endif 1256 1249 } else if (!(pThis->sr[4] & 0x04)) { /* Host access is controlled by SR4, not GR5! */ … … 1261 1254 VERIFY_VRAM_READ_OFF_RETURN(pThis, off, *prc); 1262 1255 #ifdef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1263 ret = !pThis->svga.fEnabled ? pThis ->CTX_SUFF(vram_ptr)[off]1256 ret = !pThis->svga.fEnabled ? pThisCC->pbVRam[off] 1264 1257 : off < VMSVGA_VGA_FB_BACKUP_SIZE ? pThis->svga.pbVgaFrameBufferR3[off] : 0xff; 1265 1258 #else 1266 ret = pThis ->CTX_SUFF(vram_ptr)[off];1259 ret = pThisCC->pbVRam[off]; 1267 1260 #endif 1268 1261 } else { … … 1270 1263 VERIFY_VRAM_READ_OFF_RETURN(pThis, addr * 4 + 3, *prc); 1271 1264 #ifdef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1272 pThis->latch = !pThis->svga.fEnabled ? ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[addr]1265 pThis->latch = !pThis->svga.fEnabled ? ((uint32_t *)pThisCC->pbVRam)[addr] 1273 1266 : addr < VMSVGA_VGA_FB_BACKUP_SIZE ? ((uint32_t *)pThis->svga.pbVgaFrameBufferR3)[addr] : UINT32_MAX; 1274 1267 #else 1275 pThis->latch = ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[addr];1268 pThis->latch = ((uint32_t *)pThisCC->pbVRam)[addr]; 1276 1269 #endif 1277 1270 if (!(pThis->gr[5] & 0x08)) { … … 1294 1287 * called for accesses between 0xa0000 and 0xc0000 1295 1288 */ 1296 static VBOXSTRICTRC vga_mem_writeb(P VGASTATE pThis, RTGCPHYS addr, uint32_t val)1289 static VBOXSTRICTRC vga_mem_writeb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, RTGCPHYS addr, uint32_t val) 1297 1290 { 1298 1291 int plane, write_mode, b, func_select, mask; … … 1348 1341 { 1349 1342 STAM_COUNTER_INC(&pThis->StatMapPage); 1350 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);1351 1343 IOMMmioMapMmio2Page(PDMDevHlpGetVM(pDevIns), pDevIns, pThis->hMmioLegacy, GCPhys - 0xa0000, 1352 1344 pThis->hMmio2VRam, addr, X86_PTE_RW | X86_PTE_P); … … 1358 1350 #ifdef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1359 1351 if (!pThis->svga.fEnabled) 1360 pThis ->CTX_SUFF(vram_ptr)[addr] = val;1352 pThisCC->pbVRam[addr] = val; 1361 1353 else if (addr < VMSVGA_VGA_FB_BACKUP_SIZE) 1362 1354 pThis->svga.pbVgaFrameBufferR3[addr] = val; … … 1367 1359 } 1368 1360 #else 1369 pThis ->CTX_SUFF(vram_ptr)[addr] = val;1361 pThisCC->pbVRam[addr] = val; 1370 1362 #endif 1371 1363 Log3(("vga: chain4: [0x%x]\n", addr)); … … 1387 1379 #ifdef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1388 1380 if (!pThis->svga.fEnabled) 1389 pThis ->CTX_SUFF(vram_ptr)[addr] = val;1381 pThisCC->pbVRam[addr] = val; 1390 1382 else if (addr < VMSVGA_VGA_FB_BACKUP_SIZE) 1391 1383 pThis->svga.pbVgaFrameBufferR3[addr] = val; … … 1396 1388 } 1397 1389 #else 1398 pThis ->CTX_SUFF(vram_ptr)[addr] = val;1390 pThisCC->pbVRam[addr] = val; 1399 1391 #endif 1400 1392 Log3(("vga: odd/even: [0x%x]\n", addr)); … … 1472 1464 uint32_t *pu32Dst; 1473 1465 if (!pThis->svga.fEnabled) 1474 pu32Dst = &((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[addr];1466 pu32Dst = &((uint32_t *)pThisCC->pbVRam)[addr]; 1475 1467 else if (addr * 4 + 3 < VMSVGA_VGA_FB_BACKUP_SIZE) 1476 1468 pu32Dst = &((uint32_t *)pThis->svga.pbVgaFrameBufferR3)[addr]; … … 1482 1474 *pu32Dst = (*pu32Dst & ~write_mask) | (val & write_mask); 1483 1475 #else 1484 ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[addr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[addr] & ~write_mask)1476 ((uint32_t *)pThisCC->pbVRam)[addr] = (((uint32_t *)pThisCC->pbVRam)[addr] & ~write_mask) 1485 1477 | (val & write_mask); 1486 1478 #endif … … 1501 1493 const uint8_t *font_ptr, int h, 1502 1494 uint32_t fgcol, uint32_t bgcol, int dup9); 1503 typedef void vga_draw_line_func(PVGASTATE pThis, uint8_t *pbDst, const uint8_t *pbSrc, int width);1495 typedef void vga_draw_line_func(PVGASTATE pThis, PVGASTATECC pThisCC, uint8_t *pbDst, const uint8_t *pbSrc, int width); 1504 1496 1505 1497 static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b) … … 1566 1558 1567 1559 /** return true if the palette was modified */ 1568 static bool vgaR3UpdatePalette16(PVGASTATE pThis )1560 static bool vgaR3UpdatePalette16(PVGASTATE pThis, PVGASTATER3 pThisCC) 1569 1561 { 1570 1562 bool full_update = false; … … 1580 1572 v = ((pThis->ar[0x14] & 0xc) << 4) | (v & 0x3f); 1581 1573 v = v * 3; 1582 col = pThis ->rgb_to_pixel(c6_to_8(pThis->palette[v]),1583 c6_to_8(pThis->palette[v + 1]),1584 c6_to_8(pThis->palette[v + 2]));1574 col = pThisCC->rgb_to_pixel(c6_to_8(pThis->palette[v]), 1575 c6_to_8(pThis->palette[v + 1]), 1576 c6_to_8(pThis->palette[v + 2])); 1585 1577 if (col != palette[i]) { 1586 1578 full_update = true; … … 1592 1584 1593 1585 /** return true if the palette was modified */ 1594 static bool vgaR3UpdatePalette256(PVGASTATE pThis )1586 static bool vgaR3UpdatePalette256(PVGASTATE pThis, PVGASTATER3 pThisCC) 1595 1587 { 1596 1588 bool full_update = false; … … 1605 1597 for(i = 0; i < 256; i++) { 1606 1598 if (wide_dac) 1607 col = pThis ->rgb_to_pixel(pThis->palette[v],1608 pThis->palette[v + 1],1609 pThis->palette[v + 2]);1599 col = pThisCC->rgb_to_pixel(pThis->palette[v], 1600 pThis->palette[v + 1], 1601 pThis->palette[v + 2]); 1610 1602 else 1611 col = pThis ->rgb_to_pixel(c6_to_8(pThis->palette[v]),1612 c6_to_8(pThis->palette[v + 1]),1613 c6_to_8(pThis->palette[v + 2]));1603 col = pThisCC->rgb_to_pixel(c6_to_8(pThis->palette[v]), 1604 c6_to_8(pThis->palette[v + 1]), 1605 c6_to_8(pThis->palette[v + 2])); 1614 1606 if (col != palette[i]) { 1615 1607 full_update = true; … … 1658 1650 1659 1651 /** update start_addr and line_offset. Return TRUE if modified */ 1660 static bool vgaR3UpdateBasicParams(PVGASTATE pThis )1652 static bool vgaR3UpdateBasicParams(PVGASTATE pThis, PVGASTATER3 pThisCC) 1661 1653 { 1662 1654 bool full_update = false; 1663 1655 uint32_t start_addr, line_offset, line_compare; 1664 1656 1665 pThis ->get_offsets(pThis, &line_offset, &start_addr, &line_compare);1657 pThisCC->get_offsets(pThis, &line_offset, &start_addr, &line_compare); 1666 1658 1667 1659 if (line_offset != pThis->line_offset || … … 1738 1730 * - underline 1739 1731 */ 1740 static int vgaR3DrawText(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv) 1732 static int vgaR3DrawText(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATER3 pThisCC, bool full_update, 1733 bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv) 1741 1734 { 1742 1735 int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; … … 1755 1748 bool blink_enabled, blink_do_redraw; 1756 1749 1757 full_update |= vgaR3UpdatePalette16(pThis );1750 full_update |= vgaR3UpdatePalette16(pThis, pThisCC); 1758 1751 palette = pThis->last_palette; 1759 1752 … … 1765 1758 full_update = true; 1766 1759 } 1767 font_base[0] = pThis ->CTX_SUFF(vram_ptr)+ offset;1760 font_base[0] = pThisCC->pbVRam + offset; 1768 1761 1769 1762 offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2; 1770 font_base[1] = pThis ->CTX_SUFF(vram_ptr)+ offset;1763 font_base[1] = pThisCC->pbVRam + offset; 1771 1764 if (offset != pThis->font_offsets[1]) { 1772 1765 pThis->font_offsets[1] = offset; … … 1779 1772 full_update = true; 1780 1773 } 1781 full_update |= vgaR3UpdateBasicParams(pThis );1774 full_update |= vgaR3UpdateBasicParams(pThis, pThisCC); 1782 1775 1783 1776 line_offset = pThis->line_offset; 1784 s1 = pThis ->CTX_SUFF(vram_ptr)+ (pThis->start_addr * 8); /** @todo r=bird: Add comment why we do *8 instead of *4, it's not so obvious... */1777 s1 = pThisCC->pbVRam + (pThis->start_addr * 8); /** @todo r=bird: Add comment why we do *8 instead of *4, it's not so obvious... */ 1785 1778 1786 1779 /* double scanning - not for 9-wide modes */ … … 1844 1837 pThis->cursor_end = pThis->cr[0xb]; 1845 1838 } 1846 cursor_ptr = pThis ->CTX_SUFF(vram_ptr)+ (pThis->start_addr + cursor_offset) * 8;1839 cursor_ptr = pThisCC->pbVRam + (pThis->start_addr + cursor_offset) * 8; 1847 1840 depth_index = vgaR3GetDepthIndex(pDrv->cBits); 1848 1841 if (cw == 16) … … 1860 1853 1861 1854 /* Figure out if we're in the visible period of the blink cycle. */ 1862 time_ns = PDMDevHlpTMTimeVirtGetNano( VGASTATE2DEVINS(pThis));1855 time_ns = PDMDevHlpTMTimeVirtGetNano(pDevIns); 1863 1856 blink_on = (time_ns % VGA_BLINK_PERIOD_FULL) < VGA_BLINK_PERIOD_ON; 1864 1857 chr_blink_flip = false; … … 2084 2077 * @returns VINF_SUCCESS on success. 2085 2078 * @returns VINF_VGA_RESIZE_IN_PROGRESS if the operation wasn't complete. 2086 * @param pThis Pointer to the vga state. 2079 * @param pThis Pointer to the shared VGA state. 2080 * @param pThisCC Pointer to the ring-3 VGA state. 2087 2081 * @param cx The width. 2088 2082 * @param cy The height. 2089 2083 * @param pDrv The display connector. 2090 2084 */ 2091 static int vgaR3ResizeGraphic(PVGASTATE pThis, int cx, int cy, PDMIDISPLAYCONNECTOR *pDrv)2092 { 2093 const unsigned cBits = pThis ->get_bpp(pThis);2085 static int vgaR3ResizeGraphic(PVGASTATE pThis, PVGASTATER3 pThisCC, int cx, int cy, PDMIDISPLAYCONNECTOR *pDrv) 2086 { 2087 const unsigned cBits = pThisCC->get_bpp(pThis); 2094 2088 2095 2089 int rc; … … 2109 2103 * 2110 2104 * The reason for doing this for WDDM driver only now is to avoid regressions of the current code */ 2111 PVBOXVDMAHOST pVdma = pThis ->pVdma;2105 PVBOXVDMAHOST pVdma = pThisCC->pVdma; 2112 2106 if (pVdma && vboxVDMAIsEnabled(pVdma)) 2113 2107 rc = VINF_SUCCESS; … … 2118 2112 if (pThis->start_addr * 4 + pThis->line_offset * cy < pThis->vram_size) 2119 2113 /* Take into account the programmed start address (in DWORDs) of the visible screen. */ 2120 rc = pDrv->pfnResize(pDrv, cBits, pThis ->CTX_SUFF(vram_ptr)+ pThis->start_addr * 4, pThis->line_offset, cx, cy);2114 rc = pDrv->pfnResize(pDrv, cBits, pThisCC->pbVRam + pThis->start_addr * 4, pThis->line_offset, cx, cy); 2121 2115 else 2122 2116 { … … 2140 2134 switch (pDrv->cBits) 2141 2135 { 2142 case 32: pThis ->rgb_to_pixel = rgb_to_pixel32_dup; break;2136 case 32: pThisCC->rgb_to_pixel = rgb_to_pixel32_dup; break; 2143 2137 case 16: 2144 default: pThis ->rgb_to_pixel = rgb_to_pixel16_dup; break;2145 case 15: pThis ->rgb_to_pixel = rgb_to_pixel15_dup; break;2146 case 8: pThis ->rgb_to_pixel = rgb_to_pixel8_dup; break;2138 default: pThisCC->rgb_to_pixel = rgb_to_pixel16_dup; break; 2139 case 15: pThisCC->rgb_to_pixel = rgb_to_pixel15_dup; break; 2140 case 8: pThisCC->rgb_to_pixel = rgb_to_pixel8_dup; break; 2147 2141 } 2148 2142 if (pThis->shift_control == 0) 2149 vgaR3UpdatePalette16(pThis );2143 vgaR3UpdatePalette16(pThis, pThisCC); 2150 2144 else if (pThis->shift_control == 1) 2151 vgaR3UpdatePalette16(pThis );2145 vgaR3UpdatePalette16(pThis, pThisCC); 2152 2146 return VINF_SUCCESS; 2153 2147 } … … 2225 2219 * graphic modes 2226 2220 */ 2227 static int vmsvgaR3DrawGraphic(PVGASTATE pThis, bool fFullUpdate, bool fFailOnResize, bool reset_dirty,2228 PDMIDISPLAYCONNECTOR *pDrv)2221 static int vmsvgaR3DrawGraphic(PVGASTATE pThis, PVGASTATER3 pThisCC, bool fFullUpdate, 2222 bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv) 2229 2223 { 2230 2224 RT_NOREF1(fFailOnResize); … … 2275 2269 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pDrv->cBits)]; 2276 2270 2277 Assert(!pThis ->cursor_invalidate);2278 Assert(!pThis ->cursor_draw_line);2279 //not used// if (pThis ->cursor_invalidate)2280 //not used// pThis ->cursor_invalidate(pThis);2271 Assert(!pThisCC->cursor_invalidate); 2272 Assert(!pThisCC->cursor_draw_line); 2273 //not used// if (pThisCC->cursor_invalidate) 2274 //not used// pThisCC->cursor_invalidate(pThis); 2281 2275 2282 2276 uint8_t *pbDst = pDrv->pbData; … … 2312 2306 offPageMax = offPage1; 2313 2307 if (pThis->fRenderVRAM) 2314 pfnVgaDrawLine(pThis, p bDst, pThis->CTX_SUFF(vram_ptr)+ offSrcLine, cx);2315 //not used// if (pThis ->cursor_draw_line)2316 //not used// pThis ->cursor_draw_line(pThis, pbDst, y);2308 pfnVgaDrawLine(pThis, pThisCC, pbDst, pThisCC->pbVRam + offSrcLine, cx); 2309 //not used// if (pThisCC->cursor_draw_line) 2310 //not used// pThisCC->cursor_draw_line(pThis, pbDst, y); 2317 2311 } 2318 2312 else if (yUpdateRectTop != UINT32_MAX) … … 2345 2339 * graphic modes 2346 2340 */ 2347 static int vgaR3DrawGraphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,2341 static int vgaR3DrawGraphic(PVGASTATE pThis, PVGASTATER3 pThisCC, bool full_update, bool fFailOnResize, bool reset_dirty, 2348 2342 PDMIDISPLAYCONNECTOR *pDrv) 2349 2343 { … … 2353 2347 uint8_t *d; 2354 2348 uint32_t v, addr1, addr; 2355 vga_draw_line_func * vga_draw_line;2356 2357 bool offsets_changed = vgaR3UpdateBasicParams(pThis );2349 vga_draw_line_func *pfnVgaDrawLine; 2350 2351 bool offsets_changed = vgaR3UpdateBasicParams(pThis, pThisCC); 2358 2352 2359 2353 full_update |= offsets_changed; 2360 2354 2361 pThis ->get_resolution(pThis, &width, &height);2355 pThisCC->get_resolution(pThis, &width, &height); 2362 2356 disp_width = width; 2363 2357 … … 2373 2367 2374 2368 if (shift_control == 0) { 2375 full_update |= vgaR3UpdatePalette16(pThis );2369 full_update |= vgaR3UpdatePalette16(pThis, pThisCC); 2376 2370 if (pThis->sr[0x01] & 8) { 2377 2371 v = VGA_DRAW_LINE4D2; … … 2382 2376 bits = 4; 2383 2377 } else if (shift_control == 1) { 2384 full_update |= vgaR3UpdatePalette16(pThis );2378 full_update |= vgaR3UpdatePalette16(pThis, pThisCC); 2385 2379 if (pThis->sr[0x01] & 8) { 2386 2380 v = VGA_DRAW_LINE2D2; … … 2391 2385 bits = 4; 2392 2386 } else { 2393 switch(pThis ->get_bpp(pThis)) {2387 switch(pThisCC->get_bpp(pThis)) { 2394 2388 default: 2395 2389 case 0: 2396 full_update |= vgaR3UpdatePalette256(pThis );2390 full_update |= vgaR3UpdatePalette256(pThis, pThisCC); 2397 2391 v = VGA_DRAW_LINE8D2; 2398 2392 bits = 4; 2399 2393 break; 2400 2394 case 8: 2401 full_update |= vgaR3UpdatePalette256(pThis );2395 full_update |= vgaR3UpdatePalette256(pThis, pThisCC); 2402 2396 v = VGA_DRAW_LINE8; 2403 2397 bits = 8; … … 2423 2417 if ( disp_width != (int)pThis->last_width 2424 2418 || height != (int)pThis->last_height 2425 || pThis ->get_bpp(pThis) != (int)pThis->last_bpp2419 || pThisCC->get_bpp(pThis) != (int)pThis->last_bpp 2426 2420 || (offsets_changed && !pThis->fRenderVRAM)) 2427 2421 { … … 2431 2425 return VERR_TRY_AGAIN; 2432 2426 } 2433 int rc = vgaR3ResizeGraphic(pThis, disp_width, height, pDrv);2427 int rc = vgaR3ResizeGraphic(pThis, pThisCC, disp_width, height, pDrv); 2434 2428 if (rc != VINF_SUCCESS) /* Return any rc, particularly VINF_VGA_RESIZE_IN_PROGRESS, to the caller. */ 2435 2429 return rc; … … 2453 2447 } 2454 2448 2455 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pDrv->cBits)];2456 2457 if (pThis ->cursor_invalidate)2458 pThis ->cursor_invalidate(pThis);2449 pfnVgaDrawLine = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pDrv->cBits)]; 2450 2451 if (pThisCC->cursor_invalidate) 2452 pThisCC->cursor_invalidate(pThis); 2459 2453 2460 2454 line_offset = pThis->line_offset; … … 2511 2505 page_max = page1; 2512 2506 if (pThis->fRenderVRAM) 2513 vga_draw_line(pThis, d, pThis->CTX_SUFF(vram_ptr)+ addr, width);2514 if (pThis ->cursor_draw_line)2515 pThis ->cursor_draw_line(pThis, d, y);2507 pfnVgaDrawLine(pThis, pThisCC, d, pThisCC->pbVRam + addr, width); 2508 if (pThisCC->cursor_draw_line) 2509 pThisCC->cursor_draw_line(pThis, d, y); 2516 2510 } else { 2517 2511 if (y_start >= 0) { … … 2554 2548 * blanked modes 2555 2549 */ 2556 static int vgaR3DrawBlank(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty,2557 PDMIDISPLAYCONNECTOR *pDrv)2550 static int vgaR3DrawBlank(PVGASTATE pThis, PVGASTATER3 pThisCC, bool full_update, 2551 bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv) 2558 2552 { 2559 2553 int i, w, val; … … 2585 2579 vgaR3ResetDirty(pThis, page_min, page_max + PAGE_SIZE); 2586 2580 } 2587 if (pDrv->pbData == pThis ->vram_ptrR3) /* Do not clear the VRAM itself. */2581 if (pDrv->pbData == pThisCC->pbVRam) /* Do not clear the VRAM itself. */ 2588 2582 return VINF_SUCCESS; 2589 2583 if (!full_update) … … 2592 2586 return VINF_SUCCESS; 2593 2587 if (pDrv->cBits == 8) 2594 val = pThis ->rgb_to_pixel(0, 0, 0);2588 val = pThisCC->rgb_to_pixel(0, 0, 0); 2595 2589 else 2596 2590 val = 0; … … 2620 2614 * vgaR3PortTakeScreenshot(). 2621 2615 */ 2622 static int vgaR3UpdateDisplay(P VGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty,2623 PDMIDISPLAYCONNECTOR *pDrv, int32_t *pcur_graphic_mode)2616 static int vgaR3UpdateDisplay(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATER3 pThisCC, bool fUpdateAll, 2617 bool fFailOnResize, bool reset_dirty, PDMIDISPLAYCONNECTOR *pDrv, int32_t *pcur_graphic_mode) 2624 2618 { 2625 2619 int rc = VINF_SUCCESS; … … 2631 2625 switch(pDrv->cBits) { 2632 2626 case 8: 2633 pThis ->rgb_to_pixel = rgb_to_pixel8_dup;2627 pThisCC->rgb_to_pixel = rgb_to_pixel8_dup; 2634 2628 break; 2635 2629 case 15: 2636 pThis ->rgb_to_pixel = rgb_to_pixel15_dup;2630 pThisCC->rgb_to_pixel = rgb_to_pixel15_dup; 2637 2631 break; 2638 2632 default: 2639 2633 case 16: 2640 pThis ->rgb_to_pixel = rgb_to_pixel16_dup;2634 pThisCC->rgb_to_pixel = rgb_to_pixel16_dup; 2641 2635 break; 2642 2636 case 32: 2643 pThis ->rgb_to_pixel = rgb_to_pixel32_dup;2637 pThisCC->rgb_to_pixel = rgb_to_pixel32_dup; 2644 2638 break; 2645 2639 } … … 2662 2656 switch(graphic_mode) { 2663 2657 case GMODE_TEXT: 2664 rc = vgaR3DrawText(p This, full_update, fFailOnResize, reset_dirty, pDrv);2658 rc = vgaR3DrawText(pDevIns, pThis, pThisCC, full_update, fFailOnResize, reset_dirty, pDrv); 2665 2659 break; 2666 2660 case GMODE_GRAPH: 2667 rc = vgaR3DrawGraphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2661 rc = vgaR3DrawGraphic(pThis, pThisCC, full_update, fFailOnResize, reset_dirty, pDrv); 2668 2662 break; 2669 2663 #ifdef VBOX_WITH_VMSVGA 2670 2664 case GMODE_SVGA: 2671 rc = vmsvgaR3DrawGraphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2665 rc = vmsvgaR3DrawGraphic(pThis, pThisCC, full_update, fFailOnResize, reset_dirty, pDrv); 2672 2666 break; 2673 2667 #endif 2674 2668 case GMODE_BLANK: 2675 2669 default: 2676 rc = vgaR3DrawBlank(pThis, full_update, fFailOnResize, reset_dirty, pDrv);2670 rc = vgaR3DrawBlank(pThis, pThisCC, full_update, fFailOnResize, reset_dirty, pDrv); 2677 2671 break; 2678 2672 } … … 2842 2836 NOREF(pvUser); \ 2843 2837 if (cb == 1) \ 2844 vga_ioport_write(p This, offPort, u32); \2838 vga_ioport_write(pDevIns, pThis, offPort, u32); \ 2845 2839 else if (cb == 2) \ 2846 2840 { \ 2847 vga_ioport_write(p This, offPort, u32 & 0xff); \2848 vga_ioport_write(p This, offPort + 1, u32 >> 8); \2841 vga_ioport_write(pDevIns, pThis, offPort, u32 & 0xff); \ 2842 vga_ioport_write(pDevIns, pThis, offPort + 1, u32 >> 8); \ 2849 2843 } \ 2850 2844 return VINF_SUCCESS; \ … … 2858 2852 NOREF(pvUser); \ 2859 2853 if (cb == 1) \ 2860 *pu32 = vga_ioport_read(p This, offPort); \2854 *pu32 = vga_ioport_read(pDevIns, pThis, offPort); \ 2861 2855 else if (cb == 2) \ 2862 2856 { \ 2863 uint32_t u32 = vga_ioport_read(p This, offPort); \2864 u32 |= vga_ioport_read(p This, offPort + 1) << 8; \2857 uint32_t u32 = vga_ioport_read(pDevIns, pThis, offPort); \ 2858 u32 |= vga_ioport_read(pDevIns, pThis, offPort + 1) << 8; \ 2865 2859 *pu32 = u32; \ 2866 2860 } \ … … 3071 3065 vgaIoPortWriteVbeData(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 3072 3066 { 3073 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3067 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3068 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3074 3069 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3075 3070 … … 3096 3091 { 3097 3092 pThis->fWriteVBEData = false; 3098 return vbe_ioport_write_data(p This, offPort, u32 & 0xFF);3093 return vbe_ioport_write_data(pDevIns, pThis, pThisCC, offPort, u32 & 0xFF); 3099 3094 } 3100 3095 … … 3110 3105 #endif 3111 3106 if (cb == 2 || cb == 4) 3112 return vbe_ioport_write_data(p This, offPort, u32);3107 return vbe_ioport_write_data(pDevIns, pThis, pThisCC, offPort, u32); 3113 3108 AssertMsgFailed(("vgaIoPortWriteVbeData: offPort=%#x cb=%d u32=%#x\n", offPort, cb, u32)); 3114 3109 … … 3231 3226 vgaR3IOPortHgsmiWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 3232 3227 { 3233 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3228 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3229 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3234 3230 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3235 3231 LogFlowFunc(("offPort=0x%x u32=0x%x cb=%u\n", offPort, u32, cb)); … … 3251 3247 { 3252 3248 PDMDevHlpPCISetIrqNoWait(pDevIns, 0, PDM_IRQ_LEVEL_LOW); 3253 HGSMIClearHostGuestFlags(pThis ->pHGSMI,3249 HGSMIClearHostGuestFlags(pThisCC->pHGSMI, 3254 3250 HGSMIHOSTFLAGS_IRQ 3255 3251 | HGSMIHOSTFLAGS_VSYNC … … 3259 3255 else 3260 3256 { 3261 HGSMISetHostGuestFlags(pThis ->pHGSMI, HGSMIHOSTFLAGS_IRQ | pThis->fu32PendingGuestFlags);3257 HGSMISetHostGuestFlags(pThisCC->pHGSMI, HGSMIHOSTFLAGS_IRQ | pThis->fu32PendingGuestFlags); 3262 3258 pThis->fu32PendingGuestFlags = 0; 3263 3259 /* Keep the IRQ unchanged. */ … … 3269 3265 # endif 3270 3266 { 3271 HGSMIHostWrite(pThis ->pHGSMI, u32);3267 HGSMIHostWrite(pThisCC->pHGSMI, u32); 3272 3268 } 3273 3269 break; … … 3275 3271 3276 3272 case VGA_PORT_HGSMI_GUEST: /* Guest */ 3277 HGSMIGuestWrite(pThis ->pHGSMI, u32);3273 HGSMIGuestWrite(pThisCC->pHGSMI, u32); 3278 3274 break; 3279 3275 … … 3307 3303 vgaR3IOPortHgmsiRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb) 3308 3304 { 3309 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3305 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3306 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3310 3307 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3311 3308 LogFlowFunc(("offPort=0x%x cb=%d\n", offPort, cb)); … … 3319 3316 { 3320 3317 case VGA_PORT_HGSMI_HOST: /* Host */ 3321 *pu32 = HGSMIHostRead(pThis ->pHGSMI);3318 *pu32 = HGSMIHostRead(pThisCC->pHGSMI); 3322 3319 break; 3323 3320 case VGA_PORT_HGSMI_GUEST: /* Guest */ 3324 *pu32 = HGSMIGuestRead(pThis ->pHGSMI);3321 *pu32 = HGSMIGuestRead(pThisCC->pHGSMI); 3325 3322 break; 3326 3323 default: … … 3389 3386 * @param cItems Number of data items to write. 3390 3387 */ 3391 static int vgaInternalMMIOFill(PVGASTATE pThis, void *pvUser, RTGCPHYS GCPhysAddr,3388 static int vgaInternalMMIOFill(PVGASTATE pThis, PVGASTATECC pThisCC, void *pvUser, RTGCPHYS GCPhysAddr, 3392 3389 uint32_t u32Item, unsigned cbItem, unsigned cItems) 3393 3390 { … … 3437 3434 if (pThis->sr[2] & (1 << (GCPhysAddr & 3))) 3438 3435 { 3439 pThis ->CTX_SUFF(vram_ptr)[GCPhysAddr] = aVal[i];3436 pThisCC->pbVRam[GCPhysAddr] = aVal[i]; 3440 3437 vgaR3MarkDirty(pThis, GCPhysAddr); 3441 3438 } … … 3451 3448 if (pThis->sr[2] & (1 << plane)) { 3452 3449 RTGCPHYS PhysAddr2 = ((GCPhysAddr & ~1) * 4) | plane; 3453 pThis ->CTX_SUFF(vram_ptr)[PhysAddr2] = aVal[i];3450 pThisCC->pbVRam[PhysAddr2] = aVal[i]; 3454 3451 vgaR3MarkDirty(pThis, PhysAddr2); 3455 3452 } … … 3523 3520 while (cItems-- > 0) 3524 3521 { 3525 ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);3522 ((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] = (((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask); 3526 3523 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3527 3524 GCPhysAddr++; … … 3533 3530 while (cItems-- > 0) 3534 3531 { 3535 ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask);3532 ((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] = (((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] & ~write_mask) | (aVal[0] & write_mask); 3536 3533 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3537 3534 GCPhysAddr++; 3538 3535 3539 ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[1] & write_mask);3536 ((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] = (((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] & ~write_mask) | (aVal[1] & write_mask); 3540 3537 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3541 3538 GCPhysAddr++; … … 3549 3546 for (i = 0; i < cbItem; i++) 3550 3547 { 3551 ((uint32_t *)pThis ->CTX_SUFF(vram_ptr))[GCPhysAddr] = (((uint32_t *)pThis->CTX_SUFF(vram_ptr))[GCPhysAddr] & ~write_mask) | (aVal[i] & write_mask);3548 ((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] = (((uint32_t *)pThisCC->pbVRam)[GCPhysAddr] & ~write_mask) | (aVal[i] & write_mask); 3552 3549 vgaR3MarkDirty(pThis, GCPhysAddr * 4); 3553 3550 GCPhysAddr++; … … 3569 3566 vgaMmioFill(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, uint32_t u32Item, unsigned cbItem, unsigned cItems) 3570 3567 { 3571 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3568 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3569 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3572 3570 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3573 3571 3574 return vgaInternalMMIOFill(pThis, p vUser, off, u32Item, cbItem, cItems);3572 return vgaInternalMMIOFill(pThis, pThisCC, pvUser, off, u32Item, cbItem, cItems); 3575 3573 } 3576 3574 … … 3582 3580 static DECLCALLBACK(VBOXSTRICTRC) vgaMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb) 3583 3581 { 3584 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3582 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3583 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3585 3584 STAM_PROFILE_START(&pThis->CTX_MID_Z(Stat,MemoryRead), a); 3586 3585 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); … … 3591 3590 { 3592 3591 case 1: 3593 *(uint8_t *)pv = vga_mem_readb(p This, off, &rc);3592 *(uint8_t *)pv = vga_mem_readb(pDevIns, pThis, pThisCC, off, &rc); 3594 3593 break; 3595 3594 case 2: … … 3597 3596 * crossing the 512KB VRAM boundrary if the access is handled in 3598 3597 * ring-0 and operating in latched mode. */ 3599 *(uint16_t *)pv = vga_mem_readb(p This, off, &rc)3600 | (vga_mem_readb(p This, off + 1, &rc) << 8);3598 *(uint16_t *)pv = vga_mem_readb(pDevIns, pThis, pThisCC, off, &rc) 3599 | (vga_mem_readb(pDevIns, pThis, pThisCC, off + 1, &rc) << 8); 3601 3600 break; 3602 3601 case 4: 3603 *(uint32_t *)pv = vga_mem_readb(p This, off, &rc)3604 | (vga_mem_readb(p This, off + 1, &rc) << 8)3605 | (vga_mem_readb(p This, off + 2, &rc) << 16)3606 | (vga_mem_readb(p This, off + 3, &rc) << 24);3602 *(uint32_t *)pv = vga_mem_readb(pDevIns, pThis, pThisCC, off, &rc) 3603 | (vga_mem_readb(pDevIns, pThis, pThisCC, off + 1, &rc) << 8) 3604 | (vga_mem_readb(pDevIns, pThis, pThisCC, off + 2, &rc) << 16) 3605 | (vga_mem_readb(pDevIns, pThis, pThisCC, off + 3, &rc) << 24); 3607 3606 break; 3608 3607 3609 3608 case 8: 3610 *(uint64_t *)pv = (uint64_t)vga_mem_readb(p This, off, &rc)3611 | ((uint64_t)vga_mem_readb(p This, off + 1, &rc) << 8)3612 | ((uint64_t)vga_mem_readb(p This, off + 2, &rc) << 16)3613 | ((uint64_t)vga_mem_readb(p This, off + 3, &rc) << 24)3614 | ((uint64_t)vga_mem_readb(p This, off + 4, &rc) << 32)3615 | ((uint64_t)vga_mem_readb(p This, off + 5, &rc) << 40)3616 | ((uint64_t)vga_mem_readb(p This, off + 6, &rc) << 48)3617 | ((uint64_t)vga_mem_readb(p This, off + 7, &rc) << 56);3609 *(uint64_t *)pv = (uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off, &rc) 3610 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 1, &rc) << 8) 3611 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 2, &rc) << 16) 3612 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 3, &rc) << 24) 3613 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 4, &rc) << 32) 3614 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 5, &rc) << 40) 3615 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 6, &rc) << 48) 3616 | ((uint64_t)vga_mem_readb(pDevIns, pThis, pThisCC, off + 7, &rc) << 56); 3618 3617 break; 3619 3618 … … 3623 3622 while (cb-- > 0) 3624 3623 { 3625 *pbData++ = vga_mem_readb(p This, off++, &rc);3624 *pbData++ = vga_mem_readb(pDevIns, pThis, pThisCC, off++, &rc); 3626 3625 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 3627 3626 break; … … 3640 3639 static DECLCALLBACK(VBOXSTRICTRC) vgaMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb) 3641 3640 { 3642 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3643 uint8_t const *pbSrc = (uint8_t const *)pv; 3641 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3642 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3643 uint8_t const *pbSrc = (uint8_t const *)pv; 3644 3644 NOREF(pvUser); 3645 3645 STAM_PROFILE_START(&pThis->CTX_MID_Z(Stat,MemoryWrite), a); … … 3650 3650 { 3651 3651 case 1: 3652 rc = vga_mem_writeb(p This, off, *pbSrc);3652 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off, *pbSrc); 3653 3653 break; 3654 3654 #if 1 3655 3655 case 2: 3656 rc = vga_mem_writeb(p This, off + 0, pbSrc[0]);3656 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 0, pbSrc[0]); 3657 3657 if (RT_LIKELY(rc == VINF_SUCCESS)) 3658 rc = vga_mem_writeb(p This, off + 1, pbSrc[1]);3658 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 1, pbSrc[1]); 3659 3659 break; 3660 3660 case 4: 3661 rc = vga_mem_writeb(p This, off + 0, pbSrc[0]);3661 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 0, pbSrc[0]); 3662 3662 if (RT_LIKELY(rc == VINF_SUCCESS)) 3663 rc = vga_mem_writeb(p This, off + 1, pbSrc[1]);3663 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 1, pbSrc[1]); 3664 3664 if (RT_LIKELY(rc == VINF_SUCCESS)) 3665 rc = vga_mem_writeb(p This, off + 2, pbSrc[2]);3665 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 2, pbSrc[2]); 3666 3666 if (RT_LIKELY(rc == VINF_SUCCESS)) 3667 rc = vga_mem_writeb(p This, off + 3, pbSrc[3]);3667 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 3, pbSrc[3]); 3668 3668 break; 3669 3669 case 8: 3670 rc = vga_mem_writeb(p This, off + 0, pbSrc[0]);3670 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 0, pbSrc[0]); 3671 3671 if (RT_LIKELY(rc == VINF_SUCCESS)) 3672 rc = vga_mem_writeb(p This, off + 1, pbSrc[1]);3672 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 1, pbSrc[1]); 3673 3673 if (RT_LIKELY(rc == VINF_SUCCESS)) 3674 rc = vga_mem_writeb(p This, off + 2, pbSrc[2]);3674 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 2, pbSrc[2]); 3675 3675 if (RT_LIKELY(rc == VINF_SUCCESS)) 3676 rc = vga_mem_writeb(p This, off + 3, pbSrc[3]);3676 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 3, pbSrc[3]); 3677 3677 if (RT_LIKELY(rc == VINF_SUCCESS)) 3678 rc = vga_mem_writeb(p This, off + 4, pbSrc[4]);3678 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 4, pbSrc[4]); 3679 3679 if (RT_LIKELY(rc == VINF_SUCCESS)) 3680 rc = vga_mem_writeb(p This, off + 5, pbSrc[5]);3680 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 5, pbSrc[5]); 3681 3681 if (RT_LIKELY(rc == VINF_SUCCESS)) 3682 rc = vga_mem_writeb(p This, off + 6, pbSrc[6]);3682 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 6, pbSrc[6]); 3683 3683 if (RT_LIKELY(rc == VINF_SUCCESS)) 3684 rc = vga_mem_writeb(p This, off + 7, pbSrc[7]);3684 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off + 7, pbSrc[7]); 3685 3685 break; 3686 3686 #else … … 3698 3698 rc = VINF_SUCCESS; 3699 3699 while (cb-- > 0 && rc == VINF_SUCCESS) 3700 rc = vga_mem_writeb(p This, off++, *pbSrc++);3700 rc = vga_mem_writeb(pDevIns, pThis, pThisCC, off++, *pbSrc++); 3701 3701 break; 3702 3702 … … 3712 3712 * @returns Strict VBox status code. 3713 3713 * @param pVM VM handle. 3714 * @param pThis VGA device instance data. 3714 * @param pDevIns The device instance. 3715 * @param pThis The shared VGA instance data. 3715 3716 * @param GCPhys The access physical address. 3716 3717 * @param GCPtr The access virtual address (only GC). 3717 3718 */ 3718 static VBOXSTRICTRC vgaLFBAccess(PVMCC pVM, P VGASTATE pThis, RTGCPHYS GCPhys, RTGCPTR GCPtr)3719 { 3720 VBOXSTRICTRC rc = PDMDevHlpCritSectEnter(p This->CTX_SUFF(pDevIns), &pThis->CritSect, VINF_EM_RAW_EMULATE_INSTR);3719 static VBOXSTRICTRC vgaLFBAccess(PVMCC pVM, PPDMDEVINS pDevIns, PVGASTATE pThis, RTGCPHYS GCPhys, RTGCPTR GCPtr) 3720 { 3721 VBOXSTRICTRC rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_EM_RAW_EMULATE_INSTR); 3721 3722 if (rc == VINF_SUCCESS) 3722 3723 { … … 3736 3737 { 3737 3738 #ifndef IN_RING3 3738 rc = PGMShwMakePageWritable(PDMDevHlpGetVMCPU(p This->CTX_SUFF(pDevIns)), GCPtr,3739 rc = PGMShwMakePageWritable(PDMDevHlpGetVMCPU(pDevIns), GCPtr, 3739 3740 PGM_MK_PG_IS_MMIO2 | PGM_MK_PG_IS_WRITE_FAULT); 3740 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->CritSect);3741 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 3741 3742 AssertMsgReturn( rc == VINF_SUCCESS 3742 3743 /* In the SMP case the page table might be removed while we wait for the PGM lock in the trap handler. */ … … 3746 3747 VBOXSTRICTRC_VAL(rc)); 3747 3748 #else /* IN_RING3 - We don't have any virtual page address of the access here. */ 3748 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->CritSect);3749 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 3749 3750 Assert(GCPtr == 0); 3750 3751 RT_NOREF1(GCPtr); … … 3753 3754 } 3754 3755 3755 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->CritSect);3756 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 3756 3757 AssertMsgFailed(("PGMHandlerPhysicalPageTempOff -> rc=%d\n", VBOXSTRICTRC_VAL(rc))); 3757 3758 } … … 3767 3768 RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser) 3768 3769 { 3769 PVGASTATE pThis = (PVGASTATE)pvUser; 3770 AssertPtr(pThis); 3770 PPDMDEVINS pDevIns = (PPDMDEVINS)pvUser; 3771 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3772 //PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3771 3773 Assert(GCPhysFault >= pThis->GCPhysVRAM); 3772 3774 AssertMsg(uErrorCode & X86_TRAP_PF_RW, ("uErrorCode=%#x\n", uErrorCode)); 3773 3775 RT_NOREF3(pVCpu, pRegFrame, uErrorCode); 3774 3776 3775 return vgaLFBAccess(pVM, p This, GCPhysFault, pvFault);3777 return vgaLFBAccess(pVM, pDevIns, pThis, GCPhysFault, pvFault); 3776 3778 } 3777 3779 #endif /* !IN_RING3 */ … … 3786 3788 PGMACCESSORIGIN enmOrigin, void *pvUser) 3787 3789 { 3788 PVGASTATE pThis = (PVGASTATE)pvUser; 3789 Assert(pThis); 3790 PPDMDEVINS pDevIns = (PPDMDEVINS)pvUser; 3791 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3792 //PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3790 3793 Assert(GCPhys >= pThis->GCPhysVRAM); 3791 3794 RT_NOREF(pVCpu, pvPhys, pvBuf, cbBuf, enmAccessType, enmOrigin); 3792 3795 3793 VBOXSTRICTRC rc = vgaLFBAccess(pVM, p This, GCPhys, 0);3796 VBOXSTRICTRC rc = vgaLFBAccess(pVM, pDevIns, pThis, GCPhys, 0); 3794 3797 if (rc == VINF_SUCCESS) 3795 3798 rc = VINF_PGM_HANDLER_DO_DEFAULT; … … 3868 3871 vbeR3IOPortWriteVbeExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 3869 3872 { 3870 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);3873 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3871 3874 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3872 3875 RT_NOREF(offPort, pvUser); … … 3875 3878 { 3876 3879 Log(("vbeR3IOPortWriteVbeExtra: addr=%#RX32\n", u32)); 3877 pThis ->u16VBEExtraAddress = u32;3880 pThisCC->u16VBEExtraAddress = u32; 3878 3881 } 3879 3882 else … … 3891 3894 vbeR3IoPortReadVbeExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb) 3892 3895 { 3893 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3896 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 3897 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 3894 3898 Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo))); 3895 3899 RT_NOREF(offPort, pvUser); 3896 3900 3897 3901 int rc = VINF_SUCCESS; 3898 if (pThis ->u16VBEExtraAddress == 0xffff)3902 if (pThisCC->u16VBEExtraAddress == 0xffff) 3899 3903 { 3900 3904 Log(("vbeR3IoPortReadVbeExtra: Requested number of 64k video banks\n")); 3901 3905 *pu32 = pThis->vram_size / _64K; 3902 3906 } 3903 else if ( pThis ->u16VBEExtraAddress >= pThis->cbVBEExtraData3904 || pThis ->u16VBEExtraAddress + cb > pThis->cbVBEExtraData)3907 else if ( pThisCC->u16VBEExtraAddress >= pThisCC->cbVBEExtraData 3908 || pThisCC->u16VBEExtraAddress + cb > pThisCC->cbVBEExtraData) 3905 3909 { 3906 3910 *pu32 = 0; 3907 3911 Log(("vbeR3IoPortReadVbeExtra: Requested address is out of VBE data!!! Address=%#x(%d) cbVBEExtraData=%#x(%d)\n", 3908 pThis ->u16VBEExtraAddress, pThis->u16VBEExtraAddress, pThis->cbVBEExtraData, pThis->cbVBEExtraData));3912 pThisCC->u16VBEExtraAddress, pThisCC->u16VBEExtraAddress, pThisCC->cbVBEExtraData, pThisCC->cbVBEExtraData)); 3909 3913 } 3910 3914 else … … 3913 3917 if (cb == 1) 3914 3918 { 3915 *pu32 = pThis ->pbVBEExtraData[pThis->u16VBEExtraAddress] & 0xFF;3919 *pu32 = pThisCC->pbVBEExtraData[pThisCC->u16VBEExtraAddress] & 0xFF; 3916 3920 3917 3921 Log(("vbeR3IoPortReadVbeExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32)); … … 3919 3923 else if (cb == 2) 3920 3924 { 3921 *pu32 = pThis ->pbVBEExtraData[pThis->u16VBEExtraAddress]3922 | (uint32_t)pThis ->pbVBEExtraData[pThis->u16VBEExtraAddress + 1] << 8;3925 *pu32 = pThisCC->pbVBEExtraData[pThisCC->u16VBEExtraAddress] 3926 | (uint32_t)pThisCC->pbVBEExtraData[pThisCC->u16VBEExtraAddress + 1] << 8; 3923 3927 3924 3928 Log(("vbeR3IoPortReadVbeExtra: cb=%#x %.*Rhxs\n", cb, cb, pu32)); … … 3942 3946 * @param pThis The VGA instance data. 3943 3947 */ 3944 static int vbeR3ParseBitmap(PVGASTATE pThis)3948 static int vbeR3ParseBitmap(PVGASTATECC pThisCC) 3945 3949 { 3946 3950 /* 3947 3951 * Get bitmap header data 3948 3952 */ 3949 PBMPINFO pBmpInfo = (PBMPINFO)(pThis ->pbLogo + sizeof(LOGOHDR));3950 PWINHDR pWinHdr = (PWINHDR)(pThis ->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO));3953 PBMPINFO pBmpInfo = (PBMPINFO)(pThisCC->pbLogo + sizeof(LOGOHDR)); 3954 PWINHDR pWinHdr = (PWINHDR)(pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO)); 3951 3955 3952 3956 if (pBmpInfo->Type == BMP_ID) … … 3957 3961 { 3958 3962 POS2HDR pOs2Hdr = (POS2HDR)pWinHdr; 3959 pThis ->cxLogo = pOs2Hdr->Width;3960 pThis ->cyLogo = pOs2Hdr->Height;3961 pThis ->cLogoPlanes = pOs2Hdr->Planes;3962 pThis ->cLogoBits = pOs2Hdr->BitCount;3963 pThis ->LogoCompression = BMP_COMPRESS_NONE;3964 pThis ->cLogoUsedColors = 0;3963 pThisCC->cxLogo = pOs2Hdr->Width; 3964 pThisCC->cyLogo = pOs2Hdr->Height; 3965 pThisCC->cLogoPlanes = pOs2Hdr->Planes; 3966 pThisCC->cLogoBits = pOs2Hdr->BitCount; 3967 pThisCC->LogoCompression = BMP_COMPRESS_NONE; 3968 pThisCC->cLogoUsedColors = 0; 3965 3969 break; 3966 3970 } … … 3969 3973 { 3970 3974 POS22HDR pOs22Hdr = (POS22HDR)pWinHdr; 3971 pThis ->cxLogo = pOs22Hdr->Width;3972 pThis ->cyLogo = pOs22Hdr->Height;3973 pThis ->cLogoPlanes = pOs22Hdr->Planes;3974 pThis ->cLogoBits = pOs22Hdr->BitCount;3975 pThis ->LogoCompression = pOs22Hdr->Compression;3976 pThis ->cLogoUsedColors = pOs22Hdr->ClrUsed;3975 pThisCC->cxLogo = pOs22Hdr->Width; 3976 pThisCC->cyLogo = pOs22Hdr->Height; 3977 pThisCC->cLogoPlanes = pOs22Hdr->Planes; 3978 pThisCC->cLogoBits = pOs22Hdr->BitCount; 3979 pThisCC->LogoCompression = pOs22Hdr->Compression; 3980 pThisCC->cLogoUsedColors = pOs22Hdr->ClrUsed; 3977 3981 break; 3978 3982 } 3979 3983 3980 3984 case BMP_HEADER_WIN3: 3981 pThis ->cxLogo = pWinHdr->Width;3982 pThis ->cyLogo = pWinHdr->Height;3983 pThis ->cLogoPlanes = pWinHdr->Planes;3984 pThis ->cLogoBits = pWinHdr->BitCount;3985 pThis ->LogoCompression = pWinHdr->Compression;3986 pThis ->cLogoUsedColors = pWinHdr->ClrUsed;3985 pThisCC->cxLogo = pWinHdr->Width; 3986 pThisCC->cyLogo = pWinHdr->Height; 3987 pThisCC->cLogoPlanes = pWinHdr->Planes; 3988 pThisCC->cLogoBits = pWinHdr->BitCount; 3989 pThisCC->LogoCompression = pWinHdr->Compression; 3990 pThisCC->cLogoUsedColors = pWinHdr->ClrUsed; 3987 3991 break; 3988 3992 … … 3993 3997 } 3994 3998 3995 AssertLogRelMsgReturn(pThis ->cxLogo <= LOGO_MAX_WIDTH && pThis->cyLogo <= LOGO_MAX_HEIGHT,3996 ("Bitmap %ux%u is too big.\n", pThis ->cxLogo, pThis->cyLogo),3999 AssertLogRelMsgReturn(pThisCC->cxLogo <= LOGO_MAX_WIDTH && pThisCC->cyLogo <= LOGO_MAX_HEIGHT, 4000 ("Bitmap %ux%u is too big.\n", pThisCC->cxLogo, pThisCC->cyLogo), 3997 4001 VERR_INVALID_PARAMETER); 3998 4002 3999 AssertLogRelMsgReturn(pThis ->cLogoPlanes == 1,4000 ("Bitmap planes %u != 1.\n", pThis ->cLogoPlanes),4003 AssertLogRelMsgReturn(pThisCC->cLogoPlanes == 1, 4004 ("Bitmap planes %u != 1.\n", pThisCC->cLogoPlanes), 4001 4005 VERR_INVALID_PARAMETER); 4002 4006 4003 AssertLogRelMsgReturn(pThis ->cLogoBits == 4 || pThis->cLogoBits == 8 || pThis->cLogoBits == 24,4004 ("Unsupported %u depth.\n", pThis ->cLogoBits),4007 AssertLogRelMsgReturn(pThisCC->cLogoBits == 4 || pThisCC->cLogoBits == 8 || pThisCC->cLogoBits == 24, 4008 ("Unsupported %u depth.\n", pThisCC->cLogoBits), 4005 4009 VERR_INVALID_PARAMETER); 4006 4010 4007 AssertLogRelMsgReturn(pThis ->cLogoUsedColors <= 256,4008 ("Unsupported %u colors.\n", pThis ->cLogoUsedColors),4011 AssertLogRelMsgReturn(pThisCC->cLogoUsedColors <= 256, 4012 ("Unsupported %u colors.\n", pThisCC->cLogoUsedColors), 4009 4013 VERR_INVALID_PARAMETER); 4010 4014 4011 AssertLogRelMsgReturn(pThis ->LogoCompression == BMP_COMPRESS_NONE,4012 ("Unsupported %u compression.\n", pThis ->LogoCompression),4015 AssertLogRelMsgReturn(pThisCC->LogoCompression == BMP_COMPRESS_NONE, 4016 ("Unsupported %u compression.\n", pThisCC->LogoCompression), 4013 4017 VERR_INVALID_PARAMETER); 4014 4018 … … 4016 4020 * Read bitmap palette 4017 4021 */ 4018 if (!pThis ->cLogoUsedColors)4019 pThis ->cLogoPalEntries = 1 << (pThis->cLogoPlanes * pThis->cLogoBits);4022 if (!pThisCC->cLogoUsedColors) 4023 pThisCC->cLogoPalEntries = 1 << (pThisCC->cLogoPlanes * pThisCC->cLogoBits); 4020 4024 else 4021 pThis ->cLogoPalEntries = pThis->cLogoUsedColors;4022 4023 if (pThis ->cLogoPalEntries)4025 pThisCC->cLogoPalEntries = pThisCC->cLogoUsedColors; 4026 4027 if (pThisCC->cLogoPalEntries) 4024 4028 { 4025 const uint8_t *pbPal = pThis ->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO) + pWinHdr->Size; /* ASSUMES Size location (safe) */4026 4027 for (uint16_t i = 0; i < pThis ->cLogoPalEntries; i++)4029 const uint8_t *pbPal = pThisCC->pbLogo + sizeof(LOGOHDR) + sizeof(BMPINFO) + pWinHdr->Size; /* ASSUMES Size location (safe) */ 4030 4031 for (uint16_t i = 0; i < pThisCC->cLogoPalEntries; i++) 4028 4032 { 4029 4033 uint16_t j; … … 4038 4042 4039 4043 pbPal++; /* skip unused byte */ 4040 pThis ->au32LogoPalette[i] = u32Pal;4044 pThisCC->au32LogoPalette[i] = u32Pal; 4041 4045 } 4042 4046 } … … 4045 4049 * Bitmap data offset 4046 4050 */ 4047 pThis ->pbLogoBitmap = pThis->pbLogo + sizeof(LOGOHDR) + pBmpInfo->Offset;4051 pThisCC->pbLogoBitmap = pThisCC->pbLogo + sizeof(LOGOHDR) + pBmpInfo->Offset; 4048 4052 } 4049 4053 else … … 4208 4212 vbeR3IoPortWriteCmdLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 4209 4213 { 4210 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4214 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4215 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 4211 4216 RT_NOREF(pvUser, offPort); 4212 4217 … … 4219 4224 { 4220 4225 case LOGO_CMD_SET_OFFSET: 4221 pThis ->offLogoData = u32 & 0xFF;4226 pThisCC->offLogoData = u32 & 0xFF; 4222 4227 break; 4223 4228 … … 4225 4230 { 4226 4231 uint8_t iStep = u32 & 0xFF; 4227 const uint8_t *pbSrc = pThis ->pbLogoBitmap;4232 const uint8_t *pbSrc = pThisCC->pbLogoBitmap; 4228 4233 uint8_t *pbDst; 4229 PCLOGOHDR pLogoHdr = (PCLOGOHDR)pThis ->pbLogo;4234 PCLOGOHDR pLogoHdr = (PCLOGOHDR)pThisCC->pbLogo; 4230 4235 uint32_t offDirty = 0; 4231 uint16_t xLogo = (LOGO_MAX_WIDTH - pThis ->cxLogo) / 2;4232 uint16_t yLogo = LOGO_MAX_HEIGHT - (LOGO_MAX_HEIGHT - pThis ->cyLogo) / 2;4236 uint16_t xLogo = (LOGO_MAX_WIDTH - pThisCC->cxLogo) / 2; 4237 uint16_t yLogo = LOGO_MAX_HEIGHT - (LOGO_MAX_HEIGHT - pThisCC->cyLogo) / 2; 4233 4238 4234 4239 /* Check VRAM size */ … … 4237 4242 4238 4243 if (pThis->vram_size >= LOGO_MAX_SIZE * 2) 4239 pbDst = pThis ->vram_ptrR3+ LOGO_MAX_SIZE;4244 pbDst = pThisCC->pbVRam + LOGO_MAX_SIZE; 4240 4245 else 4241 pbDst = pThis ->vram_ptrR3;4246 pbDst = pThisCC->pbVRam; 4242 4247 4243 4248 /* Clear screen - except on power on... */ 4244 if (!pThis ->fLogoClearScreen)4249 if (!pThisCC->fLogoClearScreen) 4245 4250 { 4246 4251 /* Clear vram */ … … 4249 4254 for (int j = 0; j < LOGO_MAX_HEIGHT; j++) 4250 4255 *pu32Dst++ = 0; 4251 pThis ->fLogoClearScreen = true;4256 pThisCC->fLogoClearScreen = true; 4252 4257 } 4253 4258 4254 4259 /* Show the bitmap. */ 4255 vbeR3ShowBitmap(pThis ->cLogoBits, xLogo, yLogo,4256 pThis->cxLogo, pThis->cyLogo,4257 false, iStep, &pThis->au32LogoPalette[0],4258 pbSrc, pbDst);4260 vbeR3ShowBitmap(pThisCC->cLogoBits, xLogo, yLogo, 4261 pThisCC->cxLogo, pThisCC->cyLogo, 4262 false, iStep, &pThisCC->au32LogoPalette[0], 4263 pbSrc, pbDst); 4259 4264 4260 4265 /* Show the 'Press F12...' text. */ 4261 4266 if (pLogoHdr->fu8ShowBootMenu == 2) 4262 4267 vbeR3ShowBitmap(1, LOGO_F12TEXT_X, LOGO_F12TEXT_Y, 4263 LOGO_F12TEXT_WIDTH, LOGO_F12TEXT_HEIGHT,4264 pThis->fBootMenuInverse, iStep, &pThis->au32LogoPalette[0],4265 &g_abLogoF12BootText[0], pbDst);4268 LOGO_F12TEXT_WIDTH, LOGO_F12TEXT_HEIGHT, 4269 pThisCC->fBootMenuInverse, iStep, &pThisCC->au32LogoPalette[0], 4270 &g_abLogoF12BootText[0], pbDst); 4266 4271 4267 4272 /* Blit the offscreen buffer. */ 4268 4273 if (pThis->vram_size >= LOGO_MAX_SIZE * 2) 4269 4274 { 4270 uint32_t *pu32TmpDst = (uint32_t *)pThis ->vram_ptrR3;4271 uint32_t *pu32TmpSrc = (uint32_t *)(pThis ->vram_ptrR3+ LOGO_MAX_SIZE);4275 uint32_t *pu32TmpDst = (uint32_t *)pThisCC->pbVRam; 4276 uint32_t *pu32TmpSrc = (uint32_t *)(pThisCC->pbVRam + LOGO_MAX_SIZE); 4272 4277 for (int i = 0; i < LOGO_MAX_WIDTH; i++) 4273 4278 { … … 4288 4293 default: 4289 4294 Log(("vbeR3IoPortWriteCmdLogo: invalid command %d\n", u32)); 4290 pThis ->LogoCommand = LOGO_CMD_NOP;4295 pThisCC->LogoCommand = LOGO_CMD_NOP; 4291 4296 break; 4292 4297 } … … 4307 4312 vbeR3IoPortReadCmdLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb) 4308 4313 { 4309 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);4314 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 4310 4315 RT_NOREF(pvUser, offPort); 4311 4316 4312 if (pThis ->offLogoData + cb > pThis->cbLogo)4317 if (pThisCC->offLogoData + cb > pThisCC->cbLogo) 4313 4318 { 4314 4319 Log(("vbeR3IoPortReadCmdLogo: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n", 4315 pThis ->offLogoData, pThis->offLogoData, pThis->cbLogo, pThis->cbLogo));4320 pThisCC->offLogoData, pThisCC->offLogoData, pThisCC->cbLogo, pThisCC->cbLogo)); 4316 4321 return VINF_SUCCESS; 4317 4322 } 4318 4323 RT_UNTRUSTED_VALIDATED_FENCE(); 4319 4324 4320 PCRTUINT64U p = (PCRTUINT64U)&pThis ->pbLogo[pThis->offLogoData];4325 PCRTUINT64U p = (PCRTUINT64U)&pThisCC->pbLogo[pThisCC->offLogoData]; 4321 4326 switch (cb) 4322 4327 { … … 4327 4332 default: AssertFailed(); break; 4328 4333 } 4329 Log(("vbeR3IoPortReadCmdLogo: LogoOffset=%#x(%d) cb=%#x %.*Rhxs\n", pThis ->offLogoData, pThis->offLogoData, cb, cb, pu32));4330 4331 pThis ->LogoCommand = LOGO_CMD_NOP;4332 pThis ->offLogoData += cb;4334 Log(("vbeR3IoPortReadCmdLogo: LogoOffset=%#x(%d) cb=%#x %.*Rhxs\n", pThisCC->offLogoData, pThisCC->offLogoData, cb, cb, pu32)); 4335 4336 pThisCC->LogoCommand = LOGO_CMD_NOP; 4337 pThisCC->offLogoData += cb; 4333 4338 4334 4339 return VINF_SUCCESS; … … 4454 4459 * Worker for vgaR3InfoText. 4455 4460 * 4456 * @param pThis The vga state. 4461 * @param pThis The shared VGA state. 4462 * @param pThisCC The VGA state for ring-3. 4457 4463 * @param pHlp Callback functions for doing output. 4458 4464 * @param offStart Where to start dumping (relative to the VRAM). … … 4464 4470 * (exclusive). 4465 4471 */ 4466 static void vgaR3InfoTextWorker(PVGASTATE pThis, P CDBGFINFOHLP pHlp,4472 static void vgaR3InfoTextWorker(PVGASTATE pThis, PVGASTATER3 pThisCC, PCDBGFINFOHLP pHlp, 4467 4473 uint32_t offStart, uint32_t cbLine, 4468 4474 uint32_t cCols, uint32_t cRows, … … 4478 4484 4479 4485 /* Do the dumping. */ 4480 uint8_t const *pbSrcOuter = pThis ->CTX_SUFF(vram_ptr)+ offStart;4486 uint8_t const *pbSrcOuter = pThisCC->pbVRam + offStart; 4481 4487 uint32_t iRow; 4482 4488 for (iRow = 0; iRow < cRows; iRow++, pbSrcOuter += cbLine) 4483 4489 { 4484 if ((uintptr_t)(pbSrcOuter + cbLine - pThis ->CTX_SUFF(vram_ptr)) > pThis->vram_size) {4490 if ((uintptr_t)(pbSrcOuter + cbLine - pThisCC->pbVRam) > pThis->vram_size) { 4485 4491 pHlp->pfnPrintf(pHlp, "The last %u row/rows is/are outside the VRAM.\n", cRows - iRow); 4486 4492 break; … … 4518 4524 static DECLCALLBACK(void) vgaR3InfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 4519 4525 { 4520 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4526 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4527 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 4521 4528 4522 4529 /* … … 4542 4549 if (!(pThis->gr[6] & 1)) 4543 4550 { 4544 uint8_t *pbSrc = pThis ->vram_ptrR3;4551 uint8_t *pbSrc = pThisCC->pbVRam; 4545 4552 if (pbSrc) 4546 4553 { … … 4573 4580 4574 4581 if (fAll) 4575 vgaR3InfoTextWorker(pThis, p Hlp, offStart - iScrBegin * cbLine, cbLine,4582 vgaR3InfoTextWorker(pThis, pThisCC, pHlp, offStart - iScrBegin * cbLine, cbLine, 4576 4583 cCols, cRows, iScrBegin, iScrBegin + cScrRows); 4577 4584 else 4578 vgaR3InfoTextWorker(pThis, p Hlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows);4585 vgaR3InfoTextWorker(pThis, pThisCC, pHlp, offStart, cbLine, cCols, cScrRows, 0, cScrRows); 4579 4586 } 4580 4587 else … … 4746 4753 static DECLCALLBACK(void *) vgaR3PortQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4747 4754 { 4748 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, IBase);4749 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis ->IBase);4750 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYPORT, &pThis ->IPort);4755 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IBase); 4756 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThisCC->IBase); 4757 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYPORT, &pThisCC->IPort); 4751 4758 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI)) 4752 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYVBVACALLBACKS, &pThis ->IVBVACallbacks);4759 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYVBVACALLBACKS, &pThisCC->IVBVACallbacks); 4753 4760 # endif 4754 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis ->ILeds);4761 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThisCC->ILeds); 4755 4762 return NULL; 4756 4763 } … … 4764 4771 static DECLCALLBACK(int) vgaR3PortQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4765 4772 { 4766 PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, ILeds); 4773 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, ILeds); 4774 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4775 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4767 4776 switch (iLUN) 4768 4777 { … … 4815 4824 /* -=-=-=-=-=- Ring 3: IDisplayPort -=-=-=-=-=- */ 4816 4825 4817 /** Converts a display port interface pointer to a vga state pointer. */4818 # define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) )4819 4820 4821 4826 /** 4822 4827 * @interface_method_impl{PDMIDISPLAYPORT,pfnUpdateDisplay} … … 4824 4829 static DECLCALLBACK(int) vgaR3PortUpdateDisplay(PPDMIDISPLAYPORT pInterface) 4825 4830 { 4826 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4827 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4828 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4831 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 4832 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4833 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4834 PDMDEV_ASSERT_EMT(pDevIns); 4829 4835 4830 4836 int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); … … 4844 4850 /* This should be called only in non VBVA mode. */ 4845 4851 # else 4846 if (VBVAUpdateDisplay(pThis ) == VINF_SUCCESS)4852 if (VBVAUpdateDisplay(pThis, pThisCC) == VINF_SUCCESS) 4847 4853 { 4848 4854 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); … … 4863 4869 } 4864 4870 4865 rc = vgaR3UpdateDisplay(p This, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/,4866 pThis ->pDrv, &pThis->graphic_mode);4871 rc = vgaR3UpdateDisplay(pDevIns, pThis, pThisCC, false /*fUpdateAll*/, false /*fFailOnResize*/, true /*reset_dirty*/, 4872 pThisCC->pDrv, &pThis->graphic_mode); 4867 4873 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 4868 4874 return rc; … … 4873 4879 * Internal vgaR3PortUpdateDisplayAll worker called under pThis->CritSect. 4874 4880 */ 4875 static int vboxR3UpdateDisplayAllInternal(PVGASTATE pThis, bool fFailOnResize) 4876 { 4877 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4878 4881 static int vboxR3UpdateDisplayAllInternal(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, bool fFailOnResize) 4882 { 4879 4883 # ifdef VBOX_WITH_VMSVGA 4880 4884 if ( !pThis->svga.fEnabled … … 4896 4900 pThis->graphic_mode = -1; /* force full update */ 4897 4901 4898 return vgaR3UpdateDisplay(pThis, true /*fUpdateAll*/, fFailOnResize, true /*reset_dirty*/, pThis->pDrv, &pThis->graphic_mode); 4902 return vgaR3UpdateDisplay(pDevIns, pThis, pThisCC, true /*fUpdateAll*/, fFailOnResize, 4903 true /*reset_dirty*/, pThisCC->pDrv, &pThis->graphic_mode); 4899 4904 } 4900 4905 … … 4905 4910 static DECLCALLBACK(int) vgaR3PortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface, bool fFailOnResize) 4906 4911 { 4907 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4908 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4912 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 4913 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4914 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4909 4915 PDMDEV_ASSERT_EMT(pDevIns); 4910 4916 … … 4918 4924 AssertRC(rc); 4919 4925 4920 rc = vboxR3UpdateDisplayAllInternal(p This, fFailOnResize);4926 rc = vboxR3UpdateDisplayAllInternal(pDevIns, pThis, pThisCC, fFailOnResize); 4921 4927 4922 4928 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); … … 4930 4936 static DECLCALLBACK(int) vgaR3PortSetRefreshRate(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval) 4931 4937 { 4932 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4933 PPDMDEVINS pDevIns = pThis->pDevInsR3; 4938 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 4939 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4940 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4934 4941 4935 4942 /* … … 4955 4962 static DECLCALLBACK(int) vgaR3PortQueryVideoMode(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy) 4956 4963 { 4957 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4958 4959 if (!pcBits) 4960 return VERR_INVALID_PARAMETER; 4964 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 4965 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4966 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4967 4968 AssertReturn(pcBits, VERR_INVALID_PARAMETER); 4969 4961 4970 *pcBits = vgaR3GetBpp(pThis); 4962 4971 if (pcx) … … 4974 4983 uint32_t *pcx, uint32_t *pcy) 4975 4984 { 4976 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4977 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 4978 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4985 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 4986 PPDMDEVINS pDevIns = pThisCC->pDevIns; 4987 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 4988 PDMDEV_ASSERT_EMT(pDevIns); 4979 4989 4980 4990 LogFlow(("vgaR3PortTakeScreenshot: ppbData=%p pcbData=%p pcx=%p pcy=%p\n", ppbData, pcbData, pcx, pcy)); … … 5035 5045 * If there is a pending resize, the function will fail. 5036 5046 */ 5037 rc = vgaR3UpdateDisplay(p This, false /*fUpdateAll*/, true /*fFailOnResize*/, false /*reset_dirty*/,5038 &Connector, &cur_graphic_mode);5047 rc = vgaR3UpdateDisplay(pDevIns, pThis, pThisCC, false /*fUpdateAll*/, true /*fFailOnResize*/, 5048 false /*reset_dirty*/, &Connector, &cur_graphic_mode); 5039 5049 5040 5050 pThis->fRenderVRAM = fSavedRenderVRAM; … … 5093 5103 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy) 5094 5104 { 5095 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);5096 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);5097 int rc;5098 PDMDEV_ASSERT_EMT( VGASTATE2DEVINS(pThis));5105 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 5106 PPDMDEVINS pDevIns = pThisCC->pDevIns; 5107 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5108 PDMDEV_ASSERT_EMT(pDevIns); 5099 5109 LogFlow(("vgaR3PortDisplayBlt: pvData=%p x=%d y=%d cx=%d cy=%d\n", pvData, x, y, cx, cy)); 5100 5110 5101 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY);5111 int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 5102 5112 AssertRC(rc); 5103 5113 … … 5106 5116 */ 5107 5117 if ( pvData 5108 && x < pThis ->pDrv->cx5109 && cx <= pThis ->pDrv->cx5110 && cx + x <= pThis ->pDrv->cx5111 && y < pThis ->pDrv->cy5112 && cy <= pThis ->pDrv->cy5113 && cy + y <= pThis ->pDrv->cy)5118 && x < pThisCC->pDrv->cx 5119 && cx <= pThisCC->pDrv->cx 5120 && cx + x <= pThisCC->pDrv->cx 5121 && y < pThisCC->pDrv->cy 5122 && cy <= pThisCC->pDrv->cy 5123 && cy + y <= pThisCC->pDrv->cy) 5114 5124 { 5115 5125 /* … … 5117 5127 */ 5118 5128 size_t cbPixelDst = 0; 5119 switch (pThis ->pDrv->cBits)5129 switch (pThisCC->pDrv->cBits) 5120 5130 { 5121 5131 case 8: … … 5143 5153 size_t cbLineSrc = cx * 4; /* 32 bits per pixel. */ 5144 5154 uint8_t *pbSrc = (uint8_t *)pvData; 5145 size_t cbLineDst = pThis ->pDrv->cbScanline;5146 uint8_t *pbDst = pThis ->pDrv->pbData + y * cbLineDst + x * cbPixelDst;5155 size_t cbLineDst = pThisCC->pDrv->cbScanline; 5156 uint8_t *pbDst = pThisCC->pDrv->pbData + y * cbLineDst + x * cbPixelDst; 5147 5157 uint32_t cyLeft = cy; 5148 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[VGA_DRAW_LINE32 * 4 + vgaR3GetDepthIndex(pThis ->pDrv->cBits)];5158 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[VGA_DRAW_LINE32 * 4 + vgaR3GetDepthIndex(pThisCC->pDrv->cBits)]; 5149 5159 Assert(pfnVgaDrawLine); 5150 5160 while (cyLeft-- > 0) 5151 5161 { 5152 pfnVgaDrawLine(pThis, p bDst, pbSrc, cx);5162 pfnVgaDrawLine(pThis, pThisCC, pbDst, pbSrc, cx); 5153 5163 pbDst += cbLineDst; 5154 5164 pbSrc += cbLineSrc; … … 5158 5168 * Invalidate the area. 5159 5169 */ 5160 pThis ->pDrv->pfnUpdateRect(pThis->pDrv, x, y, cx, cy);5170 pThisCC->pDrv->pfnUpdateRect(pThisCC->pDrv, x, y, cx, cy); 5161 5171 } 5162 5172 } … … 5176 5186 static DECLCALLBACK(void) vgaR3PortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy) 5177 5187 { 5178 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 5179 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 5188 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 5189 PPDMDEVINS pDevIns = pThisCC->pDevIns; 5190 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5180 5191 uint32_t v; 5181 vga_draw_line_func *vga_draw_line;5182 5192 5183 5193 uint32_t cbPixelDst; … … 5210 5220 } 5211 5221 5212 Assert(pThis ->pDrv);5213 Assert(pThis ->pDrv->pbData);5222 Assert(pThisCC->pDrv); 5223 Assert(pThisCC->pDrv->pbData); 5214 5224 5215 5225 /* Correct negative x and y coordinates. */ … … 5229 5239 5230 5240 /* Also check if coords are greater than the display resolution. */ 5231 if (x + cx > pThis ->pDrv->cx)5241 if (x + cx > pThisCC->pDrv->cx) 5232 5242 { 5233 5243 // x < 0 is not possible here 5234 cx = pThis ->pDrv->cx > (uint32_t)x? pThis->pDrv->cx - x: 0;5235 } 5236 5237 if (y + cy > pThis ->pDrv->cy)5244 cx = pThisCC->pDrv->cx > (uint32_t)x? pThisCC->pDrv->cx - x: 0; 5245 } 5246 5247 if (y + cy > pThisCC->pDrv->cy) 5238 5248 { 5239 5249 // y < 0 is not possible here 5240 cy = pThis ->pDrv->cy > (uint32_t)y? pThis->pDrv->cy - y: 0;5250 cy = pThisCC->pDrv->cy > (uint32_t)y? pThisCC->pDrv->cy - y: 0; 5241 5251 } 5242 5252 … … 5262 5272 5263 5273 /* Choose the rendering function. */ 5264 switch(pThis ->get_bpp(pThis))5274 switch(pThisCC->get_bpp(pThis)) 5265 5275 { 5266 5276 default: … … 5289 5299 } 5290 5300 5291 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pThis->pDrv->cBits)];5301 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(pThisCC->pDrv->cBits)]; 5292 5302 5293 5303 /* Compute source and destination addresses and pitches. */ 5294 cbPixelDst = (pThis ->pDrv->cBits + 7) / 8;5295 cbLineDst = pThis ->pDrv->cbScanline;5296 pbDst = pThis ->pDrv->pbData + y * cbLineDst + x * cbPixelDst;5297 5298 cbPixelSrc = (pThis ->get_bpp(pThis) + 7) / 8;5304 cbPixelDst = (pThisCC->pDrv->cBits + 7) / 8; 5305 cbLineDst = pThisCC->pDrv->cbScanline; 5306 pbDst = pThisCC->pDrv->pbData + y * cbLineDst + x * cbPixelDst; 5307 5308 cbPixelSrc = (pThisCC->get_bpp(pThis) + 7) / 8; 5299 5309 uint32_t offSrc, u32Dummy; 5300 pThis ->get_offsets(pThis, &cbLineSrc, &offSrc, &u32Dummy);5310 pThisCC->get_offsets(pThis, &cbLineSrc, &offSrc, &u32Dummy); 5301 5311 5302 5312 /* Assume that rendering is performed only on visible part of VRAM. 5303 5313 * This is true because coordinates were verified. 5304 5314 */ 5305 pbSrc = pThis ->vram_ptrR3;5315 pbSrc = pThisCC->pbVRam; 5306 5316 pbSrc += offSrc * 4 + y * cbLineSrc + x * cbPixelSrc; 5307 5317 … … 5314 5324 while (cy-- > 0) 5315 5325 { 5316 vga_draw_line (pThis, pbDst, pbSrc, cx);5326 pfnVgaDrawLine(pThis, pThisCC, pbDst, pbSrc, cx); 5317 5327 pbDst += cbLineDst; 5318 5328 pbSrc += cbLineSrc; … … 5337 5347 uint32_t cbDstLine, uint32_t cDstBitsPerPixel) 5338 5348 { 5339 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 5340 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 5349 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 5350 PPDMDEVINS pDevIns = pThisCC->pDevIns; 5351 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5341 5352 uint32_t v; 5342 vga_draw_line_func *vga_draw_line;5343 5353 5344 5354 # ifdef DEBUG_sunlover … … 5347 5357 5348 5358 Assert(pInterface); 5349 Assert(pThis ->pDrv);5359 Assert(pThisCC->pDrv); 5350 5360 5351 5361 int32_t xSrcCorrected = xSrc; … … 5422 5432 */ 5423 5433 if ( (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0 5424 && VBVAIsPaused(pThis )5434 && VBVAIsPaused(pThisCC) 5425 5435 # ifdef VBOX_WITH_VMSVGA 5426 5436 && !pThis->svga.fEnabled … … 5457 5467 } 5458 5468 5459 vga_draw_line = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(cDstBitsPerPixel)];5469 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[v * 4 + vgaR3GetDepthIndex(cDstBitsPerPixel)]; 5460 5470 5461 5471 /* Compute source and destination addresses and pitches. */ … … 5474 5484 while (cyCorrected-- > 0) 5475 5485 { 5476 vga_draw_line(pThis, pbDstCur, pbSrcCur, cxCorrected);5486 pfnVgaDrawLine(pThis, pThisCC, pbDstCur, pbSrcCur, cxCorrected); 5477 5487 pbDstCur += cbLineDst; 5478 5488 pbSrcCur += cbLineSrc; … … 5492 5502 static DECLCALLBACK(void) vgaR3PortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender) 5493 5503 { 5494 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 5495 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 5504 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 5505 PPDMDEVINS pDevIns = pThisCC->pDevIns; 5506 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5496 5507 5497 5508 LogFlow(("vgaR3PortSetRenderVRAM: fRender = %d\n", fRender)); … … 5530 5541 static DECLCALLBACK(void) vgaTimerRefresh(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 5531 5542 { 5532 PVGASTATE pThis = (PVGASTATE)pvUser; 5533 RT_NOREF(pTimer); 5543 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5544 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5545 RT_NOREF(pvUser, pTimer); 5534 5546 5535 5547 if (pThis->fScanLineCfg & VBVASCANLINECFG_ENABLE_VSYNC_IRQ) 5536 VBVARaiseIrq(p This, HGSMIHOSTFLAGS_VSYNC);5537 5538 if (pThis ->pDrv)5539 pThis ->pDrv->pfnRefresh(pThis->pDrv);5548 VBVARaiseIrq(pDevIns, pThis, pThisCC, HGSMIHOSTFLAGS_VSYNC); 5549 5550 if (pThisCC->pDrv) 5551 pThisCC->pDrv->pfnRefresh(pThisCC->pDrv); 5540 5552 5541 5553 if (pThis->cMilliesRefreshInterval) … … 5543 5555 5544 5556 # ifdef VBOX_WITH_VIDEOHWACCEL 5545 vbvaTimerCb(p This);5557 vbvaTimerCb(pDevIns, pThis, pThisCC); 5546 5558 # endif 5547 5559 … … 5561 5573 * Helper for VMSVGA. 5562 5574 */ 5563 int vgaR3RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer) 5564 { 5565 PPDMDEVINS pDevIns = pVGAState->pDevInsR3; 5566 Assert(pVGAState->GCPhysVRAM); 5567 5575 int vgaR3RegisterVRAMHandler(PPDMDEVINS pDevIns, PVGASTATE pThis, uint64_t cbFrameBuffer) 5576 { 5577 Assert(pThis->GCPhysVRAM); 5568 5578 int rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), 5569 p VGAState->GCPhysVRAM, pVGAState->GCPhysVRAM + (cbFrameBuffer - 1),5570 p VGAState->hLfbAccessHandlerType, pVGAState, pDevIns->pvInstanceDataR0,5579 pThis->GCPhysVRAM, pThis->GCPhysVRAM + (cbFrameBuffer - 1), 5580 pThis->hLfbAccessHandlerType, pThis, pDevIns->pvInstanceDataR0, 5571 5581 pDevIns->pvInstanceDataRC, "VGA LFB"); 5572 5582 … … 5579 5589 * Helper for VMSVGA. 5580 5590 */ 5581 int vgaR3UnregisterVRAMHandler(PVGASTATE pVGAState) 5582 { 5583 PPDMDEVINS pDevIns = pVGAState->pDevInsR3; 5584 5585 Assert(pVGAState->GCPhysVRAM); 5586 int rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns), pVGAState->GCPhysVRAM); 5591 int vgaR3UnregisterVRAMHandler(PPDMDEVINS pDevIns, PVGASTATE pThis) 5592 { 5593 Assert(pThis->GCPhysVRAM); 5594 int rc = PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns), pThis->GCPhysVRAM); 5587 5595 AssertRC(rc); 5588 5596 return rc; … … 5620 5628 { 5621 5629 rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), GCPhysAddress, GCPhysAddress + (pThis->vram_size - 1), 5622 pThis->hLfbAccessHandlerType, p This, pDevIns->pvInstanceDataR0,5623 pDevIns->p vInstanceDataRC, "VGA LFB");5630 pThis->hLfbAccessHandlerType, pDevIns, pDevIns->pDevInsR0RemoveMe, 5631 pDevIns->pDevInsForRC, "VGA LFB"); 5624 5632 AssertLogRelRC(rc); 5625 5633 if (RT_SUCCESS(rc)) … … 5819 5827 static DECLCALLBACK(int) vgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5820 5828 { 5821 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5829 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5830 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5822 5831 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5823 5832 5824 5833 # ifdef VBOX_WITH_VDMA 5825 vboxVDMASaveStateExecPrep(pThis ->pVdma);5834 vboxVDMASaveStateExecPrep(pThisCC->pVdma); 5826 5835 # endif 5827 5836 … … 5843 5852 rc = pHlp->pfnSSMPutU32(pSSM, 1); 5844 5853 AssertRCReturn(rc, rc); 5845 rc = vboxVDMASaveStateExecPerform(pHlp, pThis ->pVdma, pSSM);5854 rc = vboxVDMASaveStateExecPerform(pHlp, pThisCC->pVdma, pSSM); 5846 5855 # else 5847 5856 rc = pHlp->pfnSSMPutU32(pSSM, 0); … … 5850 5859 5851 5860 # ifdef VBOX_WITH_VDMA 5852 vboxVDMASaveStateExecDone(pThis ->pVdma);5861 vboxVDMASaveStateExecDone(pThisCC->pVdma); 5853 5862 # endif 5854 5863 … … 5872 5881 static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 5873 5882 { 5874 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5875 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5883 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5884 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5885 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5876 5886 int rc; 5877 5887 … … 5931 5941 if (u32 == 1) 5932 5942 { 5933 rc = vboxVDMASaveLoadExecPerform(pHlp, pThis ->pVdma, pSSM, uVersion);5943 rc = vboxVDMASaveLoadExecPerform(pHlp, pThisCC->pVdma, pSSM, uVersion); 5934 5944 AssertRCReturn(rc, rc); 5935 5945 } … … 5962 5972 static DECLCALLBACK(int) vgaR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5963 5973 { 5964 RT_NOREF(pSSM); 5965 int rc = VINF_SUCCESS; 5974 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 5975 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5976 int rc; 5977 RT_NOREF(pThisCC, pThis, pSSM); 5966 5978 5967 5979 # ifdef VBOX_WITH_HGSMI 5968 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);5969 5980 rc = vboxVBVALoadStateDone(pDevIns); 5970 5981 AssertRCReturn(rc, rc); 5971 5982 # ifdef VBOX_WITH_VDMA 5972 rc = vboxVDMASaveLoadDone(pThis ->pVdma);5983 rc = vboxVDMASaveLoadDone(pThisCC->pVdma); 5973 5984 AssertRCReturn(rc, rc); 5974 5985 # endif 5975 5986 /* Now update the current VBVA state which depends on VBE registers. vboxVBVALoadStateDone cleared the state. */ 5976 VBVAOnVBEChanged(pThis );5987 VBVAOnVBEChanged(pThis, pThisCC); 5977 5988 # endif 5978 5989 # ifdef VBOX_WITH_VMSVGA … … 5983 5994 } 5984 5995 # endif 5985 return rc;5996 return VINF_SUCCESS; 5986 5997 } 5987 5998 … … 5994 6005 static DECLCALLBACK(void) vgaR3Resume(PPDMDEVINS pDevIns) 5995 6006 { 5996 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 5997 VBVAOnResume(pThis); 6007 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6008 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6009 VBVAOnResume(pDevIns, pThis, pThisCC); 5998 6010 } 5999 6011 … … 6004 6016 static DECLCALLBACK(void) vgaR3Reset(PPDMDEVINS pDevIns) 6005 6017 { 6006 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6018 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6019 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6007 6020 char *pchStart; 6008 6021 char *pchEnd; 6009 6022 LogFlow(("vgaReset\n")); 6010 6023 6011 if (pThis ->pVdma)6012 vboxVDMAReset(pThis ->pVdma);6024 if (pThisCC->pVdma) 6025 vboxVDMAReset(pThisCC->pVdma); 6013 6026 6014 6027 # ifdef VBOX_WITH_VMSVGA … … 6018 6031 6019 6032 # ifdef VBOX_WITH_HGSMI 6020 VBVAReset(p This);6033 VBVAReset(pDevIns, pThis, pThisCC); 6021 6034 # endif 6022 6035 6023 6036 6024 6037 /* Clear the VRAM ourselves. */ 6025 if (pThis ->vram_ptrR3&& pThis->vram_size)6026 memset(pThis ->vram_ptrR3, 0, pThis->vram_size);6038 if (pThisCC->pbVRam && pThis->vram_size) 6039 memset(pThisCC->pbVRam, 0, pThis->vram_size); 6027 6040 6028 6041 /* … … 6046 6059 * Restore and re-init some bits. 6047 6060 */ 6048 pThis ->get_bpp = vgaR3GetBpp;6049 pThis ->get_offsets = vgaR3GetOffsets;6050 pThis ->get_resolution = vgaR3GetResolution;6061 pThisCC->get_bpp = vgaR3GetBpp; 6062 pThisCC->get_offsets = vgaR3GetOffsets; 6063 pThisCC->get_resolution = vgaR3GetResolution; 6051 6064 pThis->graphic_mode = -1; /* Force full update. */ 6052 6065 # ifdef CONFIG_BOCHS_VBE … … 6078 6091 * Reset the logo data. 6079 6092 */ 6080 pThis ->LogoCommand = LOGO_CMD_NOP;6081 pThis ->offLogoData = 0;6093 pThisCC->LogoCommand = LOGO_CMD_NOP; 6094 pThisCC->offLogoData = 0; 6082 6095 6083 6096 /* notify port handler */ 6084 if (pThis ->pDrv)6097 if (pThisCC->pDrv) 6085 6098 { 6086 6099 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); /* hack around lock order issue. */ 6087 pThis ->pDrv->pfnReset(pThis->pDrv);6088 pThis ->pDrv->pfnVBVAMousePointerShape(pThis->pDrv, false, false, 0, 0, 0, 0, NULL);6100 pThisCC->pDrv->pfnReset(pThisCC->pDrv); 6101 pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, false, false, 0, 0, 0, 0, NULL); 6089 6102 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_IGNORED); 6090 6103 } … … 6106 6119 static DECLCALLBACK(void) vgaR3PowerOn(PPDMDEVINS pDevIns) 6107 6120 { 6108 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6121 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6122 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6109 6123 # ifdef VBOX_WITH_VMSVGA 6110 6124 vmsvgaR3PowerOn(pDevIns); 6111 6125 # endif 6112 VBVAOnResume(p This);6126 VBVAOnResume(pDevIns, pThis, pThisCC); 6113 6127 } 6114 6128 … … 6125 6139 LogFlow(("vgaRelocate: offDelta = %08X\n", offDelta)); 6126 6140 6127 pThis ->vram_ptrRC+= offDelta;6141 pThisRC->pbVRam += offDelta; 6128 6142 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 6129 6143 } … … 6141 6155 static DECLCALLBACK(int) vgaAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 6142 6156 { 6143 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6157 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6158 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6144 6159 6145 6160 AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, … … 6152 6167 case 0: 6153 6168 { 6154 int rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThis ->IBase, &pThis->pDrvBase, "Display Port");6169 int rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThisCC->IBase, &pThisCC->pDrvBase, "Display Port"); 6155 6170 if (RT_SUCCESS(rc)) 6156 6171 { 6157 pThis ->pDrv = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIDISPLAYCONNECTOR);6158 if (pThis ->pDrv)6172 pThisCC->pDrv = PDMIBASE_QUERY_INTERFACE(pThisCC->pDrvBase, PDMIDISPLAYCONNECTOR); 6173 if (pThisCC->pDrv) 6159 6174 { 6160 /* pThis ->pDrv->pbData can be NULL when there is no framebuffer. */6161 if ( pThis ->pDrv->pfnRefresh6162 && pThis ->pDrv->pfnResize6163 && pThis ->pDrv->pfnUpdateRect)6175 /* pThisCC->pDrv->pbData can be NULL when there is no framebuffer. */ 6176 if ( pThisCC->pDrv->pfnRefresh 6177 && pThisCC->pDrv->pfnResize 6178 && pThisCC->pDrv->pfnUpdateRect) 6164 6179 rc = VINF_SUCCESS; 6165 6180 else 6166 6181 { 6167 Assert(pThis ->pDrv->pfnRefresh);6168 Assert(pThis ->pDrv->pfnResize);6169 Assert(pThis ->pDrv->pfnUpdateRect);6170 pThis ->pDrv = NULL;6171 pThis ->pDrvBase = NULL;6182 Assert(pThisCC->pDrv->pfnRefresh); 6183 Assert(pThisCC->pDrv->pfnResize); 6184 Assert(pThisCC->pDrv->pfnUpdateRect); 6185 pThisCC->pDrv = NULL; 6186 pThisCC->pDrvBase = NULL; 6172 6187 rc = VERR_INTERNAL_ERROR; 6173 6188 } … … 6175 6190 if(rc == VINF_SUCCESS) 6176 6191 { 6177 rc = vbvaVHWAConstruct(p This);6192 rc = vbvaVHWAConstruct(pDevIns, pThis, pThisCC); 6178 6193 if (rc != VERR_NOT_IMPLEMENTED) 6179 6194 AssertRC(rc); … … 6184 6199 { 6185 6200 AssertMsgFailed(("LUN #0 doesn't have a display connector interface! rc=%Rrc\n", rc)); 6186 pThis ->pDrvBase = NULL;6201 pThisCC->pDrvBase = NULL; 6187 6202 rc = VERR_PDM_MISSING_INTERFACE; 6188 6203 } … … 6212 6227 static DECLCALLBACK(void) vgaDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 6213 6228 { 6214 RT_NOREF1(fFlags); 6215 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6229 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6216 6230 AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, ("VGA device does not support hotplugging\n")); 6231 RT_NOREF(fFlags); 6217 6232 6218 6233 /* … … 6223 6238 /* LUN #0: Display port. */ 6224 6239 case 0: 6225 pThis ->pDrv = NULL;6226 pThis ->pDrvBase = NULL;6240 pThisCC->pDrv = NULL; 6241 pThisCC->pDrvBase = NULL; 6227 6242 break; 6228 6243 … … 6240 6255 { 6241 6256 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 6242 6243 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);6257 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6258 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6244 6259 LogFlow(("vgaR3Destruct:\n")); 6245 6260 6246 6261 # ifdef VBOX_WITH_VDMA 6247 if (pThis ->pVdma)6248 vboxVDMADestruct(pThis ->pVdma);6262 if (pThisCC->pVdma) 6263 vboxVDMADestruct(pThisCC->pVdma); 6249 6264 # endif 6250 6265 … … 6255 6270 6256 6271 # ifdef VBOX_WITH_HGSMI 6257 VBVADestroy(pThis );6272 VBVADestroy(pThisCC); 6258 6273 # endif 6259 6274 … … 6261 6276 * Free MM heap pointers. 6262 6277 */ 6263 if (pThis ->pbVBEExtraData)6264 { 6265 PDMDevHlpMMHeapFree(pDevIns, pThis ->pbVBEExtraData);6266 pThis ->pbVBEExtraData = NULL;6267 } 6268 if (pThis ->pbVgaBios)6269 { 6270 PDMDevHlpMMHeapFree(pDevIns, pThis ->pbVgaBios);6271 pThis ->pbVgaBios = NULL;6272 } 6273 6274 if (pThis ->pszVgaBiosFile)6275 { 6276 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszVgaBiosFile);6277 pThis ->pszVgaBiosFile = NULL;6278 } 6279 6280 if (pThis ->pszLogoFile)6281 { 6282 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszLogoFile);6283 pThis ->pszLogoFile = NULL;6284 } 6285 6286 if (pThis ->pbLogo)6287 { 6288 PDMDevHlpMMHeapFree(pDevIns, pThis ->pbLogo);6289 pThis ->pbLogo = NULL;6278 if (pThisCC->pbVBEExtraData) 6279 { 6280 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pbVBEExtraData); 6281 pThisCC->pbVBEExtraData = NULL; 6282 } 6283 if (pThisCC->pbVgaBios) 6284 { 6285 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pbVgaBios); 6286 pThisCC->pbVgaBios = NULL; 6287 } 6288 6289 if (pThisCC->pszVgaBiosFile) 6290 { 6291 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszVgaBiosFile); 6292 pThisCC->pszVgaBiosFile = NULL; 6293 } 6294 6295 if (pThisCC->pszLogoFile) 6296 { 6297 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszLogoFile); 6298 pThisCC->pszLogoFile = NULL; 6299 } 6300 6301 if (pThisCC->pbLogo) 6302 { 6303 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pbLogo); 6304 pThisCC->pbLogo = NULL; 6290 6305 } 6291 6306 … … 6326 6341 { 6327 6342 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 6328 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6329 PVM pVM = PDMDevHlpGetVM(pDevIns); 6330 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 6343 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 6344 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 6345 PVM pVM = PDMDevHlpGetVM(pDevIns); 6346 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 6331 6347 int rc; 6332 6348 unsigned i; … … 6464 6480 # endif 6465 6481 6466 pThis->pDevInsR3 = pDevIns; 6467 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 6468 # ifdef VBOX_WITH_RAW_MODE_KEEP 6469 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 6470 # endif 6482 pThisCC->pDevIns = pDevIns; 6471 6483 6472 6484 vgaR3Reset(pDevIns); … … 6507 6519 6508 6520 /* the interfaces. */ 6509 pThis ->IBase.pfnQueryInterface = vgaR3PortQueryInterface;6510 6511 pThis ->IPort.pfnUpdateDisplay = vgaR3PortUpdateDisplay;6512 pThis ->IPort.pfnUpdateDisplayAll = vgaR3PortUpdateDisplayAll;6513 pThis ->IPort.pfnQueryVideoMode = vgaR3PortQueryVideoMode;6514 pThis ->IPort.pfnSetRefreshRate = vgaR3PortSetRefreshRate;6515 pThis ->IPort.pfnTakeScreenshot = vgaR3PortTakeScreenshot;6516 pThis ->IPort.pfnFreeScreenshot = vgaR3PortFreeScreenshot;6517 pThis ->IPort.pfnDisplayBlt = vgaR3PortDisplayBlt;6518 pThis ->IPort.pfnUpdateDisplayRect = vgaR3PortUpdateDisplayRect;6519 pThis ->IPort.pfnCopyRect = vgaR3PortCopyRect;6520 pThis ->IPort.pfnSetRenderVRAM = vgaR3PortSetRenderVRAM;6521 pThisCC->IBase.pfnQueryInterface = vgaR3PortQueryInterface; 6522 6523 pThisCC->IPort.pfnUpdateDisplay = vgaR3PortUpdateDisplay; 6524 pThisCC->IPort.pfnUpdateDisplayAll = vgaR3PortUpdateDisplayAll; 6525 pThisCC->IPort.pfnQueryVideoMode = vgaR3PortQueryVideoMode; 6526 pThisCC->IPort.pfnSetRefreshRate = vgaR3PortSetRefreshRate; 6527 pThisCC->IPort.pfnTakeScreenshot = vgaR3PortTakeScreenshot; 6528 pThisCC->IPort.pfnFreeScreenshot = vgaR3PortFreeScreenshot; 6529 pThisCC->IPort.pfnDisplayBlt = vgaR3PortDisplayBlt; 6530 pThisCC->IPort.pfnUpdateDisplayRect = vgaR3PortUpdateDisplayRect; 6531 pThisCC->IPort.pfnCopyRect = vgaR3PortCopyRect; 6532 pThisCC->IPort.pfnSetRenderVRAM = vgaR3PortSetRenderVRAM; 6521 6533 # ifdef VBOX_WITH_VMSVGA 6522 pThis ->IPort.pfnSetViewport = vmsvgaR3PortSetViewport;6534 pThisCC->IPort.pfnSetViewport = vmsvgaR3PortSetViewport; 6523 6535 # else 6524 pThis ->IPort.pfnSetViewport = NULL;6536 pThisCC->IPort.pfnSetViewport = NULL; 6525 6537 # endif 6526 pThis ->IPort.pfnSendModeHint = vbvaR3PortSendModeHint;6527 pThis ->IPort.pfnReportHostCursorCapabilities = vgaR3PortReportHostCursorCapabilities;6528 pThis ->IPort.pfnReportHostCursorPosition = vgaR3PortReportHostCursorPosition;6538 pThisCC->IPort.pfnSendModeHint = vbvaR3PortSendModeHint; 6539 pThisCC->IPort.pfnReportHostCursorCapabilities = vgaR3PortReportHostCursorCapabilities; 6540 pThisCC->IPort.pfnReportHostCursorPosition = vgaR3PortReportHostCursorPosition; 6529 6541 6530 6542 # if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 6531 pThis ->IVBVACallbacks.pfnVHWACommandCompleteAsync = vbvaR3VHWACommandCompleteAsync;6543 pThisCC->IVBVACallbacks.pfnVHWACommandCompleteAsync = vbvaR3VHWACommandCompleteAsync; 6532 6544 # endif 6533 6545 6534 pThis ->ILeds.pfnQueryStatusLed = vgaR3PortQueryStatusLed;6546 pThisCC->ILeds.pfnQueryStatusLed = vgaR3PortQueryStatusLed; 6535 6547 pThis->Led3D.u32Magic = PDMLED_MAGIC; 6536 6548 … … 6588 6600 rc = PDMDevHlpPCIIORegionCreateMmio2Ex(pDevIns, pThis->pciRegions.iVRAM, pThis->vram_size, 6589 6601 PCI_ADDRESS_SPACE_MEM_PREFETCH, 0 /*fFlags*/, vgaR3PciIORegionVRamMapUnmap, 6590 "VRam", (void **)&pThis ->vram_ptrR3, &pThis->hMmio2VRam);6602 "VRam", (void **)&pThisCC->pbVRam, &pThis->hMmio2VRam); 6591 6603 AssertLogRelRCReturn(rc, PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 6592 6604 N_("Failed to allocate %u bytes of VRAM"), pThis->vram_size)); 6593 6605 # ifndef VGA_WITH_PARTIAL_RING0_MAPPING 6594 pThis->vram_ptrR0 = (RTR0PTR)pThis ->vram_ptrR3;6606 pThis->vram_ptrR0 = (RTR0PTR)pThisCC->pbVRam; 6595 6607 # endif 6596 6608 … … 6658 6670 * Get the VGA BIOS ROM file name. 6659 6671 */ 6660 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "BiosRom", &pThis ->pszVgaBiosFile);6672 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "BiosRom", &pThisCC->pszVgaBiosFile); 6661 6673 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 6662 6674 { 6663 pThis ->pszVgaBiosFile = NULL;6675 pThisCC->pszVgaBiosFile = NULL; 6664 6676 rc = VINF_SUCCESS; 6665 6677 } 6666 6678 else if (RT_FAILURE(rc)) 6667 6679 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Configuration error: Querying \"BiosRom\" as a string failed")); 6668 else if (!*pThis ->pszVgaBiosFile)6669 { 6670 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszVgaBiosFile);6671 pThis ->pszVgaBiosFile = NULL;6680 else if (!*pThisCC->pszVgaBiosFile) 6681 { 6682 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszVgaBiosFile); 6683 pThisCC->pszVgaBiosFile = NULL; 6672 6684 } 6673 6685 … … 6676 6688 */ 6677 6689 RTFILE FileVgaBios = NIL_RTFILE; 6678 if (pThis->pszVgaBiosFile) 6679 { 6680 rc = RTFileOpen(&FileVgaBios, pThis->pszVgaBiosFile, 6681 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 6690 if (pThisCC->pszVgaBiosFile) 6691 { 6692 rc = RTFileOpen(&FileVgaBios, pThisCC->pszVgaBiosFile, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 6682 6693 if (RT_SUCCESS(rc)) 6683 6694 { 6684 rc = RTFileQuerySize(FileVgaBios, &pThis ->cbVgaBios);6695 rc = RTFileQuerySize(FileVgaBios, &pThisCC->cbVgaBios); 6685 6696 if (RT_SUCCESS(rc)) 6686 6697 { 6687 if ( RT_ALIGN(pThis ->cbVgaBios, _4K) != pThis->cbVgaBios6688 || pThis ->cbVgaBios > _64K6689 || pThis ->cbVgaBios < 16 * _1K)6698 if ( RT_ALIGN(pThisCC->cbVgaBios, _4K) != pThisCC->cbVgaBios 6699 || pThisCC->cbVgaBios > _64K 6700 || pThisCC->cbVgaBios < 16 * _1K) 6690 6701 rc = VERR_TOO_MUCH_DATA; 6691 6702 } … … 6696 6707 * In case of failure simply fall back to the built-in VGA BIOS ROM. 6697 6708 */ 6698 Log(("vgaConstruct: Failed to open VGA BIOS ROM file '%s', rc=%Rrc!\n", pThis ->pszVgaBiosFile, rc));6709 Log(("vgaConstruct: Failed to open VGA BIOS ROM file '%s', rc=%Rrc!\n", pThisCC->pszVgaBiosFile, rc)); 6699 6710 RTFileClose(FileVgaBios); 6700 6711 FileVgaBios = NIL_RTFILE; 6701 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszVgaBiosFile);6702 pThis ->pszVgaBiosFile = NULL;6712 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszVgaBiosFile); 6713 pThisCC->pszVgaBiosFile = NULL; 6703 6714 } 6704 6715 } … … 6707 6718 * Attempt to get the VGA BIOS ROM data from file. 6708 6719 */ 6709 if (pThis ->pszVgaBiosFile)6720 if (pThisCC->pszVgaBiosFile) 6710 6721 { 6711 6722 /* 6712 6723 * Allocate buffer for the VGA BIOS ROM data. 6713 6724 */ 6714 pThis ->pbVgaBios = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, pThis->cbVgaBios);6715 if (pThis ->pbVgaBios)6725 pThisCC->pbVgaBios = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, pThisCC->cbVgaBios); 6726 if (pThisCC->pbVgaBios) 6716 6727 { 6717 rc = RTFileRead(FileVgaBios, pThis ->pbVgaBios, pThis->cbVgaBios, NULL);6728 rc = RTFileRead(FileVgaBios, pThisCC->pbVgaBios, pThisCC->cbVgaBios, NULL); 6718 6729 if (RT_FAILURE(rc)) 6719 6730 { 6720 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Rrc\n", pThis ->cbVgaBios, rc));6721 PDMDevHlpMMHeapFree(pDevIns, pThis ->pbVgaBios);6722 pThis ->pbVgaBios = NULL;6731 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Rrc\n", pThisCC->cbVgaBios, rc)); 6732 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pbVgaBios); 6733 pThisCC->pbVgaBios = NULL; 6723 6734 } 6724 6735 rc = VINF_SUCCESS; … … 6728 6739 } 6729 6740 else 6730 pThis ->pbVgaBios = NULL;6741 pThisCC->pbVgaBios = NULL; 6731 6742 6732 6743 /* cleanup */ … … 6739 6750 uint64_t cbVgaBiosBinary; 6740 6751 uint32_t fFlags = 0; 6741 if (pThis ->pbVgaBios == NULL)6752 if (pThisCC->pbVgaBios == NULL) 6742 6753 { 6743 6754 CPUMMICROARCH enmMicroarch = pVM ? CPUMGetGuestMicroarch(pVM) : kCpumMicroarch_Intel_P6; … … 6767 6778 else 6768 6779 { 6769 pbVgaBiosBinary = pThis ->pbVgaBios;6770 cbVgaBiosBinary = pThis ->cbVgaBios;6780 pbVgaBiosBinary = pThisCC->pbVgaBios; 6781 cbVgaBiosBinary = pThisCC->cbVgaBios; 6771 6782 } 6772 6783 … … 6790 6801 * Create the refresh timer. 6791 6802 */ 6792 rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_REAL, vgaTimerRefresh, pThis, TMTIMER_FLAGS_NO_CRIT_SECT,6803 rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_REAL, vgaTimerRefresh, NULL, TMTIMER_FLAGS_NO_CRIT_SECT, 6793 6804 "VGA Refresh Timer", &pThis->hRefreshTimer); 6794 6805 AssertRCReturn(rc, rc); … … 6834 6845 */ 6835 6846 AssertRelease(sizeof(VBEHEADER) + cb < 65536); 6836 pThis ->cbVBEExtraData = (uint16_t)(sizeof(VBEHEADER) + cb);6837 pThis ->pbVBEExtraData = (uint8_t *)PDMDevHlpMMHeapAllocZ(pDevIns, pThis->cbVBEExtraData);6838 if (!pThis ->pbVBEExtraData)6847 pThisCC->cbVBEExtraData = (uint16_t)(sizeof(VBEHEADER) + cb); 6848 pThisCC->pbVBEExtraData = (uint8_t *)PDMDevHlpMMHeapAllocZ(pDevIns, pThisCC->cbVBEExtraData); 6849 if (!pThisCC->pbVBEExtraData) 6839 6850 return VERR_NO_MEMORY; 6840 6851 6841 pVBEDataHdr = (PVBEHEADER)pThis ->pbVBEExtraData;6852 pVBEDataHdr = (PVBEHEADER)pThisCC->pbVBEExtraData; 6842 6853 pVBEDataHdr->u16Signature = VBEHEADER_MAGIC; 6843 6854 pVBEDataHdr->cbData = cb; … … 7059 7070 * Get the Logo file name. 7060 7071 */ 7061 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "LogoFile", &pThis ->pszLogoFile);7072 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "LogoFile", &pThisCC->pszLogoFile); 7062 7073 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 7063 pThis ->pszLogoFile = NULL;7074 pThisCC->pszLogoFile = NULL; 7064 7075 else if (RT_FAILURE(rc)) 7065 7076 return PDMDEV_SET_ERROR(pDevIns, rc, 7066 7077 N_("Configuration error: Querying \"LogoFile\" as a string failed")); 7067 else if (!*pThis ->pszLogoFile)7068 { 7069 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszLogoFile);7070 pThis ->pszLogoFile = NULL;7078 else if (!*pThisCC->pszLogoFile) 7079 { 7080 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszLogoFile); 7081 pThisCC->pszLogoFile = NULL; 7071 7082 } 7072 7083 … … 7076 7087 LogoHdr.cbLogo = g_cbVgaDefBiosLogo; 7077 7088 RTFILE FileLogo = NIL_RTFILE; 7078 if (pThis ->pszLogoFile)7079 { 7080 rc = RTFileOpen(&FileLogo, pThis ->pszLogoFile,7089 if (pThisCC->pszLogoFile) 7090 { 7091 rc = RTFileOpen(&FileLogo, pThisCC->pszLogoFile, 7081 7092 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 7082 7093 if (RT_SUCCESS(rc)) … … 7097 7108 * Ignore failure and fall back to the default logo. 7098 7109 */ 7099 LogRel(("vgaR3Construct: Failed to open logo file '%s', rc=%Rrc!\n", pThis ->pszLogoFile, rc));7110 LogRel(("vgaR3Construct: Failed to open logo file '%s', rc=%Rrc!\n", pThisCC->pszLogoFile, rc)); 7100 7111 if (FileLogo != NIL_RTFILE) 7101 7112 RTFileClose(FileLogo); 7102 7113 FileLogo = NIL_RTFILE; 7103 PDMDevHlpMMHeapFree(pDevIns, pThis ->pszLogoFile);7104 pThis ->pszLogoFile = NULL;7114 PDMDevHlpMMHeapFree(pDevIns, pThisCC->pszLogoFile); 7115 pThisCC->pszLogoFile = NULL; 7105 7116 } 7106 7117 } … … 7116 7127 * Let us fall back to default logo on read failure. 7117 7128 */ 7118 pThis ->cbLogo = LogoHdr.cbLogo;7129 pThisCC->cbLogo = LogoHdr.cbLogo; 7119 7130 if (g_cbVgaDefBiosLogo) 7120 pThis ->cbLogo = g_cbVgaDefBiosLogo;7131 pThisCC->cbLogo = g_cbVgaDefBiosLogo; 7121 7132 # ifndef VBOX_OSE 7122 7133 if (g_cbVgaDefBiosLogoNY) 7123 pThis ->cbLogo = g_cbVgaDefBiosLogoNY;7134 pThisCC->cbLogo = g_cbVgaDefBiosLogoNY; 7124 7135 # endif 7125 pThis ->cbLogo += sizeof(LogoHdr);7126 7127 pThis ->pbLogo = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, pThis->cbLogo);7128 if (pThis ->pbLogo)7136 pThisCC->cbLogo += sizeof(LogoHdr); 7137 7138 pThisCC->pbLogo = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, pThisCC->cbLogo); 7139 if (pThisCC->pbLogo) 7129 7140 { 7130 7141 /* 7131 7142 * Write the logo header. 7132 7143 */ 7133 PLOGOHDR pLogoHdr = (PLOGOHDR)pThis ->pbLogo;7144 PLOGOHDR pLogoHdr = (PLOGOHDR)pThisCC->pbLogo; 7134 7145 *pLogoHdr = LogoHdr; 7135 7146 … … 7137 7148 * Write the logo bitmap. 7138 7149 */ 7139 if (pThis ->pszLogoFile)7150 if (pThisCC->pszLogoFile) 7140 7151 { 7141 7152 rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL); 7142 7153 if (RT_SUCCESS(rc)) 7143 rc = vbeR3ParseBitmap(pThis );7154 rc = vbeR3ParseBitmap(pThisCC); 7144 7155 if (RT_FAILURE(rc)) 7145 7156 { 7146 7157 LogRel(("Error %Rrc reading logo file '%s', using internal logo\n", 7147 rc, pThis ->pszLogoFile));7158 rc, pThisCC->pszLogoFile)); 7148 7159 pLogoHdr->cbLogo = LogoHdr.cbLogo = g_cbVgaDefBiosLogo; 7149 7160 } 7150 7161 } 7151 if ( !pThis ->pszLogoFile7162 if ( !pThisCC->pszLogoFile 7152 7163 || RT_FAILURE(rc)) 7153 7164 { … … 7164 7175 pLogoHdr->cbLogo = LogoHdr.cbLogo = g_cbVgaDefBiosLogoNY; 7165 7176 memcpy(pLogoHdr + 1, g_abVgaDefBiosLogoNY, LogoHdr.cbLogo); 7166 pThis ->fBootMenuInverse = true;7177 pThisCC->fBootMenuInverse = true; 7167 7178 } 7168 7179 else 7169 7180 # endif 7170 7181 memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo); 7171 rc = vbeR3ParseBitmap(pThis); 7172 if (RT_FAILURE(rc)) 7173 AssertReleaseMsgFailed(("Parsing of internal bitmap failed! vbeR3ParseBitmap() -> %Rrc\n", rc)); 7182 rc = vbeR3ParseBitmap(pThisCC); 7183 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Parsing of internal bitmap failed! vbeR3ParseBitmap() -> %Rrc\n", rc), rc); 7174 7184 } 7175 7185 … … 7186 7196 7187 7197 # ifdef VBOX_WITH_HGSMI 7188 VBVAInit (pThis);7198 VBVAInit(pDevIns, pThis, pThisCC); 7189 7199 # endif 7190 7200 … … 7192 7202 if (rc == VINF_SUCCESS) 7193 7203 { 7194 rc = vboxVDMAConstruct(pThis, 1024);7204 rc = vboxVDMAConstruct(pThis, pThisCC, 1024); 7195 7205 AssertRC(rc); 7196 7206 } … … 7227 7237 * Attach status driver (optional). 7228 7238 */ 7229 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis ->IBase, &pBase, "Status Port");7239 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThisCC->IBase, &pBase, "Status Port"); 7230 7240 if (RT_SUCCESS(rc)) 7231 pThis ->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);7241 pThisCC->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS); 7232 7242 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 7233 7243 { … … 7252 7262 { 7253 7263 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 7254 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 7264 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 7265 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 7255 7266 7256 7267 int rc = PDMDevHlpSetDeviceCritSect(pDevIns, &pThis->CritSect); … … 7311 7322 */ 7312 7323 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE) || (defined(IN_RING0) && defined(VGA_WITH_PARTIAL_RING0_MAPPING)) 7313 rc = PDMDevHlpMmio2SetUpContext(pDevIns, pThis->hMmio2VRam, 0 /* off */, VGA_MAPPING_SIZE, (void **)&pThis ->CTX_SUFF(vram_ptr));7324 rc = PDMDevHlpMmio2SetUpContext(pDevIns, pThis->hMmio2VRam, 0 /* off */, VGA_MAPPING_SIZE, (void **)&pThisCC->pbVRam); 7314 7325 AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMmio2SetUpContext(,VRAM,0,%#x,) -> %Rrc\n", VGA_MAPPING_SIZE, rc), rc); 7315 7326 # endif … … 7349 7360 /* .uSharedVersion = */ 42, 7350 7361 /* .cbInstanceShared = */ sizeof(VGASTATE), 7351 /* .cbInstanceCC = */ 0,7352 /* .cbInstanceRC = */ 0,7362 /* .cbInstanceCC = */ sizeof(VGASTATECC), 7363 /* .cbInstanceRC = */ sizeof(VGASTATERC), 7353 7364 /* .cMaxPciDevices = */ 1, 7354 7365 /* .cMaxMsixVectors = */ 0, -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r82094 r82109 282 282 283 283 284 /** 285 * The shared VGA state data. 286 */ 284 287 typedef struct VGAState 285 288 { 286 #ifndef VBOX287 VGA_STATE_COMMON288 #else /* VBOX */289 R3PTRTYPE(uint8_t *) vram_ptrR3;290 R3PTRTYPE(FNGETBPP *) get_bpp;291 R3PTRTYPE(FNGETOFFSETS *) get_offsets;292 R3PTRTYPE(FNGETRESOLUTION *) get_resolution;293 R3PTRTYPE(FNRGBTOPIXEL *) rgb_to_pixel;294 R3PTRTYPE(FNCURSORINVALIDATE *) cursor_invalidate;295 R3PTRTYPE(FNCURSORDRAWLINE *) cursor_draw_line;296 RTR3PTR R3PtrCmnAlignment;297 289 uint32_t vram_size; 298 290 uint32_t latch; … … 337 329 bool last_cur_blink, last_chr_blink; 338 330 uint32_t cursor_offset; 339 /* hardware mouse cursor support */331 /** hardware mouse cursor support */ 340 332 uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32]; 341 /* tell for each page if it has been updated since the last time */333 /** tell for each page if it has been updated since the last time */ 342 334 uint32_t last_palette[256]; 343 335 uint32_t last_ch_attr[CH_ATTR_SIZE]; /* XXX: make it dynamic */ … … 346 338 uint32_t u32Marker; 347 339 348 # ifdef VBOX_WITH_RAW_MODE_KEEP349 /** Pointer to the device instance - RC Ptr. */350 PPDMDEVINSRC pDevInsRC;351 /** Pointer to the GC vram mapping. */352 RCPTRTYPE(uint8_t *) vram_ptrRC;353 uint32_t Padding1;354 # endif355 356 /** Pointer to the device instance - R3 Ptr. */357 PPDMDEVINSR3 pDevInsR3;358 # ifdef VBOX_WITH_HGSMI359 R3PTRTYPE(PHGSMIINSTANCE) pHGSMI;360 # endif361 # ifdef VBOX_WITH_VDMA362 R3PTRTYPE(PVBOXVDMAHOST) pVdma;363 # endif364 /** LUN\#0: The display port base interface. */365 PDMIBASE IBase;366 /** LUN\#0: The display port interface. */367 PDMIDISPLAYPORT IPort;368 # if defined(VBOX_WITH_HGSMI)369 /** LUN\#0: VBVA callbacks interface */370 PDMIDISPLAYVBVACALLBACKS IVBVACallbacks;371 # else372 RTR3PTR Padding2;373 # endif374 /** Status LUN: Leds interface. */375 PDMILEDPORTS ILeds;376 377 /** Pointer to base interface of the driver. */378 R3PTRTYPE(PPDMIBASE) pDrvBase;379 /** Pointer to display connector interface of the driver. */380 R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;381 382 /** Status LUN: Partner of ILeds. */383 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;384 385 340 /** Refresh timer handle - HC. */ 386 341 TMTIMERHANDLE hRefreshTimer; 387 342 388 /** Pointer to the device instance - R0 Ptr. */ 389 PPDMDEVINSR0 pDevInsR0; 390 /** The R0 vram pointer... */ 391 R0PTRTYPE(uint8_t *) vram_ptrR0; 392 393 # ifdef VBOX_WITH_VMSVGA 343 #ifdef VBOX_WITH_VMSVGA 394 344 VMSVGAState svga; 395 # 345 #endif 396 346 397 347 /** The number of monitors. */ … … 412 362 /** Whether 3D is enabled for the VM. */ 413 363 bool f3DEnabled; 414 # 364 #ifdef VBOX_WITH_VMSVGA 415 365 /* Whether the SVGA emulation is enabled or not. */ 416 366 bool fVMSVGAEnabled; … … 418 368 bool fVMSVGAPciBarLayout; 419 369 bool Padding4[4]; 420 # 370 #else 421 371 bool Padding4[3+4]; 422 # 372 #endif 423 373 424 374 struct { 425 375 uint32_t u32Padding1; 426 376 uint32_t iVRAM; 427 # 377 #ifdef VBOX_WITH_VMSVGA 428 378 uint32_t iIO; 429 379 uint32_t iFIFO; 430 # 380 #endif 431 381 } pciRegions; 432 382 … … 438 388 /** The critical section protect the instance data. */ 439 389 PDMCRITSECT CritSect; 440 441 STAMPROFILE StatRZMemoryRead;442 STAMPROFILE StatR3MemoryRead;443 STAMPROFILE StatRZMemoryWrite;444 STAMPROFILE StatR3MemoryWrite;445 STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */446 STAMCOUNTER StatUpdateDisp; /**< Counts vgaPortUpdateDisplay calls. */447 # ifdef VBOX_WITH_HGSMI448 STAMCOUNTER StatHgsmiMdaCgaAccesses;449 # endif450 390 451 391 /* Keep track of ring 0 latched accesses to the VGA MMIO memory. */ … … 455 395 uint16_t iMask; 456 396 457 # 397 #ifdef VBE_BYTEWISE_IO 458 398 /** VBE read/write data/index flags */ 459 399 uint8_t fReadVBEData; … … 467 407 uint8_t cbWriteVBEExtraAddress; 468 408 uint8_t Padding5; 469 # 409 #endif 470 410 471 411 /** Retrace emulation state */ … … 474 414 vga_retrace_s retrace_state; 475 415 476 /** The VBE BIOS extra data. */ 477 R3PTRTYPE(uint8_t *) pbVBEExtraData; 478 /** The size of the VBE BIOS extra data. */ 479 uint16_t cbVBEExtraData; 480 /** The VBE BIOS current memory address. */ 481 uint16_t u16VBEExtraAddress; 482 uint16_t Padding7[2]; 483 484 /** The BIOS logo data. */ 485 R3PTRTYPE(uint8_t *) pbLogo; 486 /** The name of the logo file. */ 487 R3PTRTYPE(char *) pszLogoFile; 488 /** Bitmap image data. */ 489 R3PTRTYPE(uint8_t *) pbLogoBitmap; 416 #ifdef VBOX_WITH_HGSMI 417 /** Base port in the assigned PCI I/O space. */ 418 RTIOPORT IOPortBase; 419 # ifdef VBOX_WITH_WDDM 420 uint8_t Padding10[2]; 421 /** Specifies guest driver caps, i.e. whether it can handle IRQs from the 422 * adapter, the way it can handle async HGSMI command completion, etc. */ 423 uint32_t fGuestCaps; 424 uint32_t fScanLineCfg; 425 uint32_t Padding11; 426 # else 427 uint8_t Padding11[14]; 428 # endif 429 430 /** The critical section serializes the HGSMI IRQ setting/clearing. */ 431 PDMCRITSECT CritSectIRQ; 432 /** VBVARaiseIRQ flags which were set when the guest was still processing previous IRQ. */ 433 uint32_t fu32PendingGuestFlags; 434 uint32_t Padding12; 435 #endif /* VBOX_WITH_HGSMI */ 436 437 PDMLED Led3D; 438 439 struct { 440 volatile uint32_t cPending; 441 uint32_t Padding1; 442 union 443 { 444 RTLISTNODE PendingList; 445 /* make sure the structure sized cross different contexts correctly */ 446 struct 447 { 448 R3PTRTYPE(void *) dummy1; 449 R3PTRTYPE(void *) dummy2; 450 } dummy; 451 }; 452 } pendingVhwaCommands; 453 454 /** The MMIO handle of the legacy graphics buffer/regs at 0xa0000-0xbffff. */ 455 PGMMMIO2HANDLE hMmioLegacy; 456 457 /** @name I/O ports for range 0x3c0-3cf. 458 * @{ */ 459 IOMIOPORTHANDLE hIoPortAr; 460 IOMIOPORTHANDLE hIoPortMsrSt00; 461 IOMIOPORTHANDLE hIoPort3c3; 462 IOMIOPORTHANDLE hIoPortSr; 463 IOMIOPORTHANDLE hIoPortDac; 464 IOMIOPORTHANDLE hIoPortPos; 465 IOMIOPORTHANDLE hIoPortGr; 466 /** @} */ 467 468 /** @name I/O ports for MDA 0x3b0-0x3bf (sparse) 469 * @{ */ 470 IOMIOPORTHANDLE hIoPortMdaCrt; 471 IOMIOPORTHANDLE hIoPortMdaFcrSt; 472 /** @} */ 473 474 /** @name I/O ports for CGA 0x3d0-0x3df (sparse) 475 * @{ */ 476 IOMIOPORTHANDLE hIoPortCgaCrt; 477 IOMIOPORTHANDLE hIoPortCgaFcrSt; 478 /** @} */ 479 480 #ifdef VBOX_WITH_HGSMI 481 /** @name I/O ports for HGSMI 0x3b0-03b3 and 0x3d0-03d3 (ring-3 only) 482 * @{ */ 483 IOMIOPORTHANDLE hIoPortHgsmiHost; 484 IOMIOPORTHANDLE hIoPortHgsmiGuest; 485 /** @} */ 486 #endif 487 488 /** @name I/O ports for Boch VBE 0x1ce-0x1cf 489 * @{ */ 490 IOMIOPORTHANDLE hIoPortVbeIndex; 491 IOMIOPORTHANDLE hIoPortVbeData; 492 /** @} */ 493 494 /** The BIOS printf I/O port. */ 495 IOMIOPORTHANDLE hIoPortBios; 496 /** The VBE extra data I/O port. */ 497 IOMIOPORTHANDLE hIoPortVbeExtra; 498 /** The logo command I/O port. */ 499 IOMIOPORTHANDLE hIoPortCmdLogo; 500 501 #ifdef VBOX_WITH_VMSVGA 502 /** VMSVGA: I/O port PCI region. */ 503 IOMIOPORTHANDLE hIoPortVmSvga; 504 /** VMSVGA: The MMIO2 handle of the FIFO PCI region. */ 505 PGMMMIO2HANDLE hMmio2VmSvgaFifo; 506 #endif 507 /** The MMIO2 handle of the VRAM. */ 508 PGMMMIO2HANDLE hMmio2VRam; 509 510 STAMPROFILE StatRZMemoryRead; 511 STAMPROFILE StatR3MemoryRead; 512 STAMPROFILE StatRZMemoryWrite; 513 STAMPROFILE StatR3MemoryWrite; 514 STAMCOUNTER StatMapPage; /**< Counts IOMMMIOMapMMIO2Page calls. */ 515 STAMCOUNTER StatUpdateDisp; /**< Counts vgaPortUpdateDisplay calls. */ 516 #ifdef VBOX_WITH_HGSMI 517 STAMCOUNTER StatHgsmiMdaCgaAccesses; 518 #endif 519 } VGAState; 520 #ifdef VBOX 521 /** VGA state. */ 522 typedef VGAState VGASTATE; 523 /** Pointer to the VGA state. */ 524 typedef VGASTATE *PVGASTATE; 525 AssertCompileMemberAlignment(VGASTATE, bank_offset, 8); 526 AssertCompileMemberAlignment(VGASTATE, font_offsets, 8); 527 AssertCompileMemberAlignment(VGASTATE, last_ch_attr, 8); 528 AssertCompileMemberAlignment(VGASTATE, u32Marker, 8); 529 #endif 530 531 532 /** 533 * The VGA state data for ring-3 context. 534 */ 535 typedef struct VGASTATER3 536 { 537 R3PTRTYPE(uint8_t *) pbVRam; 538 R3PTRTYPE(FNGETBPP *) get_bpp; 539 R3PTRTYPE(FNGETOFFSETS *) get_offsets; 540 R3PTRTYPE(FNGETRESOLUTION *) get_resolution; 541 R3PTRTYPE(FNRGBTOPIXEL *) rgb_to_pixel; 542 R3PTRTYPE(FNCURSORINVALIDATE *) cursor_invalidate; 543 R3PTRTYPE(FNCURSORDRAWLINE *) cursor_draw_line; 544 545 /** Pointer to the device instance. 546 * @note Only for getting our bearings in interface methods. */ 547 PPDMDEVINSR3 pDevIns; 548 #ifdef VBOX_WITH_HGSMI 549 R3PTRTYPE(PHGSMIINSTANCE) pHGSMI; 550 #endif 551 #ifdef VBOX_WITH_VDMA 552 R3PTRTYPE(PVBOXVDMAHOST) pVdma; 553 #endif 554 555 /** LUN\#0: The display port base interface. */ 556 PDMIBASE IBase; 557 /** LUN\#0: The display port interface. */ 558 PDMIDISPLAYPORT IPort; 559 #ifdef VBOX_WITH_HGSMI 560 /** LUN\#0: VBVA callbacks interface */ 561 PDMIDISPLAYVBVACALLBACKS IVBVACallbacks; 562 #endif 563 /** Status LUN: Leds interface. */ 564 PDMILEDPORTS ILeds; 565 566 /** Pointer to base interface of the driver. */ 567 R3PTRTYPE(PPDMIBASE) pDrvBase; 568 /** Pointer to display connector interface of the driver. */ 569 R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv; 570 571 /** Status LUN: Partner of ILeds. */ 572 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 573 574 /** The VGA BIOS ROM data. */ 575 R3PTRTYPE(uint8_t *) pbVgaBios; 576 /** The size of the VGA BIOS ROM. */ 577 uint64_t cbVgaBios; 578 /** The name of the VGA BIOS ROM file. */ 579 R3PTRTYPE(char *) pszVgaBiosFile; 580 581 /** @name Logo data 582 * @{ */ 490 583 /** Current logo data offset. */ 491 584 uint32_t offLogoData; … … 514 607 /** Palette data. */ 515 608 uint32_t au32LogoPalette[256]; 516 517 /** The VGA BIOS ROM data. */ 518 R3PTRTYPE(uint8_t *) pbVgaBios; 519 /** The size of the VGA BIOS ROM. */ 520 uint64_t cbVgaBios; 521 /** The name of the VGA BIOS ROM file. */ 522 R3PTRTYPE(char *) pszVgaBiosFile; 523 # if HC_ARCH_BITS == 32 524 uint32_t Padding9; 525 # endif 526 527 # ifdef VBOX_WITH_HGSMI 528 /** Base port in the assigned PCI I/O space. */ 529 RTIOPORT IOPortBase; 530 # ifdef VBOX_WITH_WDDM 531 uint8_t Padding10[2]; 532 /** Specifies guest driver caps, i.e. whether it can handle IRQs from the 533 * adapter, the way it can handle async HGSMI command completion, etc. */ 534 uint32_t fGuestCaps; 535 uint32_t fScanLineCfg; 536 uint32_t Padding11; 537 # else 538 uint8_t Padding11[14]; 539 # endif 540 541 /** The critical section serializes the HGSMI IRQ setting/clearing. */ 542 PDMCRITSECT CritSectIRQ; 543 /** VBVARaiseIRQ flags which were set when the guest was still processing previous IRQ. */ 544 uint32_t fu32PendingGuestFlags; 545 uint32_t Padding12; 546 # endif /* VBOX_WITH_HGSMI */ 547 548 PDMLED Led3D; 549 550 struct { 551 volatile uint32_t cPending; 552 uint32_t Padding1; 553 union 554 { 555 RTLISTNODE PendingList; 556 /* make sure the structure sized cross different contexts correctly */ 557 struct 558 { 559 R3PTRTYPE(void *) dummy1; 560 R3PTRTYPE(void *) dummy2; 561 } dummy; 562 }; 563 } pendingVhwaCommands; 564 565 /** The MMIO handle of the legacy graphics buffer/regs at 0xa0000-0xbffff. */ 566 PGMMMIO2HANDLE hMmioLegacy; 567 568 /** @name I/O ports for range 0x3c0-3cf. 609 /** The BIOS logo data. */ 610 R3PTRTYPE(uint8_t *) pbLogo; 611 /** The name of the logo file. */ 612 R3PTRTYPE(char *) pszLogoFile; 613 /** Bitmap image data. */ 614 R3PTRTYPE(uint8_t *) pbLogoBitmap; 615 /** @} */ 616 617 /** @name VBE extra data (modes) 569 618 * @{ */ 570 IOMIOPORTHANDLE hIoPortAr;571 IOMIOPORTHANDLE hIoPortMsrSt00;572 IOMIOPORTHANDLE hIoPort3c3;573 IOMIOPORTHANDLE hIoPortSr;574 IOMIOPORTHANDLE hIoPortDac;575 IOMIOPORTHANDLE hIoPortPos;576 IOMIOPORTHANDLE hIoPortGr;619 /** The VBE BIOS extra data. */ 620 R3PTRTYPE(uint8_t *) pbVBEExtraData; 621 /** The size of the VBE BIOS extra data. */ 622 uint16_t cbVBEExtraData; 623 /** The VBE BIOS current memory address. */ 624 uint16_t u16VBEExtraAddress; 625 uint16_t Padding7[2]; 577 626 /** @} */ 578 627 579 /** @name I/O ports for MDA 0x3b0-0x3bf (sparse) 580 * @{ */ 581 IOMIOPORTHANDLE hIoPortMdaCrt; 582 IOMIOPORTHANDLE hIoPortMdaFcrSt; 583 /** @} */ 584 585 /** @name I/O ports for CGA 0x3d0-0x3df (sparse) 586 * @{ */ 587 IOMIOPORTHANDLE hIoPortCgaCrt; 588 IOMIOPORTHANDLE hIoPortCgaFcrSt; 589 /** @} */ 590 591 # ifdef VBOX_WITH_HGSMI 592 /** @name I/O ports for HGSMI 0x3b0-03b3 and 0x3d0-03d3 (ring-3 only) 593 * @{ */ 594 IOMIOPORTHANDLE hIoPortHgsmiHost; 595 IOMIOPORTHANDLE hIoPortHgsmiGuest; 596 /** @} */ 597 # endif 598 599 /** @name I/O ports for Boch VBE 0x1ce-0x1cf 600 * @{ */ 601 IOMIOPORTHANDLE hIoPortVbeIndex; 602 IOMIOPORTHANDLE hIoPortVbeData; 603 /** @} */ 604 605 /** The BIOS printf I/O port. */ 606 IOMIOPORTHANDLE hIoPortBios; 607 /** The VBE extra data I/O port. */ 608 IOMIOPORTHANDLE hIoPortVbeExtra; 609 /** The logo command I/O port. */ 610 IOMIOPORTHANDLE hIoPortCmdLogo; 611 612 # ifdef VBOX_WITH_VMSVGA 613 /** VMSVGA: I/O port PCI region. */ 614 IOMIOPORTHANDLE hIoPortVmSvga; 615 /** VMSVGA: The MMIO2 handle of the FIFO PCI region. */ 616 PGMMMIO2HANDLE hMmio2VmSvgaFifo; 617 # endif 618 /** The MMIO2 handle of the VRAM. */ 619 PGMMMIO2HANDLE hMmio2VRam; 620 #endif /* VBOX */ 621 } VGAState; 622 #ifdef VBOX 623 /** VGA state. */ 624 typedef VGAState VGASTATE; 625 /** Pointer to the VGA state. */ 626 typedef VGASTATE *PVGASTATE; 627 AssertCompileMemberAlignment(VGASTATE, bank_offset, 8); 628 AssertCompileMemberAlignment(VGASTATE, font_offsets, 8); 629 AssertCompileMemberAlignment(VGASTATE, last_ch_attr, 8); 630 AssertCompileMemberAlignment(VGASTATE, u32Marker, 8); 631 #endif 628 } VGASTATER3; 629 /** Pointer to the ring-3 VGA state. */ 630 typedef VGASTATER3 *PVGASTATER3; 631 632 633 /** 634 * The VGA state data for ring-0 context. 635 */ 636 typedef struct VGASTATER0 637 { 638 /** The R0 vram pointer... */ 639 R0PTRTYPE(uint8_t *) pbVRam; 640 } VGASTATER0; 641 /** Pointer to the ring-0 VGA state. */ 642 typedef VGASTATER0 *PVGASTATER0; 643 644 645 /** 646 * The VGA state data for raw-mode context. 647 */ 648 typedef struct VGASTATERC 649 { 650 /** Pointer to the GC vram mapping. */ 651 RCPTRTYPE(uint8_t *) pbVRam; 652 } VGASTATERC; 653 /** Pointer to the raw-mode VGA state. */ 654 typedef VGASTATERC *PVGASTATERC; 655 656 657 /** The VGA state for the current context. */ 658 typedef CTX_SUFF(VGASTATE) VGASTATECC; 659 /** Pointer to the VGA state for the current context. */ 660 typedef CTX_SUFF(PVGASTATE) PVGASTATECC; 661 662 632 663 633 664 /** VBE Extra Data. */ … … 648 679 649 680 #ifdef VBOX_WITH_HGSMI 650 int VBVAInit (PVGASTATE pVGAState); 651 void VBVADestroy (PVGASTATE pVGAState); 652 int VBVAUpdateDisplay (PVGASTATE pVGAState); 653 void VBVAReset (PVGASTATE pVGAState); 654 void VBVAPause (PVGASTATE pVGAState, bool fPause); 655 void VBVAOnVBEChanged(PVGASTATE pVGAState); 656 void VBVAOnResume(PVGASTATE pThis); 657 658 bool VBVAIsPaused(PVGASTATE pVGAState); 659 bool VBVAIsEnabled(PVGASTATE pVGAState); 660 661 void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags); 662 663 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pView); 664 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen); 665 int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen); 681 int VBVAInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 682 void VBVADestroy(PVGASTATECC pThisCC); 683 int VBVAUpdateDisplay(PVGASTATE pThis, PVGASTATECC pThisCC); 684 void VBVAReset(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 685 void VBVAOnVBEChanged(PVGASTATE pThis, PVGASTATECC pThisCC); 686 void VBVAOnResume(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 687 688 bool VBVAIsPaused(PVGASTATECC pThisCC); 689 #ifdef UNUSED_FUNCTION 690 bool VBVAIsEnabled(PVGASTATECC pThisCC); 691 #endif 692 693 void VBVARaiseIrq(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t fFlags); 694 695 int VBVAInfoScreen(PVGASTATE pThis, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen); 696 #ifdef UNUSED_FUNCTION 697 int VBVAGetInfoViewAndScreen(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t u32ViewIndex, 698 VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen); 699 #endif 666 700 667 701 /* @return host-guest flags that were set on reset … … 673 707 DECLCALLBACK(int) vbvaR3VHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, 674 708 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd); 675 int vbvaVHWAConstruct(PVGASTATE pVGAState); 676 int vbvaVHWAReset(PVGASTATE pVGAState); 677 678 void vbvaTimerCb(PVGASTATE pVGAState); 709 int vbvaVHWAConstruct(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 710 711 void vbvaTimerCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC); 679 712 680 713 int vboxVBVASaveStatePrep(PPDMDEVINS pDevIns); … … 682 715 # endif 683 716 684 #define PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(_pcb) ( (PVGASTATE)((uint8_t *)(_pcb) - RT_OFFSETOF(VGASTATE, IVBVACallbacks)) )685 686 717 int vboxVBVASaveStateExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM); 687 718 int vboxVBVALoadStateExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version); … … 693 724 # ifdef VBOX_WITH_VDMA 694 725 typedef struct VBOXVDMAHOST *PVBOXVDMAHOST; 695 int vboxVDMAConstruct(PVGASTATE p VGAState, uint32_t cPipeElements);726 int vboxVDMAConstruct(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t cPipeElements); 696 727 void vboxVDMADestruct(PVBOXVDMAHOST pVdma); 697 728 void vboxVDMAReset(PVBOXVDMAHOST pVdma); … … 708 739 709 740 # ifdef VBOX_WITH_VMSVGA 710 int vgaR3 RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer);711 int vgaR3 UnregisterVRAMHandler(PVGASTATE pVGAState);712 int vgaR3UpdateDisplay(PVGASTATE p VGAState, unsigned xStart, unsigned yStart, unsigned width, unsigned height);741 int vgaR3UnregisterVRAMHandler(PPDMDEVINS pDevIns, PVGASTATE pThis); 742 int vgaR3RegisterVRAMHandler(PPDMDEVINS pDevIns, PVGASTATE pThis, uint64_t cbFrameBuffer); 743 int vgaR3UpdateDisplay(PVGASTATE pThis, unsigned xStart, unsigned yStart, unsigned width, unsigned height); 713 744 # endif 714 745 -
trunk/src/VBox/Devices/Graphics/DevVGATmpl.h
r76553 r82109 181 181 * 4 color mode 182 182 */ 183 static void RT_CONCAT(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,183 static void RT_CONCAT(vga_draw_line2_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 184 184 const uint8_t *s, int width) 185 185 { 186 186 uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode; 187 187 int x; 188 RT_NOREF(pThisCC); 188 189 189 190 palette = s1->last_palette; … … 225 226 * 4 color mode, dup2 horizontal 226 227 */ 227 static void RT_CONCAT(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,228 static void RT_CONCAT(vga_draw_line2d2_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 228 229 const uint8_t *s, int width) 229 230 { 230 231 uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode; 231 232 int x; 233 RT_NOREF(pThisCC); 232 234 233 235 palette = s1->last_palette; … … 260 262 * 16 color mode 261 263 */ 262 static void RT_CONCAT(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,264 static void RT_CONCAT(vga_draw_line4_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 263 265 const uint8_t *s, int width) 264 266 { 265 267 uint32_t plane_mask, data, v, *palette, vram_ofs; 266 268 int x; 267 268 vram_ofs = s - s1->vram_ptrR3; 269 RT_NOREF(pThisCC); 270 271 vram_ofs = s - pThisCC->pbVRam; 269 272 palette = s1->last_palette; 270 273 plane_mask = mask16[s1->ar[0x12] & 0xf]; 271 274 width >>= 3; 272 275 for(x = 0; x < width; x++) { 273 s = s1->vram_ptrR3+ (vram_ofs & s1->vga_addr_mask);276 s = pThisCC->pbVRam + (vram_ofs & s1->vga_addr_mask); 274 277 data = ((uint32_t *)s)[0]; 275 278 data &= plane_mask; … … 294 297 * 16 color mode, dup2 horizontal 295 298 */ 296 static void RT_CONCAT(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,299 static void RT_CONCAT(vga_draw_line4d2_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 297 300 const uint8_t *s, int width) 298 301 { 299 302 uint32_t plane_mask, data, v, *palette; 300 303 int x; 304 RT_NOREF(pThisCC); 301 305 302 306 palette = s1->last_palette; … … 328 332 * XXX: add plane_mask support (never used in standard VGA modes) 329 333 */ 330 static void RT_CONCAT(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,334 static void RT_CONCAT(vga_draw_line8d2_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 331 335 const uint8_t *s, int width) 332 336 { 333 337 uint32_t *palette; 334 338 int x; 339 RT_NOREF(pThisCC); 335 340 336 341 palette = s1->last_palette; … … 351 356 * XXX: add plane_mask support (never used in standard VGA modes) 352 357 */ 353 static void RT_CONCAT(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,358 static void RT_CONCAT(vga_draw_line8_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 354 359 const uint8_t *s, int width) 355 360 { 356 361 uint32_t *palette; 357 362 int x; 363 RT_NOREF(pThisCC); 358 364 359 365 palette = s1->last_palette; … … 381 387 * 15 bit color 382 388 */ 383 static void RT_CONCAT(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,389 static void RT_CONCAT(vga_draw_line15_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 384 390 const uint8_t *s, int width) 385 391 { 392 RT_NOREF(s1, pThisCC); 386 393 #if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) 387 394 memcpy(d, s, width * 2); … … 401 408 } while (--w != 0); 402 409 #endif 403 NOREF(s1);404 410 } 405 411 … … 407 413 * 16 bit color 408 414 */ 409 static void RT_CONCAT(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,415 static void RT_CONCAT(vga_draw_line16_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 410 416 const uint8_t *s, int width) 411 417 { 418 RT_NOREF(s1, pThisCC); 412 419 #if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) 413 420 memcpy(d, s, width * 2); … … 427 434 } while (--w != 0); 428 435 #endif 429 NOREF(s1);430 436 } 431 437 … … 433 439 * 24 bit color 434 440 */ 435 static void RT_CONCAT(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,441 static void RT_CONCAT(vga_draw_line24_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 436 442 const uint8_t *s, int width) 437 443 { 438 444 int w; 439 445 uint32_t r, g, b; 440 NOREF(s1);446 RT_NOREF(s1, pThisCC); 441 447 442 448 w = width; … … 460 466 * 32 bit color 461 467 */ 462 static void RT_CONCAT(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,468 static void RT_CONCAT(vga_draw_line32_, DEPTH)(VGAState *s1, PVGASTATER3 pThisCC, uint8_t *d, 463 469 const uint8_t *s, int width) 464 470 { 471 RT_NOREF(s1, pThisCC); 465 472 #if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) 466 473 memcpy(d, s, width * 4); … … 485 492 } while (--w != 0); 486 493 #endif 487 NOREF(s1);488 494 } 489 495 -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r82088 r82109 383 383 } 384 384 385 static int vbvaFlushProcess( unsigned uScreenId, PVGASTATE pVGAState, VBVADATA *pVBVAData)385 static int vbvaFlushProcess(PVGASTATECC pThisCC, VBVADATA *pVBVAData, unsigned uScreenId) 386 386 { 387 387 LOGVBVABUFFER(("uScreenId %d, indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n", 388 388 uScreenId, pVBVAData->indexRecordFirst, pVBVAData->guest.pVBVA->indexRecordFree, 389 389 pVBVAData->off32Data, pVBVAData->guest.pVBVA->off32Free)); 390 struct { 390 struct 391 { 391 392 /* The rectangle that includes all dirty rectangles. */ 392 393 int32_t xLeft; … … 430 431 if (!fUpdate) 431 432 { 432 p VGAState->pDrv->pfnVBVAUpdateBegin(pVGAState->pDrv, uScreenId);433 pThisCC->pDrv->pfnVBVAUpdateBegin(pThisCC->pDrv, uScreenId); 433 434 fUpdate = true; 434 435 } 435 436 436 437 /* Updates the rectangle and sends the command to the VRDP server. */ 437 p VGAState->pDrv->pfnVBVAUpdateProcess(pVGAState->pDrv, uScreenId, pHdr, cbCmd);438 pThisCC->pDrv->pfnVBVAUpdateProcess(pThisCC->pDrv, uScreenId, pHdr, cbCmd); 438 439 439 440 int32_t xRight = pHdr->x + pHdr->w; … … 492 493 dirtyRect.yTop, dirtyRect.xRight - dirtyRect.xLeft, 493 494 dirtyRect.yBottom - dirtyRect.yTop)); 494 p VGAState->pDrv->pfnVBVAUpdateEnd(pVGAState->pDrv, uScreenId, dirtyRect.xLeft, dirtyRect.yTop,495 pThisCC->pDrv->pfnVBVAUpdateEnd(pThisCC->pDrv, uScreenId, dirtyRect.xLeft, dirtyRect.yTop, 495 496 dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop); 496 497 } 497 498 else 498 499 { 499 p VGAState->pDrv->pfnVBVAUpdateEnd(pVGAState->pDrv, uScreenId, 0, 0, 0, 0);500 pThisCC->pDrv->pfnVBVAUpdateEnd(pThisCC->pDrv, uScreenId, 0, 0, 0, 0); 500 501 } 501 502 } … … 504 505 } 505 506 506 static int vbvaFlush(PVGASTATE p VGAState, VBVACONTEXT *pCtx)507 static int vbvaFlush(PVGASTATE pThis, PVGASTATECC pThisCC, VBVACONTEXT *pCtx) 507 508 { 508 509 int rc = VINF_SUCCESS; … … 514 515 if (pVBVAData->guest.pVBVA) 515 516 { 516 rc = vbvaFlushProcess( uScreenId, pVGAState, pVBVAData);517 rc = vbvaFlushProcess(pThisCC, pVBVAData, uScreenId); 517 518 if (RT_FAILURE(rc)) 518 519 break; … … 524 525 /* Turn off VBVA processing. */ 525 526 LogRel(("VBVA: Disabling (%Rrc)\n", rc)); 526 p VGAState->fGuestCaps = 0;527 p VGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps);527 pThis->fGuestCaps = 0; 528 pThisCC->pDrv->pfnVBVAGuestCapabilityUpdate(pThisCC->pDrv, pThis->fGuestCaps); 528 529 for (uScreenId = 0; uScreenId < pCtx->cViews; uScreenId++) 529 530 { … … 532 533 { 533 534 vbvaDataCleanup(pVBVAData); 534 p VGAState->pDrv->pfnVBVADisable(pVGAState->pDrv, uScreenId);535 pThisCC->pDrv->pfnVBVADisable(pThisCC->pDrv, uScreenId); 535 536 } 536 537 } … … 540 541 } 541 542 542 static int vbvaResize(PVGASTATE pVGAState, VBVAVIEW *pView, const VBVAINFOSCREEN *pNewScreen, bool fResetInputMapping)543 static int vbvaResize(PVGASTATECC pThisCC, VBVAVIEW *pView, const VBVAINFOSCREEN *pNewScreen, bool fResetInputMapping) 543 544 { 544 545 /* Callers ensure that pNewScreen contains valid data. */ … … 547 548 pView->screen = *pNewScreen; 548 549 549 uint8_t *p u8VRAM = pVGAState->vram_ptrR3+ pView->view.u32ViewOffset;550 return p VGAState->pDrv->pfnVBVAResize (pVGAState->pDrv, &pView->view, &pView->screen, pu8VRAM, fResetInputMapping);551 } 552 553 static int vbvaEnable( unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pCtx,550 uint8_t *pbVRam = pThisCC->pbVRam + pView->view.u32ViewOffset; 551 return pThisCC->pDrv->pfnVBVAResize(pThisCC->pDrv, &pView->view, &pView->screen, pbVRam, fResetInputMapping); 552 } 553 554 static int vbvaEnable(PVGASTATE pThis, PVGASTATECC pThisCC, VBVACONTEXT *pCtx, unsigned uScreenId, 554 555 VBVABUFFER RT_UNTRUSTED_VOLATILE_GUEST *pVBVA, uint32_t u32Offset, bool fRestored) 555 556 { … … 563 564 uint32_t const cbVBVABuffer = RT_UOFFSETOF(VBVABUFFER, au8Data) + VbgaSafe.cbData; 564 565 ASSERT_GUEST_RETURN( VbgaSafe.cbData <= UINT32_MAX - RT_UOFFSETOF(VBVABUFFER, au8Data) 565 && cbVBVABuffer <= p VGAState->vram_size566 && u32Offset <= p VGAState->vram_size - cbVBVABuffer,566 && cbVBVABuffer <= pThis->vram_size 567 && u32Offset <= pThis->vram_size - cbVBVABuffer, 567 568 VERR_INVALID_PARAMETER); 568 569 if (!fRestored) … … 582 583 */ 583 584 int rc; 584 if (p VGAState->pDrv->pfnVBVAEnable)585 if (pThisCC->pDrv->pfnVBVAEnable) 585 586 { 586 587 pVBVA->hostFlags.u32HostEvents = 0; 587 588 pVBVA->hostFlags.u32SupportedOrders = 0; 588 rc = p VGAState->pDrv->pfnVBVAEnable(pVGAState->pDrv, uScreenId, &pVBVA->hostFlags);589 rc = pThisCC->pDrv->pfnVBVAEnable(pThisCC->pDrv, uScreenId, &pVBVA->hostFlags); 589 590 if (RT_SUCCESS(rc)) 590 591 { … … 623 624 } 624 625 625 static int vbvaDisable (unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pCtx)626 static int vbvaDisable(PVGASTATE pThis, PVGASTATECC pThisCC, VBVACONTEXT *pCtx, unsigned idScreen) 626 627 { 627 628 /* Process any pending orders and empty the VBVA ring buffer. */ 628 vbvaFlush (pVGAState, pCtx); 629 630 VBVADATA *pVBVAData = &pCtx->aViews[uScreenId].vbva; 629 vbvaFlush(pThis, pThisCC, pCtx); 630 631 AssertReturn(idScreen < RT_ELEMENTS(pCtx->aViews), VERR_OUT_OF_RANGE); 632 VBVADATA *pVBVAData = &pCtx->aViews[idScreen].vbva; 631 633 vbvaDataCleanup(pVBVAData); 632 634 633 if ( uScreenId== 0)634 { 635 p VGAState->fGuestCaps = 0;636 p VGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps);637 } 638 p VGAState->pDrv->pfnVBVADisable(pVGAState->pDrv, uScreenId);635 if (idScreen == 0) 636 { 637 pThis->fGuestCaps = 0; 638 pThisCC->pDrv->pfnVBVAGuestCapabilityUpdate(pThisCC->pDrv, pThis->fGuestCaps); 639 } 640 pThisCC->pDrv->pfnVBVADisable(pThisCC->pDrv, idScreen); 639 641 return VINF_SUCCESS; 640 642 } 641 643 642 bool VBVAIsEnabled(PVGASTATE pVGAState) 643 { 644 PHGSMIINSTANCE pHGSMI = pVGAState->pHGSMI; 644 #ifdef UNUSED_FUNCTION 645 bool VBVAIsEnabled(PVGASTATECC pThisCC) 646 { 647 PHGSMIINSTANCE pHGSMI = pThisCC->pHGSMI; 645 648 if (pHGSMI) 646 649 { … … 658 661 return false; 659 662 } 663 #endif 660 664 661 665 #ifdef DEBUG_sunlover … … 677 681 #endif 678 682 679 static int vbvaUpdateMousePointerShape(PVGASTATE pVGAState, VBVAMOUSESHAPEINFO *pMouseShapeInfo, bool fShape) 680 { 681 LogFlowFunc(("pVGAState %p, pMouseShapeInfo %p, fShape %d\n", 682 pVGAState, pMouseShapeInfo, fShape)); 683 static int vbvaUpdateMousePointerShape(PVGASTATECC pThisCC, VBVAMOUSESHAPEINFO *pMouseShapeInfo, bool fShape) 684 { 685 LogFlowFunc(("pThisCC %p, pMouseShapeInfo %p, fShape %d\n", pThisCC, pMouseShapeInfo, fShape)); 683 686 #ifdef DEBUG_sunlover 684 687 dumpMouseShapeInfo(pMouseShapeInfo); 685 688 #endif 686 689 687 if (pVGAState->pDrv->pfnVBVAMousePointerShape == NULL) 688 { 690 if (pThisCC->pDrv->pfnVBVAMousePointerShape == NULL) 689 691 return VERR_NOT_SUPPORTED; 690 }691 692 692 693 int rc; 693 694 if (fShape && pMouseShapeInfo->pu8Shape != NULL) 694 { 695 rc = pVGAState->pDrv->pfnVBVAMousePointerShape (pVGAState->pDrv, 696 pMouseShapeInfo->fVisible, 697 pMouseShapeInfo->fAlpha, 698 pMouseShapeInfo->u32HotX, 699 pMouseShapeInfo->u32HotY, 700 pMouseShapeInfo->u32Width, 701 pMouseShapeInfo->u32Height, 702 pMouseShapeInfo->pu8Shape); 703 } 695 rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, 696 pMouseShapeInfo->fVisible, 697 pMouseShapeInfo->fAlpha, 698 pMouseShapeInfo->u32HotX, 699 pMouseShapeInfo->u32HotY, 700 pMouseShapeInfo->u32Width, 701 pMouseShapeInfo->u32Height, 702 pMouseShapeInfo->pu8Shape); 704 703 else 705 { 706 rc = pVGAState->pDrv->pfnVBVAMousePointerShape (pVGAState->pDrv, 707 pMouseShapeInfo->fVisible, 708 false, 709 0, 0, 710 0, 0, 711 NULL); 712 } 713 704 rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, 705 pMouseShapeInfo->fVisible, 706 false, 707 0, 0, 708 0, 0, 709 NULL); 714 710 return rc; 715 711 } 716 712 717 static int vbvaMousePointerShape(PVGASTATE pVGAState, VBVACONTEXT *pCtx,713 static int vbvaMousePointerShape(PVGASTATECC pThisCC, VBVACONTEXT *pCtx, 718 714 const VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *pShape, HGSMISIZE cbShape) 719 715 { … … 790 786 } 791 787 792 return vbvaUpdateMousePointerShape(p VGAState, &pCtx->mouseShapeInfo, fShape);788 return vbvaUpdateMousePointerShape(pThisCC, &pCtx->mouseShapeInfo, fShape); 793 789 } 794 790 … … 855 851 856 852 #ifdef VBOX_WITH_VIDEOHWACCEL 853 857 854 static void vbvaVHWAHHCommandReinit(VBOXVHWACMD* pHdr, VBOXVHWACMD_TYPE enmCmd, int32_t iDisplay) 858 855 { … … 887 884 } 888 885 889 static void vbvaVHWACommandComplete(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand)886 static void vbvaVHWACommandComplete(PVGASTATECC pThisCC, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand) 890 887 { 891 888 if (fAsyncCommand) 892 889 { 893 890 Assert(pCommand->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH); 894 vbvaR3VHWACommandCompleteAsync(&p VGAState->IVBVACallbacks, pCommand);891 vbvaR3VHWACommandCompleteAsync(&pThisCC->IVBVACallbacks, pCommand); 895 892 } 896 893 else … … 902 899 } 903 900 904 static void vbvaVHWACommandCompleteAllPending(P VGASTATE pVGAState, int rc)905 { 906 if (!ASMAtomicUoReadU32(&p VGAState->pendingVhwaCommands.cPending))901 static void vbvaVHWACommandCompleteAllPending(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, int rc) 902 { 903 if (!ASMAtomicUoReadU32(&pThis->pendingVhwaCommands.cPending)) 907 904 return; 908 905 909 PDMDevHlpCritSectEnter(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect, VERR_SEM_BUSY);906 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 910 907 911 908 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 912 RTListForEachSafe(&p VGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node)909 RTListForEachSafe(&pThis->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 913 910 { 914 911 pIter->pCommand->rc = rc; 915 vbvaVHWACommandComplete(p VGAState, pIter->pCommand, true);912 vbvaVHWACommandComplete(pThisCC, pIter->pCommand, true); 916 913 917 914 /* the command is submitted/processed, remove from the pend list */ 918 915 RTListNodeRemove(&pIter->Node); 919 ASMAtomicDecU32(&p VGAState->pendingVhwaCommands.cPending);916 ASMAtomicDecU32(&pThis->pendingVhwaCommands.cPending); 920 917 RTMemFree(pIter); 921 918 } 922 919 923 PDMDevHlpCritSectLeave(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect);924 } 925 926 static void vbvaVHWACommandClearAllPending(P VGASTATE pVGAState)927 { 928 if (!ASMAtomicUoReadU32(&p VGAState->pendingVhwaCommands.cPending))920 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 921 } 922 923 static void vbvaVHWACommandClearAllPending(PPDMDEVINS pDevIns, PVGASTATE pThis) 924 { 925 if (!ASMAtomicUoReadU32(&pThis->pendingVhwaCommands.cPending)) 929 926 return; 930 927 931 PDMDevHlpCritSectEnter(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect, VERR_SEM_BUSY);928 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 932 929 933 930 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 934 RTListForEachSafe(&p VGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node)931 RTListForEachSafe(&pThis->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 935 932 { 936 933 RTListNodeRemove(&pIter->Node); 937 ASMAtomicDecU32(&p VGAState->pendingVhwaCommands.cPending);934 ASMAtomicDecU32(&pThis->pendingVhwaCommands.cPending); 938 935 RTMemFree(pIter); 939 936 } 940 937 941 PDMDevHlpCritSectLeave(pVGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect); 942 } 943 944 static void vbvaVHWACommandPend(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand) 938 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 939 } 940 941 static void vbvaVHWACommandPend(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 942 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand) 945 943 { 946 944 int rc = VERR_BUFFER_OVERFLOW; 947 945 948 if (ASMAtomicUoReadU32(&p VGAState->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS)946 if (ASMAtomicUoReadU32(&pThis->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS) 949 947 { 950 948 VBOX_VHWA_PENDINGCMD *pPend = (VBOX_VHWA_PENDINGCMD *)RTMemAlloc(sizeof(*pPend)); … … 953 951 pCommand->Flags |= VBOXVHWACMD_FLAG_HG_ASYNCH; 954 952 pPend->pCommand = pCommand; 955 PDMDevHlpCritSectEnter(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect, VERR_SEM_BUSY);956 if (ASMAtomicUoReadU32(&p VGAState->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS)957 { 958 RTListAppend(&p VGAState->pendingVhwaCommands.PendingList, &pPend->Node);959 ASMAtomicIncU32(&p VGAState->pendingVhwaCommands.cPending);960 PDMDevHlpCritSectLeave(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect);953 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 954 if (ASMAtomicUoReadU32(&pThis->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS) 955 { 956 RTListAppend(&pThis->pendingVhwaCommands.PendingList, &pPend->Node); 957 ASMAtomicIncU32(&pThis->pendingVhwaCommands.cPending); 958 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 961 959 return; 962 960 } 963 PDMDevHlpCritSectLeave(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect);961 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 964 962 LogRel(("VBVA: Pending command count has reached its threshold.. completing them all..")); 965 963 RTMemFree(pPend); … … 971 969 LogRel(("VBVA: Pending command count has reached its threshold, completing them all..")); 972 970 973 vbvaVHWACommandCompleteAllPending(p VGAState, rc);971 vbvaVHWACommandCompleteAllPending(pDevIns, pThis, pThisCC, rc); 974 972 975 973 pCommand->rc = rc; 976 974 977 vbvaVHWACommandComplete(p VGAState, pCommand, false);975 vbvaVHWACommandComplete(pThisCC, pCommand, false); 978 976 } 979 977 … … 993 991 } 994 992 995 static int vbvaVHWACommandSavePending(PCPDMDEVHLPR3 pHlp, PVGASTATE p VGAState, PSSMHANDLE pSSM)996 { 997 int rc = pHlp->pfnSSMPutU32(pSSM, p VGAState->pendingVhwaCommands.cPending);993 static int vbvaVHWACommandSavePending(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM) 994 { 995 int rc = pHlp->pfnSSMPutU32(pSSM, pThis->pendingVhwaCommands.cPending); 998 996 AssertRCReturn(rc, rc); 999 997 1000 998 VBOX_VHWA_PENDINGCMD *pIter; 1001 RTListForEach(&p VGAState->pendingVhwaCommands.PendingList, pIter, VBOX_VHWA_PENDINGCMD, Node)1002 { 1003 AssertContinue((uintptr_t)pIter->pCommand - (uintptr_t)p VGAState->vram_ptrR3 < pVGAState->vram_size);1004 rc = pHlp->pfnSSMPutU32(pSSM, (uint32_t)(((uint8_t *)pIter->pCommand) - ((uint8_t *)p VGAState->vram_ptrR3)));999 RTListForEach(&pThis->pendingVhwaCommands.PendingList, pIter, VBOX_VHWA_PENDINGCMD, Node) 1000 { 1001 AssertContinue((uintptr_t)pIter->pCommand - (uintptr_t)pThisCC->pbVRam < pThis->vram_size); 1002 rc = pHlp->pfnSSMPutU32(pSSM, (uint32_t)(((uint8_t *)pIter->pCommand) - ((uint8_t *)pThisCC->pbVRam))); 1005 1003 AssertRCReturn(rc, rc); 1006 1004 } … … 1008 1006 } 1009 1007 1010 static int vbvaVHWACommandLoadPending(PCPDMDEVHLPR3 pHlp, PVGASTATE pVGAState, PSSMHANDLE pSSM, uint32_t u32Version) 1008 static int vbvaVHWACommandLoadPending(PPDMDEVINS pDevIns, PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PVGASTATECC pThisCC, 1009 PSSMHANDLE pSSM, uint32_t u32Version) 1011 1010 { 1012 1011 if (u32Version < VGA_SAVEDSTATE_VERSION_WITH_PENDVHWA) … … 1022 1021 AssertRCReturn(rc, rc); 1023 1022 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand 1024 = (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)((uint8_t volatile *)p VGAState->vram_ptrR3+ off32);1025 vbvaVHWACommandPend(p VGAState, pCommand);1023 = (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)((uint8_t volatile *)pThisCC->pbVRam + off32); 1024 vbvaVHWACommandPend(pDevIns, pThis, pThisCC, pCommand); 1026 1025 } 1027 1026 return rc; … … 1030 1029 1031 1030 /** Worker for vbvaVHWACommandSubmit. */ 1032 static bool vbvaVHWACommandSubmitInner(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool *pfPending) 1031 static bool vbvaVHWACommandSubmitInner(PVGASTATE pThis, PVGASTATECC pThisCC, 1032 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool *pfPending) 1033 1033 { 1034 1034 *pfPending = false; … … 1040 1040 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 1041 1041 1042 bool fGuestCmd = (uintptr_t)pCommand - (uintptr_t)p VGAState->vram_ptrR3 < pVGAState->vram_size;1042 bool fGuestCmd = (uintptr_t)pCommand - (uintptr_t)pThisCC->pbVRam < pThis->vram_size; 1043 1043 ASSERT_GUEST_LOGREL_MSG_STMT_RETURN( !fGuestCmd 1044 1044 || ( enmCmd != VBOXVHWACMD_TYPE_HH_CONSTRUCT … … 1053 1053 pCommand->rc = VERR_INVALID_PARAMETER, 1054 1054 true); 1055 ASSERT_GUEST_STMT_RETURN(p VGAState->pDrv->pfnVHWACommandProcess, pCommand->rc = VERR_INVALID_STATE, true);1055 ASSERT_GUEST_STMT_RETURN(pThisCC->pDrv->pfnVHWACommandProcess, pCommand->rc = VERR_INVALID_STATE, true); 1056 1056 RT_UNTRUSTED_VALIDATED_FENCE(); 1057 1057 … … 1060 1060 */ 1061 1061 Log(("VGA Command >>> %#p, %d\n", pCommand, enmCmd)); 1062 int rc = p VGAState->pDrv->pfnVHWACommandProcess(pVGAState->pDrv, enmCmd, fGuestCmd, pCommand);1062 int rc = pThisCC->pDrv->pfnVHWACommandProcess(pThisCC->pDrv, enmCmd, fGuestCmd, pCommand); 1063 1063 if (rc == VINF_CALLBACK_RETURN) 1064 1064 { … … 1089 1089 1090 1090 1091 static bool vbvaVHWACommandSubmit(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand) 1091 static bool vbvaVHWACommandSubmit(PVGASTATE pThis, PVGASTATECC pThisCC, 1092 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand) 1092 1093 { 1093 1094 bool fPending = false; 1094 bool fRet = vbvaVHWACommandSubmitInner(p VGAState, pCommand, &fPending);1095 bool fRet = vbvaVHWACommandSubmitInner(pThis, pThisCC, pCommand, &fPending); 1095 1096 if (!fPending) 1096 vbvaVHWACommandComplete(p VGAState, pCommand, fAsyncCommand);1097 vbvaVHWACommandComplete(pThisCC, pCommand, fAsyncCommand); 1097 1098 return fRet; 1098 1099 } … … 1102 1103 * @returns false if commands are pending, otherwise true. 1103 1104 */ 1104 static bool vbvaVHWACheckPendingCommands(P VGASTATE pVGAState)1105 { 1106 if (!ASMAtomicUoReadU32(&p VGAState->pendingVhwaCommands.cPending))1105 static bool vbvaVHWACheckPendingCommands(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 1106 { 1107 if (!ASMAtomicUoReadU32(&pThis->pendingVhwaCommands.cPending)) 1107 1108 return true; 1108 1109 1109 PDMDevHlpCritSectEnter(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect, VERR_SEM_BUSY);1110 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 1110 1111 1111 1112 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 1112 RTListForEachSafe(&p VGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node)1113 { 1114 if (!vbvaVHWACommandSubmit(p VGAState, pIter->pCommand, true))1115 { 1116 PDMDevHlpCritSectLeave(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect);1113 RTListForEachSafe(&pThis->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 1114 { 1115 if (!vbvaVHWACommandSubmit(pThis, pThisCC, pIter->pCommand, true)) 1116 { 1117 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 1117 1118 return false; /* the command should be still pending */ 1118 1119 } … … 1120 1121 /* the command is submitted/processed, remove from the pend list */ 1121 1122 RTListNodeRemove(&pIter->Node); 1122 ASMAtomicDecU32(&p VGAState->pendingVhwaCommands.cPending);1123 ASMAtomicDecU32(&pThis->pendingVhwaCommands.cPending); 1123 1124 RTMemFree(pIter); 1124 1125 } 1125 1126 1126 PDMDevHlpCritSectLeave(p VGAState->CTX_SUFF(pDevIns), &pVGAState->CritSect);1127 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 1127 1128 1128 1129 return true; 1129 1130 } 1130 1131 1131 void vbvaTimerCb(PVGASTATE pVGAState) 1132 { 1133 vbvaVHWACheckPendingCommands(pVGAState); 1134 } 1135 1136 static void vbvaVHWAHandleCommand(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1137 { 1138 if (vbvaVHWACheckPendingCommands(pVGAState)) 1139 { 1140 if (vbvaVHWACommandSubmit(pVGAState, pCmd, false)) 1132 void vbvaTimerCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 1133 { 1134 vbvaVHWACheckPendingCommands(pDevIns, pThis, pThisCC); 1135 } 1136 1137 static void vbvaVHWAHandleCommand(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1138 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1139 { 1140 if (vbvaVHWACheckPendingCommands(pDevIns, pThis, pThisCC)) 1141 { 1142 if (vbvaVHWACommandSubmit(pThis, pThisCC, pCmd, false)) 1141 1143 return; 1142 1144 } 1143 1145 1144 vbvaVHWACommandPend(p VGAState, pCmd);1146 vbvaVHWACommandPend(pDevIns, pThis, pThisCC, pCmd); 1145 1147 } 1146 1148 … … 1150 1152 } 1151 1153 1152 static int vbvaVHWAHHCommandPost(P VGASTATE pVGAState, VBOXVHWACMD *pCmd)1154 static int vbvaVHWAHHCommandPost(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, VBOXVHWACMD *pCmd) 1153 1155 { 1154 1156 RTSEMEVENT hComplEvent; … … 1161 1163 1162 1164 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandSetEventCallback, (void *)hComplEvent); 1163 vbvaVHWAHandleCommand(p VGAState, pCmd);1165 vbvaVHWAHandleCommand(pDevIns, pThis, pThisCC, pCmd); 1164 1166 1165 1167 if ((ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags) & VBOXVHWACMD_FLAG_HG_ASYNCH) != 0) … … 1176 1178 } 1177 1179 1178 int vbvaVHWAConstruct(P VGASTATE pVGAState)1179 { 1180 p VGAState->pendingVhwaCommands.cPending = 0;1181 RTListInit(&p VGAState->pendingVhwaCommands.PendingList);1180 int vbvaVHWAConstruct(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 1181 { 1182 pThis->pendingVhwaCommands.cPending = 0; 1183 RTListInit(&pThis->pendingVhwaCommands.PendingList); 1182 1184 1183 1185 VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(VBOXVHWACMD_TYPE_HH_CONSTRUCT, 0, sizeof(VBOXVHWACMD_HH_CONSTRUCT)); … … 1189 1191 VBOXVHWACMD_HH_CONSTRUCT *pBody = VBOXVHWACMD_BODY_HOST_HEAP(pCmd, VBOXVHWACMD_HH_CONSTRUCT); 1190 1192 1191 do1193 for (;;) 1192 1194 { 1193 1195 memset(pBody, 0, sizeof(VBOXVHWACMD_HH_CONSTRUCT)); 1194 1196 1195 PPDMDEVINS pDevIns = pVGAState->pDevInsR3;1196 1197 PVM pVM = PDMDevHlpGetVM(pDevIns); 1197 1198 1198 1199 pBody->pVM = pVM; 1199 pBody->pvVRAM = p VGAState->vram_ptrR3;1200 pBody->cbVRAM = p VGAState->vram_size;1201 1202 rc = vbvaVHWAHHCommandPost(p VGAState, pCmd);1200 pBody->pvVRAM = pThisCC->pbVRam; 1201 pBody->cbVRAM = pThis->vram_size; 1202 1203 rc = vbvaVHWAHHCommandPost(pDevIns, pThis, pThisCC, pCmd); 1203 1204 ASMCompilerBarrier(); 1204 1205 … … 1210 1211 if(rc == VERR_NOT_IMPLEMENTED) 1211 1212 { 1212 /** @todo set some flag in p VGAStateindicating VHWA is not supported */1213 /** @todo set some flag in pThis indicating VHWA is not supported */ 1213 1214 /* VERR_NOT_IMPLEMENTED is not a failure, we just do not support it */ 1214 1215 rc = VINF_SUCCESS; … … 1222 1223 1223 1224 ++iDisplay; 1224 if (iDisplay >= p VGAState->cMonitors)1225 if (iDisplay >= pThis->cMonitors) 1225 1226 break; 1226 1227 vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_CONSTRUCT, (int32_t)iDisplay); 1227 } while (true);1228 } 1228 1229 1229 1230 vbvaVHWAHHCommandRelease(pCmd); … … 1234 1235 } 1235 1236 1236 int vbvaVHWAReset(PVGASTATE pVGAState)1237 { 1238 vbvaVHWACommandClearAllPending(p VGAState);1237 static int vbvaVHWAReset(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 1238 { 1239 vbvaVHWACommandClearAllPending(pDevIns, pThis); 1239 1240 1240 1241 /* ensure we have all pending cmds processed and h->g cmds disabled */ … … 1248 1249 do 1249 1250 { 1250 rc = vbvaVHWAHHCommandPost(p VGAState, pCmd);1251 rc = vbvaVHWAHHCommandPost(pDevIns, pThis, pThisCC, pCmd); 1251 1252 AssertRC(rc); 1252 1253 if(RT_SUCCESS(rc)) … … 1262 1263 1263 1264 ++iDisplay; 1264 if (iDisplay >= p VGAState->cMonitors)1265 if (iDisplay >= pThis->cMonitors) 1265 1266 break; 1266 1267 vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_RESET, (int32_t)iDisplay); … … 1275 1276 } 1276 1277 1277 typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPRECB(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext); 1278 typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPRECB(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, VBOXVHWACMD *pCmd, 1279 uint32_t iDisplay, void *pvContext); 1278 1280 typedef FNVBOXVHWAHHCMDPRECB *PFNVBOXVHWAHHCMDPRECB; 1279 1281 1280 typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPOSTCB(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext); 1282 typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPOSTCB(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, VBOXVHWACMD *pCmd, 1283 uint32_t iDisplay, int rc, void *pvContext); 1281 1284 typedef FNVBOXVHWAHHCMDPOSTCB *PFNVBOXVHWAHHCMDPOSTCB; 1282 1285 1283 int vbvaVHWAHHPost(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, PFNVBOXVHWAHHCMDPRECB pfnPre, PFNVBOXVHWAHHCMDPOSTCB pfnPost, void *pvContext) 1286 static int vbvaVHWAHHPost(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, VBOXVHWACMD *pCmd, 1287 PFNVBOXVHWAHHCMDPRECB pfnPre, PFNVBOXVHWAHHCMDPOSTCB pfnPost, void *pvContext) 1284 1288 { 1285 1289 const VBOXVHWACMD_TYPE enmType = pCmd->enmCmd; … … 1289 1293 do 1290 1294 { 1291 if (!pfnPre || pfnPre(p VGAState, pCmd, iDisplay, pvContext))1292 { 1293 rc = vbvaVHWAHHCommandPost(p VGAState, pCmd);1295 if (!pfnPre || pfnPre(pDevIns, pThis, pThisCC, pCmd, iDisplay, pvContext)) 1296 { 1297 rc = vbvaVHWAHHCommandPost(pDevIns, pThis, pThisCC, pCmd); 1294 1298 AssertRC(rc); 1295 1299 if (pfnPost) 1296 1300 { 1297 if (!pfnPost(p VGAState, pCmd, iDisplay, rc, pvContext))1301 if (!pfnPost(pDevIns, pThis, pThisCC, pCmd, iDisplay, rc, pvContext)) 1298 1302 { 1299 1303 rc = VINF_SUCCESS; … … 1317 1321 1318 1322 ++iDisplay; 1319 if (iDisplay >= p VGAState->cMonitors)1323 if (iDisplay >= pThis->cMonitors) 1320 1324 break; 1321 1325 vbvaVHWAHHCommandReinit(pCmd, enmType, (int32_t)iDisplay); … … 1326 1330 1327 1331 /** @todo call this also on reset? */ 1328 int vbvaVHWAEnable (PVGASTATE pVGAState, bool bEnable)1332 static int vbvaVHWAEnable(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, bool bEnable) 1329 1333 { 1330 1334 const VBOXVHWACMD_TYPE enmType = bEnable ? VBOXVHWACMD_TYPE_HH_ENABLE : VBOXVHWACMD_TYPE_HH_DISABLE; … … 1333 1337 if(pCmd) 1334 1338 { 1335 int rc = vbvaVHWAHHPost (pVGAState, pCmd, NULL, NULL, NULL);1339 int rc = vbvaVHWAHHPost(pDevIns, pThis, pThisCC, pCmd, NULL, NULL, NULL); 1336 1340 vbvaVHWAHHCommandRelease(pCmd); 1337 1341 return rc; … … 1343 1347 { 1344 1348 /* ensure we have no pending commands */ 1345 return vbvaVHWAEnable( PDMINS_2_DATA(pDevIns, PVGASTATE), false);1349 return vbvaVHWAEnable(pDevIns, PDMDEVINS_2_DATA(pDevIns, PVGASTATE), PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC), false); 1346 1350 } 1347 1351 … … 1349 1353 { 1350 1354 /* ensure we have no pending commands */ 1351 return vbvaVHWAEnable(PDMINS_2_DATA(pDevIns, PVGASTATE), true); 1352 } 1355 return vbvaVHWAEnable(pDevIns, PDMDEVINS_2_DATA(pDevIns, PVGASTATE), PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC), true); 1356 } 1357 1353 1358 1354 1359 /** … … 1358 1363 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1359 1364 { 1360 PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface); 1365 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IVBVACallbacks); 1366 PPDMDEVINS pDevIns = pThisCC->pDevIns; 1367 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 1361 1368 int rc; 1369 1362 1370 Log(("VGA Command <<< Async rc %d %#p, %d\n", pCmd->rc, pCmd, pCmd->enmCmd)); 1363 1371 1364 if ((uintptr_t)pCmd - (uintptr_t)p VGAState->vram_ptrR3 < pVGAState->vram_size)1365 { 1366 PHGSMIINSTANCE pIns = p VGAState->pHGSMI;1372 if ((uintptr_t)pCmd - (uintptr_t)pThisCC->pbVRam < pThis->vram_size) 1373 { 1374 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 1367 1375 Assert(!(pCmd->Flags & VBOXVHWACMD_FLAG_HH_CMD)); 1368 1376 Assert(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH); 1369 1377 #ifdef VBOX_WITH_WDDM 1370 if (p VGAState->fGuestCaps & VBVACAPS_COMPLETEGCMD_BY_IOREAD)1378 if (pThis->fGuestCaps & VBVACAPS_COMPLETEGCMD_BY_IOREAD) 1371 1379 { 1372 1380 rc = HGSMICompleteGuestCommand(pIns, pCmd, !!(pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ)); … … 1449 1457 } VBOXVBVASAVEDSTATECBDATA, *PVBOXVBVASAVEDSTATECBDATA; 1450 1458 1451 static DECLCALLBACK(bool) vboxVBVASaveStateBeginPostCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, 1452 int rc, void *pvContext) 1453 { 1454 RT_NOREF(pVGAState, pCmd); 1459 /** 1460 * @callback_method_impl{FNVBOXVHWAHHCMDPOSTCB} 1461 */ 1462 static DECLCALLBACK(bool) vboxVBVASaveStateBeginPostCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1463 VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext) 1464 { 1465 RT_NOREF(pDevIns, pThis, pThisCC, pCmd); 1455 1466 PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext; 1456 1467 if (RT_FAILURE(pData->rc)) … … 1483 1494 } 1484 1495 1485 static DECLCALLBACK(bool) 1486 vboxVBVASaveStatePerformPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1487 { 1488 RT_NOREF(pVGAState, pCmd); 1496 /** 1497 * @callback_method_impl{FNVBOXVHWAHHCMDPRECB} 1498 */ 1499 static DECLCALLBACK(bool) vboxVBVASaveStatePerformPreCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1500 VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1501 { 1502 RT_NOREF(pThis, pThisCC, pCmd); 1489 1503 PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext; 1490 1504 if (RT_FAILURE(pData->rc)) … … 1499 1513 1500 1514 int rc; 1501 PCPDMDEVHLPR3 pHlp = p VGAState->pDevInsR3->pHlpR3;1515 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1502 1516 1503 1517 if (pData->ab2DOn[iDisplay]) … … 1522 1536 } 1523 1537 1524 static DECLCALLBACK(bool) vboxVBVASaveStateEndPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1525 { 1526 RT_NOREF(pVGAState, pCmd); 1538 /** 1539 * @callback_method_impl{FNVBOXVHWAHHCMDPOSTCB} 1540 */ 1541 static DECLCALLBACK(bool) vboxVBVASaveStateEndPreCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1542 VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1543 { 1544 RT_NOREF(pDevIns, pThis, pThisCC, pCmd); 1527 1545 PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext; 1528 1546 Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn)); 1529 1547 if (pData->ab2DOn[iDisplay]) 1530 {1531 1548 return true; 1532 }1533 1534 1549 return false; 1535 1550 } 1536 1551 1537 static DECLCALLBACK(bool) 1538 vboxVBVALoadStatePerformPostCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext) 1539 { 1540 RT_NOREF(pVGAState, pCmd); 1552 /** 1553 * @callback_method_impl{FNVBOXVHWAHHCMDPOSTCB} 1554 */ 1555 static DECLCALLBACK(bool) vboxVBVALoadStatePerformPostCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1556 VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext) 1557 { 1558 RT_NOREF(pThis, pThisCC, pCmd); 1541 1559 PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext; 1542 1560 if (RT_FAILURE(pData->rc)) … … 1555 1573 } 1556 1574 1557 PCPDMDEVHLPR3 pHlp = p VGAState->pDevInsR3->pHlpR3;1575 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1558 1576 Assert(RT_SUCCESS(pCmd->rc) || pCmd->rc == VERR_NOT_IMPLEMENTED); 1559 1577 if (pCmd->rc == VERR_NOT_IMPLEMENTED) … … 1572 1590 } 1573 1591 1574 static DECLCALLBACK(bool) 1575 vboxVBVALoadStatePerformPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1576 { 1577 RT_NOREF(pVGAState, pCmd); 1592 /** 1593 * @callback_method_impl{FNVBOXVHWAHHCMDPOSTCB} 1594 */ 1595 static DECLCALLBACK(bool) vboxVBVALoadStatePerformPreCb(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 1596 VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext) 1597 { 1598 RT_NOREF(pThis, pThisCC, pCmd); 1578 1599 PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext; 1579 1600 if (RT_FAILURE(pData->rc)) … … 1587 1608 } 1588 1609 1589 PCPDMDEVHLPR3 pHlp = p VGAState->pDevInsR3->pHlpR3;1610 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1590 1611 int rc; 1591 1612 uint32_t u32; … … 1610 1631 } 1611 1632 } 1612 #endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */ 1613 1614 int vboxVBVASaveDevStateExec(PCPDMDEVHLPR3 pHlp, PVGASTATE pVGAState, PSSMHANDLE pSSM) 1615 { 1616 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 1633 1634 #endif /* VBOX_WITH_VIDEOHWACCEL */ 1635 1636 static int vboxVBVASaveDevStateExec(PCPDMDEVHLPR3 pHlp, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM) 1637 { 1638 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 1617 1639 int rc = HGSMIHostSaveStateExec(pHlp, pIns, pSSM); 1618 1640 if (RT_SUCCESS(rc)) … … 1713 1735 rc = pHlp->pfnSSMPutU32(pSSM, 4); 1714 1736 AssertRCReturn(rc, rc); 1715 rc = pHlp->pfnSSMPutU32(pSSM, p VGAState->fGuestCaps);1737 rc = pHlp->pfnSSMPutU32(pSSM, pThis->fGuestCaps); 1716 1738 AssertRCReturn(rc, rc); 1717 1739 #else … … 1737 1759 int vboxVBVASaveStateExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1738 1760 { 1739 PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE); 1740 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1761 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 1762 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 1763 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1741 1764 int rc; 1742 1765 #ifdef VBOX_WITH_VIDEOHWACCEL … … 1746 1769 VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN, 0, cbCmd); 1747 1770 Assert(pCmd); 1748 if (pCmd)1749 { 1750 vbvaVHWAHHPost(p VGAState, pCmd, NULL, vboxVBVASaveStateBeginPostCb, &VhwaData);1771 if (pCmd) 1772 { 1773 vbvaVHWAHHPost(pDevIns, pThis, pThisCC, pCmd, NULL, vboxVBVASaveStateBeginPostCb, &VhwaData); 1751 1774 rc = VhwaData.rc; 1752 1775 AssertRC(rc); … … 1754 1777 { 1755 1778 #endif 1756 rc = vboxVBVASaveDevStateExec(pHlp, p VGAState, pSSM);1779 rc = vboxVBVASaveDevStateExec(pHlp, pThis, pThisCC, pSSM); 1757 1780 AssertRC(rc); 1758 1781 #ifdef VBOX_WITH_VIDEOHWACCEL … … 1762 1785 VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM *pSave = VBOXVHWACMD_BODY_HOST_HEAP(pCmd, VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM); 1763 1786 pSave->pSSM = pSSM; 1764 vbvaVHWAHHPost(p VGAState, pCmd, vboxVBVASaveStatePerformPreCb, NULL, &VhwaData);1787 vbvaVHWAHHPost(pDevIns, pThis, pThisCC, pCmd, vboxVBVASaveStatePerformPreCb, NULL, &VhwaData); 1765 1788 rc = VhwaData.rc; 1766 1789 AssertRC(rc); 1767 1790 if (RT_SUCCESS(rc)) 1768 1791 { 1769 rc = vbvaVHWACommandSavePending(pHlp, p VGAState, pSSM);1792 rc = vbvaVHWACommandSavePending(pHlp, pThis, pThisCC, pSSM); 1770 1793 AssertRCReturn(rc, rc); 1771 1794 1772 1795 vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND, 0); 1773 vbvaVHWAHHPost(p VGAState, pCmd, vboxVBVASaveStateEndPreCb, NULL, &VhwaData);1796 vbvaVHWAHHPost(pDevIns, pThis, pThisCC, pCmd, vboxVBVASaveStateEndPreCb, NULL, &VhwaData); 1774 1797 rc = VhwaData.rc; 1775 1798 AssertRC(rc); … … 1785 1808 if (RT_SUCCESS(rc)) 1786 1809 { 1787 for (uint32_t i = 0; i < p VGAState->cMonitors; ++i)1810 for (uint32_t i = 0; i < pThis->cMonitors; ++i) 1788 1811 { 1789 1812 rc = pHlp->pfnSSMPutU32(pSSM, VBOXVBVASAVEDSTATE_VHWAUNAVAILABLE_MAGIC); … … 1806 1829 } 1807 1830 1808 PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE); 1809 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 1810 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1831 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 1832 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 1833 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 1834 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 1811 1835 int rc = HGSMIHostLoadStateExec(pHlp, pIns, pSSM, uVersion); 1812 1836 if (RT_SUCCESS(rc)) … … 1941 1965 if (cbExtra >= 4) 1942 1966 { 1943 rc = pHlp->pfnSSMGetU32 (pSSM, &p VGAState->fGuestCaps);1967 rc = pHlp->pfnSSMGetU32 (pSSM, &pThis->fGuestCaps); 1944 1968 AssertRCReturn(rc, rc); 1945 p VGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps);1969 pThisCC->pDrv->pfnVBVAGuestCapabilityUpdate(pThisCC->pDrv, pThis->fGuestCaps); 1946 1970 cbExtra -= 4; 1947 1971 } … … 2001 2025 VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM *pLoad = VBOXVHWACMD_BODY_HOST_HEAP(pCmd, VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM); 2002 2026 pLoad->pSSM = pSSM; 2003 vbvaVHWAHHPost (pVGAState, pCmd, vboxVBVALoadStatePerformPreCb, vboxVBVALoadStatePerformPostCb, &VhwaData); 2027 vbvaVHWAHHPost(pDevIns, pThis, pThisCC, pCmd, vboxVBVALoadStatePerformPreCb, 2028 vboxVBVALoadStatePerformPostCb, &VhwaData); 2004 2029 rc = VhwaData.rc; 2005 2030 vbvaVHWAHHCommandRelease(pCmd); … … 2008 2033 if (fLoadCommands) 2009 2034 { 2010 rc = vbvaVHWACommandLoadPending(p Hlp, pVGAState, pSSM, uVersion);2035 rc = vbvaVHWACommandLoadPending(pDevIns, pHlp, pThis, pThisCC, pSSM, uVersion); 2011 2036 AssertRCReturn(rc, rc); 2012 2037 } … … 2019 2044 uint32_t u32; 2020 2045 2021 for (uint32_t i = 0; i < p VGAState->cMonitors; ++i)2046 for (uint32_t i = 0; i < pThis->cMonitors; ++i) 2022 2047 { 2023 2048 rc = pHlp->pfnSSMGetU32(pSSM, &u32); … … 2056 2081 int vboxVBVALoadStateDone(PPDMDEVINS pDevIns) 2057 2082 { 2058 PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE); 2059 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pVGAState->pHGSMI); 2083 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2084 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 2085 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2060 2086 if (pCtx) 2061 2087 { … … 2066 2092 if (pView->vbva.guest.pVBVA) 2067 2093 { 2068 int rc = vbvaEnable(iView, pVGAState, pCtx, pView->vbva.guest.pVBVA, pView->vbva.u32VBVAOffset, true /* fRestored */); 2094 int rc = vbvaEnable(pThis, pThisCC, pCtx, iView, pView->vbva.guest.pVBVA, 2095 pView->vbva.u32VBVAOffset, true /* fRestored */); 2069 2096 if (RT_SUCCESS(rc)) 2070 vbvaResize(p VGAState, pView, &pView->screen, false);2097 vbvaResize(pThisCC, pView, &pView->screen, false); 2071 2098 else 2072 2099 LogRel(("VBVA: can not restore: %Rrc\n", rc)); … … 2075 2102 2076 2103 if (pCtx->mouseShapeInfo.fSet) 2077 vbvaUpdateMousePointerShape(p VGAState, &pCtx->mouseShapeInfo, true);2104 vbvaUpdateMousePointerShape(pThisCC, &pCtx->mouseShapeInfo, true); 2078 2105 } 2079 2106 … … 2081 2108 } 2082 2109 2083 void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags) 2084 { 2085 PPDMDEVINS pDevIns = pVGAState->pDevInsR3; 2086 2087 PDMDevHlpCritSectEnter(pVGAState->CTX_SUFF(pDevIns), &pVGAState->CritSectIRQ, VERR_SEM_BUSY); 2088 2089 const uint32_t fu32CurrentGuestFlags = HGSMIGetHostGuestFlags(pVGAState->pHGSMI); 2110 void VBVARaiseIrq(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t fFlags) 2111 { 2112 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSectIRQ, VERR_SEM_BUSY); 2113 2114 const uint32_t fu32CurrentGuestFlags = HGSMIGetHostGuestFlags(pThisCC->pHGSMI); 2090 2115 if ((fu32CurrentGuestFlags & HGSMIHOSTFLAGS_IRQ) == 0) 2091 2116 { 2092 2117 /* No IRQ set yet. */ 2093 Assert(p VGAState->fu32PendingGuestFlags == 0);2094 2095 HGSMISetHostGuestFlags(p VGAState->pHGSMI, HGSMIHOSTFLAGS_IRQ | fFlags);2118 Assert(pThis->fu32PendingGuestFlags == 0); 2119 2120 HGSMISetHostGuestFlags(pThisCC->pHGSMI, HGSMIHOSTFLAGS_IRQ | fFlags); 2096 2121 2097 2122 /* If VM is not running, the IRQ will be set in VBVAOnResume. */ … … 2104 2129 { 2105 2130 /* IRQ already set, remember the new flags. */ 2106 pVGAState->fu32PendingGuestFlags |= HGSMIHOSTFLAGS_IRQ | fFlags; 2107 } 2108 2109 PDMDevHlpCritSectLeave(pVGAState->CTX_SUFF(pDevIns), &pVGAState->CritSectIRQ); 2110 } 2111 2112 void VBVAOnResume(PVGASTATE pThis) 2113 { 2114 PPDMDEVINS pDevIns = pThis->pDevInsR3; 2115 2131 pThis->fu32PendingGuestFlags |= HGSMIHOSTFLAGS_IRQ | fFlags; 2132 } 2133 2134 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSectIRQ); 2135 } 2136 2137 void VBVAOnResume(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 2138 { 2116 2139 PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSectIRQ, VERR_SEM_BUSY); 2117 2140 2118 if (HGSMIGetHostGuestFlags(pThis ->pHGSMI) & HGSMIHOSTFLAGS_IRQ)2141 if (HGSMIGetHostGuestFlags(pThisCC->pHGSMI) & HGSMIHOSTFLAGS_IRQ) 2119 2142 PDMDevHlpPCISetIrqNoWait(pDevIns, 0, PDM_IRQ_LEVEL_HIGH); 2120 2143 … … 2122 2145 } 2123 2146 2124 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32)2147 static int vbvaHandleQueryConf32(PVGASTATECC pThisCC, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32) 2125 2148 { 2126 2149 uint32_t const idxQuery = pConf32->u32Index; … … 2128 2151 LogFlowFunc(("VBVA_QUERY_CONF32: u32Index %d, u32Value 0x%x\n", idxQuery, pConf32->u32Value)); 2129 2152 2130 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(p VGAState->pHGSMI);2153 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2131 2154 uint32_t uValue; 2132 2155 if (idxQuery == VBOX_VBVA_CONF32_MONITOR_COUNT) … … 2173 2196 } 2174 2197 2175 static int vbvaHandleInfoHeap(PVGASTATE pVGAState, const VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *pInfoHeap)2198 static int vbvaHandleInfoHeap(PVGASTATECC pThisCC, const VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *pInfoHeap) 2176 2199 { 2177 2200 uint32_t const offHeap = pInfoHeap->u32HeapOffset; … … 2180 2203 LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n", offHeap, cbHeap)); 2181 2204 2182 return HGSMIHostHeapSetup(p VGAState->pHGSMI, offHeap, cbHeap);2183 } 2184 2185 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_GUEST *pView)2205 return HGSMIHostHeapSetup(pThisCC->pHGSMI, offHeap, cbHeap); 2206 } 2207 2208 static int vbvaInfoView(PVGASTATE pThis, PVGASTATER3 pThisCC, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_GUEST *pView) 2186 2209 { 2187 2210 VBVAINFOVIEW view; … … 2192 2215 view.u32ViewIndex, view.u32ViewOffset, view.u32ViewSize, view.u32MaxScreenSize)); 2193 2216 2194 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(p VGAState->pHGSMI);2217 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2195 2218 ASSERT_GUEST_LOGREL_MSG_RETURN( view.u32ViewIndex < pCtx->cViews 2196 && view.u32ViewOffset <= p VGAState->vram_size2197 && view.u32ViewSize <= p VGAState->vram_size2198 && view.u32ViewOffset <= p VGAState->vram_size - view.u32ViewSize2219 && view.u32ViewOffset <= pThis->vram_size 2220 && view.u32ViewSize <= pThis->vram_size 2221 && view.u32ViewOffset <= pThis->vram_size - view.u32ViewSize 2199 2222 && view.u32MaxScreenSize <= view.u32ViewSize, 2200 2223 ("index %d(%d), offset 0x%x, size 0x%x, max 0x%x, vram size 0x%x\n", 2201 2224 view.u32ViewIndex, pCtx->cViews, view.u32ViewOffset, view.u32ViewSize, 2202 view.u32MaxScreenSize, p VGAState->vram_size),2225 view.u32MaxScreenSize, pThis->vram_size), 2203 2226 VERR_INVALID_PARAMETER); 2204 2227 RT_UNTRUSTED_VALIDATED_FENCE(); … … 2208 2231 } 2209 2232 2210 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *pScreen)2233 static int vbvaInfoScreen(PVGASTATECC pThisCC, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *pScreen) 2211 2234 { 2212 2235 /* … … 2225 2248 */ 2226 2249 /* Allow screen.u16BitsPerPixel == 0 because legacy guest code used it for screen blanking. */ 2227 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(p VGAState->pHGSMI);2250 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2228 2251 ASSERT_GUEST_LOGREL_MSG_RETURN(screen.u32ViewIndex < pCtx->cViews, 2229 2252 ("Screen index %#x is out of bound (cViews=%#x)\n", screen.u32ViewIndex, pCtx->cViews), … … 2258 2281 * Do the job. 2259 2282 */ 2260 vbvaResize(p VGAState, &pCtx->aViews[screen.u32ViewIndex], &screen, true);2283 vbvaResize(pThisCC, &pCtx->aViews[screen.u32ViewIndex], &screen, true); 2261 2284 return VINF_SUCCESS; 2262 2285 } 2263 2286 2264 int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen) 2265 { 2266 if (u32ViewIndex >= pVGAState->cMonitors) 2287 #ifdef UNUSED_FUNCTION 2288 int VBVAGetInfoViewAndScreen(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen) 2289 { 2290 if (u32ViewIndex >= pThis->cMonitors) 2267 2291 return VERR_INVALID_PARAMETER; 2268 2292 2269 PHGSMIINSTANCE pIns = p VGAState->pHGSMI;2293 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 2270 2294 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns); 2271 2295 … … 2278 2302 return VINF_SUCCESS; 2279 2303 } 2280 2281 static int vbvaHandleEnable(PVGASTATE pVGAState, uint32_t fEnableFlags, uint32_t offEnable, uint32_t idScreen) 2304 #endif 2305 2306 static int vbvaHandleEnable(PVGASTATE pThis, PVGASTATER3 pThisCC, uint32_t fEnableFlags, uint32_t offEnable, uint32_t idScreen) 2282 2307 { 2283 2308 LogFlowFunc(("VBVA_ENABLE[%u]: fEnableFlags=0x%x offEnable=%#x\n", idScreen, fEnableFlags, offEnable)); 2284 PHGSMIINSTANCE pIns = p VGAState->pHGSMI;2309 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 2285 2310 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2286 2311 … … 2295 2320 if (fEnableFlags & VBVA_F_ENABLE) 2296 2321 { 2297 ASSERT_GUEST_LOGREL_MSG_RETURN(offEnable < p VGAState->vram_size,2298 ("offEnable=%#x vram_size=%#x\n", offEnable, p VGAState->vram_size),2322 ASSERT_GUEST_LOGREL_MSG_RETURN(offEnable < pThis->vram_size, 2323 ("offEnable=%#x vram_size=%#x\n", offEnable, pThis->vram_size), 2299 2324 VERR_INVALID_PARAMETER); 2300 2325 if (fEnableFlags & VBVA_F_ABSOFFSET) 2301 2326 /* Offset from VRAM start. */ 2302 ASSERT_GUEST_LOGREL_MSG_RETURN( p VGAState->vram_size >= RT_UOFFSETOF(VBVABUFFER, au8Data)2303 && offEnable <= p VGAState->vram_size - RT_UOFFSETOF(VBVABUFFER, au8Data),2304 ("offEnable=%#x vram_size=%#x\n", offEnable, p VGAState->vram_size),2327 ASSERT_GUEST_LOGREL_MSG_RETURN( pThis->vram_size >= RT_UOFFSETOF(VBVABUFFER, au8Data) 2328 && offEnable <= pThis->vram_size - RT_UOFFSETOF(VBVABUFFER, au8Data), 2329 ("offEnable=%#x vram_size=%#x\n", offEnable, pThis->vram_size), 2305 2330 VERR_INVALID_PARAMETER); 2306 2331 else … … 2309 2334 RT_UNTRUSTED_VALIDATED_FENCE(); 2310 2335 const VBVAINFOVIEW *pView = &pCtx->aViews[idScreen].view; 2311 ASSERT_GUEST_LOGREL_MSG_RETURN( p VGAState->vram_size - offEnable >= pView->u32ViewOffset2336 ASSERT_GUEST_LOGREL_MSG_RETURN( pThis->vram_size - offEnable >= pView->u32ViewOffset 2312 2337 && pView->u32ViewSize >= RT_UOFFSETOF(VBVABUFFER, au8Data) 2313 2338 && offEnable <= pView->u32ViewSize - RT_UOFFSETOF(VBVABUFFER, au8Data), 2314 2339 ("offEnable=%#x vram_size=%#x view: %#x LB %#x\n", 2315 offEnable, p VGAState->vram_size, pView->u32ViewOffset, pView->u32ViewSize),2340 offEnable, pThis->vram_size, pView->u32ViewOffset, pView->u32ViewSize), 2316 2341 VERR_INVALID_PARAMETER); 2317 2342 offEnable += pView->u32ViewOffset; … … 2335 2360 2336 2361 /* Process any pending orders and empty the VBVA ring buffer. */ 2337 vbvaFlush(p VGAState, pCtx);2338 2339 rc = vbvaEnable( idScreen, pVGAState, pCtx, pVBVA, offEnable, false /* fRestored */);2362 vbvaFlush(pThis, pThisCC, pCtx); 2363 2364 rc = vbvaEnable(pThis, pThisCC, pCtx, idScreen, pVBVA, offEnable, false /* fRestored */); 2340 2365 if (RT_FAILURE(rc)) 2341 2366 LogRelMax(8, ("VBVA: can not enable: %Rrc\n", rc)); 2342 2367 } 2343 2368 else 2344 rc = vbvaDisable( idScreen, pVGAState, pCtx);2369 rc = vbvaDisable(pThis, pThisCC, pCtx, idScreen); 2345 2370 return rc; 2346 2371 } 2347 2372 2348 static int vbvaHandleQueryModeHints(PVGASTATE pVGAState, VBVAQUERYMODEHINTS volatile *pQueryModeHints, HGSMISIZE cbBuffer)2349 { 2350 PHGSMIINSTANCE pIns = p VGAState->pHGSMI;2373 static int vbvaHandleQueryModeHints(PVGASTATECC pThisCC, VBVAQUERYMODEHINTS volatile *pQueryModeHints, HGSMISIZE cbBuffer) 2374 { 2375 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 2351 2376 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2352 2377 … … 2391 2416 */ 2392 2417 2393 static DECLCALLBACK(void) vbvaNotifyGuest 2418 static DECLCALLBACK(void) vbvaNotifyGuest(void *pvCallback) 2394 2419 { 2395 2420 #if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM)) 2396 PVGASTATE pVGAState = (PVGASTATE)pvCallback; 2397 VBVARaiseIrq (pVGAState, 0); 2421 PPDMDEVINS pDevIns = (PPDMDEVINS)pvCallback; 2422 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2423 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 2424 VBVARaiseIrq(pDevIns, pThis, pThisCC, 0); 2398 2425 #else 2399 2426 NOREF(pvCallback); … … 2422 2449 LogFlowFunc(("pvHandler %p, u16ChannelInfo %d, pvBuffer %p, cbBuffer %u\n", pvHandler, u16ChannelInfo, pvBuffer, cbBuffer)); 2423 2450 2424 PVGASTATE pVGAState = (PVGASTATE)pvHandler; 2425 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 2426 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2451 PPDMDEVINS pDevIns = (PPDMDEVINS)pvHandler; 2452 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2453 PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC); 2454 PHGSMIINSTANCE pIns = pThisCC->pHGSMI; 2455 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2427 2456 2428 2457 switch (u16ChannelInfo) … … 2434 2463 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd 2435 2464 = (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMIBufferData((VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2436 vboxVDMACommand(p VGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());2465 vboxVDMACommand(pThisCC->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize()); 2437 2466 rc = VINF_SUCCESS; 2438 2467 } … … 2446 2475 VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd 2447 2476 = (VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMIBufferData((VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2448 vboxVDMAControl(p VGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());2477 vboxVDMAControl(pThisCC->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize()); 2449 2478 } 2450 2479 else … … 2455 2484 case VBVA_QUERY_CONF32: 2456 2485 if (cbBuffer >= sizeof(VBVACONF32)) 2457 rc = vbvaHandleQueryConf32(p VGAState, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);2486 rc = vbvaHandleQueryConf32(pThisCC, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2458 2487 else 2459 2488 rc = VERR_INVALID_PARAMETER; … … 2478 2507 ++pView, cbBuffer -= sizeof(VBVAINFOVIEW)) 2479 2508 { 2480 rc = VBVAInfoView(pVGAState, pView);2509 rc = vbvaInfoView(pThis, pThisCC, pView); 2481 2510 if (RT_FAILURE(rc)) 2482 2511 break; … … 2487 2516 case VBVA_INFO_HEAP: 2488 2517 if (cbBuffer >= sizeof(VBVAINFOHEAP)) 2489 rc = vbvaHandleInfoHeap(p VGAState, (VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);2518 rc = vbvaHandleInfoHeap(pThisCC, (VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2490 2519 else 2491 2520 rc = VERR_INVALID_PARAMETER; … … 2494 2523 case VBVA_FLUSH: 2495 2524 if (cbBuffer >= sizeof(VBVAFLUSH)) 2496 rc = vbvaFlush(p VGAState, pCtx);2525 rc = vbvaFlush(pThis, pThisCC, pCtx); 2497 2526 else 2498 2527 rc = VERR_INVALID_PARAMETER; … … 2502 2531 rc = VERR_INVALID_PARAMETER; 2503 2532 if (cbBuffer >= sizeof(VBVAINFOSCREEN)) 2504 rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);2533 rc = vbvaInfoScreen(pThisCC, (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2505 2534 break; 2506 2535 … … 2524 2553 idScreen = vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer); 2525 2554 2526 rc = vbvaHandleEnable(p VGAState, fEnableFlags, offEnable, idScreen);2555 rc = vbvaHandleEnable(pThis, pThisCC, fEnableFlags, offEnable, idScreen); 2527 2556 pVbvaEnable->i32Result = rc; 2528 2557 } … … 2534 2563 VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *pShape 2535 2564 = (VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2536 rc = vbvaMousePointerShape(p VGAState, pCtx, pShape, cbBuffer);2565 rc = vbvaMousePointerShape(pThisCC, pCtx, pShape, cbBuffer); 2537 2566 pShape->i32Result = rc; 2538 2567 } … … 2546 2575 if (cbBuffer >= VBOXVHWACMD_HEADSIZE()) 2547 2576 { 2548 vbvaVHWAHandleCommand(p VGAState, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);2577 vbvaVHWAHandleCommand(pDevIns, pThis, pThisCC, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2549 2578 rc = VINF_SUCCESS; 2550 2579 } … … 2559 2588 { 2560 2589 VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *pCaps = (VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2561 p VGAState->fGuestCaps = pCaps->fCaps;2590 pThis->fGuestCaps = pCaps->fCaps; 2562 2591 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 2563 2592 2564 p VGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps);2593 pThisCC->pDrv->pfnVBVAGuestCapabilityUpdate(pThisCC->pDrv, pThis->fGuestCaps); 2565 2594 pCaps->rc = rc = VINF_SUCCESS; 2566 2595 } … … 2574 2603 { 2575 2604 VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *pCfg = (VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2576 p VGAState->fScanLineCfg = pCfg->fFlags;2605 pThis->fScanLineCfg = pCfg->fFlags; 2577 2606 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); 2578 2607 … … 2588 2617 VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *pQueryModeHints 2589 2618 = (VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2590 rc = vbvaHandleQueryModeHints(p VGAState, pQueryModeHints, cbBuffer);2619 rc = vbvaHandleQueryModeHints(pThisCC, pQueryModeHints, cbBuffer); 2591 2620 pQueryModeHints->rc = rc; 2592 2621 } … … 2611 2640 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_REPORT_INPUT_MAPPING: x=%RI32, y=%RI32, cx=%RU32, cy=%RU32\n", 2612 2641 inputMapping.x, inputMapping.y, inputMapping.cx, inputMapping.cy)); 2613 p VGAState->pDrv->pfnVBVAInputMappingUpdate(pVGAState->pDrv,2642 pThisCC->pDrv->pfnVBVAInputMappingUpdate(pThisCC->pDrv, 2614 2643 inputMapping.x, inputMapping.y, 2615 2644 inputMapping.cx, inputMapping.cy); … … 2633 2662 RT_BOOL(Report.fReportPosition), vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer), Report.x, Report.y)); 2634 2663 2635 p VGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, RT_BOOL(Report.fReportPosition), vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer), Report.x, Report.y);2664 pThisCC->pDrv->pfnVBVAReportCursorPosition(pThisCC->pDrv, RT_BOOL(Report.fReportPosition), vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer), Report.x, Report.y); 2636 2665 /* This was only ever briefly used by the guest, and a value 2637 2666 * of zero in both was taken to mean "ignore". */ … … 2652 2681 } 2653 2682 2654 /* When VBVA is paused, thenVGA device is allowed to work but2683 /** When VBVA is paused, the VGA device is allowed to work but 2655 2684 * no HGSMI etc state is changed. 2656 2685 */ 2657 void VBVAPause(PVGASTATE pVGAState, bool fPause) 2658 { 2659 if (!pVGAState || !pVGAState->pHGSMI) 2660 { 2686 static void vbvaPause(PVGASTATECC pThisCC, bool fPause) 2687 { 2688 if (!pThisCC || !pThisCC->pHGSMI) 2661 2689 return; 2662 } 2663 2664 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pVGAState->pHGSMI); 2665 2690 2691 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2666 2692 if (pCtx) 2667 {2668 2693 pCtx->fPaused = fPause; 2669 } 2670 } 2671 2672 bool VBVAIsPaused(PVGASTATE pVGAState) 2673 { 2674 if (pVGAState && pVGAState->pHGSMI) 2675 { 2676 const VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pVGAState->pHGSMI); 2694 } 2695 2696 bool VBVAIsPaused(PVGASTATECC pThisCC) 2697 { 2698 if (pThisCC && pThisCC->pHGSMI) 2699 { 2700 const VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2677 2701 if (pCtx && pCtx->cViews) 2678 2702 { … … 2687 2711 } 2688 2712 2689 void VBVAOnVBEChanged(PVGASTATE p VGAState)2713 void VBVAOnVBEChanged(PVGASTATE pThis, PVGASTATECC pThisCC) 2690 2714 { 2691 2715 /* The guest does not depend on host handling the VBE registers. */ 2692 if (pVGAState->fGuestCaps & VBVACAPS_USE_VBVA_ONLY) 2693 { 2716 if (pThis->fGuestCaps & VBVACAPS_USE_VBVA_ONLY) 2694 2717 return; 2695 } 2696 2697 VBVAPause(pVGAState, (pVGAState->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0); 2698 } 2699 2700 void VBVAReset (PVGASTATE pVGAState) 2701 { 2702 if (!pVGAState || !pVGAState->pHGSMI) 2703 { 2718 2719 vbvaPause(pThisCC, (pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) == 0); 2720 } 2721 2722 void VBVAReset(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 2723 { 2724 if (!pThis || !pThisCC->pHGSMI) 2704 2725 return; 2705 } 2706 2707 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI); 2726 2727 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2708 2728 2709 2729 #ifdef VBOX_WITH_VIDEOHWACCEL 2710 vbvaVHWAReset (pVGAState);2730 vbvaVHWAReset(pDevIns, pThis, pThisCC); 2711 2731 #endif 2712 2732 2713 HGSMIReset(p VGAState->pHGSMI);2733 HGSMIReset(pThisCC->pHGSMI); 2714 2734 /* Make sure the IRQ is reset. */ 2715 PDMDevHlpPCISetIrq(p VGAState->pDevInsR3, 0, PDM_IRQ_LEVEL_LOW);2716 p VGAState->fu32PendingGuestFlags = 0;2735 PDMDevHlpPCISetIrq(pDevIns, 0, PDM_IRQ_LEVEL_LOW); 2736 pThis->fu32PendingGuestFlags = 0; 2717 2737 2718 2738 if (pCtx) 2719 2739 { 2720 vbvaFlush (pVGAState, pCtx); 2721 2722 unsigned uScreenId; 2723 2724 for (uScreenId = 0; uScreenId < pCtx->cViews; uScreenId++) 2725 { 2726 vbvaDisable (uScreenId, pVGAState, pCtx); 2727 } 2740 vbvaFlush(pThis, pThisCC, pCtx); 2741 2742 for (unsigned idScreen = 0; idScreen < pCtx->cViews; idScreen++) 2743 vbvaDisable(pThis, pThisCC, pCtx, idScreen); 2728 2744 2729 2745 pCtx->mouseShapeInfo.fSet = false; … … 2736 2752 } 2737 2753 2738 int VBVAUpdateDisplay (PVGASTATE pVGAState)2754 int VBVAUpdateDisplay(PVGASTATE pThis, PVGASTATECC pThisCC) 2739 2755 { 2740 2756 int rc = VERR_NOT_SUPPORTED; /* Assuming that the VGA device will have to do updates. */ 2741 2757 2742 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI); 2743 2758 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2744 2759 if (pCtx) 2745 2760 { 2746 2761 if (!pCtx->fPaused) 2747 2762 { 2748 rc = vbvaFlush (pVGAState, pCtx); 2749 2750 if (RT_SUCCESS (rc)) 2763 rc = vbvaFlush(pThis, pThisCC, pCtx); 2764 if (RT_SUCCESS(rc)) 2751 2765 { 2752 2766 if (!pCtx->aViews[0].vbva.guest.pVBVA) … … 2762 2776 } 2763 2777 2764 static int vbvaSendModeHintWorker(P VGASTATE pThis, uint32_t cx, uint32_t cy,2765 uint32_t c BPP, uint32_t iDisplay, uint32_t dx,2778 static int vbvaSendModeHintWorker(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, 2779 uint32_t cx, uint32_t cy, uint32_t cBPP, uint32_t iDisplay, uint32_t dx, 2766 2780 uint32_t dy, uint32_t fEnabled, 2767 2781 uint32_t fNotifyGuest) 2768 2782 { 2769 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThis ->pHGSMI);2783 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2770 2784 /** @note See Display::setVideoModeHint: "It is up to the guest to decide 2771 2785 * whether the hint is valid. Therefore don't do any VRAM sanity checks … … 2781 2795 pCtx->aModeHints[iDisplay].fEnabled = fEnabled; 2782 2796 if (fNotifyGuest && pThis->fGuestCaps & VBVACAPS_IRQ && pThis->fGuestCaps & VBVACAPS_VIDEO_MODE_HINTS) 2783 VBVARaiseIrq(p This, HGSMIHOSTFLAGS_HOTPLUG);2797 VBVARaiseIrq(pDevIns, pThis, pThisCC, HGSMIHOSTFLAGS_HOTPLUG); 2784 2798 return VINF_SUCCESS; 2785 2799 } 2786 2800 2787 /** Converts a display port interface pointer to a vga state pointer. */2788 #define IDISPLAYPORT_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, IPort)) )2789 2801 2790 2802 /** … … 2794 2806 uint32_t iDisplay, uint32_t dx, uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest) 2795 2807 { 2796 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 2797 int rc = PDMDevHlpCritSectEnter(pThis->pDevInsR3, &pThis->CritSect, VERR_SEM_BUSY); 2808 PVGASTATECC pThisCC = RT_FROM_MEMBER(pInterface, VGASTATECC, IPort); 2809 PPDMDEVINS pDevIns = pThisCC->pDevIns; 2810 PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE); 2811 int rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VERR_SEM_BUSY); 2798 2812 AssertRC(rc); 2799 2813 2800 rc = vbvaSendModeHintWorker(p This, cx, cy, cBPP, iDisplay, dx, dy, fEnabled, fNotifyGuest);2801 2802 PDMDevHlpCritSectLeave(p This->pDevInsR3, &pThis->CritSect);2814 rc = vbvaSendModeHintWorker(pDevIns, pThis, pThisCC, cx, cy, cBPP, iDisplay, dx, dy, fEnabled, fNotifyGuest); 2815 2816 PDMDevHlpCritSectLeave(pDevIns, &pThis->CritSect); 2803 2817 return rc; 2804 2818 } 2805 2819 2806 int VBVAInit(PVGASTATE pVGAState) 2807 { 2808 PPDMDEVINS pDevIns = pVGAState->pDevInsR3; 2809 2820 int VBVAInit(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC) 2821 { 2810 2822 PVM pVM = PDMDevHlpGetVM(pDevIns); 2811 2823 2812 int rc = HGSMICreate(&p VGAState->pHGSMI,2824 int rc = HGSMICreate(&pThisCC->pHGSMI, 2813 2825 pVM, 2814 2826 "VBVA", 2815 2827 0, 2816 p VGAState->vram_ptrR3,2817 p VGAState->vram_size,2828 pThisCC->pbVRam, 2829 pThis->vram_size, 2818 2830 vbvaNotifyGuest, 2819 p VGAState,2831 pDevIns, 2820 2832 sizeof(VBVACONTEXT)); 2821 2833 if (RT_SUCCESS(rc)) 2822 2834 { 2823 rc = HGSMIHostChannelRegister(p VGAState->pHGSMI,2835 rc = HGSMIHostChannelRegister(pThisCC->pHGSMI, 2824 2836 HGSMI_CH_VBVA, 2825 2837 vbvaChannelHandler, 2826 p VGAState);2838 pDevIns); 2827 2839 if (RT_SUCCESS(rc)) 2828 2840 { 2829 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(p VGAState->pHGSMI);2830 pCtx->cViews = p VGAState->cMonitors;2841 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pThisCC->pHGSMI); 2842 pCtx->cViews = pThis->cMonitors; 2831 2843 pCtx->fPaused = true; 2832 2844 memset(pCtx->aModeHints, ~0, sizeof(pCtx->aModeHints)); … … 2838 2850 } 2839 2851 2840 void VBVADestroy(PVGASTATE pVGAState)2841 { 2842 PHGSMIINSTANCE pHgsmi = p VGAState->pHGSMI;2852 void VBVADestroy(PVGASTATECC pThisCC) 2853 { 2854 PHGSMIINSTANCE pHgsmi = pThisCC->pHGSMI; 2843 2855 if (pHgsmi) 2844 2856 { … … 2851 2863 2852 2864 HGSMIDestroy(pHgsmi); 2853 p VGAState->pHGSMI = NULL;2854 } 2855 } 2856 2865 pThisCC->pHGSMI = NULL; 2866 } 2867 } 2868 -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r82048 r82109 172 172 { 173 173 PHGSMIINSTANCE pHgsmi; /**< Same as VGASTATE::pHgsmi. */ 174 PVGASTATE p VGAState;174 PVGASTATE pThis; 175 175 } VBOXVDMAHOST, *PVBOXVDMAHOST; 176 176 … … 186 186 187 187 188 /*********************************************************************************************************************************189 * Internal Functions *190 *********************************************************************************************************************************/191 188 192 189 … … 196 193 * @returns VBox status code. 197 194 */ 198 int vboxVDMAConstruct(PVGASTATE p VGAState, uint32_t cPipeElements)195 int vboxVDMAConstruct(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t cPipeElements) 199 196 { 200 197 RT_NOREF(cPipeElements); 201 int rc;202 198 PVBOXVDMAHOST pVdma = (PVBOXVDMAHOST)RTMemAllocZ(sizeof(*pVdma)); 203 199 Assert(pVdma); 204 200 if (pVdma) 205 201 { 206 pVdma->pHgsmi = pVGAState->pHGSMI; 207 pVdma->pVGAState = pVGAState; 208 209 rc = VINF_SUCCESS; 210 if (RT_SUCCESS(rc)) 211 { 212 pVGAState->pVdma = pVdma; 213 214 return VINF_SUCCESS; 215 /* the timer is cleaned up automatically */ 216 } 217 RTMemFree(pVdma); 218 } 219 else 220 rc = VERR_OUT_OF_RESOURCES; 221 return rc; 202 pVdma->pHgsmi = pThisCC->pHGSMI; 203 pVdma->pThis = pThis; 204 205 pThisCC->pVdma = pVdma; 206 return VINF_SUCCESS; 207 } 208 return VERR_NO_MEMORY; 222 209 } 223 210
Note:
See TracChangeset
for help on using the changeset viewer.