Changeset 57081 in vbox for trunk/src/VBox
- Timestamp:
- Jul 26, 2015 6:16:11 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r57011 r57081 44 44 #include <iprt/uuid.h> 45 45 #ifdef IN_RING3 46 # include <iprt/ctype.h> 46 47 # include <iprt/mem.h> 47 48 #endif … … 92 93 * Structures and Typedefs * 93 94 *******************************************************************************/ 94 /* 64-bit GMR descriptor */ 95 /** 96 * 64-bit GMR descriptor. 97 */ 95 98 typedef struct 96 99 { … … 99 102 } VMSVGAGMRDESCRIPTOR, *PVMSVGAGMRDESCRIPTOR; 100 103 101 /* GMR slot */ 104 /** 105 * GMR slot 106 */ 102 107 typedef struct 103 108 { … … 108 113 } GMR, *PGMR; 109 114 110 /* Internal SVGA state. */ 111 typedef struct 115 #ifdef IN_RING3 116 /** 117 * Internal SVGA ring-3 only state. 118 */ 119 typedef struct VMSVGAR3STATE 112 120 { 113 121 GMR aGMR[VMSVGA_MAX_GMR_IDS]; … … 130 138 SVGAColorBGRX colorAnnotation; 131 139 132 # ifdef VMSVGA_USE_EMT_HALT_CODE140 # ifdef VMSVGA_USE_EMT_HALT_CODE 133 141 /** Number of EMTs in BusyDelayedEmts (quicker than scanning the set). */ 134 142 uint32_t volatile cBusyDelayedEmts; 135 143 /** Set of EMTs that are */ 136 144 VMCPUSET BusyDelayedEmts; 137 # else145 # else 138 146 /** Number of EMTs waiting on hBusyDelayedEmts. */ 139 147 uint32_t volatile cBusyDelayedEmts; … … 141 149 * busy (ugly). */ 142 150 RTSEMEVENTMULTI hBusyDelayedEmts; 143 # endif151 # endif 144 152 /** Tracks how much time we waste reading SVGA_REG_BUSY with a busy FIFO. */ 145 153 STAMPROFILE StatBusyDelayEmts; … … 156 164 STAMPROFILE StatFifoStalls; 157 165 158 } VMSVGASTATE, *PVMSVGASTATE; 166 } VMSVGAR3STATE, *PVMSVGAR3STATE; 167 #endif /* IN_RING3 */ 159 168 160 169 … … 200 209 201 210 /** 202 * SSM descriptor table for the VMSVGA STATE structure.211 * SSM descriptor table for the VMSVGAR3STATE structure. 203 212 */ 204 static SSMFIELD const g_aVMSVGA STATEFields[] =213 static SSMFIELD const g_aVMSVGAR3STATEFields[] = 205 214 { 206 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, aGMR),207 SSMFIELD_ENTRY( VMSVGA STATE, GMRFB),208 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.fActive),209 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.xHotspot),210 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.yHotspot),211 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.width),212 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.height),213 SSMFIELD_ENTRY( VMSVGA STATE, Cursor.cbData),214 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGA STATE, Cursor.pData),215 SSMFIELD_ENTRY( VMSVGA STATE, colorAnnotation),216 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, cBusyDelayedEmts),215 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, aGMR), 216 SSMFIELD_ENTRY( VMSVGAR3STATE, GMRFB), 217 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.fActive), 218 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.xHotspot), 219 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.yHotspot), 220 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.width), 221 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.height), 222 SSMFIELD_ENTRY( VMSVGAR3STATE, Cursor.cbData), 223 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAR3STATE, Cursor.pData), 224 SSMFIELD_ENTRY( VMSVGAR3STATE, colorAnnotation), 225 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, cBusyDelayedEmts), 217 226 #ifdef VMSVGA_USE_EMT_HALT_CODE 218 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, BusyDelayedEmts),227 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, BusyDelayedEmts), 219 228 #else 220 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, hBusyDelayedEmts),229 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, hBusyDelayedEmts), 221 230 #endif 222 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatBusyDelayEmts),223 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatR3CmdPresent),224 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatR3CmdDrawPrimitive),225 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatR3CmdSurfaceDMA),226 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoCommands),227 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoErrors),228 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoUnkCmds),229 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoTodoTimeout),230 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoTodoWoken),231 SSMFIELD_ENTRY_IGNORE( VMSVGA STATE, StatFifoStalls),231 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatBusyDelayEmts), 232 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdPresent), 233 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdDrawPrimitive), 234 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatR3CmdSurfaceDMA), 235 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoCommands), 236 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoErrors), 237 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoUnkCmds), 238 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoTodoTimeout), 239 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoTodoWoken), 240 SSMFIELD_ENTRY_IGNORE( VMSVGAR3STATE, StatFifoStalls), 232 241 SSMFIELD_ENTRY_TERM() 233 242 }; … … 241 250 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, pFIFOR3), 242 251 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, pFIFOR0), 243 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, pS VGAState),252 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, pSvgaR3State), 244 253 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, p3dState), 245 254 SSMFIELD_ENTRY_IGN_HCPTR( VMSVGAState, pFrameBufferBackup), … … 820 829 /* The guest is basically doing a HLT via the device here, but with 821 830 a special wake up condition on FIFO completion. */ 822 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;831 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 823 832 STAM_REL_PROFILE_START(&pSVGAState->StatBusyDelayEmts, EmtDelay); 824 833 PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3); … … 835 844 This used to be a crude 50 ms sleep. The current code tries to be 836 845 more efficient, but the consept is still very crude. */ 837 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;846 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 838 847 STAM_REL_PROFILE_START(&pSVGAState->StatBusyDelayEmts, EmtDelay); 839 848 RTThreadYield(); … … 1069 1078 PDMBOTHCBDECL(int) vmsvgaWritePort(PVGASTATE pThis, uint32_t u32) 1070 1079 { 1071 PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState; 1072 int rc = VINF_SUCCESS; 1080 #ifdef IN_RING3 1081 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1082 #endif 1083 int rc = VINF_SUCCESS; 1073 1084 1074 1085 Log(("vmsvgaWritePort index=%s (%d) val=%#x\n", vmsvgaIndexToString(pThis), pThis->svga.u32IndexReg, u32)); … … 1927 1938 PVGASTATE pThis = (PVGASTATE)pvUser; 1928 1939 Assert(pThis); 1929 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;1940 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1930 1941 NOREF(pVCpu); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmOrigin); 1931 1942 … … 1962 1973 static DECLCALLBACK(int) vmsvgaRegisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId) 1963 1974 { 1964 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);1965 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;1975 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 1976 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1966 1977 PGMR pGMR = &pSVGAState->aGMR[gmrId]; 1967 1978 int rc; … … 1980 1991 static DECLCALLBACK(int) vmsvgaDeregisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId) 1981 1992 { 1982 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);1983 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;1993 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 1994 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1984 1995 PGMR pGMR = &pSVGAState->aGMR[gmrId]; 1985 1996 … … 1995 2006 static DECLCALLBACK(int) vmsvgaResetGMRHandlers(PVGASTATE pThis) 1996 2007 { 1997 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;2008 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 1998 2009 1999 2010 for (uint32_t i = 0; i < RT_ELEMENTS(pSVGAState->aGMR); i++) … … 2075 2086 break; 2076 2087 } 2088 2089 case VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS: 2090 { 2091 # ifdef VBOX_WITH_VMSVGA3D 2092 uint32_t sid = (uint32_t)(uintptr_t)pThis->svga.pvFIFOExtCmdParam; 2093 Log(("vmsvgaFIFOLoop: VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS sid=%#x\n", sid)); 2094 vmsvga3dUpdateHeapBuffersForSurfaces(pThis, sid); 2095 # endif 2096 break; 2097 } 2098 2077 2099 2078 2100 default: … … 2151 2173 { 2152 2174 /* 2153 * The thread is running, should only happen during reset .2175 * The thread is running, should only happen during reset and vmsvga3dsfc. 2154 2176 * We ASSUME not racing code here, both wrt thread state and ext commands. 2155 2177 */ 2156 2178 Log(("vmsvgaR3RunExtCmdOnFifoThread: uExtCmd=%d enmState=RUNNING\n", uExtCmd)); 2157 Assert(uExtCmd == VMSVGA_FIFO_EXTCMD_RESET );2179 Assert(uExtCmd == VMSVGA_FIFO_EXTCMD_RESET || uExtCmd == VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS); 2158 2180 2159 2181 /* Post the request. */ … … 2193 2215 * @param offFifoMin The start byte offset of the command FIFO. 2194 2216 */ 2195 static void vmsvgaFifoSetNotBusy(PVGASTATE pThis, PVMSVGA STATE pSVGAState, uint32_t offFifoMin)2217 static void vmsvgaFifoSetNotBusy(PVGASTATE pThis, PVMSVGAR3STATE pSVGAState, uint32_t offFifoMin) 2196 2218 { 2197 2219 ASMAtomicAndU32(&pThis->svga.fBusy, ~VMSVGA_BUSY_F_FIFO); … … 2243 2265 uint32_t offCurrentCmd, uint32_t offFifoMin, uint32_t offFifoMax, 2244 2266 uint8_t *pbBounceBuf, uint32_t *pcbAlreadyRead, 2245 PPDMTHREAD pThread, PVGASTATE pThis, PVMSVGA STATE pSVGAState)2267 PPDMTHREAD pThread, PVGASTATE pThis, PVMSVGAR3STATE pSVGAState) 2246 2268 { 2247 2269 Assert(pbBounceBuf); … … 2375 2397 static DECLCALLBACK(int) vmsvgaFIFOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 2376 2398 { 2377 PVGASTATE pThis = (PVGASTATE)pThread->pvUser;2378 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;2379 int rc;2399 PVGASTATE pThis = (PVGASTATE)pThread->pvUser; 2400 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 2401 int rc; 2380 2402 2381 2403 if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) … … 3428 3450 void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR) 3429 3451 { 3430 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;3452 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3431 3453 3432 3454 /* Free the old descriptor if present. */ … … 3465 3487 SVGAGuestPtr src, uint32_t offSrc, int32_t cbSrcPitch, uint32_t cbWidth, uint32_t cHeight) 3466 3488 { 3467 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;3489 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3468 3490 PGMR pGMR; 3469 3491 int rc; … … 3741 3763 } 3742 3764 3765 # ifdef VBOX_WITH_VMSVGA3D 3743 3766 3744 3767 /** 3745 * @callback_method_impl{FNDBGFHANDLERDEV} 3768 * Used by vmsvga3dInfoSurfaceWorker to make the FIFO thread to save one or all 3769 * surfaces to VMSVGA3DMIPMAPLEVEL::pSurfaceData heap buffers. 3770 * 3771 * @param pThis The VGA device instance data. 3772 * @param sid Either UINT32_MAX or the ID of a specific 3773 * surface. If UINT32_MAX is used, all surfaces 3774 * are processed. 3746 3775 */ 3747 static DECLCALLBACK(void) vmsvgaInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)3776 void vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(PVGASTATE pThis, uint32_t sid) 3748 3777 { 3749 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 3750 PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState; 3778 vmsvgaR3RunExtCmdOnFifoThread(pThis, VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS, (void *)(uintptr_t)sid, 3779 sid == UINT32_MAX ? 10 * RT_MS_1SEC : RT_MS_1MIN); 3780 } 3781 3782 3783 /** 3784 * @callback_method_impl{FNDBGFHANDLERDEV, "vmsvga3dsfc"} 3785 */ 3786 DECLCALLBACK(void) vmsvgaR3Info3dSurface(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3787 { 3788 /* There might be a specific context ID at the start of the 3789 arguments, if not show all contexts. */ 3790 uint32_t cid = UINT32_MAX; 3791 if (pszArgs) 3792 pszArgs = RTStrStripL(pszArgs); 3793 if (pszArgs && RT_C_IS_DIGIT(*pszArgs)) 3794 cid = RTStrToUInt32(pszArgs); 3795 3796 /* Verbose or terse display, we default to verbose. */ 3797 bool fVerbose = true; 3798 if (RTStrIStr(pszArgs, "terse")) 3799 fVerbose = false; 3800 3801 /* The size of the ascii art (x direction, y is 3/4 of x). */ 3802 uint32_t cxAscii = 80; 3803 if (RTStrIStr(pszArgs, "gigantic")) 3804 cxAscii = 300; 3805 else if (RTStrIStr(pszArgs, "huge")) 3806 cxAscii = 180; 3807 else if (RTStrIStr(pszArgs, "big")) 3808 cxAscii = 132; 3809 else if (RTStrIStr(pszArgs, "normal")) 3810 cxAscii = 80; 3811 else if (RTStrIStr(pszArgs, "medium")) 3812 cxAscii = 64; 3813 else if (RTStrIStr(pszArgs, "small")) 3814 cxAscii = 48; 3815 else if (RTStrIStr(pszArgs, "tiny")) 3816 cxAscii = 24; 3817 3818 /* Y invert the image when producing the ASCII art. */ 3819 bool fInvY = false; 3820 if (RTStrIStr(pszArgs, "invy")) 3821 fInvY = true; 3822 3823 vmsvga3dInfoSurfaceWorker(PDMINS_2_DATA(pDevIns, PVGASTATE), pHlp, cid, fVerbose, cxAscii, fInvY); 3824 } 3825 3826 3827 /** 3828 * @callback_method_impl{FNDBGFHANDLERDEV, "vmsvga3dctx"} 3829 */ 3830 DECLCALLBACK(void) vmsvgaR3Info3dContext(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3831 { 3832 /* There might be a specific surface ID at the start of the 3833 arguments, if not show all contexts. */ 3834 uint32_t sid = UINT32_MAX; 3835 if (pszArgs) 3836 pszArgs = RTStrStripL(pszArgs); 3837 if (pszArgs && RT_C_IS_DIGIT(*pszArgs)) 3838 sid = RTStrToUInt32(pszArgs); 3839 3840 /* Verbose or terse display, we default to verbose. */ 3841 bool fVerbose = true; 3842 if (RTStrIStr(pszArgs, "terse")) 3843 fVerbose = false; 3844 3845 vmsvga3dInfoContextWorker(PDMINS_2_DATA(pDevIns, PVGASTATE), pHlp, sid, fVerbose); 3846 } 3847 3848 # endif /* VBOX_WITH_VMSVGA3D */ 3849 3850 /** 3851 * @callback_method_impl{FNDBGFHANDLERDEV, "vmsvga"} 3852 */ 3853 static DECLCALLBACK(void) vmsvgaR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3854 { 3855 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 3856 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3751 3857 3752 3858 pHlp->pfnPrintf(pHlp, "Extension enabled: %RTbool\n", pThis->svga.fEnabled); 3753 3859 pHlp->pfnPrintf(pHlp, "Configured: %RTbool\n", pThis->svga.fConfigured); 3754 3860 pHlp->pfnPrintf(pHlp, "Base I/O port: %#x\n", pThis->svga.BasePort); 3755 pHlp->pfnPrintf(pHlp, "Host windows ID: %#RX64\n", pThis->svga.u64HostWindowId);3756 3861 pHlp->pfnPrintf(pHlp, "FIFO address: %RGp\n", pThis->svga.GCPhysFIFO); 3757 3862 pHlp->pfnPrintf(pHlp, "FIFO size: %u (%#x)\n", pThis->svga.cbFIFO, pThis->svga.cbFIFO); … … 3780 3885 3781 3886 pHlp->pfnPrintf(pHlp, "3D enabled: %RTbool\n", pThis->svga.f3DEnabled); 3782 3887 pHlp->pfnPrintf(pHlp, "Host windows ID: %#RX64\n", pThis->svga.u64HostWindowId); 3888 if (pThis->svga.u64HostWindowId != 0) 3889 vmsvga3dInfoHostWindow(pHlp, pThis->svga.u64HostWindowId); 3783 3890 } 3784 3891 … … 3789 3896 int vmsvgaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 3790 3897 { 3791 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);3792 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;3793 int rc;3898 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 3899 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3900 int rc; 3794 3901 3795 3902 /* Load our part of the VGAState */ … … 3802 3909 3803 3910 /* Load the VMSVGA state. */ 3804 rc = SSMR3GetStructEx(pSSM, pSVGAState, sizeof(*pSVGAState), 0, g_aVMSVGA STATEFields, NULL);3911 rc = SSMR3GetStructEx(pSSM, pSVGAState, sizeof(*pSVGAState), 0, g_aVMSVGAR3STATEFields, NULL); 3805 3912 AssertRCReturn(rc, rc); 3806 3913 … … 3858 3965 int vmsvgaLoadDone(PPDMDEVINS pDevIns) 3859 3966 { 3860 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);3861 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;3967 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 3968 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3862 3969 3863 3970 pThis->last_bpp = VMSVGA_VAL_UNINITIALIZED; /* force mode reset */ … … 3869 3976 int rc; 3870 3977 3871 rc = pThis->pDrv->pfnVBVAMousePointerShape 3872 3873 3874 3875 3876 3877 3878 3978 rc = pThis->pDrv->pfnVBVAMousePointerShape(pThis->pDrv, 3979 true, 3980 true, 3981 pSVGAState->Cursor.xHotspot, 3982 pSVGAState->Cursor.yHotspot, 3983 pSVGAState->Cursor.width, 3984 pSVGAState->Cursor.height, 3985 pSVGAState->Cursor.pData); 3879 3986 AssertRC(rc); 3880 3987 } … … 3887 3994 int vmsvgaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 3888 3995 { 3889 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);3890 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;3891 int rc;3996 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 3997 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3998 int rc; 3892 3999 3893 4000 /* Save our part of the VGAState */ … … 3900 4007 3901 4008 /* Save the VMSVGA state. */ 3902 rc = SSMR3PutStructEx(pSSM, pSVGAState, sizeof(*pSVGAState), 0, g_aVMSVGA STATEFields, NULL);4009 rc = SSMR3PutStructEx(pSSM, pSVGAState, sizeof(*pSVGAState), 0, g_aVMSVGAR3STATEFields, NULL); 3903 4010 AssertLogRelRCReturn(rc, rc); 3904 4011 … … 3944 4051 int vmsvgaReset(PPDMDEVINS pDevIns) 3945 4052 { 3946 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);3947 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;4053 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 4054 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 3948 4055 3949 4056 /* Reset before init? */ … … 3960 4067 /* Reset other stuff. */ 3961 4068 pThis->svga.cScratchRegion = VMSVGA_SCRATCH_SIZE; 3962 memset(pThis->svga.au32ScratchRegion, 0, sizeof(pThis->svga.au32ScratchRegion));3963 memset(pThis->svga.pSVGAState, 0, sizeof(VMSVGASTATE));3964 memset(pThis->svga.pFrameBufferBackup, 0, VMSVGA_FRAMEBUFFER_BACKUP_SIZE);4069 RT_ZERO(pThis->svga.au32ScratchRegion); 4070 RT_ZERO(*pThis->svga.pSvgaR3State); 4071 RT_BZERO(pThis->svga.pFrameBufferBackup, VMSVGA_FRAMEBUFFER_BACKUP_SIZE); 3965 4072 3966 4073 /* Register caps. */ … … 4015 4122 * Destroy the special SVGA state. 4016 4123 */ 4017 PVMSVGA STATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;4124 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 4018 4125 if (pSVGAState) 4019 4126 { … … 4033 4140 4034 4141 RTMemFree(pSVGAState); 4035 pThis->svga.pS VGAState = NULL;4142 pThis->svga.pSvgaR3State = NULL; 4036 4143 } 4037 4144 … … 4064 4171 { 4065 4172 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 4066 PVMSVGA STATEpSVGAState;4173 PVMSVGAR3STATE pSVGAState; 4067 4174 PVM pVM = PDMDevHlpGetVM(pDevIns); 4068 4175 int rc; … … 4071 4178 memset(pThis->svga.au32ScratchRegion, 0, sizeof(pThis->svga.au32ScratchRegion)); 4072 4179 4073 pThis->svga.pS VGAState = RTMemAllocZ(sizeof(VMSVGASTATE));4074 AssertReturn(pThis->svga.pS VGAState, VERR_NO_MEMORY);4075 pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;4180 pThis->svga.pSvgaR3State = (PVMSVGAR3STATE)RTMemAllocZ(sizeof(VMSVGAR3STATE)); 4181 AssertReturn(pThis->svga.pSvgaR3State, VERR_NO_MEMORY); 4182 pSVGAState = pThis->svga.pSvgaR3State; 4076 4183 4077 4184 /* Necessary for creating a backup of the text mode frame buffer when switching into svga mode. */ … … 4189 4296 * Info handlers. 4190 4297 */ 4191 PDMDevHlpDBGFInfoRegister(pDevIns, "vmsvga", "Basic VMSVGA device state details", vmsvgaInfo); 4298 PDMDevHlpDBGFInfoRegister(pDevIns, "vmsvga", "Basic VMSVGA device state details", vmsvgaR3Info); 4299 # ifdef VBOX_WITH_VMSVGA3D 4300 PDMDevHlpDBGFInfoRegister(pDevIns, "vmsvga3dctx", "VMSVGA 3d context details. Accepts 'terse'.", vmsvgaR3Info3dContext); 4301 PDMDevHlpDBGFInfoRegister(pDevIns, "vmsvga3dsfc", 4302 "VMSVGA 3d surface details. " 4303 "Accepts 'terse', 'invy', and one of 'tiny', 'medium', 'normal', 'big', 'huge', or 'gigantic'.", 4304 vmsvgaR3Info3dSurface); 4305 # endif 4192 4306 4193 4307 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r57010 r57081 872 872 #endif 873 873 } VMSVGA3DSTATE; 874 /** Pointer to the VMSVGA3d state. */875 typedef VMSVGA3DSTATE *PVMSVGA3DSTATE;876 874 877 875 /** … … 1396 1394 * Allocate the state. 1397 1395 */ 1398 pThis->svga.p3dState = RTMemAllocZ(sizeof(VMSVGA3DSTATE));1396 pThis->svga.p3dState = (PVMSVGA3DSTATE)RTMemAllocZ(sizeof(VMSVGA3DSTATE)); 1399 1397 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 1400 1398 1401 1399 #ifdef RT_OS_WINDOWS 1402 1400 /* Create event semaphore and async IO thread. */ 1403 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1401 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1404 1402 rc = RTSemEventCreate(&pState->WndRequestSem); 1405 1403 if (RT_SUCCESS(rc)) … … 1427 1425 int vmsvga3dPowerOn(PVGASTATE pThis) 1428 1426 { 1429 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1427 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1430 1428 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 1431 1429 PVMSVGA3DCONTEXT pContext; … … 1819 1817 int vmsvga3dReset(PVGASTATE pThis) 1820 1818 { 1821 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1819 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1822 1820 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 1823 1821 … … 1844 1842 int vmsvga3dTerminate(PVGASTATE pThis) 1845 1843 { 1846 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1844 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1847 1845 AssertReturn(pState, VERR_WRONG_ORDER); 1848 1846 int rc; … … 2016 2014 int vmsvga3dQueryCaps(PVGASTATE pThis, uint32_t idx3dCaps, uint32_t *pu32Val) 2017 2015 { 2018 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2016 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2019 2017 AssertReturn(pState, VERR_NO_MEMORY); 2020 2018 int rc = VINF_SUCCESS; … … 2617 2615 { 2618 2616 PVMSVGA3DSURFACE pSurface; 2619 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2617 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2620 2618 AssertReturn(pState, VERR_NO_MEMORY); 2621 2619 … … 2809 2807 int vmsvga3dSurfaceDestroy(PVGASTATE pThis, uint32_t sid) 2810 2808 { 2811 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2809 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2812 2810 AssertReturn(pState, VERR_NO_MEMORY); 2813 2811 … … 2928 2926 int vmsvga3dSurfaceCopy(PVGASTATE pThis, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src, uint32_t cCopyBoxes, SVGA3dCopyBox *pBox) 2929 2927 { 2930 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2928 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2931 2929 uint32_t sidSrc = src.sid; 2932 2930 uint32_t sidDest = dest.sid; … … 3159 3157 SVGA3dSurfaceImageId src, SVGA3dBox srcBox, SVGA3dStretchBltMode mode) 3160 3158 { 3161 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3159 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3162 3160 PVMSVGA3DSURFACE pSurfaceSrc; 3163 3161 uint32_t sidSrc = src.sid; … … 3387 3385 uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes) 3388 3386 { 3389 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3387 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3390 3388 PVMSVGA3DSURFACE pSurface; 3391 3389 PVMSVGA3DMIPMAPLEVEL pMipLevel; … … 3799 3797 int vmsvga3dGenerateMipmaps(PVGASTATE pThis, uint32_t sid, SVGA3dTextureFilter filter) 3800 3798 { 3801 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3799 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3802 3800 PVMSVGA3DSURFACE pSurface; 3803 3801 int rc = VINF_SUCCESS; … … 3872 3870 int vmsvga3dCommandPresent(PVGASTATE pThis, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect) 3873 3871 { 3874 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3872 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3875 3873 PVMSVGA3DSURFACE pSurface; 3876 3874 int rc = VINF_SUCCESS; … … 4289 4287 int rc; 4290 4288 PVMSVGA3DCONTEXT pContext; 4291 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4289 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4292 4290 4293 4291 AssertReturn(pState, VERR_NO_MEMORY); … … 4588 4586 static int vmsvga3dContextDestroyOgl(PVGASTATE pThis, PVMSVGA3DCONTEXT pContext, uint32_t cid) 4589 4587 { 4590 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4588 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4591 4589 AssertReturn(pState, VERR_NO_MEMORY); 4592 4590 AssertReturn(pContext, VERR_INVALID_PARAMETER); … … 4719 4717 int vmsvga3dContextDestroy(PVGASTATE pThis, uint32_t cid) 4720 4718 { 4721 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4719 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4722 4720 AssertReturn(pState, VERR_WRONG_ORDER); 4723 4721 … … 4736 4734 int vmsvga3dChangeMode(PVGASTATE pThis) 4737 4735 { 4738 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4736 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4739 4737 AssertReturn(pState, VERR_NO_MEMORY); 4740 4738 … … 4774 4772 { 4775 4773 PVMSVGA3DCONTEXT pContext; 4776 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4774 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4777 4775 AssertReturn(pState, VERR_NO_MEMORY); 4778 4776 bool fModelViewChanged = false; … … 4882 4880 { 4883 4881 PVMSVGA3DCONTEXT pContext; 4884 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4882 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4885 4883 AssertReturn(pState, VERR_NO_MEMORY); 4886 4884 … … 5024 5022 uint32_t val; 5025 5023 PVMSVGA3DCONTEXT pContext; 5026 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5024 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5027 5025 AssertReturn(pState, VERR_NO_MEMORY); 5028 5026 … … 5854 5852 { 5855 5853 PVMSVGA3DCONTEXT pContext; 5856 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5854 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5857 5855 PVMSVGA3DSURFACE pRenderTarget; 5858 5856 … … 6185 6183 GLenum currentStage = ~0L; 6186 6184 PVMSVGA3DCONTEXT pContext; 6187 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6185 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6188 6186 AssertReturn(pState, VERR_NO_MEMORY); 6189 6187 … … 6439 6437 { 6440 6438 PVMSVGA3DCONTEXT pContext; 6441 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6439 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6442 6440 AssertReturn(pState, VERR_NO_MEMORY); 6443 6441 GLenum oglFace; … … 6492 6490 { 6493 6491 PVMSVGA3DCONTEXT pContext; 6494 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6492 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6495 6493 AssertReturn(pState, VERR_NO_MEMORY); 6496 6494 float QuadAttenuation; … … 6672 6670 { 6673 6671 PVMSVGA3DCONTEXT pContext; 6674 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6672 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6675 6673 AssertReturn(pState, VERR_NO_MEMORY); 6676 6674 … … 6709 6707 { 6710 6708 PVMSVGA3DCONTEXT pContext; 6711 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6709 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6712 6710 AssertReturn(pState, VERR_NO_MEMORY); 6713 6711 … … 6755 6753 { 6756 6754 PVMSVGA3DCONTEXT pContext; 6757 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6755 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6758 6756 AssertReturn(pState, VERR_NO_MEMORY); 6759 6757 double oglPlane[4]; … … 6790 6788 { 6791 6789 PVMSVGA3DCONTEXT pContext; 6792 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6790 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6793 6791 AssertReturn(pState, VERR_NO_MEMORY); 6794 6792 … … 6828 6826 GLbitfield mask = 0; 6829 6827 PVMSVGA3DCONTEXT pContext; 6830 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;6828 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6831 6829 AssertReturn(pState, VERR_NO_MEMORY); 6832 6830 GLboolean fDepthWriteEnabled = GL_FALSE; … … 7271 7269 { 7272 7270 PVMSVGA3DCONTEXT pContext; 7273 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;7271 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 7274 7272 AssertReturn(pState, VERR_INTERNAL_ERROR); 7275 7273 int rc = VERR_NOT_IMPLEMENTED; … … 7520 7518 PVMSVGA3DCONTEXT pContext; 7521 7519 PVMSVGA3DSHADER pShader; 7522 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;7520 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 7523 7521 AssertReturn(pState, VERR_NO_MEMORY); 7524 7522 int rc; … … 7620 7618 { 7621 7619 PVMSVGA3DCONTEXT pContext; 7622 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;7620 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 7623 7621 AssertReturn(pState, VERR_NO_MEMORY); 7624 7622 PVMSVGA3DSHADER pShader = NULL; … … 7673 7671 int vmsvga3dShaderSet(PVGASTATE pThis, PVMSVGA3DCONTEXT pContext, uint32_t cid, SVGA3dShaderType type, uint32_t shid) 7674 7672 { 7675 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;7673 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 7676 7674 AssertReturn(pState, VERR_NO_MEMORY); 7677 7675 int rc; … … 7749 7747 { 7750 7748 PVMSVGA3DCONTEXT pContext; 7751 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;7749 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 7752 7750 AssertReturn(pState, VERR_NO_MEMORY); 7753 7751 int rc; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r56292 r57081 57 57 58 58 #ifdef RT_OS_WINDOWS 59 59 60 /** 60 61 * Send a message to the async window thread and wait for a reply … … 239 240 return DefWindowProc(hwnd, uMsg, wParam, lParam); 240 241 } 242 241 243 #endif /* RT_OS_WINDOWS */ 244 245 246 void vmsvga3dInfoU32Flags(PCDBGFINFOHLP pHlp, uint32_t fFlags, const char *pszPrefix, PCVMSVGAINFOFLAGS32 paFlags, uint32_t cFlags) 247 { 248 for (uint32_t i = 0; i < cFlags; i++) 249 if ((paFlags[i].fFlags & fFlags) == paFlags[i].fFlags) 250 { 251 Assert(paFlags[i].fFlags); 252 pHlp->pfnPrintf(pHlp, " %s%s", pszPrefix, paFlags[i].pszJohnny); 253 fFlags &= ~paFlags[i].fFlags; 254 if (!fFlags) 255 return; 256 } 257 if (fFlags) 258 pHlp->pfnPrintf(pHlp, " UNKNOWN_%#x", fFlags); 259 } 260 261 262 /** 263 * Worker for vmsvgaR3Info that display details of a host window. 264 * 265 * @param pHlp The output methods. 266 * @param idHostWindow The host window handle/id/whatever. 267 */ 268 void vmsvga3dInfoHostWindow(PCDBGFINFOHLP pHlp, uint64_t idHostWindow) 269 { 270 #ifdef RT_OS_WINDOWS 271 HWND hwnd = (HWND)(uintptr_t)idHostWindow; 272 Assert((uintptr_t)hwnd == idHostWindow); 273 if (hwnd != NULL) 274 { 275 WINDOWINFO Info; 276 RT_ZERO(Info); 277 Info.cbSize = sizeof(Info); 278 if (GetWindowInfo(hwnd, &Info)) 279 { 280 pHlp->pfnPrintf(pHlp, " Window rect: xLeft=%d, yTop=%d, xRight=%d, yBottom=%d (cx=%d, cy=%d)\n", 281 Info.rcWindow.left, Info.rcWindow.top, Info.rcWindow.right, Info.rcWindow.bottom, 282 Info.rcWindow.right - Info.rcWindow.left, Info.rcWindow.bottom - Info.rcWindow.top); 283 pHlp->pfnPrintf(pHlp, " Client rect: xLeft=%d, yTop=%d, xRight=%d, yBottom=%d (cx=%d, cy=%d)\n", 284 Info.rcClient.left, Info.rcClient.top, Info.rcClient.right, Info.rcClient.bottom, 285 Info.rcClient.right - Info.rcClient.left, Info.rcClient.bottom - Info.rcClient.top); 286 pHlp->pfnPrintf(pHlp, " Style: %#x", Info.dwStyle); 287 static const VMSVGAINFOFLAGS32 g_aStyles[] = 288 { 289 { WS_POPUP , "POPUP" }, 290 { WS_CHILD , "CHILD" }, 291 { WS_MINIMIZE , "MINIMIZE" }, 292 { WS_VISIBLE , "VISIBLE" }, 293 { WS_DISABLED , "DISABLED" }, 294 { WS_CLIPSIBLINGS , "CLIPSIBLINGS" }, 295 { WS_CLIPCHILDREN , "CLIPCHILDREN" }, 296 { WS_MAXIMIZE , "MAXIMIZE" }, 297 { WS_BORDER , "BORDER" }, 298 { WS_DLGFRAME , "DLGFRAME" }, 299 { WS_VSCROLL , "VSCROLL" }, 300 { WS_HSCROLL , "HSCROLL" }, 301 { WS_SYSMENU , "SYSMENU" }, 302 { WS_THICKFRAME , "THICKFRAME" }, 303 { WS_GROUP , "GROUP" }, 304 { WS_TABSTOP , "TABSTOP" }, 305 }; 306 vmsvga3dInfoU32Flags(pHlp, Info.dwStyle, "", g_aStyles, RT_ELEMENTS(g_aStyles)); 307 pHlp->pfnPrintf(pHlp, "\n"); 308 309 pHlp->pfnPrintf(pHlp, " ExStyle: %#x", Info.dwExStyle); 310 static const VMSVGAINFOFLAGS32 g_aExStyles[] = 311 { 312 { WS_EX_DLGMODALFRAME, "DLGMODALFRAME" }, 313 { 0x00000002, "DRAGDETECT" }, 314 { WS_EX_NOPARENTNOTIFY, "NOPARENTNOTIFY" }, 315 { WS_EX_TOPMOST, "TOPMOST" }, 316 { WS_EX_ACCEPTFILES, "ACCEPTFILES" }, 317 { WS_EX_TRANSPARENT, "TRANSPARENT" }, 318 { WS_EX_MDICHILD, "MDICHILD" }, 319 { WS_EX_TOOLWINDOW, "TOOLWINDOW" }, 320 { WS_EX_WINDOWEDGE, "WINDOWEDGE" }, 321 { WS_EX_CLIENTEDGE, "CLIENTEDGE" }, 322 { WS_EX_CONTEXTHELP, "CONTEXTHELP" }, 323 { WS_EX_RIGHT, "RIGHT" }, 324 /*{ WS_EX_LEFT, "LEFT" }, = 0 */ 325 { WS_EX_RTLREADING, "RTLREADING" }, 326 /*{ WS_EX_LTRREADING, "LTRREADING" }, = 0 */ 327 { WS_EX_LEFTSCROLLBAR, "LEFTSCROLLBAR" }, 328 /*{ WS_EX_RIGHTSCROLLBAR, "RIGHTSCROLLBAR" }, = 0 */ 329 { WS_EX_CONTROLPARENT, "CONTROLPARENT" }, 330 { WS_EX_STATICEDGE, "STATICEDGE" }, 331 { WS_EX_APPWINDOW, "APPWINDOW" }, 332 { WS_EX_LAYERED, "LAYERED" }, 333 { WS_EX_NOINHERITLAYOUT, "NOINHERITLAYOUT" }, 334 { WS_EX_LAYOUTRTL, "LAYOUTRTL" }, 335 { WS_EX_COMPOSITED, "COMPOSITED" }, 336 { WS_EX_NOACTIVATE, "NOACTIVATE" }, 337 }; 338 vmsvga3dInfoU32Flags(pHlp, Info.dwExStyle, "", g_aExStyles, RT_ELEMENTS(g_aExStyles)); 339 pHlp->pfnPrintf(pHlp, "\n"); 340 341 pHlp->pfnPrintf(pHlp, " Window Status: %#x\n", Info.dwWindowStatus); 342 if (Info.cxWindowBorders || Info.cyWindowBorders) 343 pHlp->pfnPrintf(pHlp, " Borders: cx=%u, cy=%u\n", Info.cxWindowBorders, Info.cyWindowBorders); 344 pHlp->pfnPrintf(pHlp, " Window Type: %#x\n", Info.atomWindowType); 345 pHlp->pfnPrintf(pHlp, " Creator Ver: %#x\n", Info.wCreatorVersion); 346 } 347 else 348 pHlp->pfnPrintf(pHlp, " GetWindowInfo: last error %d\n", GetLastError()); 349 } 350 #else 351 pHlp->pfnPrintf(pHlp, " Windows info: Not implemented on this platform\n"); 352 #endif 353 354 } 355 356 357 /** 358 * Formats an enum value as a string, sparse mapping table. 359 * 360 * @returns pszBuffer. 361 * @param pszBuffer The output buffer. 362 * @param cbBuffer The size of the output buffer. 363 * @param pszName The variable name, optional. 364 * @param iValue The enum value. 365 * @param pszPrefix The prefix of the enum values. Empty string if 366 * none. This helps reduce the memory footprint 367 * as well as the source code size. 368 * @param papszValues One to one string mapping of the enum values. 369 * @param cValues The number of values in the mapping. 370 */ 371 char *vmsvgaFormatEnumValueEx(char *pszBuffer, size_t cbBuffer, const char *pszName, int32_t iValue, 372 const char *pszPrefix, PCVMSVGAINFOENUM paValues, size_t cValues) 373 { 374 for (uint32_t i = 0; i < cValues; i++) 375 if (paValues[i].iValue == iValue) 376 { 377 if (pszName) 378 RTStrPrintf(pszBuffer, cbBuffer, "%s = %s%s (%#x)", pszName, pszPrefix, paValues[i].pszName, iValue); 379 else 380 RTStrPrintf(pszBuffer, cbBuffer, "%s%s (%#x)", pszPrefix, paValues[i].pszName, iValue); 381 return pszBuffer; 382 } 383 384 if (pszName) 385 RTStrPrintf(pszBuffer, cbBuffer, "%s = %sUNKNOWN_%d (%#x)", pszName, pszPrefix, iValue, iValue); 386 else 387 RTStrPrintf(pszBuffer, cbBuffer, "%sUNKNOWN_%d (%#x)", pszPrefix, iValue, iValue); 388 return pszBuffer; 389 } 390 391 392 /** 393 * Formats an enum value as a string. 394 * 395 * @returns pszBuffer. 396 * @param pszBuffer The output buffer. 397 * @param cbBuffer The size of the output buffer. 398 * @param pszName The variable name, optional. 399 * @param uValue The enum value. 400 * @param pszPrefix The prefix of the enum values. Empty string if 401 * none. This helps reduce the memory footprint 402 * as well as the source code size. 403 * @param papszValues One to one string mapping of the enum values. 404 * @param cValues The number of values in the mapping. 405 */ 406 char *vmsvgaFormatEnumValue(char *pszBuffer, size_t cbBuffer, const char *pszName, uint32_t uValue, 407 const char *pszPrefix, const char * const *papszValues, size_t cValues) 408 { 409 if (uValue < cValues) 410 { 411 if (pszName) 412 RTStrPrintf(pszBuffer, cbBuffer, "%s = %s%s (%#x)", pszName, pszPrefix, papszValues[uValue], uValue); 413 else 414 RTStrPrintf(pszBuffer, cbBuffer, "%s%s (%#x)", pszPrefix, papszValues[uValue], uValue); 415 } 416 else 417 { 418 if (pszName) 419 RTStrPrintf(pszBuffer, cbBuffer, "%s = %sUNKNOWN_%d (%#x)", pszName, pszPrefix, uValue, uValue); 420 else 421 RTStrPrintf(pszBuffer, cbBuffer, "%sUNKNOWN_%d (%#x)", pszPrefix, uValue, uValue); 422 } 423 return pszBuffer; 424 } 425 426 427 /** 428 * DBGF info printer for vmsvga3dAsciiPrint. 429 * 430 * @param pszLine The line to print. 431 * @param pvUser The debug info helpers. 432 */ 433 DECLCALLBACK(void) vmsvga3dAsciiPrintlnInfo(const char *pszLine, void *pvUser) 434 { 435 PCDBGFINFOHLP pHlp = (PCDBGFINFOHLP)pvUser; 436 pHlp->pfnPrintf(pHlp, ">%s<\n", pszLine); 437 } 438 439 440 /** 441 * Log printer for vmsvga3dAsciiPrint. 442 * 443 * @param pszLine The line to print. 444 * @param pvUser Ignored. 445 */ 446 DECLCALLBACK(void) vmsvga3dAsciiPrintlnLog(const char *pszLine, void *pvUser) 447 { 448 size_t cch = strlen(pszLine); 449 while (cch > 0 && pszLine[cch - 1] == ' ') 450 cch--; 451 RTLogPrintf("%.*s\n", cch, pszLine); 452 NOREF(pvUser); 453 } 454 455 456 void vmsvga3dAsciiPrint(PFMVMSVGAASCIIPRINTLN pfnPrintLine, void *pvUser, void const *pvImage, size_t cbImage, 457 uint32_t cx, uint32_t cy, uint32_t cbScanline, SVGA3dSurfaceFormat enmFormat, bool fInvY, 458 uint32_t cchMaxX, uint32_t cchMaxY) 459 { 460 /* 461 * Skip stuff we can't or won't need to handle. 462 */ 463 if (!cx || !cy) 464 return; 465 switch (enmFormat) 466 { 467 /* Compressed. */ 468 case SVGA3D_DXT1: 469 case SVGA3D_DXT2: 470 case SVGA3D_DXT3: 471 case SVGA3D_DXT4: 472 case SVGA3D_DXT5: 473 return; 474 /* Generic. */ 475 case SVGA3D_BUFFER: 476 return; 477 } 478 479 /* 480 * Figure the pixel conversion factors. 481 */ 482 uint32_t cxPerChar = cx / cchMaxX + 1; 483 uint32_t cyPerChar = cy / cchMaxY + 1; 484 /** @todo try keep aspect... */ 485 uint32_t const cchLine = (cx + cxPerChar - 1) / cxPerChar; 486 uint32_t const cbSrcPixel = vmsvga3dSurfaceFormatSize(enmFormat); 487 488 /* 489 * The very simple conversion we're doing in this function is based on 490 * mapping a block of converted pixels to an ASCII character of similar 491 * weigth. We do that by summing up all the 8-bit gray scale pixels in 492 * that block, applying a conversion factor and getting an index into an 493 * array of increasingly weighty characters. 494 */ 495 static const char s_szPalette[] = " ..`',:;icodxkO08XNWM"; 496 static const uint32_t s_cchPalette = sizeof(s_szPalette) - 1; 497 uint32_t const cPixelsWeightPerChar = cxPerChar * cyPerChar * 256; 498 499 /* 500 * Do the work 501 */ 502 uint32_t *pauScanline = (uint32_t *)RTMemTmpAllocZ(sizeof(pauScanline[0]) * cchLine + cchLine + 1); 503 if (!pauScanline) 504 return; 505 char *pszLine = (char *)&pauScanline[cchLine]; 506 RTCPTRUNION uSrc; 507 uSrc.pv = pvImage; 508 if (fInvY) 509 uSrc.pu8 += (cy - 1) * cbScanline; 510 uint32_t cyLeft = cy; 511 uint32_t cyLeftInScanline = cyPerChar; 512 bool fHitFormatAssert = false; 513 for (;;) 514 { 515 /* 516 * Process the scanline. This is tedious because of all the 517 * different formats. We generally ignore alpha, unless it's 518 * all we've got to work with. 519 * Color to 8-bit grayscale conversion is done by averaging. 520 */ 521 #define CONVERT_SCANLINE(a_AddExpr) \ 522 do { \ 523 for (uint32_t xSrc = 0, xDst = 0, cxLeftInChar = cxPerChar; xSrc < cx; xSrc++) \ 524 { \ 525 pauScanline[xDst] += (a_AddExpr) & 0xff; \ 526 Assert(pauScanline[xDst] <= cPixelsWeightPerChar); \ 527 if (--cxLeftInChar == 0) \ 528 { \ 529 xDst++; \ 530 cxLeftInChar = cxPerChar; \ 531 } \ 532 } \ 533 } while (0) 534 535 uint32_t u32Tmp; 536 switch (enmFormat) 537 { 538 /* Unsigned RGB and super/subsets. */ 539 case SVGA3D_X8R8G8B8: 540 case SVGA3D_A8R8G8B8: 541 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu32[xSrc]) & 0xff) /* B */ 542 + ((u32Tmp >> 8) & 0xff) /* G */ 543 + ((u32Tmp >> 16) & 0xff) /* R */) / 3); 544 break; 545 case SVGA3D_R5G6B5: 546 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0x1f) * 8 547 + ((uSrc.pu16[xSrc] >> 5) & 0x3f) * 4 548 + ( uSrc.pu16[xSrc] >> 11) * 8 ) / 3 ); 549 break; 550 case SVGA3D_X1R5G5B5: 551 case SVGA3D_A1R5G5B5: 552 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0x1f) * 8 553 + ((uSrc.pu16[xSrc] >> 5) & 0x1f) * 8 554 + ((uSrc.pu16[xSrc] >> 10) & 0x1f) * 8) / 3 ); 555 break; 556 case SVGA3D_A4R4G4B4: 557 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0xf) * 16 558 + ((uSrc.pu16[xSrc] >> 4) & 0xf) * 16 559 + ((uSrc.pu16[xSrc] >> 8) & 0xf) * 16) / 3 ); 560 break; 561 case SVGA3D_A16B16G16R16: 562 CONVERT_SCANLINE( ( ((uSrc.pu64[xSrc] >> 8) & 0xff) /* R */ 563 + ((uSrc.pu64[xSrc] >> 24) & 0xff) /* G */ 564 + ((uSrc.pu64[xSrc] >> 40) & 0xff) /* B */ ) / 3); 565 break; 566 case SVGA3D_A2R10G10B10: 567 CONVERT_SCANLINE( ( ((uSrc.pu32[xSrc] ) & 0x3ff) /* B */ 568 + ((uSrc.pu32[xSrc] >> 10) & 0x3ff) /* G */ 569 + ((uSrc.pu32[xSrc] >> 20) & 0x3ff) /* R */ ) / (3 * 4)); 570 break; 571 case SVGA3D_G16R16: 572 CONVERT_SCANLINE( ( (uSrc.pu32[xSrc] & 0xffff) /* R */ 573 + (uSrc.pu32[xSrc] >> 16 ) /* G */) / 0x200); 574 break; 575 576 /* Depth. */ 577 case SVGA3D_Z_D32: 578 CONVERT_SCANLINE( (((u32Tmp = ~(( uSrc.pu32[xSrc] >> 1) | uSrc.pu32[xSrc]) & UINT32_C(0x44444444)) >> 2) & 1) 579 | ((u32Tmp >> ( 6 - 1)) & RT_BIT_32(1)) 580 | ((u32Tmp >> (10 - 2)) & RT_BIT_32(2)) 581 | ((u32Tmp >> (14 - 3)) & RT_BIT_32(3)) 582 | ((u32Tmp >> (18 - 4)) & RT_BIT_32(4)) 583 | ((u32Tmp >> (22 - 5)) & RT_BIT_32(5)) 584 | ((u32Tmp >> (26 - 6)) & RT_BIT_32(6)) 585 | ((u32Tmp >> (30 - 7)) & RT_BIT_32(7)) ); 586 break; 587 case SVGA3D_Z_D16: 588 CONVERT_SCANLINE( (((u32Tmp = ~uSrc.pu16[xSrc]) >> 1) & 1) 589 | ((u32Tmp >> ( 3 - 1)) & RT_BIT_32(1)) 590 | ((u32Tmp >> ( 5 - 2)) & RT_BIT_32(2)) 591 | ((u32Tmp >> ( 7 - 3)) & RT_BIT_32(3)) 592 | ((u32Tmp >> ( 9 - 4)) & RT_BIT_32(4)) 593 | ((u32Tmp >> (11 - 5)) & RT_BIT_32(5)) 594 | ((u32Tmp >> (13 - 6)) & RT_BIT_32(6)) 595 | ((u32Tmp >> (15 - 7)) & RT_BIT_32(7)) ); 596 break; 597 case SVGA3D_Z_D24S8: 598 CONVERT_SCANLINE( ((u32Tmp = uSrc.pu16[xSrc]) & 0xff) /* stencile */ 599 | ((~u32Tmp >> 18) & 0x3f)); 600 break; 601 case SVGA3D_Z_D15S1: 602 CONVERT_SCANLINE( (((u32Tmp = uSrc.pu16[xSrc]) & 0x01) << 7) /* stencile */ 603 | ((~u32Tmp >> 8) & 0x7f)); 604 break; 605 606 /* Pure alpha. */ 607 case SVGA3D_ALPHA8: 608 CONVERT_SCANLINE(uSrc.pu8[xSrc]); 609 break; 610 611 /* Luminance */ 612 case SVGA3D_LUMINANCE8: 613 CONVERT_SCANLINE(uSrc.pu8[xSrc]); 614 break; 615 case SVGA3D_LUMINANCE4_ALPHA4: 616 CONVERT_SCANLINE(uSrc.pu8[xSrc] & 0xf0); 617 break; 618 case SVGA3D_LUMINANCE16: 619 CONVERT_SCANLINE(uSrc.pu16[xSrc] >> 8); 620 break; 621 case SVGA3D_LUMINANCE8_ALPHA8: 622 CONVERT_SCANLINE(uSrc.pu16[xSrc] >> 8); 623 break; 624 625 /* Not supported. */ 626 case SVGA3D_DXT1: 627 case SVGA3D_DXT2: 628 case SVGA3D_DXT3: 629 case SVGA3D_DXT4: 630 case SVGA3D_DXT5: 631 case SVGA3D_BUFFER: 632 AssertFailedBreak(); 633 634 /* Not considered for implementation yet. */ 635 case SVGA3D_BUMPU8V8: 636 case SVGA3D_BUMPL6V5U5: 637 case SVGA3D_BUMPX8L8V8U8: 638 case SVGA3D_BUMPL8V8U8: 639 case SVGA3D_ARGB_S10E5: 640 case SVGA3D_ARGB_S23E8: 641 case SVGA3D_V8U8: 642 case SVGA3D_Q8W8V8U8: 643 case SVGA3D_CxV8U8: 644 case SVGA3D_X8L8V8U8: 645 case SVGA3D_A2W10V10U10: 646 case SVGA3D_R_S10E5: 647 case SVGA3D_R_S23E8: 648 case SVGA3D_RG_S10E5: 649 case SVGA3D_RG_S23E8: 650 case SVGA3D_Z_D24X8: 651 case SVGA3D_V16U16: 652 case SVGA3D_UYVY: 653 case SVGA3D_YUY2: 654 case SVGA3D_NV12: 655 case SVGA3D_AYUV: 656 case SVGA3D_BC4_UNORM: 657 case SVGA3D_BC5_UNORM: 658 case SVGA3D_Z_DF16: 659 case SVGA3D_Z_DF24: 660 case SVGA3D_Z_D24S8_INT: 661 if (!fHitFormatAssert) 662 { 663 AssertMsgFailed(("%s is not implemented\n", vmsvgaSurfaceType2String(enmFormat))); 664 fHitFormatAssert = true; 665 } 666 /* fall thru */ 667 default: 668 /* Lazy programmer fallbacks. */ 669 if (cbSrcPixel == 4) 670 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu32[xSrc]) & 0xff) 671 + ((u32Tmp >> 8) & 0xff) 672 + ((u32Tmp >> 16) & 0xff) 673 + ((u32Tmp >> 24) & 0xff) ) / 4); 674 else if (cbSrcPixel == 3) 675 CONVERT_SCANLINE( ( (uint32_t)uSrc.pu8[xSrc * 4] 676 + (uint32_t)uSrc.pu8[xSrc * 4 + 1] 677 + (uint32_t)uSrc.pu8[xSrc * 4 + 2] ) / 3); 678 else if (cbSrcPixel == 2) 679 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu16[xSrc]) & 0xf) * 16 680 + ((u32Tmp >> 4) & 0xf) * 16 681 + ((u32Tmp >> 8) & 0xf) * 16 682 + ((u32Tmp >> 12) & 0xf) * 16 ) / 4); 683 else if (cbSrcPixel == 1) 684 CONVERT_SCANLINE(uSrc.pu8[xSrc]); 685 else 686 AssertFailed(); 687 break; 688 689 } 690 691 /* 692 * Print we've reached the end of a block in y direction or if we're at 693 * the end of the image. 694 */ 695 cyLeft--; 696 if (--cyLeftInScanline == 0 || cyLeft == 0) 697 { 698 for (uint32_t i = 0; i < cchLine; i++) 699 { 700 uint32_t off = pauScanline[i] * s_cchPalette / cPixelsWeightPerChar; Assert(off < s_cchPalette); 701 pszLine[i] = s_szPalette[off < sizeof(s_szPalette) - 1 ? off : sizeof(s_szPalette) - 1]; 702 } 703 pszLine[cchLine] = '\0'; 704 pfnPrintLine(pszLine, pvUser); 705 706 if (!cyLeft) 707 break; 708 cyLeftInScanline = cyPerChar; 709 RT_BZERO(pauScanline, sizeof(pauScanline[0]) * cchLine); 710 } 711 712 /* 713 * Advance. 714 */ 715 if (!fInvY) 716 uSrc.pu8 += cbScanline; 717 else 718 uSrc.pu8 -= cbScanline; 719 } 720 } 721 722 723 /** 724 * List of render state names with type prefix. 725 * 726 * First char in the name is a type indicator: 727 * - '*' = requires special handling. 728 * - 'f' = SVGA3dbool 729 * - 'd' = uint32_t 730 * - 'r' = float 731 * - 'b' = SVGA3dBlendOp 732 * - 'c' = SVGA3dColor, SVGA3dColorMask 733 * - 'e' = SVGA3dBlendEquation 734 * - 'm' = SVGA3dColorMask 735 * - 'p' = SVGA3dCmpFunc 736 * - 's' = SVGA3dStencilOp 737 * - 'v' = SVGA3dVertexMaterial 738 * - 'w' = SVGA3dWrapFlags 739 */ 740 static const char * const g_apszRenderStateNamesAndType[] = 741 { 742 "*" "INVALID", /* invalid */ 743 "f" "ZENABLE", /* SVGA3dBool */ 744 "f" "ZWRITEENABLE", /* SVGA3dBool */ 745 "f" "ALPHATESTENABLE", /* SVGA3dBool */ 746 "f" "DITHERENABLE", /* SVGA3dBool */ 747 "f" "BLENDENABLE", /* SVGA3dBool */ 748 "f" "FOGENABLE", /* SVGA3dBool */ 749 "f" "SPECULARENABLE", /* SVGA3dBool */ 750 "f" "STENCILENABLE", /* SVGA3dBool */ 751 "f" "LIGHTINGENABLE", /* SVGA3dBool */ 752 "f" "NORMALIZENORMALS", /* SVGA3dBool */ 753 "f" "POINTSPRITEENABLE", /* SVGA3dBool */ 754 "f" "POINTSCALEENABLE", /* SVGA3dBool */ 755 "x" "STENCILREF", /* uint32_t */ 756 "x" "STENCILMASK", /* uint32_t */ 757 "x" "STENCILWRITEMASK", /* uint32_t */ 758 "r" "FOGSTART", /* float */ 759 "r" "FOGEND", /* float */ 760 "r" "FOGDENSITY", /* float */ 761 "r" "POINTSIZE", /* float */ 762 "r" "POINTSIZEMIN", /* float */ 763 "r" "POINTSIZEMAX", /* float */ 764 "r" "POINTSCALE_A", /* float */ 765 "r" "POINTSCALE_B", /* float */ 766 "r" "POINTSCALE_C", /* float */ 767 "c" "FOGCOLOR", /* SVGA3dColor */ 768 "c" "AMBIENT", /* SVGA3dColor */ 769 "*" "CLIPPLANEENABLE", /* SVGA3dClipPlanes */ 770 "*" "FOGMODE", /* SVGA3dFogMode */ 771 "*" "FILLMODE", /* SVGA3dFillMode */ 772 "*" "SHADEMODE", /* SVGA3dShadeMode */ 773 "*" "LINEPATTERN", /* SVGA3dLinePattern */ 774 "b" "SRCBLEND", /* SVGA3dBlendOp */ 775 "b" "DSTBLEND", /* SVGA3dBlendOp */ 776 "e" "BLENDEQUATION", /* SVGA3dBlendEquation */ 777 "*" "CULLMODE", /* SVGA3dFace */ 778 "p" "ZFUNC", /* SVGA3dCmpFunc */ 779 "p" "ALPHAFUNC", /* SVGA3dCmpFunc */ 780 "p" "STENCILFUNC", /* SVGA3dCmpFunc */ 781 "s" "STENCILFAIL", /* SVGA3dStencilOp */ 782 "s" "STENCILZFAIL", /* SVGA3dStencilOp */ 783 "s" "STENCILPASS", /* SVGA3dStencilOp */ 784 "r" "ALPHAREF", /* float */ 785 "*" "FRONTWINDING", /* SVGA3dFrontWinding */ 786 "*" "COORDINATETYPE", /* SVGA3dCoordinateType */ 787 "r" "ZBIAS", /* float */ 788 "f" "RANGEFOGENABLE", /* SVGA3dBool */ 789 "c" "COLORWRITEENABLE", /* SVGA3dColorMask */ 790 "f" "VERTEXMATERIALENABLE", /* SVGA3dBool */ 791 "v" "DIFFUSEMATERIALSOURCE", /* SVGA3dVertexMaterial */ 792 "v" "SPECULARMATERIALSOURCE", /* SVGA3dVertexMaterial */ 793 "v" "AMBIENTMATERIALSOURCE", /* SVGA3dVertexMaterial */ 794 "v" "EMISSIVEMATERIALSOURCE", /* SVGA3dVertexMaterial */ 795 "c" "TEXTUREFACTOR", /* SVGA3dColor */ 796 "f" "LOCALVIEWER", /* SVGA3dBool */ 797 "f" "SCISSORTESTENABLE", /* SVGA3dBool */ 798 "c" "BLENDCOLOR", /* SVGA3dColor */ 799 "f" "STENCILENABLE2SIDED", /* SVGA3dBool */ 800 "p" "CCWSTENCILFUNC", /* SVGA3dCmpFunc */ 801 "s" "CCWSTENCILFAIL", /* SVGA3dStencilOp */ 802 "s" "CCWSTENCILZFAIL", /* SVGA3dStencilOp */ 803 "s" "CCWSTENCILPASS", /* SVGA3dStencilOp */ 804 "*" "VERTEXBLEND", /* SVGA3dVertexBlendFlags */ 805 "r" "SLOPESCALEDEPTHBIAS", /* float */ 806 "r" "DEPTHBIAS", /* float */ 807 "r" "OUTPUTGAMMA", /* float */ 808 "f" "ZVISIBLE", /* SVGA3dBool */ 809 "f" "LASTPIXEL", /* SVGA3dBool */ 810 "f" "CLIPPING", /* SVGA3dBool */ 811 "w" "WRAP0", /* SVGA3dWrapFlags */ 812 "w" "WRAP1", /* SVGA3dWrapFlags */ 813 "w" "WRAP2", /* SVGA3dWrapFlags */ 814 "w" "WRAP3", /* SVGA3dWrapFlags */ 815 "w" "WRAP4", /* SVGA3dWrapFlags */ 816 "w" "WRAP5", /* SVGA3dWrapFlags */ 817 "w" "WRAP6", /* SVGA3dWrapFlags */ 818 "w" "WRAP7", /* SVGA3dWrapFlags */ 819 "w" "WRAP8", /* SVGA3dWrapFlags */ 820 "w" "WRAP9", /* SVGA3dWrapFlags */ 821 "w" "WRAP10", /* SVGA3dWrapFlags */ 822 "w" "WRAP11", /* SVGA3dWrapFlags */ 823 "w" "WRAP12", /* SVGA3dWrapFlags */ 824 "w" "WRAP13", /* SVGA3dWrapFlags */ 825 "w" "WRAP14", /* SVGA3dWrapFlags */ 826 "w" "WRAP15", /* SVGA3dWrapFlags */ 827 "f" "MULTISAMPLEANTIALIAS", /* SVGA3dBool */ 828 "x" "MULTISAMPLEMASK", /* uint32_t */ 829 "f" "INDEXEDVERTEXBLENDENABLE", /* SVGA3dBool */ 830 "r" "TWEENFACTOR", /* float */ 831 "f" "ANTIALIASEDLINEENABLE", /* SVGA3dBool */ 832 "c" "COLORWRITEENABLE1", /* SVGA3dColorMask */ 833 "c" "COLORWRITEENABLE2", /* SVGA3dColorMask */ 834 "c" "COLORWRITEENABLE3", /* SVGA3dColorMask */ 835 "f" "SEPARATEALPHABLENDENABLE", /* SVGA3dBool */ 836 "b" "SRCBLENDALPHA", /* SVGA3dBlendOp */ 837 "b" "DSTBLENDALPHA", /* SVGA3dBlendOp */ 838 "e" "BLENDEQUATIONALPHA", /* SVGA3dBlendEquation */ 839 "*" "TRANSPARENCYANTIALIAS", /* SVGA3dTransparencyAntialiasType */ 840 "f" "LINEAA", /* SVGA3dBool */ 841 "r" "LINEWIDTH", /* float */ 842 }; 843 844 845 /** 846 * Formats a SVGA3dRenderState structure as a string. 847 * 848 * @returns pszBuffer. 849 * @param pszBuffer Output string buffer. 850 * @param cbBuffer Size of output buffer. 851 * @param pRenderState The SVGA3d render state to format. 852 */ 853 char *vmsvga3dFormatRenderState(char *pszBuffer, size_t cbBuffer, SVGA3dRenderState const *pRenderState) 854 { 855 uint32_t iState = pRenderState->state; 856 if (iState != SVGA3D_RS_INVALID) 857 { 858 if (iState < RT_ELEMENTS(g_apszRenderStateNamesAndType)) 859 { 860 const char *pszName = g_apszRenderStateNamesAndType[iState]; 861 char const chType = *pszName++; 862 863 union 864 { 865 uint32_t u; 866 float r; 867 SVGA3dColorMask Color; 868 } uValue; 869 uValue.u = pRenderState->uintValue; 870 871 switch (chType) 872 { 873 case 'f': 874 if (uValue.u == 0) 875 RTStrPrintf(pszBuffer, cbBuffer, "%s = false", pszName); 876 else if (uValue.u == 1) 877 RTStrPrintf(pszBuffer, cbBuffer, "%s = true", pszName); 878 else 879 RTStrPrintf(pszBuffer, cbBuffer, "%s = true (%#x)", pszName, uValue.u); 880 break; 881 case 'x': 882 RTStrPrintf(pszBuffer, cbBuffer, "%s = %#x (%d)", pszName, uValue.u, uValue.u); 883 break; 884 case 'r': 885 RTStrPrintf(pszBuffer, cbBuffer, "%s = %d.%06u (%#x)", 886 pszName, (int)uValue.r, (unsigned)(uValue.r * 1000000) % 1000000U, uValue.u); 887 break; 888 case 'c': //SVGA3dColor, SVGA3dColorMask 889 RTStrPrintf(pszBuffer, cbBuffer, "%s = RGBA(%d,%d,%d,%d) (%#x)", pszName, 890 uValue.Color.s.red, uValue.Color.s.green, uValue.Color.s.blue, uValue.Color.s.alpha, uValue.u); 891 break; 892 case 'w': //SVGA3dWrapFlags 893 RTStrPrintf(pszBuffer, cbBuffer, "%s = %#x%s", pszName, uValue.u, 894 uValue.u <= SVGA3D_WRAPCOORD_ALL ? " (out of bounds" : ""); 895 break; 896 default: 897 AssertFailed(); 898 case 'b': //SVGA3dBlendOp 899 case 'e': //SVGA3dBlendEquation 900 case 'p': //SVGA3dCmpFunc 901 case 's': //SVGA3dStencilOp 902 case 'v': //SVGA3dVertexMaterial 903 case '*': 904 RTStrPrintf(pszBuffer, cbBuffer, "%s = %#x", pszName, uValue.u); 905 break; 906 } 907 } 908 else 909 RTStrPrintf(pszBuffer, cbBuffer, "UNKNOWN_%d_%#x = %#x", iState, iState, pRenderState->uintValue); 910 } 911 else 912 RTStrPrintf(pszBuffer, cbBuffer, "INVALID"); 913 return pszBuffer; 914 } 915 916 /** 917 * Texture state names with type prefix. 918 */ 919 static const char * const g_apszTextureStateNamesAndType[] = 920 { 921 "*" "INVALID", /* invalid */ 922 "x" "BIND_TEXTURE", /* SVGA3dSurfaceId */ 923 "m" "COLOROP", /* SVGA3dTextureCombiner */ 924 "a" "COLORARG1", /* SVGA3dTextureArgData */ 925 "a" "COLORARG2", /* SVGA3dTextureArgData */ 926 "m" "ALPHAOP", /* SVGA3dTextureCombiner */ 927 "a" "ALPHAARG1", /* SVGA3dTextureArgData */ 928 "a" "ALPHAARG2", /* SVGA3dTextureArgData */ 929 "e" "ADDRESSU", /* SVGA3dTextureAddress */ 930 "e" "ADDRESSV", /* SVGA3dTextureAddress */ 931 "l" "MIPFILTER", /* SVGA3dTextureFilter */ 932 "l" "MAGFILTER", /* SVGA3dTextureFilter */ 933 "m" "MINFILTER", /* SVGA3dTextureFilter */ 934 "c" "BORDERCOLOR", /* SVGA3dColor */ 935 "r" "TEXCOORDINDEX", /* uint32_t */ 936 "t" "TEXTURETRANSFORMFLAGS", /* SVGA3dTexTransformFlags */ 937 "g" "TEXCOORDGEN", /* SVGA3dTextureCoordGen */ 938 "r" "BUMPENVMAT00", /* float */ 939 "r" "BUMPENVMAT01", /* float */ 940 "r" "BUMPENVMAT10", /* float */ 941 "r" "BUMPENVMAT11", /* float */ 942 "x" "TEXTURE_MIPMAP_LEVEL", /* uint32_t */ 943 "r" "TEXTURE_LOD_BIAS", /* float */ 944 "x" "TEXTURE_ANISOTROPIC_LEVEL", /* uint32_t */ 945 "e" "ADDRESSW", /* SVGA3dTextureAddress */ 946 "r" "GAMMA", /* float */ 947 "r" "BUMPENVLSCALE", /* float */ 948 "r" "BUMPENVLOFFSET", /* float */ 949 "a" "COLORARG0", /* SVGA3dTextureArgData */ 950 "a" "ALPHAARG0" /* SVGA3dTextureArgData */ 951 }; 952 953 /** 954 * Formats a SVGA3dTextureState structure as a string. 955 * 956 * @returns pszBuffer. 957 * @param pszBuffer Output string buffer. 958 * @param cbBuffer Size of output buffer. 959 * @param pTextureState The SVGA3d texture state to format. 960 */ 961 char *vmsvga3dFormatTextureState(char *pszBuffer, size_t cbBuffer, SVGA3dTextureState const *pTextureState) 962 { 963 /* 964 * Format the stage first. 965 */ 966 char *pszRet = pszBuffer; 967 size_t cchPrefix = RTStrPrintf(pszBuffer, cbBuffer, "[%u] ", pTextureState->stage); 968 if (cchPrefix < cbBuffer) 969 { 970 cbBuffer -= cchPrefix; 971 pszBuffer += cchPrefix; 972 } 973 else 974 cbBuffer = 0; 975 976 /* 977 * Format the name and value. 978 */ 979 uint32_t iName = pTextureState->name; 980 if (iName != SVGA3D_TS_INVALID) 981 { 982 if (iName < RT_ELEMENTS(g_apszTextureStateNamesAndType)) 983 { 984 const char *pszName = g_apszTextureStateNamesAndType[iName]; 985 char chType = *pszName++; 986 987 union 988 { 989 uint32_t u; 990 float r; 991 SVGA3dColorMask Color; 992 } uValue; 993 uValue.u = pTextureState->value; 994 995 switch (chType) 996 { 997 case 'x': 998 RTStrPrintf(pszBuffer, cbBuffer, "%s = %#x (%d)", pszName, uValue.u, uValue.u); 999 break; 1000 1001 case 'r': 1002 RTStrPrintf(pszBuffer, cbBuffer, "%s = %d.%06u (%#x)", 1003 pszName, (int)uValue.r, (unsigned)(uValue.r * 1000000) % 1000000U, uValue.u); 1004 break; 1005 1006 case 'a': //SVGA3dTextureArgData 1007 { 1008 static const char * const s_apszValues[] = 1009 { 1010 "INVALID", "CONSTANT", "PREVIOUS", "DIFFUSE", "TEXTURE", "SPECULAR" 1011 }; 1012 vmsvgaFormatEnumValue(pszBuffer, cbBuffer, pszName, uValue.u, 1013 "SVGA3D_TA_", s_apszValues, RT_ELEMENTS(s_apszValues)); 1014 break; 1015 } 1016 1017 case 'c': //SVGA3dColor, SVGA3dColorMask 1018 RTStrPrintf(pszBuffer, cbBuffer, "%s = RGBA(%d,%d,%d,%d) (%#x)", pszName, 1019 uValue.Color.s.red, uValue.Color.s.green, uValue.Color.s.blue, uValue.Color.s.alpha, uValue.u); 1020 break; 1021 1022 case 'e': //SVGA3dTextureAddress 1023 { 1024 static const char * const s_apszValues[] = 1025 { 1026 "INVALID", "WRAP", "MIRROR", "CLAMP", "BORDER", "MIRRORONCE", "EDGE", 1027 }; 1028 vmsvgaFormatEnumValue(pszBuffer, cbBuffer, pszName, uValue.u, 1029 "SVGA3D_TEX_ADDRESS_", s_apszValues, RT_ELEMENTS(s_apszValues)); 1030 break; 1031 } 1032 1033 case 'l': //SVGA3dTextureFilter 1034 { 1035 static const char * const s_apszValues[] = 1036 { 1037 "NONE", "NEAREST", "LINEAR", "ANISOTROPIC", "FLATCUBIC", "GAUSSIANCUBIC", "PYRAMIDALQUAD", "GAUSSIANQUAD", 1038 }; 1039 vmsvgaFormatEnumValue(pszBuffer, cbBuffer, pszName, uValue.u, 1040 "SVGA3D_TEX_FILTER_", s_apszValues, RT_ELEMENTS(s_apszValues)); 1041 break; 1042 } 1043 1044 case 'g': //SVGA3dTextureCoordGen 1045 { 1046 static const char * const s_apszValues[] = 1047 { 1048 "OFF", "EYE_POSITION", "EYE_NORMAL", "REFLECTIONVECTOR", "SPHERE", 1049 }; 1050 vmsvgaFormatEnumValue(pszBuffer, cbBuffer, pszName, uValue.u, 1051 "SVGA3D_TEXCOORD_GEN_", s_apszValues, RT_ELEMENTS(s_apszValues)); 1052 break; 1053 } 1054 1055 case 'm': //SVGA3dTextureCombiner 1056 { 1057 static const char * const s_apszValues[] = 1058 { 1059 "INVALID", "DISABLE", "SELECTARG1", "SELECTARG2", "MODULATE", "ADD", "ADDSIGNED", "SUBTRACT", 1060 "BLENDTEXTUREALPHA", "BLENDDIFFUSEALPHA", "BLENDCURRENTALPHA", "BLENDFACTORALPHA", "MODULATE2X", 1061 "MODULATE4X", "DSDT", "DOTPRODUCT3", "BLENDTEXTUREALPHAPM", "ADDSIGNED2X", "ADDSMOOTH", "PREMODULATE", 1062 "MODULATEALPHA_ADDCOLOR", "MODULATECOLOR_ADDALPHA", "MODULATEINVALPHA_ADDCOLOR", 1063 "MODULATEINVCOLOR_ADDALPHA", "BUMPENVMAPLUMINANCE", "MULTIPLYADD", "LERP", 1064 }; 1065 vmsvgaFormatEnumValue(pszBuffer, cbBuffer, pszName, uValue.u, 1066 "SVGA3D_TC_", s_apszValues, RT_ELEMENTS(s_apszValues)); 1067 break; 1068 } 1069 1070 default: 1071 AssertFailed(); 1072 RTStrPrintf(pszBuffer, cbBuffer, "%s = %#x\n", pszName, uValue.u); 1073 break; 1074 } 1075 } 1076 else 1077 RTStrPrintf(pszBuffer, cbBuffer, "UNKNOWN_%d_%#x = %#x\n", iName, iName, pTextureState->value); 1078 } 1079 else 1080 RTStrPrintf(pszBuffer, cbBuffer, "INVALID"); 1081 return pszRet; 1082 } 1083 1084 1085 242 1086 243 1087 /** … … 349 1193 350 1194 #ifdef LOG_ENABLED 1195 351 1196 const char *vmsvga3dGetCapString(uint32_t idxCap) 352 1197 { … … 1125 1970 1126 1971 #endif /* LOG_ENABLED */ 1972 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h
r56947 r57081 1 1 /* $Id$ */ 2 2 /** @file 3 * VMware SVGA device -- 3D part 3 * DevVMWare - VMWare SVGA device, shared part. 4 * 5 * @remarks This is code that's very similar on both for OpenGL and D3D 6 * backends, so instead of moving backend specific structures 7 * into header files with #ifdefs and stuff, we just include 8 * the code into the backend implementation source file. 4 9 */ 10 5 11 /* 6 12 * Copyright (C) 2013-2015 Oracle Corporation … … 18 24 #define ___DevVGA_SVGA3d_shared_h___ 19 25 26 /** 27 * Worker for vmsvga3dUpdateHeapBuffersForSurfaces. 28 * 29 * This will allocate heap buffers if necessary, thus increasing the memory 30 * usage of the process. 31 * 32 * @todo Would be interesting to share this code with the saved state code. 33 * 34 * @returns VBox status code. 35 * @param pState The 3D state structure. 36 * @param pSurface The surface to refresh the heap buffers for. 37 */ 38 static int vmsvga3dSurfaceUpdateHeapBuffers(PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface) 39 { 40 /* 41 * Currently we've got trouble retreving bit for DEPTHSTENCIL 42 * surfaces both for OpenGL and D3D, so skip these here (don't 43 * wast memory on them). 44 */ 45 uint32_t const fSwitchFlags = pSurface->flags 46 & ( SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER 47 | SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET 48 | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP); 49 if ( fSwitchFlags != SVGA3D_SURFACE_HINT_DEPTHSTENCIL 50 && fSwitchFlags != (SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_HINT_TEXTURE)) 51 { 52 53 #ifdef VMSVGA3D_OPENGL 54 /* 55 * Change OpenGL context to the one the surface is associated with. 56 */ 57 # ifdef VMSVGA3D_OGL_WITH_SHARED_CTX 58 PVMSVGA3DCONTEXT pContext = &pState->SharedCtx; 59 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 60 # else 61 /** @todo stricter checks for associated context */ 62 uint32_t cid = pSurface->idAssociatedContext; 63 if ( cid >= pState->cContexts 64 || pState->papContexts[cid]->id != cid) 65 { 66 Log(("vmsvga3dSurfaceUpdateHeapBuffers: invalid context id (%x - %x)!\n", cid, (cid >= pState->cContexts) ? -1 : pState->papContexts[cid]->id)); 67 AssertFailedReturn(VERR_INVALID_PARAMETER); 68 } 69 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 70 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 71 # endif 72 #endif 73 74 /* 75 * Work thru each mipmap level for each face. 76 */ 77 for (uint32_t iFace = 0; iFace < pSurface->cFaces; iFace++) 78 { 79 Assert(pSurface->faces[iFace].numMipLevels <= pSurface->faces[0].numMipLevels); 80 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[iFace * pSurface->faces[0].numMipLevels]; 81 for (uint32_t i = 0; i < pSurface->faces[iFace].numMipLevels; i++, pMipmapLevel++) 82 { 83 #ifdef VMSVGA3D_DIRECT3D 84 if (pSurface->u.pSurface) 85 #else 86 if (pSurface->oglId.texture != OPENGL_INVALID_ID) 87 #endif 88 { 89 Assert(pMipmapLevel->cbSurface); 90 Assert(pMipmapLevel->cbSurface == pMipmapLevel->cbSurfacePitch * pMipmapLevel->size.height); /* correct for depth stuff? */ 91 92 /* 93 * Make sure we've got surface memory buffer. 94 */ 95 uint8_t *pbDst = (uint8_t *)pMipmapLevel->pSurfaceData; 96 if (!pbDst) 97 { 98 pMipmapLevel->pSurfaceData = pbDst = (uint8_t *)RTMemAllocZ(pMipmapLevel->cbSurface); 99 AssertReturn(pbDst, VERR_NO_MEMORY); 100 } 101 102 #ifdef VMSVGA3D_DIRECT3D 103 /* 104 * D3D specifics. 105 */ 106 HRESULT hr; 107 switch (fSwitchFlags) 108 { 109 case SVGA3D_SURFACE_HINT_TEXTURE: 110 case SVGA3D_SURFACE_HINT_RENDERTARGET: 111 case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET: 112 { 113 /* 114 * Lock the buffer and make it accessible to memcpy. 115 */ 116 D3DLOCKED_RECT LockedRect; 117 if (fSwitchFlags & SVGA3D_SURFACE_HINT_TEXTURE) 118 { 119 if (pSurface->bounce.pTexture) 120 { 121 if ( !pSurface->fDirty 122 && fSwitchFlags == (SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET) 123 && i == 0 /* only the first time */) 124 { 125 /** @todo stricter checks for associated context */ 126 uint32_t cid = pSurface->idAssociatedContext; 127 if ( cid >= pState->cContexts 128 || pState->papContexts[cid]->id != cid) 129 { 130 Log(("vmsvga3dSurfaceUpdateHeapBuffers: invalid context id (%x - %x)!\n", cid, (cid >= pState->cContexts) ? -1 : pState->papContexts[cid]->id)); 131 AssertFailedReturn(VERR_INVALID_PARAMETER); 132 } 133 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 134 135 IDirect3DSurface9 *pDst = NULL; 136 hr = pSurface->bounce.pTexture->GetSurfaceLevel(i, &pDst); 137 AssertMsgReturn(hr == D3D_OK, ("GetSurfaceLevel failed with %#x\n", hr), VERR_INTERNAL_ERROR); 138 139 IDirect3DSurface9 *pSrc = NULL; 140 hr = pSurface->u.pTexture->GetSurfaceLevel(i, &pSrc); 141 AssertMsgReturn(hr == D3D_OK, ("GetSurfaceLevel failed with %#x\n", hr), VERR_INTERNAL_ERROR); 142 143 hr = pContext->pDevice->GetRenderTargetData(pSrc, pDst); 144 AssertMsgReturn(hr == D3D_OK, ("GetRenderTargetData failed with %#x\n", hr), VERR_INTERNAL_ERROR); 145 146 pSrc->Release(); 147 pDst->Release(); 148 } 149 150 hr = pSurface->bounce.pTexture->LockRect(i, /* texture level */ 151 &LockedRect, 152 NULL, 153 D3DLOCK_READONLY); 154 } 155 else 156 hr = pSurface->u.pTexture->LockRect(i, /* texture level */ 157 &LockedRect, 158 NULL, 159 D3DLOCK_READONLY); 160 } 161 else 162 hr = pSurface->u.pSurface->LockRect(&LockedRect, 163 NULL, 164 D3DLOCK_READONLY); 165 AssertMsgReturn(hr == D3D_OK, ("LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 166 167 /* 168 * Copy the data. Take care in case the pitch differs. 169 */ 170 if (pMipmapLevel->cbSurfacePitch == (uint32_t)LockedRect.Pitch) 171 memcpy(pbDst, LockedRect.pBits, pMipmapLevel->cbSurface); 172 else 173 for (uint32_t j = 0; j < pMipmapLevel->size.height; j++) 174 memcpy(pbDst + j * pMipmapLevel->cbSurfacePitch, 175 (uint8_t *)LockedRect.pBits + j * LockedRect.Pitch, 176 pMipmapLevel->cbSurfacePitch); 177 178 /* 179 * Release the buffer. 180 */ 181 if (fSwitchFlags & SVGA3D_SURFACE_HINT_TEXTURE) 182 { 183 if (pSurface->bounce.pTexture) 184 { 185 hr = pSurface->bounce.pTexture->UnlockRect(i); 186 AssertMsgReturn(hr == D3D_OK, ("UnlockRect failed with %#x\n", hr), VERR_INTERNAL_ERROR); 187 } 188 else 189 hr = pSurface->u.pTexture->UnlockRect(i); 190 } 191 else 192 hr = pSurface->u.pSurface->UnlockRect(); 193 AssertMsgReturn(hr == D3D_OK, ("UnlockRect failed with %#x\n", hr), VERR_INTERNAL_ERROR); 194 break; 195 } 196 197 case SVGA3D_SURFACE_HINT_VERTEXBUFFER: 198 { 199 void *pvD3DData = NULL; 200 hr = pSurface->u.pVertexBuffer->Lock(0, 0, &pvD3DData, D3DLOCK_READONLY); 201 AssertMsgReturn(hr == D3D_OK, ("Lock vertex failed with %x\n", hr), VERR_INTERNAL_ERROR); 202 203 memcpy(pbDst, pvD3DData, pMipmapLevel->cbSurface); 204 205 hr = pSurface->u.pVertexBuffer->Unlock(); 206 AssertMsg(hr == D3D_OK, ("Unlock vertex failed with %x\n", hr)); 207 break; 208 } 209 210 case SVGA3D_SURFACE_HINT_INDEXBUFFER: 211 { 212 void *pvD3DData = NULL; 213 hr = pSurface->u.pIndexBuffer->Lock(0, 0, &pvD3DData, D3DLOCK_READONLY); 214 AssertMsgReturn(hr == D3D_OK, ("Lock index failed with %x\n", hr), VERR_INTERNAL_ERROR); 215 216 memcpy(pbDst, pvD3DData, pMipmapLevel->cbSurface); 217 218 hr = pSurface->u.pIndexBuffer->Unlock(); 219 AssertMsg(hr == D3D_OK, ("Unlock index failed with %x\n", hr)); 220 break; 221 } 222 223 default: 224 AssertMsgFailed(("%#x\n", fSwitchFlags)); 225 } 226 227 #elif defined(VMSVGA3D_OPENGL) 228 /* 229 * OpenGL specifics. 230 */ 231 switch (fSwitchFlags) 232 { 233 case SVGA3D_SURFACE_HINT_TEXTURE: 234 case SVGA3D_SURFACE_HINT_RENDERTARGET: 235 case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET: 236 { 237 GLint activeTexture; 238 glGetIntegerv(GL_TEXTURE_BINDING_2D, &activeTexture); 239 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 240 241 glBindTexture(GL_TEXTURE_2D, pSurface->oglId.texture); 242 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 243 244 /* Set row length and alignment of the output data. */ 245 VMSVGAPACKPARAMS SavedParams; 246 vmsvga3dSetPackParams(pState, pContext, pSurface, &SavedParams); 247 248 glGetTexImage(GL_TEXTURE_2D, 249 i, 250 pSurface->formatGL, 251 pSurface->typeGL, 252 pbDst); 253 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 254 255 vmsvga3dRestorePackParams(pState, pContext, pSurface, &SavedParams); 256 257 /* Restore the old active texture. */ 258 glBindTexture(GL_TEXTURE_2D, activeTexture); 259 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 260 break; 261 } 262 263 case SVGA3D_SURFACE_HINT_VERTEXBUFFER: 264 case SVGA3D_SURFACE_HINT_INDEXBUFFER: 265 { 266 pState->ext.glBindBuffer(GL_ARRAY_BUFFER, pSurface->oglId.buffer); 267 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 268 269 void *pvSrc = pState->ext.glMapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY); 270 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 271 if (RT_VALID_PTR(pvSrc)) 272 memcpy(pbDst, pvSrc, pMipmapLevel->cbSurface); 273 else 274 AssertPtr(pvSrc); 275 276 pState->ext.glUnmapBuffer(GL_ARRAY_BUFFER); 277 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 278 279 pState->ext.glBindBuffer(GL_ARRAY_BUFFER, 0); 280 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 281 break; 282 } 283 284 default: 285 AssertMsgFailed(("%#x\n", fSwitchFlags)); 286 } 287 #else 288 # error "misconfigured" 289 #endif 290 } 291 /* else: There is no data in hardware yet, so whatever we got is already current. */ 292 } 293 } 294 } 295 296 return VINF_SUCCESS; 297 } 298 299 300 /** 301 * Updates the heap buffers for all surfaces or one specific one. 302 * 303 * @param pThis The VGA device instance data. 304 * @param sid The surface ID, UINT32_MAX if all. 305 * @thread VMSVGAFIFO 306 */ 307 void vmsvga3dUpdateHeapBuffersForSurfaces(PVGASTATE pThis, uint32_t sid) 308 { 309 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 310 AssertReturnVoid(pState); 311 312 if (sid == UINT32_MAX) 313 { 314 uint32_t cSurfaces = pState->cSurfaces; 315 for (sid = 0; sid < cSurfaces; sid++) 316 { 317 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 318 if (pSurface && pSurface->id == sid) 319 vmsvga3dSurfaceUpdateHeapBuffers(pState, pSurface); 320 } 321 } 322 else if (sid < pState->cSurfaces) 323 { 324 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 325 if (pSurface && pSurface->id == sid) 326 vmsvga3dSurfaceUpdateHeapBuffers(pState, pSurface); 327 } 328 } 329 330 20 331 int vmsvga3dLoadExec(PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 21 332 { 22 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;333 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 23 334 AssertReturn(pState, VERR_NO_MEMORY); 24 335 int rc; … … 348 659 int vmsvga3dSaveExec(PVGASTATE pThis, PSSMHANDLE pSSM) 349 660 { 350 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;661 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 351 662 AssertReturn(pState, VERR_NO_MEMORY); 352 663 int rc; … … 811 1122 812 1123 1124 1125 static const char * const g_apszTransformTypes[] = 1126 { 1127 "SVGA3D_TRANSFORM_INVALID", 1128 "SVGA3D_TRANSFORM_WORLD", 1129 "SVGA3D_TRANSFORM_VIEW", 1130 "SVGA3D_TRANSFORM_PROJECTION", 1131 "SVGA3D_TRANSFORM_TEXTURE0", 1132 "SVGA3D_TRANSFORM_TEXTURE1", 1133 "SVGA3D_TRANSFORM_TEXTURE2", 1134 "SVGA3D_TRANSFORM_TEXTURE3", 1135 "SVGA3D_TRANSFORM_TEXTURE4", 1136 "SVGA3D_TRANSFORM_TEXTURE5", 1137 "SVGA3D_TRANSFORM_TEXTURE6", 1138 "SVGA3D_TRANSFORM_TEXTURE7", 1139 "SVGA3D_TRANSFORM_WORLD1", 1140 "SVGA3D_TRANSFORM_WORLD2", 1141 "SVGA3D_TRANSFORM_WORLD3", 1142 }; 1143 1144 static const char * const g_apszFaces[] = 1145 { 1146 "SVGA3D_FACE_INVALID", 1147 "SVGA3D_FACE_NONE", 1148 "SVGA3D_FACE_FRONT", 1149 "SVGA3D_FACE_BACK", 1150 "SVGA3D_FACE_FRONT_BACK", 1151 }; 1152 1153 static const char * const g_apszLightTypes[] = 1154 { 1155 "SVGA3D_LIGHTTYPE_INVALID", 1156 "SVGA3D_LIGHTTYPE_POINT", 1157 "SVGA3D_LIGHTTYPE_SPOT1", 1158 "SVGA3D_LIGHTTYPE_SPOT2", 1159 "SVGA3D_LIGHTTYPE_DIRECTIONAL", 1160 }; 1161 1162 static const char * const g_apszRenderTargets[] = 1163 { 1164 "SVGA3D_RT_DEPTH", 1165 "SVGA3D_RT_STENCIL", 1166 "SVGA3D_RT_COLOR0", 1167 "SVGA3D_RT_COLOR1", 1168 "SVGA3D_RT_COLOR2", 1169 "SVGA3D_RT_COLOR3", 1170 "SVGA3D_RT_COLOR4", 1171 "SVGA3D_RT_COLOR5", 1172 "SVGA3D_RT_COLOR6", 1173 "SVGA3D_RT_COLOR7", 1174 }; 1175 1176 static void vmsvga3dInfoContextWorkerOne(PCDBGFINFOHLP pHlp, PVMSVGA3DCONTEXT pContext, bool fVerbose) 1177 { 1178 char szTmp[128]; 1179 1180 pHlp->pfnPrintf(pHlp, "*** VMSVGA 3d context %#x (%d) ***\n", pContext->id, pContext->id); 1181 #ifdef RT_OS_WINDOWS 1182 pHlp->pfnPrintf(pHlp, "hwnd: %p\n", pContext->hwnd); 1183 if (fVerbose) 1184 vmsvga3dInfoHostWindow(pHlp, (uintptr_t)pContext->hwnd); 1185 # ifdef VMSVGA3D_DIRECT3D 1186 pHlp->pfnPrintf(pHlp, "pDevice: %p\n", pContext->pDevice); 1187 # else 1188 pHlp->pfnPrintf(pHlp, "hdc: %p\n", pContext->hdc); 1189 pHlp->pfnPrintf(pHlp, "hglrc: %p\n", pContext->hglrc); 1190 # endif 1191 #else 1192 /** @todo Other hosts... */ 1193 #endif 1194 pHlp->pfnPrintf(pHlp, "sidRenderTarget: %#x\n", pContext->sidRenderTarget); 1195 1196 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->aSidActiveTexture); i++) 1197 if (pContext->aSidActiveTexture[i] != SVGA3D_INVALID_ID) 1198 pHlp->pfnPrintf(pHlp, "aSidActiveTexture[%u]: %#x\n", i, pContext->aSidActiveTexture[i]); 1199 1200 pHlp->pfnPrintf(pHlp, "fUpdateFlags: %#x\n", pContext->state.u32UpdateFlags); 1201 1202 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aRenderState); i++) 1203 if (pContext->state.aRenderState[i].state != SVGA3D_RS_INVALID) 1204 pHlp->pfnPrintf(pHlp, "aRenderState[%3d]: %s\n", i, 1205 vmsvga3dFormatRenderState(szTmp, sizeof(szTmp), &pContext->state.aRenderState[i])); 1206 1207 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aTextureState); i++) 1208 for (uint32_t j = 0; j < RT_ELEMENTS(pContext->state.aTextureState[i]); j++) 1209 if (pContext->state.aTextureState[i][j].name != SVGA3D_TS_INVALID) 1210 pHlp->pfnPrintf(pHlp, "aTextureState[%3d][%3d]: %s\n", i, j, 1211 vmsvga3dFormatTextureState(szTmp, sizeof(szTmp), &pContext->state.aTextureState[i][j])); 1212 1213 AssertCompile(RT_ELEMENTS(g_apszTransformTypes) == SVGA3D_TRANSFORM_MAX); 1214 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aTransformState); i++) 1215 if (pContext->state.aTransformState[i].fValid) 1216 { 1217 pHlp->pfnPrintf(pHlp, "aTransformState[%s(%u)]:\n", g_apszTransformTypes[i], i); 1218 for (uint32_t j = 0; j < RT_ELEMENTS(pContext->state.aTransformState[i].matrix); j++) 1219 pHlp->pfnPrintf(pHlp, 1220 (j % 4) == 0 ? " [ " FLOAT_FMT_STR : (j % 4) < 3 ? ", " FLOAT_FMT_STR : ", " FLOAT_FMT_STR "]\n", 1221 FLOAT_FMT_ARGS(pContext->state.aTransformState[i].matrix[j])); 1222 } 1223 1224 AssertCompile(RT_ELEMENTS(g_apszFaces) == SVGA3D_FACE_MAX); 1225 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aMaterial); i++) 1226 if (pContext->state.aMaterial[i].fValid) 1227 { 1228 pHlp->pfnPrintf(pHlp, "aTransformState[%s(%u)]: shininess=" FLOAT_FMT_STR "\n", 1229 g_apszFaces[i], i, FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.shininess)); 1230 pHlp->pfnPrintf(pHlp, " diffuse =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1231 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.diffuse[0]), 1232 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.diffuse[1]), 1233 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.diffuse[2]), 1234 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.diffuse[3])); 1235 pHlp->pfnPrintf(pHlp, " ambient =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1236 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.ambient[0]), 1237 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.ambient[1]), 1238 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.ambient[2]), 1239 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.ambient[3])); 1240 pHlp->pfnPrintf(pHlp, " specular=[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1241 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.specular[0]), 1242 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.specular[1]), 1243 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.specular[2]), 1244 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.specular[3])); 1245 pHlp->pfnPrintf(pHlp, " emissive=[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1246 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.emissive[0]), 1247 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.emissive[1]), 1248 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.emissive[2]), 1249 FLOAT_FMT_ARGS(pContext->state.aMaterial[i].material.emissive[3])); 1250 } 1251 1252 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aClipPlane); i++) 1253 if (pContext->state.aClipPlane[i].fValid) 1254 pHlp->pfnPrintf(pHlp, "aClipPlane[%#04x]: [ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1255 FLOAT_FMT_ARGS(pContext->state.aClipPlane[i].plane[0]), 1256 FLOAT_FMT_ARGS(pContext->state.aClipPlane[i].plane[1]), 1257 FLOAT_FMT_ARGS(pContext->state.aClipPlane[i].plane[2]), 1258 FLOAT_FMT_ARGS(pContext->state.aClipPlane[i].plane[3])); 1259 1260 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aLightData); i++) 1261 if (pContext->state.aLightData[i].fValidData) 1262 { 1263 pHlp->pfnPrintf(pHlp, "aLightData[%#04x]: enabled=%RTbool inWorldSpace=%RTbool type=%s(%u)\n", 1264 i, 1265 pContext->state.aLightData[i].fEnabled, 1266 pContext->state.aLightData[i].data.inWorldSpace, 1267 pContext->state.aLightData[i].data.type < RT_ELEMENTS(g_apszLightTypes) 1268 ? g_apszLightTypes[pContext->state.aLightData[i].data.type] : "UNKNOWN", 1269 pContext->state.aLightData[i].data.type); 1270 pHlp->pfnPrintf(pHlp, " diffuse =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1271 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.diffuse[0]), 1272 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.diffuse[1]), 1273 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.diffuse[2]), 1274 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.diffuse[3])); 1275 pHlp->pfnPrintf(pHlp, " specular =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1276 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.specular[0]), 1277 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.specular[1]), 1278 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.specular[2]), 1279 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.specular[3])); 1280 pHlp->pfnPrintf(pHlp, " ambient =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1281 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.ambient[0]), 1282 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.ambient[1]), 1283 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.ambient[2]), 1284 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.ambient[3])); 1285 pHlp->pfnPrintf(pHlp, " position =[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1286 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.position[0]), 1287 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.position[1]), 1288 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.position[2]), 1289 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.position[3])); 1290 pHlp->pfnPrintf(pHlp, " direction=[ " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR " ]\n", 1291 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.direction[0]), 1292 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.direction[1]), 1293 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.direction[2]), 1294 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.direction[3])); 1295 pHlp->pfnPrintf(pHlp, " range=" FLOAT_FMT_STR " falloff=" FLOAT_FMT_STR "\n", 1296 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.range), 1297 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.falloff)); 1298 pHlp->pfnPrintf(pHlp, " attenuation0=" FLOAT_FMT_STR " attenuation1=" FLOAT_FMT_STR " attenuation2=" FLOAT_FMT_STR "\n", 1299 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.attenuation0), 1300 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.attenuation1), 1301 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.attenuation2)); 1302 pHlp->pfnPrintf(pHlp, " theta=" FLOAT_FMT_STR " phi=" FLOAT_FMT_STR "\n", 1303 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.theta), 1304 FLOAT_FMT_ARGS(pContext->state.aLightData[i].data.phi)); 1305 } 1306 1307 for (uint32_t i = 0; i < RT_ELEMENTS(pContext->state.aRenderTargets); i++) 1308 if (pContext->state.aRenderTargets[i] != SVGA3D_INVALID_ID) 1309 pHlp->pfnPrintf(pHlp, "aRenderTargets[%s/%u] = %#x (%d)\n", 1310 i < RT_ELEMENTS(g_apszRenderTargets) ? g_apszRenderTargets[i] : "UNKNOWN", i, 1311 pContext->state.aRenderTargets[i], pContext->state.aRenderTargets[i]); 1312 1313 pHlp->pfnPrintf(pHlp, "RectScissor: (x,y,cx,cy)=(%u,%u,%u,%u)\n", 1314 pContext->state.RectViewPort.x, pContext->state.RectViewPort.y, 1315 pContext->state.RectViewPort.w, pContext->state.RectViewPort.h); 1316 pHlp->pfnPrintf(pHlp, "zRange: (min,max)=(" FLOAT_FMT_STR ", " FLOAT_FMT_STR ")\n", 1317 FLOAT_FMT_ARGS(pContext->state.zRange.min), 1318 FLOAT_FMT_ARGS(pContext->state.zRange.max)); 1319 pHlp->pfnPrintf(pHlp, "fUpdateFlags: %#x\n", pContext->state.u32UpdateFlags); 1320 pHlp->pfnPrintf(pHlp, "shidPixel: %#x (%d)\n", pContext->state.shidPixel, pContext->state.shidPixel); 1321 pHlp->pfnPrintf(pHlp, "shidVertex: %#x (%d)\n", pContext->state.shidVertex, pContext->state.shidVertex); 1322 1323 for (uint32_t iWhich = 0; iWhich < 2; iWhich++) 1324 { 1325 uint32_t cConsts = iWhich == 0 ? pContext->state.cPixelShaderConst : pContext->state.cVertexShaderConst; 1326 PVMSVGASHADERCONST paConsts = iWhich == 0 ? pContext->state.paPixelShaderConst : pContext->state.paVertexShaderConst; 1327 const char *pszName = iWhich ? "paPixelShaderConst" : "paVertexShaderConst"; 1328 1329 for (uint32_t i = 0; i < cConsts; i++) 1330 if (paConsts[i].fValid) 1331 { 1332 if (paConsts[i].ctype == SVGA3D_CONST_TYPE_FLOAT) 1333 pHlp->pfnPrintf(pHlp, "%s[%#x(%u)] = [" FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR "] ctype=FLOAT\n", 1334 pszName, i, i, 1335 FLOAT_FMT_ARGS(paConsts[i].value[0]), FLOAT_FMT_ARGS(paConsts[i].value[1]), 1336 FLOAT_FMT_ARGS(paConsts[i].value[2]), FLOAT_FMT_ARGS(paConsts[i].value[3])); 1337 else 1338 pHlp->pfnPrintf(pHlp, "%s[%#x(%u)] = [%#x, %#x, %#x, %#x] ctype=%s\n", 1339 pszName, i, i, 1340 paConsts[i].value[0], paConsts[i].value[1], 1341 paConsts[i].value[2], paConsts[i].value[3], 1342 paConsts[i].ctype == SVGA3D_CONST_TYPE_INT ? "INT" 1343 : paConsts[i].ctype == SVGA3D_CONST_TYPE_BOOL ? "BOOL" : "UNKNOWN"); 1344 } 1345 } 1346 1347 for (uint32_t iWhich = 0; iWhich < 2; iWhich++) 1348 { 1349 uint32_t cShaders = iWhich == 0 ? pContext->cPixelShaders : pContext->cVertexShaders; 1350 PVMSVGA3DSHADER paShaders = iWhich == 0 ? pContext->paPixelShader : pContext->paVertexShader; 1351 const char *pszName = iWhich == 0 ? "paPixelShaders" : "paVertexShaders"; 1352 for (uint32_t i = 0; i < cShaders; i++) 1353 if (paShaders[i].id == i) 1354 { 1355 pHlp->pfnPrintf(pHlp, "%s[%u]: id=%#x cid=%#x type=%s(%d) cbData=%#x pvData=%p\n", 1356 pszName, i, 1357 paShaders[i].id, 1358 paShaders[i].cid, 1359 paShaders[i].type == SVGA3D_SHADERTYPE_VS ? "VS" 1360 : paShaders[i].type == SVGA3D_SHADERTYPE_PS ? "PS" : "UNKNOWN", 1361 paShaders[i].type, 1362 paShaders[i].cbData, 1363 paShaders[i].pShaderProgram); 1364 } 1365 } 1366 } 1367 1368 1369 void vmsvga3dInfoContextWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, uint32_t cid, bool fVerbose) 1370 { 1371 /* Warning! This code is currently racing papContexts reallocation! */ 1372 /* Warning! This code is currently racing papContexts reallocation! */ 1373 /* Warning! This code is currently racing papContexts reallocation! */ 1374 VMSVGA3DSTATE volatile *pState = pThis->svga.p3dState; 1375 if (pState) 1376 { 1377 /* 1378 * Deal with a specific request first. 1379 */ 1380 if (cid != UINT32_MAX) 1381 { 1382 if (cid < pState->cContexts) 1383 { 1384 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 1385 if (pContext && pContext->id == cid) 1386 { 1387 vmsvga3dInfoContextWorkerOne(pHlp, pContext, fVerbose); 1388 return; 1389 } 1390 } 1391 pHlp->pfnPrintf(pHlp, "Context ID %#x not found.\n", cid); 1392 } 1393 else 1394 { 1395 /* 1396 * Dump all. 1397 */ 1398 uint32_t cContexts = pState->cContexts; 1399 pHlp->pfnPrintf(pHlp, "cContexts=%d\n", cContexts); 1400 for (cid = 0; cid < cContexts; cid++) 1401 { 1402 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 1403 if (pContext && pContext->id == cid) 1404 { 1405 pHlp->pfnPrintf(pHlp, "\n"); 1406 vmsvga3dInfoContextWorkerOne(pHlp, pContext, fVerbose); 1407 } 1408 } 1409 } 1410 } 1411 } 1412 1413 /** Values for SVGA3dTextureFilter, prefix SVGA3D_TEX_FILTER_. */ 1414 static const char * const g_apszTexureFilters[] = 1415 { 1416 "NONE", 1417 "NEAREST", 1418 "LINEAR", 1419 "ANISOTROPIC", 1420 "FLATCUBIC", 1421 "GAUSSIANCUBIC", 1422 "PYRAMIDALQUAD", 1423 "GAUSSIANQUAD", 1424 }; 1425 1426 /** SVGA3dSurfaceFlags values, prefix SVGA3D_SURFACE_. */ 1427 static VMSVGAINFOFLAGS32 const g_aSvga3DSurfaceFlags[] = 1428 { 1429 { SVGA3D_SURFACE_CUBEMAP , "CUBEMAP" }, 1430 { SVGA3D_SURFACE_HINT_STATIC , "HINT_STATIC" }, 1431 { SVGA3D_SURFACE_HINT_DYNAMIC , "HINT_DYNAMIC" }, 1432 { SVGA3D_SURFACE_HINT_INDEXBUFFER , "HINT_INDEXBUFFER" }, 1433 { SVGA3D_SURFACE_HINT_VERTEXBUFFER , "HINT_VERTEXBUFFER" }, 1434 { SVGA3D_SURFACE_HINT_TEXTURE , "HINT_TEXTURE" }, 1435 { SVGA3D_SURFACE_HINT_RENDERTARGET , "HINT_RENDERTARGET" }, 1436 { SVGA3D_SURFACE_HINT_DEPTHSTENCIL , "HINT_DEPTHSTENCIL" }, 1437 { SVGA3D_SURFACE_HINT_WRITEONLY , "HINT_WRITEONLY" }, 1438 { SVGA3D_SURFACE_MASKABLE_ANTIALIAS , "MASKABLE_ANTIALIAS" }, 1439 { SVGA3D_SURFACE_AUTOGENMIPMAPS , "AUTOGENMIPMAPS" }, 1440 }; 1441 1442 1443 #ifdef VMSVGA3D_DIRECT3D 1444 1445 /** Values for D3DFORMAT, prefix D3DFMT_. */ 1446 static VMSVGAINFOENUM const g_aD3DFormats[] = 1447 { 1448 { D3DFMT_UNKNOWN , "UNKNOWN" }, 1449 { D3DFMT_R8G8B8 , "R8G8B8" }, 1450 { D3DFMT_A8R8G8B8 , "A8R8G8B8" }, 1451 { D3DFMT_X8R8G8B8 , "X8R8G8B8" }, 1452 { D3DFMT_R5G6B5 , "R5G6B5" }, 1453 { D3DFMT_X1R5G5B5 , "X1R5G5B5" }, 1454 { D3DFMT_A1R5G5B5 , "A1R5G5B5" }, 1455 { D3DFMT_A4R4G4B4 , "A4R4G4B4" }, 1456 { D3DFMT_R3G3B2 , "R3G3B2" }, 1457 { D3DFMT_A8 , "A8" }, 1458 { D3DFMT_A8R3G3B2 , "A8R3G3B2" }, 1459 { D3DFMT_X4R4G4B4 , "X4R4G4B4" }, 1460 { D3DFMT_A2B10G10R10 , "A2B10G10R10" }, 1461 { D3DFMT_A8B8G8R8 , "A8B8G8R8" }, 1462 { D3DFMT_X8B8G8R8 , "X8B8G8R8" }, 1463 { D3DFMT_G16R16 , "G16R16" }, 1464 { D3DFMT_A2R10G10B10 , "A2R10G10B10" }, 1465 { D3DFMT_A16B16G16R16 , "A16B16G16R16" }, 1466 { D3DFMT_A8P8 , "A8P8" }, 1467 { D3DFMT_P8 , "P8" }, 1468 { D3DFMT_L8 , "L8" }, 1469 { D3DFMT_A8L8 , "A8L8" }, 1470 { D3DFMT_A4L4 , "A4L4" }, 1471 { D3DFMT_V8U8 , "V8U8" }, 1472 { D3DFMT_L6V5U5 , "L6V5U5" }, 1473 { D3DFMT_X8L8V8U8 , "X8L8V8U8" }, 1474 { D3DFMT_Q8W8V8U8 , "Q8W8V8U8" }, 1475 { D3DFMT_V16U16 , "V16U16" }, 1476 { D3DFMT_A2W10V10U10 , "A2W10V10U10" }, 1477 { D3DFMT_D16_LOCKABLE , "D16_LOCKABLE" }, 1478 { D3DFMT_D32 , "D32" }, 1479 { D3DFMT_D15S1 , "D15S1" }, 1480 { D3DFMT_D24S8 , "D24S8" }, 1481 { D3DFMT_D24X8 , "D24X8" }, 1482 { D3DFMT_D24X4S4 , "D24X4S4" }, 1483 { D3DFMT_D16 , "D16" }, 1484 { D3DFMT_L16 , "L16" }, 1485 { D3DFMT_D32F_LOCKABLE , "D32F_LOCKABLE" }, 1486 { D3DFMT_D24FS8 , "D24FS8" }, 1487 { D3DFMT_VERTEXDATA , "VERTEXDATA" }, 1488 { D3DFMT_INDEX16 , "INDEX16" }, 1489 { D3DFMT_INDEX32 , "INDEX32" }, 1490 { D3DFMT_Q16W16V16U16 , "Q16W16V16U16" }, 1491 { D3DFMT_R16F , "R16F" }, 1492 { D3DFMT_G16R16F , "G16R16F" }, 1493 { D3DFMT_A16B16G16R16F , "A16B16G16R16F" }, 1494 { D3DFMT_R32F , "R32F" }, 1495 { D3DFMT_G32R32F , "G32R32F" }, 1496 { D3DFMT_A32B32G32R32F , "A32B32G32R32F" }, 1497 { D3DFMT_CxV8U8 , "CxV8U8" }, 1498 { D3DFMT_UYVY , "UYVY" }, 1499 { D3DFMT_YUY2 , "YUY2" }, 1500 { D3DFMT_DXT1 , "DXT1" }, 1501 { D3DFMT_DXT2 , "DXT2" }, 1502 { D3DFMT_DXT3 , "DXT3" }, 1503 { D3DFMT_DXT4 , "DXT4" }, 1504 { D3DFMT_DXT5 , "DXT5" }, 1505 { D3DFMT_MULTI2_ARGB8 , "MULTI2_ARGB8" }, 1506 { D3DFMT_G8R8_G8B8 , "G8R8_G8B8" }, 1507 { D3DFMT_R8G8_B8G8 , "R8G8_B8G8" }, 1508 { D3DFMT_FORCE_DWORD , "FORCE_DWORD" }, 1509 }; 1510 1511 /** Values for D3DMULTISAMPLE_TYPE, prefix D3DMULTISAMPLE_. */ 1512 static VMSVGAINFOENUM const g_aD3DMultiSampleTypes[] = 1513 { 1514 { D3DMULTISAMPLE_NONE , "NONE" }, 1515 { D3DMULTISAMPLE_NONMASKABLE , "NONMASKABLE" }, 1516 { D3DMULTISAMPLE_2_SAMPLES , "2_SAMPLES" }, 1517 { D3DMULTISAMPLE_3_SAMPLES , "3_SAMPLES" }, 1518 { D3DMULTISAMPLE_4_SAMPLES , "4_SAMPLES" }, 1519 { D3DMULTISAMPLE_5_SAMPLES , "5_SAMPLES" }, 1520 { D3DMULTISAMPLE_6_SAMPLES , "6_SAMPLES" }, 1521 { D3DMULTISAMPLE_7_SAMPLES , "7_SAMPLES" }, 1522 { D3DMULTISAMPLE_8_SAMPLES , "8_SAMPLES" }, 1523 { D3DMULTISAMPLE_9_SAMPLES , "9_SAMPLES" }, 1524 { D3DMULTISAMPLE_10_SAMPLES , "10_SAMPLES" }, 1525 { D3DMULTISAMPLE_11_SAMPLES , "11_SAMPLES" }, 1526 { D3DMULTISAMPLE_12_SAMPLES , "12_SAMPLES" }, 1527 { D3DMULTISAMPLE_13_SAMPLES , "13_SAMPLES" }, 1528 { D3DMULTISAMPLE_14_SAMPLES , "14_SAMPLES" }, 1529 { D3DMULTISAMPLE_15_SAMPLES , "15_SAMPLES" }, 1530 { D3DMULTISAMPLE_16_SAMPLES , "16_SAMPLES" }, 1531 { D3DMULTISAMPLE_FORCE_DWORD , "FORCE_DWORD" }, 1532 }; 1533 1534 /** D3DUSAGE_XXX flag value, prefix D3DUSAGE_. */ 1535 static VMSVGAINFOFLAGS32 const g_aD3DUsageFlags[] = 1536 { 1537 { D3DUSAGE_RENDERTARGET , "RENDERTARGET" }, 1538 { D3DUSAGE_DEPTHSTENCIL , "DEPTHSTENCIL" }, 1539 { D3DUSAGE_WRITEONLY , "WRITEONLY" }, 1540 { D3DUSAGE_SOFTWAREPROCESSING , "SOFTWAREPROCESSING" }, 1541 { D3DUSAGE_DONOTCLIP , "DONOTCLIP" }, 1542 { D3DUSAGE_POINTS , "POINTS" }, 1543 { D3DUSAGE_RTPATCHES , "RTPATCHES" }, 1544 { D3DUSAGE_NPATCHES , "NPATCHES" }, 1545 { D3DUSAGE_DYNAMIC , "DYNAMIC" }, 1546 { D3DUSAGE_AUTOGENMIPMAP , "AUTOGENMIPMAP" }, 1547 { D3DUSAGE_RESTRICTED_CONTENT , "RESTRICTED_CONTENT" }, 1548 { D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER , "RESTRICT_SHARED_RESOURCE_DRIVER" }, 1549 { D3DUSAGE_RESTRICT_SHARED_RESOURCE , "RESTRICT_SHARED_RESOURCE" }, 1550 { D3DUSAGE_DMAP , "DMAP" }, 1551 { D3DUSAGE_NONSECURE , "NONSECURE" }, 1552 { D3DUSAGE_TEXTAPI , "TEXTAPI" }, 1553 }; 1554 1555 1556 /** 1557 * Release all shared surface objects. 1558 */ 1559 static DECLCALLBACK(int) vmsvga3dInfoSharedObjectCallback(PAVLU32NODECORE pNode, void *pvUser) 1560 { 1561 PVMSVGA3DSHAREDSURFACE pSharedSurface = (PVMSVGA3DSHAREDSURFACE)pNode; 1562 PCDBGFINFOHLP pHlp = (PCDBGFINFOHLP)pvUser; 1563 1564 pHlp->pfnPrintf(pHlp, "Shared surface: %#x pv=%p\n", pSharedSurface->Core.Key, pSharedSurface->u.pCubeTexture); 1565 1566 return 0; 1567 } 1568 1569 #elif defined(VMSVGA3D_OPENGL) 1570 /** @todo */ 1571 1572 #else 1573 # error "Build config error." 1574 #endif 1575 1576 1577 static void vmsvga3dInfoSurfaceWorkerOne(PCDBGFINFOHLP pHlp, PVMSVGA3DSURFACE pSurface, 1578 bool fVerbose, uint32_t cxAscii, bool fInvY) 1579 { 1580 char szTmp[128]; 1581 1582 pHlp->pfnPrintf(pHlp, "*** VMSVGA 3d surface %#x (%d)%s ***\n", pSurface->id, pSurface->id, pSurface->fDirty ? " - dirty" : ""); 1583 #if defined(VMSVGA3D_OPENGL) && defined(VMSVGA3D_OGL_WITH_SHARED_CTX) 1584 pHlp->pfnPrintf(pHlp, "idWeakContextAssociation: %#x\n", pSurface->idWeakContextAssociation); 1585 #else 1586 pHlp->pfnPrintf(pHlp, "idAssociatedContext: %#x\n", pSurface->idAssociatedContext); 1587 #endif 1588 pHlp->pfnPrintf(pHlp, "Format: %s (%d)\n", vmsvgaSurfaceType2String(pSurface->format), pSurface->format); 1589 pHlp->pfnPrintf(pHlp, "Flags: %#x", pSurface->flags); 1590 vmsvga3dInfoU32Flags(pHlp, pSurface->flags, "SVGA3D_SURFACE_", g_aSvga3DSurfaceFlags, RT_ELEMENTS(g_aSvga3DSurfaceFlags)); 1591 pHlp->pfnPrintf(pHlp, "\n"); 1592 if (pSurface->cFaces == 0) 1593 pHlp->pfnPrintf(pHlp, "Faces: %u\n", pSurface->cFaces); 1594 for (uint32_t iFace = 0; iFace < pSurface->cFaces; iFace++) 1595 { 1596 Assert(pSurface->faces[iFace].numMipLevels <= pSurface->faces[0].numMipLevels); 1597 if (pSurface->faces[iFace].numMipLevels == 0) 1598 pHlp->pfnPrintf(pHlp, "Faces[%u] Mipmap levels: %u\n", iFace, pSurface->faces[iFace].numMipLevels); 1599 1600 uint32_t iMipmap = iFace * pSurface->faces[0].numMipLevels; 1601 for (uint32_t iLevel = 0; iLevel < pSurface->faces[iFace].numMipLevels; iLevel++, iMipmap++) 1602 { 1603 pHlp->pfnPrintf(pHlp, "Face #%u, mipmap #%u[%u]:%s cx=%u, cy=%u, cz=%u, cbSurface=%#x, cbPitch=%#x", 1604 iFace, iLevel, iMipmap, iMipmap < 10 ? " " : "", 1605 pSurface->pMipmapLevels[iMipmap].size.width, 1606 pSurface->pMipmapLevels[iMipmap].size.height, 1607 pSurface->pMipmapLevels[iMipmap].size.depth, 1608 pSurface->pMipmapLevels[iMipmap].cbSurface, 1609 pSurface->pMipmapLevels[iMipmap].cbSurfacePitch); 1610 if (pSurface->pMipmapLevels[iMipmap].pSurfaceData) 1611 pHlp->pfnPrintf(pHlp, " pvData=%p", pSurface->pMipmapLevels[iMipmap].pSurfaceData); 1612 if (pSurface->pMipmapLevels[iMipmap].fDirty) 1613 pHlp->pfnPrintf(pHlp, " dirty"); 1614 pHlp->pfnPrintf(pHlp, "\n"); 1615 } 1616 } 1617 1618 pHlp->pfnPrintf(pHlp, "cbBlock: %u (%#x)\n", pSurface->cbBlock, pSurface->cbBlock); 1619 pHlp->pfnPrintf(pHlp, "Multi-sample count: %u\n", pSurface->multiSampleCount); 1620 pHlp->pfnPrintf(pHlp, "Autogen filter: %s\n", 1621 vmsvgaFormatEnumValue(szTmp, sizeof(szTmp), NULL, pSurface->autogenFilter, 1622 "SVGA3D_TEX_FILTER_", g_apszTexureFilters, RT_ELEMENTS(g_apszTexureFilters))); 1623 1624 #ifdef VMSVGA3D_DIRECT3D 1625 pHlp->pfnPrintf(pHlp, "formatD3D: %s\n", 1626 vmsvgaFormatEnumValueEx(szTmp, sizeof(szTmp), NULL, pSurface->formatD3D, 1627 "D3DFMT_", g_aD3DFormats, RT_ELEMENTS(g_aD3DFormats))); 1628 pHlp->pfnPrintf(pHlp, "fUsageD3D: %#x", pSurface->fUsageD3D); 1629 vmsvga3dInfoU32Flags(pHlp, pSurface->fUsageD3D, "D3DUSAGE_", g_aD3DUsageFlags, RT_ELEMENTS(g_aD3DUsageFlags)); 1630 pHlp->pfnPrintf(pHlp, "\n"); 1631 pHlp->pfnPrintf(pHlp, "multiSampleTypeD3D: %s\n", 1632 vmsvgaFormatEnumValueEx(szTmp, sizeof(szTmp), NULL, pSurface->multiSampleTypeD3D, 1633 "D3DMULTISAMPLE", g_aD3DMultiSampleTypes, RT_ELEMENTS(g_aD3DMultiSampleTypes))); 1634 if (pSurface->hSharedObject != NULL) 1635 pHlp->pfnPrintf(pHlp, "hSharedObject: %p\n", pSurface->hSharedObject); 1636 if (pSurface->pQuery) 1637 pHlp->pfnPrintf(pHlp, "pQuery: %p\n", pSurface->pQuery); 1638 if (pSurface->u.pSurface) 1639 pHlp->pfnPrintf(pHlp, "u.pXxxx: %p\n", pSurface->u.pSurface); 1640 if (pSurface->bounce.pTexture) 1641 pHlp->pfnPrintf(pHlp, "bounce.pXxxx: %p\n", pSurface->bounce.pTexture); 1642 RTAvlU32DoWithAll(&pSurface->pSharedObjectTree, true /*fFromLeft*/, vmsvga3dInfoSharedObjectCallback, (void *)pHlp); 1643 pHlp->pfnPrintf(pHlp, "fStencilAsTexture: %RTbool\n", pSurface->fStencilAsTexture); 1644 1645 #elif defined(VMSVGA3D_OPENGL) 1646 /** @todo */ 1647 #else 1648 # error "Build config error." 1649 #endif 1650 1651 if (fVerbose) 1652 for (uint32_t iFace = 0; iFace < pSurface->cFaces; iFace++) 1653 { 1654 uint32_t iMipmap = iFace * pSurface->faces[0].numMipLevels; 1655 for (uint32_t iLevel = 0; iLevel < pSurface->faces[iFace].numMipLevels; iLevel++, iMipmap++) 1656 if (pSurface->pMipmapLevels[iMipmap].pSurfaceData) 1657 { 1658 if ( ASMMemIsAll8(pSurface->pMipmapLevels[iMipmap].pSurfaceData, 1659 pSurface->pMipmapLevels[iMipmap].cbSurface, 0) == NULL) 1660 pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: all zeros ---\n", iFace, iLevel, iMipmap); 1661 else 1662 { 1663 pHlp->pfnPrintf(pHlp, "--- Face #%u, mipmap #%u[%u]: cx=%u, cy=%u, cz=%u ---\n", 1664 iFace, iLevel, iMipmap, 1665 pSurface->pMipmapLevels[iMipmap].size.width, 1666 pSurface->pMipmapLevels[iMipmap].size.height, 1667 pSurface->pMipmapLevels[iMipmap].size.depth); 1668 vmsvga3dAsciiPrint(vmsvga3dAsciiPrintlnInfo, (void *)pHlp, 1669 pSurface->pMipmapLevels[iMipmap].pSurfaceData, 1670 pSurface->pMipmapLevels[iMipmap].cbSurface, 1671 pSurface->pMipmapLevels[iMipmap].size.width, 1672 pSurface->pMipmapLevels[iMipmap].size.height, 1673 pSurface->pMipmapLevels[iMipmap].cbSurfacePitch, 1674 pSurface->format, 1675 fInvY, 1676 cxAscii, cxAscii * 3 / 4); 1677 } 1678 } 1679 } 1680 } 1681 1682 1683 void vmsvga3dInfoSurfaceWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, uint32_t sid, bool fVerbose, uint32_t cxAscii, bool fInvY) 1684 { 1685 /* Warning! This code is currently racing papSurfaces reallocation! */ 1686 /* Warning! This code is currently racing papSurfaces reallocation! */ 1687 /* Warning! This code is currently racing papSurfaces reallocation! */ 1688 VMSVGA3DSTATE volatile *pState = pThis->svga.p3dState; 1689 if (pState) 1690 { 1691 /* 1692 * Deal with a specific request first. 1693 */ 1694 if (sid != UINT32_MAX) 1695 { 1696 if (sid < pState->cSurfaces) 1697 { 1698 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 1699 if (pSurface && pSurface->id == sid) 1700 { 1701 if (fVerbose) 1702 vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(pThis, sid); 1703 vmsvga3dInfoSurfaceWorkerOne(pHlp, pSurface, fVerbose, cxAscii, fInvY); 1704 return; 1705 } 1706 } 1707 pHlp->pfnPrintf(pHlp, "Surface ID %#x not found.\n", sid); 1708 } 1709 else 1710 { 1711 /* 1712 * Dump all. 1713 */ 1714 if (fVerbose) 1715 vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(pThis, UINT32_MAX); 1716 uint32_t cSurfaces = pState->cSurfaces; 1717 pHlp->pfnPrintf(pHlp, "cSurfaces=%d\n", cSurfaces); 1718 for (sid = 0; sid < cSurfaces; sid++) 1719 { 1720 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 1721 if (pSurface && pSurface->id == sid) 1722 { 1723 pHlp->pfnPrintf(pHlp, "\n"); 1724 vmsvga3dInfoSurfaceWorkerOne(pHlp, pSurface, fVerbose, cxAscii, fInvY); 1725 } 1726 } 1727 } 1728 } 1729 1730 } 1731 1732 813 1733 #endif /* !___DevVGA_SVGA3d_shared_h___ */ 814 1734 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r56593 r57081 329 329 }; 330 330 331 typedef struct 331 typedef struct VMSVGA3DSTATE 332 332 { 333 333 #ifdef VBOX_VMSVGA3D_WITH_OPENGL … … 355 355 bool fSupportedSurfaceINTZ; 356 356 bool fSupportedSurfaceNULL; 357 } VMSVGA3DSTATE , *PVMSVGA3DSTATE;357 } VMSVGA3DSTATE; 358 358 359 359 /** … … 474 474 int rc; 475 475 476 pThis->svga.p3dState = RTMemAllocZ(sizeof(VMSVGA3DSTATE));476 pThis->svga.p3dState = pState = (PVMSVGA3DSTATE)RTMemAllocZ(sizeof(VMSVGA3DSTATE)); 477 477 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 478 pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;479 478 480 479 /* Create event semaphore. */ … … 499 498 int vmsvga3dPowerOn(PVGASTATE pThis) 500 499 { 501 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;500 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 502 501 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 503 502 HRESULT hr; … … 592 591 int vmsvga3dReset(PVGASTATE pThis) 593 592 { 594 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;593 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 595 594 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 596 595 … … 613 612 int vmsvga3dTerminate(PVGASTATE pThis) 614 613 { 615 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;614 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 616 615 AssertReturn(pThis->svga.p3dState, VERR_NO_MEMORY); 617 616 … … 732 731 int vmsvga3dQueryCaps(PVGASTATE pThis, uint32_t idx3dCaps, uint32_t *pu32Val) 733 732 { 734 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;733 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 735 734 AssertReturn(pState, VERR_NO_MEMORY); 736 735 D3DCAPS9 *pCaps = &pState->caps; … … 1389 1388 { 1390 1389 PVMSVGA3DSURFACE pSurface; 1391 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1390 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1392 1391 AssertReturn(pState, VERR_NO_MEMORY); 1393 1392 … … 1590 1589 * Release all shared surface objects. 1591 1590 */ 1592 static intvmsvga3dSharedSurfaceDestroyTree(PAVLU32NODECORE pNode, void *pParam)1591 static DECLCALLBACK(int) vmsvga3dSharedSurfaceDestroyTree(PAVLU32NODECORE pNode, void *pParam) 1593 1592 { 1594 1593 PVMSVGA3DSHAREDSURFACE pSharedSurface = (PVMSVGA3DSHAREDSURFACE)pNode; … … 1615 1614 int vmsvga3dSurfaceDestroy(PVGASTATE pThis, uint32_t sid) 1616 1615 { 1617 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1616 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1618 1617 AssertReturn(pState, VERR_NO_MEMORY); 1619 1618 … … 1758 1757 static int vmsvga3dSurfaceTrackUsage(PVGASTATE pThis, PVMSVGA3DCONTEXT pContext, uint32_t sid) 1759 1758 { 1760 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1759 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1761 1760 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 1762 1761 HRESULT hr; … … 1819 1818 int vmsvga3dSurfaceCopy(PVGASTATE pThis, SVGA3dSurfaceImageId dest, SVGA3dSurfaceImageId src, uint32_t cCopyBoxes, SVGA3dCopyBox *pBox) 1820 1819 { 1821 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;1820 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 1822 1821 PVMSVGA3DSURFACE pSurfaceSrc; 1823 1822 uint32_t sidSrc = src.sid; … … 2193 2192 int vmsvga3dSurfaceStretchBlt(PVGASTATE pThis, SVGA3dSurfaceImageId dest, SVGA3dBox destBox, SVGA3dSurfaceImageId src, SVGA3dBox srcBox, SVGA3dStretchBltMode mode) 2194 2193 { 2195 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2194 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2196 2195 PVMSVGA3DSURFACE pSurfaceSrc; 2197 2196 uint32_t sidSrc = src.sid; … … 2323 2322 uint32_t cCopyBoxes, SVGA3dCopyBox *pBoxes) 2324 2323 { 2325 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2324 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2326 2325 PVMSVGA3DSURFACE pSurface; 2327 2326 PVMSVGA3DMIPMAPLEVEL pMipLevel; … … 2689 2688 #if 0 2690 2689 { 2691 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2690 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2692 2691 HRESULT hr; 2693 2692 PVMSVGA3DSURFACE pSurface; … … 2731 2730 int vmsvga3dGenerateMipmaps(PVGASTATE pThis, uint32_t sid, SVGA3dTextureFilter filter) 2732 2731 { 2733 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2732 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2734 2733 PVMSVGA3DSURFACE pSurface; 2735 2734 int rc = VINF_SUCCESS; … … 2784 2783 int vmsvga3dCommandPresent(PVGASTATE pThis, uint32_t sid, uint32_t cRects, SVGA3dCopyRect *pRect) 2785 2784 { 2786 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2785 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2787 2786 PVMSVGA3DSURFACE pSurface; 2788 2787 int rc = VINF_SUCCESS; … … 2925 2924 HRESULT hr; 2926 2925 D3DPRESENT_PARAMETERS PresParam; 2927 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;2926 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2928 2927 2929 2928 AssertReturn(pState, VERR_NO_MEMORY); … … 3042 3041 int vmsvga3dContextDestroy(PVGASTATE pThis, uint32_t cid) 3043 3042 { 3044 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3043 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3045 3044 AssertReturn(pState, VERR_NO_MEMORY); 3046 3045 … … 3184 3183 int vmsvga3dChangeMode(PVGASTATE pThis) 3185 3184 { 3186 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3185 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3187 3186 AssertReturn(pState, VERR_NO_MEMORY); 3188 3187 … … 3437 3436 HRESULT hr; 3438 3437 PVMSVGA3DCONTEXT pContext; 3439 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3438 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3440 3439 AssertReturn(pState, VERR_NO_MEMORY); 3441 3440 … … 3519 3518 HRESULT hr; 3520 3519 PVMSVGA3DCONTEXT pContext; 3521 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3520 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3522 3521 AssertReturn(pState, VERR_NO_MEMORY); 3523 3522 … … 3595 3594 HRESULT hr; 3596 3595 PVMSVGA3DCONTEXT pContext; 3597 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;3596 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3598 3597 AssertReturn(pState, VERR_NO_MEMORY); 3599 3598 … … 4266 4265 HRESULT hr; 4267 4266 PVMSVGA3DCONTEXT pContext; 4268 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4267 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4269 4268 PVMSVGA3DSURFACE pRenderTarget; 4270 4269 … … 4698 4697 HRESULT hr; 4699 4698 PVMSVGA3DCONTEXT pContext; 4700 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4699 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4701 4700 AssertReturn(pState, VERR_NO_MEMORY); 4702 4701 … … 4967 4966 D3DMATERIAL9 material; 4968 4967 PVMSVGA3DCONTEXT pContext; 4969 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;4968 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4970 4969 AssertReturn(pState, VERR_NO_MEMORY); 4971 4970 … … 5022 5021 D3DLIGHT9 light; 5023 5022 PVMSVGA3DCONTEXT pContext; 5024 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5023 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5025 5024 AssertReturn(pState, VERR_NO_MEMORY); 5026 5025 … … 5100 5099 HRESULT hr; 5101 5100 PVMSVGA3DCONTEXT pContext; 5102 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5101 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5103 5102 AssertReturn(pState, VERR_NO_MEMORY); 5104 5103 … … 5130 5129 D3DVIEWPORT9 viewPort; 5131 5130 PVMSVGA3DCONTEXT pContext; 5132 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5131 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5133 5132 AssertReturn(pState, VERR_NO_MEMORY); 5134 5133 … … 5165 5164 HRESULT hr; 5166 5165 PVMSVGA3DCONTEXT pContext; 5167 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5166 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5168 5167 AssertReturn(pState, VERR_NO_MEMORY); 5169 5168 … … 5194 5193 HRESULT hr; 5195 5194 PVMSVGA3DCONTEXT pContext; 5196 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5195 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5197 5196 AssertReturn(pState, VERR_NO_MEMORY); 5198 5197 … … 5394 5393 { 5395 5394 PVMSVGA3DCONTEXT pContext; 5396 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5395 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5397 5396 AssertReturn(pState, VERR_INTERNAL_ERROR); 5398 5397 int rc; … … 5694 5693 RECT rect; 5695 5694 PVMSVGA3DCONTEXT pContext; 5696 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5695 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5697 5696 AssertReturn(pState, VERR_NO_MEMORY); 5698 5697 … … 5728 5727 PVMSVGA3DCONTEXT pContext; 5729 5728 PVMSVGA3DSHADER pShader; 5730 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5729 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5731 5730 AssertReturn(pState, VERR_NO_MEMORY); 5732 5731 … … 5827 5826 { 5828 5827 PVMSVGA3DCONTEXT pContext; 5829 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5828 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5830 5829 AssertReturn(pState, VERR_NO_MEMORY); 5831 5830 PVMSVGA3DSHADER pShader = NULL; … … 5877 5876 int vmsvga3dShaderSet(PVGASTATE pThis, PVMSVGA3DCONTEXT pContext, uint32_t cid, SVGA3dShaderType type, uint32_t shid) 5878 5877 { 5879 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5878 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5880 5879 AssertReturn(pState, VERR_NO_MEMORY); 5881 5880 HRESULT hr; … … 5951 5950 HRESULT hr; 5952 5951 PVMSVGA3DCONTEXT pContext; 5953 PVMSVGA3DSTATE pState = (PVMSVGA3DSTATE)pThis->svga.p3dState;5952 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5954 5953 AssertReturn(pState, VERR_NO_MEMORY); 5955 5954 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r55811 r57081 23 23 #include "vmsvga/svga_overlay.h" 24 24 25 #if defined(RT_OS_WINDOWS) && defined(IN_RING3)26 # include <Windows.h>27 28 # define WM_VMSVGA3D_WAKEUP (WM_APP+1)29 # define WM_VMSVGA3D_CREATEWINDOW (WM_APP+2)30 # define WM_VMSVGA3D_DESTROYWINDOW (WM_APP+3)31 # define WM_VMSVGA3D_RESIZEWINDOW (WM_APP+4)32 # define WM_VMSVGA3D_EXIT (WM_APP+5)33 34 DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser);35 int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam);36 37 #endif38 25 39 26 /** Arbitrary limit */ … … 44 31 #define SVGA3D_MAX_LIGHTS 32 45 32 33 34 /**@def FLOAT_FMT_STR 35 * Format string bits to go with FLOAT_FMT_ARGS. */ 36 #define FLOAT_FMT_STR "%d.%06d" 37 /** @def FLOAT_FMT_ARGS 38 * Format arguments for a float value, corresponding to FLOAT_FMT_STR. 39 * @param r The floating point value to format. */ 40 #define FLOAT_FMT_ARGS(r) (int)(r), ((unsigned)((r) * 1000000) % 1000000U) 41 42 43 /* DevVGA-SVGA.cpp: */ 46 44 void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR); 47 45 int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType, uint8_t *pDest, int32_t cbDestPitch, 48 46 SVGAGuestPtr src, uint32_t offSrc, int32_t cbSrcPitch, uint32_t cbWidth, uint32_t cHeight); 47 void vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(PVGASTATE pThis, uint32_t sid); 49 48 49 50 /* DevVGA-SVGA3d-ogl.cpp & DevVGA-SVGA3d-win.cpp: */ 50 51 int vmsvga3dInit(PVGASTATE pThis); 51 52 int vmsvga3dPowerOn(PVGASTATE pThis); … … 93 94 int vmsvga3dQueryWait(PVGASTATE pThis, uint32_t cid, SVGA3dQueryType type, SVGAGuestPtr guestResult); 94 95 96 /* DevVGA-SVGA3d-shared.h: */ 97 #if defined(RT_OS_WINDOWS) && defined(IN_RING3) 98 # include <Windows.h> 99 100 # define WM_VMSVGA3D_WAKEUP (WM_APP+1) 101 # define WM_VMSVGA3D_CREATEWINDOW (WM_APP+2) 102 # define WM_VMSVGA3D_DESTROYWINDOW (WM_APP+3) 103 # define WM_VMSVGA3D_RESIZEWINDOW (WM_APP+4) 104 # define WM_VMSVGA3D_EXIT (WM_APP+5) 105 106 DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser); 107 int vmsvga3dSendThreadMessage(RTTHREAD pWindowThread, RTSEMEVENT WndRequestSem, UINT msg, WPARAM wParam, LPARAM lParam); 108 109 #endif 110 111 void vmsvga3dUpdateHeapBuffersForSurfaces(PVGASTATE pThis, uint32_t sid); 112 void vmsvga3dInfoContextWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, uint32_t cid, bool fVerbose); 113 void vmsvga3dInfoSurfaceWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, uint32_t sid, bool fVerbose, uint32_t cxAscii, bool fInvY); 114 115 116 /* DevVGA-SVGA3d-shared.cpp: */ 117 118 /** 119 * Structure for use with vmsvga3dInfoU32Flags. 120 */ 121 typedef struct VMSVGAINFOFLAGS32 122 { 123 /** The flags. */ 124 uint32_t fFlags; 125 /** The corresponding mnemonic. */ 126 const char *pszJohnny; 127 } VMSVGAINFOFLAGS32; 128 /** Pointer to a read-only flag translation entry. */ 129 typedef VMSVGAINFOFLAGS32 const *PCVMSVGAINFOFLAGS32; 130 void vmsvga3dInfoU32Flags(PCDBGFINFOHLP pHlp, uint32_t fFlags, const char *pszPrefix, PCVMSVGAINFOFLAGS32 paFlags, uint32_t cFlags); 131 132 /** 133 * Structure for use with vmsvgaFormatEnumValueEx and vmsvgaFormatEnumValue. 134 */ 135 typedef struct VMSVGAINFOENUM 136 { 137 /** The enum value. */ 138 int32_t iValue; 139 /** The corresponding value name. */ 140 const char *pszName; 141 } VMSVGAINFOENUM; 142 /** Pointer to a read-only enum value translation entry. */ 143 typedef VMSVGAINFOENUM const *PCVMSVGAINFOENUM; 144 char *vmsvgaFormatEnumValueEx(char *pszBuffer, size_t cbBuffer, const char *pszName, int32_t iValue, 145 const char *pszPrefix, PCVMSVGAINFOENUM paValues, size_t cValues); 146 char *vmsvgaFormatEnumValue(char *pszBuffer, size_t cbBuffer, const char *pszName, uint32_t uValue, 147 const char *pszPrefix, const char * const *papszValues, size_t cValues); 148 149 /** 150 * ASCII "art" scanline printer callback. 151 * 152 * @param pszLine The line to output. 153 * @param pvUser The user argument. 154 */ 155 typedef DECLCALLBACK(void) FMVMSVGAASCIIPRINTLN(const char *pszLine, void *pvUser); 156 /** Pointer to an ASCII "art" print line callback. */ 157 typedef FMVMSVGAASCIIPRINTLN *PFMVMSVGAASCIIPRINTLN; 158 void vmsvga3dAsciiPrint(PFMVMSVGAASCIIPRINTLN pfnPrintLine, void *pvUser, void const *pvImage, size_t cbImage, 159 uint32_t cx, uint32_t cy, uint32_t cbScanline, SVGA3dSurfaceFormat enmFormat, bool fInvY, 160 uint32_t cchMaxX, uint32_t cchMaxY); 161 DECLCALLBACK(void) vmsvga3dAsciiPrintlnInfo(const char *pszLine, void *pvUser); 162 DECLCALLBACK(void) vmsvga3dAsciiPrintlnLog(const char *pszLine, void *pvUser); 163 164 char *vmsvga3dFormatRenderState(char *pszBuffer, size_t cbBuffer, SVGA3dRenderState const *pRenderState); 165 char *vmsvga3dFormatTextureState(char *pszBuffer, size_t cbBuffer, SVGA3dTextureState const *pTextureState); 166 void vmsvga3dInfoHostWindow(PCDBGFINFOHLP pHlp, uint64_t idHostWindow); 95 167 96 168 uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format); -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r57011 r57081 214 214 #ifdef VBOX_WITH_VMSVGA 215 215 216 #define VMSVGA_FIFO_EXTCMD_NONE 0 217 #define VMSVGA_FIFO_EXTCMD_TERMINATE 1 218 #define VMSVGA_FIFO_EXTCMD_SAVESTATE 2 219 #define VMSVGA_FIFO_EXTCMD_LOADSTATE 3 220 #define VMSVGA_FIFO_EXTCMD_RESET 4 216 #define VMSVGA_FIFO_EXTCMD_NONE 0 217 #define VMSVGA_FIFO_EXTCMD_TERMINATE 1 218 #define VMSVGA_FIFO_EXTCMD_SAVESTATE 2 219 #define VMSVGA_FIFO_EXTCMD_LOADSTATE 3 220 #define VMSVGA_FIFO_EXTCMD_RESET 4 221 #define VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS 5 221 222 222 223 /** Size of the region to backup when switching into svga mode. */ … … 230 231 } VMSVGA_STATE_LOAD, *PVMSVGA_STATE_LOAD; 231 232 232 typedef struct 233 /** Pointer to the private VMSVGA ring-3 state structure. 234 * @todo Still not entirely satisfired with the type name, but better than 235 * the previous lower/upper case only distinction. */ 236 typedef struct VMSVGAR3STATE *PVMSVGAR3STATE; 237 /** Pointer to the private (implementation specific) VMSVGA3d state. */ 238 typedef struct VMSVGA3DSTATE *PVMSVGA3DSTATE; 239 240 typedef struct VMSVGAState 233 241 { 234 242 /** The host window handle */ … … 239 247 R0PTRTYPE(uint32_t *) pFIFOR0; 240 248 /** R3 Opaque pointer to svga state. */ 241 R3PTRTYPE( void *) pSVGAState;249 R3PTRTYPE(PVMSVGAR3STATE) pSvgaR3State; 242 250 /** R3 Opaque pointer to 3d state. */ 243 R3PTRTYPE( void *)p3dState;251 R3PTRTYPE(PVMSVGA3DSTATE) p3dState; 244 252 /** R3 Opaque pointer to a copy of the first 32k of the framebuffer before switching into svga mode. */ 245 253 R3PTRTYPE(void *) pFrameBufferBackup; -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r56405 r57081 334 334 GEN_CHECK_OFF(VGASTATE, svga.pFIFOR3); 335 335 GEN_CHECK_OFF(VGASTATE, svga.pFIFOR0); 336 GEN_CHECK_OFF(VGASTATE, svga.pS VGAState);336 GEN_CHECK_OFF(VGASTATE, svga.pSvgaR3State); 337 337 GEN_CHECK_OFF(VGASTATE, svga.p3dState); 338 338 GEN_CHECK_OFF(VGASTATE, svga.pFrameBufferBackup);
Note:
See TracChangeset
for help on using the changeset viewer.