Changeset 50848 in vbox
- Timestamp:
- Mar 24, 2014 10:15:41 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxVideoHost3D.h
r50831 r50848 28 28 #include <iprt/cdefs.h> 29 29 #include <VBox/VBoxVideo.h> 30 #include <VBox/hgcmsvc.h> 30 31 31 32 /* screen update instance */ … … 112 113 void(*pfnInternal)(); 113 114 void* pvInternal; 114 } ;115 } u; 115 116 } VBOXCRCMDCTL; 117 118 typedef struct VBOXCRCMDCTL_HGCM 119 { 120 VBOXCRCMDCTL Hdr; 121 VBOXHGCMSVCPARM aParms[1]; 122 } VBOXCRCMDCTL_HGCM; 116 123 117 124 typedef struct VBOXVDMAHOST * HVBOXCRCMDCTL_REMAINING_HOST_COMMAND; -
trunk/include/VBox/vmm/pdmifs.h
r50763 r50848 3076 3076 PFNCRCTLCOMPLETION pfnCompletion, 3077 3077 void *pvCompletion)); 3078 3079 DECLR3CALLBACKMEMBER(int, pfnCrCtlSubmitSync, (PPDMIDISPLAYVBVACALLBACKS pInterface, 3080 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)); 3078 3081 } PDMIDISPLAYVBVACALLBACKS; 3079 3082 /** PDMIDISPLAYVBVACALLBACKS */ 3080 #define PDMIDISPLAYVBVACALLBACKS_IID " b78b81d2-c821-4e66-96ff-dbafa76343a5"3083 #define PDMIDISPLAYVBVACALLBACKS_IID "193b2975-215f-480a-abef-42f029ae890f" 3081 3084 3082 3085 /** Pointer to a PCI raw connector interface. */ -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r50804 r50848 5955 5955 #endif 5956 5956 pThis->IVBVACallbacks.pfnCrCtlSubmit = vboxCmdVBVACmdHostCtl; 5957 pThis->IVBVACallbacks.pfnCrCtlSubmitSync = vboxCmdVBVACmdHostCtlSync; 5957 5958 5958 5959 /* -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r50760 r50848 630 630 PFNCRCTLCOMPLETION pfnCompletion, 631 631 void *pvCompletion); 632 int vboxCmdVBVACmdHostCtlSync(PPDMIDISPLAYVBVACALLBACKS pInterface, 633 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd); 632 634 633 635 int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM); -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r50831 r50848 605 605 if ((enmSource == VBVAEXHOSTCTL_SOURCE_HOST_ENABLED) && !VBoxVBVAExHSIsEnabled(pCmdVbva)) 606 606 { 607 WARN(("cmd vbva not enabled\n"));607 Log(("cmd vbva not enabled\n")); 608 608 return VERR_INVALID_STATE; 609 609 } … … 619 619 if ((enmSource == VBVAEXHOSTCTL_SOURCE_HOST_ENABLED) && !VBoxVBVAExHSIsEnabled(pCmdVbva)) 620 620 { 621 WARN(("cmd vbva not enabled\n"));621 Log(("cmd vbva not enabled\n")); 622 622 RTCritSectLeave(&pCmdVbva->CltCritSect); 623 623 return VERR_INVALID_STATE; … … 669 669 VBOXCRCMD_SVRINFO CrSrvInfo; 670 670 VBVAEXHOSTCTL* pCurRemainingHostCtl; 671 RTSEMEVENTMULTI HostCrCtlCompleteEvent; 672 int32_t volatile i32cHostCrCtlCompleted; 671 673 #ifdef VBOX_VDMA_WITH_WATCHDOG 672 674 PTMTIMERR3 WatchDogTimer; … … 2157 2159 pVdma->pVGAState = pVGAState; 2158 2160 2161 rc = RTSemEventMultiCreate(&pVdma->HostCrCtlCompleteEvent); 2162 if (RT_SUCCESS(rc)) 2163 { 2159 2164 #ifdef VBOX_VDMA_WITH_WATCHDOG 2160 rc = PDMDevHlpTMTimerCreate(pVGAState->pDevInsR3, TMCLOCK_REAL, vboxVDMAWatchDogTimer,2161 pVdma, TMTIMER_FLAGS_NO_CRIT_SECT,2162 "VDMA WatchDog Timer", &pVdma->WatchDogTimer);2163 AssertRC(rc);2165 rc = PDMDevHlpTMTimerCreate(pVGAState->pDevInsR3, TMCLOCK_REAL, vboxVDMAWatchDogTimer, 2166 pVdma, TMTIMER_FLAGS_NO_CRIT_SECT, 2167 "VDMA WatchDog Timer", &pVdma->WatchDogTimer); 2168 AssertRC(rc); 2164 2169 #endif 2165 rc = VBoxVBVAExHSInit(&pVdma->CmdVbva); 2166 if (RT_SUCCESS(rc)) 2167 { 2168 rc = VBoxVDMAThreadCreate(&pVdma->Thread, vboxVDMAWorkerThread, pVdma); 2170 rc = VBoxVBVAExHSInit(&pVdma->CmdVbva); 2169 2171 if (RT_SUCCESS(rc)) 2170 2172 { 2171 pVGAState->pVdma = pVdma; 2173 rc = VBoxVDMAThreadCreate(&pVdma->Thread, vboxVDMAWorkerThread, pVdma); 2174 if (RT_SUCCESS(rc)) 2175 { 2176 pVGAState->pVdma = pVdma; 2172 2177 #ifdef VBOX_WITH_CRHGSMI 2173 int rcIgnored = vboxVDMACrCtlHgsmiSetup(pVdma); NOREF(rcIgnored); /** @todo is this ignoring intentional? */2178 int rcIgnored = vboxVDMACrCtlHgsmiSetup(pVdma); NOREF(rcIgnored); /** @todo is this ignoring intentional? */ 2174 2179 #endif 2175 return VINF_SUCCESS; 2180 return VINF_SUCCESS; 2181 } 2182 else 2183 WARN(("VBoxVDMAThreadCreate faile %d\n", rc)); 2184 2185 VBoxVBVAExHSTerm(&pVdma->CmdVbva); 2176 2186 } 2177 2187 else 2178 WARN(("VBoxV DMAThreadCreate faile%d\n", rc));2179 2180 VBoxVBVAExHSTerm(&pVdma->CmdVbva);2188 WARN(("VBoxVBVAExHSInit failed %d\n", rc)); 2189 2190 RTSemEventMultiDestroy(pVdma->HostCrCtlCompleteEvent); 2181 2191 } 2182 2192 else 2183 WARN(("VBoxVBVAExHSInit faile %d\n", rc)); 2193 WARN(("RTSemEventMultiCreate failed %d\n", rc)); 2194 2184 2195 2185 2196 RTMemFree(pVdma); … … 2216 2227 VBoxVDMAThreadTerm(&pVdma->Thread); 2217 2228 VBoxVBVAExHSTerm(&pVdma->CmdVbva); 2229 RTSemEventMultiDestroy(pVdma->HostCrCtlCompleteEvent); 2218 2230 RTMemFree(pVdma); 2219 2231 return VINF_SUCCESS; … … 2393 2405 } 2394 2406 else 2395 WARN(("VBoxVBVAExHCtlSubmit failed %d\n", rc));2407 Log(("VBoxVBVAExHCtlSubmit failed %d\n", rc)); 2396 2408 2397 2409 return rc; … … 2426 2438 if (!RT_SUCCESS(rc)) 2427 2439 { 2428 WARN(("vdmaVBVACtlSubmit failed rc %d\n", rc));2440 Log(("vdmaVBVACtlSubmit failed rc %d\n", rc)); 2429 2441 return rc;; 2430 2442 } … … 2450 2462 { 2451 2463 VBOXCRCMDCTL* pVboxCtl = (VBOXCRCMDCTL*)pCtl->u.cmd.pu8Cmd; 2452 if (pVboxCtl-> pfnInternal)2453 ((PFNCRCTLCOMPLETION)pVboxCtl-> pfnInternal)(pVboxCtl, pCtl->u.cmd.cbCmd, rc, pvCompletion);2464 if (pVboxCtl->u.pfnInternal) 2465 ((PFNCRCTLCOMPLETION)pVboxCtl->u.pfnInternal)(pVboxCtl, pCtl->u.cmd.cbCmd, rc, pvCompletion); 2454 2466 VBoxVBVAExHCtlFree(pVbva, pCtl); 2455 2467 } … … 2459 2471 void *pvCompletion) 2460 2472 { 2461 pCmd-> pfnInternal = (void(*)())pfnCompletion;2473 pCmd->u.pfnInternal = (void(*)())pfnCompletion; 2462 2474 int rc = vdmaVBVACtlOpaqueSubmit(pVdma, VBVAEXHOSTCTL_SOURCE_HOST_ENABLED, (uint8_t*)pCmd, cbCmd, vboxCmdVBVACmdCtlHostCompletion, pvCompletion); 2463 2475 if (!RT_SUCCESS(rc)) … … 2465 2477 if (rc == VERR_INVALID_STATE) 2466 2478 { 2467 pCmd-> pfnInternal = NULL;2479 pCmd->u.pfnInternal = NULL; 2468 2480 PVGASTATE pVGAState = pVdma->pVGAState; 2469 2481 rc = pVGAState->pDrv->pfnCrHgcmCtlSubmit(pVGAState->pDrv, pCmd, cbCmd, pfnCompletion, pvCompletion); … … 2597 2609 } 2598 2610 2611 typedef struct VBOXCMDVBVA_CMDHOSTCTL_SYNC 2612 { 2613 struct VBOXVDMAHOST *pVdma; 2614 uint32_t fProcessing; 2615 int rc; 2616 } VBOXCMDVBVA_CMDHOSTCTL_SYNC; 2617 2618 static DECLCALLBACK(void) vboxCmdVBVACmdHostCtlSyncCb(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion) 2619 { 2620 VBOXCMDVBVA_CMDHOSTCTL_SYNC *pData = (VBOXCMDVBVA_CMDHOSTCTL_SYNC*)pvCompletion; 2621 2622 pData->rc = rc; 2623 pData->fProcessing = 0; 2624 2625 struct VBOXVDMAHOST *pVdma = pData->pVdma; 2626 2627 ASMAtomicIncS32(&pVdma->i32cHostCrCtlCompleted); 2628 2629 RTSemEventMultiSignal(pVdma->HostCrCtlCompleteEvent); 2630 } 2631 2632 int vboxCmdVBVACmdHostCtlSync(PPDMIDISPLAYVBVACALLBACKS pInterface, 2633 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd) 2634 { 2635 PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface); 2636 struct VBOXVDMAHOST *pVdma = pVGAState->pVdma; 2637 VBOXCMDVBVA_CMDHOSTCTL_SYNC Data; 2638 Data.pVdma = pVdma; 2639 Data.fProcessing = 1; 2640 Data.rc = VERR_INTERNAL_ERROR; 2641 int rc = vdmaVBVACtlOpaqueHostSubmit(pVdma, pCmd, cbCmd, vboxCmdVBVACmdHostCtlSyncCb, &Data); 2642 if (!RT_SUCCESS(rc)) 2643 { 2644 WARN(("vdmaVBVACtlOpaqueHostSubmit failed %d", rc)); 2645 return rc; 2646 } 2647 2648 while (Data.fProcessing) 2649 { 2650 /* Poll infrequently to make sure no completed message has been missed. */ 2651 RTSemEventMultiWait(pVdma->HostCrCtlCompleteEvent, 500); 2652 2653 if (Data.fProcessing) 2654 RTThreadYield(); 2655 } 2656 2657 /* 'Our' message has been processed, so should reset the semaphore. 2658 * There is still possible that another message has been processed 2659 * and the semaphore has been signalled again. 2660 * Reset only if there are no other messages completed. 2661 */ 2662 int32_t c = ASMAtomicDecS32(&pVdma->i32cHostCrCtlCompleted); 2663 Assert(c >= 0); 2664 if (!c) 2665 RTSemEventMultiReset(pVdma->HostCrCtlCompleteEvent); 2666 2667 rc = Data.rc; 2668 if (!RT_SUCCESS(rc)) 2669 WARN(("host call failed %d", rc)); 2670 2671 return rc; 2672 } 2673 2599 2674 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl) 2600 2675 { -
trunk/src/VBox/Main/include/DisplayImpl.h
r50828 r50848 26 26 #include <VBox/VMMDev.h> 27 27 #include <VBox/VBoxVideo.h> 28 #include <VBox/vmm/pdmifs.h> 28 29 29 30 #ifdef VBOX_WITH_CROGL … … 168 169 #endif 169 170 #ifdef VBOX_WITH_CRHGSMI 171 void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam); 172 void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam); 170 173 void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd); 171 174 void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl); 172 173 void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);174 void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);175 175 #endif 176 176 int handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, … … 178 178 void *pvCompletion); 179 179 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 180 void handleCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);181 180 void handleCrVRecScreenshotPerform(uint32_t uScreen, 182 181 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel, … … 298 297 299 298 static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 300 static DECLCALLBACK(void) displayCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 301 #endif 299 #endif 300 static DECLCALLBACK(void) displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion); 302 301 303 302 static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser); … … 350 349 volatile uint32_t mfCrOglVideoRecState; 351 350 CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData; 351 VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl; 352 352 #endif 353 353 … … 374 374 #endif 375 375 376 int crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion); 377 int crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd); 378 376 379 private: 377 380 static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll); -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r50686 r50848 2131 2131 } 2132 2132 2133 VBOXHGCMSVCPARM parm; 2134 2135 parm.type = VBOX_HGCM_SVC_PARM_PTR; 2136 parm.u.pointer.addr = &outputRedirect; 2137 parm.u.pointer.size = sizeof(outputRedirect); 2138 2139 VMMDev *pVMMDev = mConsole->getVMMDev(); 2140 2141 if (!pVMMDev) 2142 { 2143 AssertMsgFailed(("remote3DRedirect no vmmdev\n")); 2144 return; 2145 } 2146 2147 int rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", 2148 SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT, 2149 SHCRGL_CPARMS_SET_OUTPUT_REDIRECT, 2150 &parm); 2151 2133 VBOXCRCMDCTL_HGCM data; 2134 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 2135 data.Hdr.u32Function = SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT; 2136 2137 data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 2138 data.aParms[0].u.pointer.addr = &outputRedirect; 2139 data.aParms[0].u.pointer.size = sizeof(outputRedirect); 2140 2141 int rc = mConsole->getDisplay()->crCtlSubmitSync(&data.Hdr, sizeof (data)); 2152 2142 if (!RT_SUCCESS(rc)) 2153 2143 { … … 2157 2147 2158 2148 LogRel(("VRDE: %s 3D redirect.\n", fEnable? "Enabled": "Disabled")); 2149 #ifdef DEBUG_misha 2150 AssertFailed(); 2151 #endif 2159 2152 2160 2153 return; -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r50828 r50848 338 338 pScreenshot->Base.pfnScreenshotEnd = NULL; 339 339 340 VBOXHGCMSVCPARM parm; 341 342 parm.type = VBOX_HGCM_SVC_PARM_PTR; 343 parm.u.pointer.addr = &pScreenshot->Base; 344 parm.u.pointer.size = sizeof (pScreenshot->Base); 345 346 int rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_TAKE_SCREENSHOT, 1, &parm); 340 VBOXCRCMDCTL_HGCM data; 341 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 342 data.Hdr.u32Function = SHCRGL_HOST_FN_TAKE_SCREENSHOT; 343 344 data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 345 data.aParms[0].u.pointer.addr = &pScreenshot->Base; 346 data.aParms[0].u.pointer.size = sizeof (pScreenshot->Base); 347 348 int rc = that->crCtlSubmitSync(&data.Hdr, sizeof (data)); 347 349 if (RT_SUCCESS(rc)) 348 350 { … … 723 725 } 724 726 727 DECLCALLBACK(void) Display::displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion) 728 { 729 Assert(pvCompletion); 730 RTMemFree(pvCompletion); 731 } 732 725 733 #ifdef VBOX_WITH_CROGL 726 734 int Display::crOglWindowsShow(bool fShow) … … 747 755 } 748 756 749 VBOXHGCMSVCPARM parm; 750 751 parm.type = VBOX_HGCM_SVC_PARM_32BIT; 752 parm.u.uint32 = (uint32_t)fShow; 753 754 int rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_WINDOWS_SHOW, &parm, NULL, NULL); 757 VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof (VBOXCRCMDCTL_HGCM)); 758 if (!pData) 759 { 760 AssertMsgFailed(("RTMemAlloc failed\n")); 761 return VERR_NO_MEMORY; 762 } 763 764 pData->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 765 pData->Hdr.u32Function = SHCRGL_HOST_FN_WINDOWS_SHOW; 766 767 pData->aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 768 pData->aParms[0].u.uint32 = (uint32_t)fShow; 769 770 int rc = crCtlSubmit(&pData->Hdr, sizeof (*pData), displayCrCmdFree, pData); 755 771 if (RT_SUCCESS(rc)) 756 772 mfCrOglDataHidden = !fShow; 757 773 else 758 AssertMsgFailed(("hgcmHostFastCallAsync failed rc %n", rc)); 774 { 775 AssertMsgFailed(("crCtlSubmit failed rc %n", rc)); 776 RTMemFree(pData); 777 } 759 778 760 779 return rc; … … 850 869 if (pVMMDev) 851 870 { 852 CRVBOXHGCMDEVRESIZE *pData = (CRVBOXHGCMDEVRESIZE*)RTMemAlloc(sizeof (*pData));853 if (p Data)871 VBOXCRCMDCTL_HGCM *pCtl = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof (CRVBOXHGCMDEVRESIZE) + sizeof (VBOXCRCMDCTL_HGCM)); 872 if (pCtl) 854 873 { 874 CRVBOXHGCMDEVRESIZE *pData = (CRVBOXHGCMDEVRESIZE*)(pCtl+1); 855 875 pData->Screen = *pScreen; 856 876 pData->pvVRAM = pvVRAM; 857 877 858 VBOXHGCMSVCPARM parm; 859 860 parm.type = VBOX_HGCM_SVC_PARM_PTR; 861 parm.u.pointer.addr = pData; 862 parm.u.pointer.size = sizeof (*pData); 863 864 rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_DEV_RESIZE, &parm, displayCrAsyncCmdCompletion, this); 865 AssertRC(rc); 878 pCtl->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 879 pCtl->Hdr.u32Function = SHCRGL_HOST_FN_DEV_RESIZE; 880 pCtl->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 881 pCtl->aParms[0].u.pointer.addr = pData; 882 pCtl->aParms[0].u.pointer.size = sizeof (*pData); 883 884 rc = crCtlSubmit(&pCtl->Hdr, sizeof (*pCtl), displayCrCmdFree, pCtl); 885 if (!RT_SUCCESS(rc)) 886 { 887 AssertMsgFailed(("crCtlSubmit failed rc %n", rc)); 888 RTMemFree(pCtl); 889 } 866 890 } 867 891 else … … 1113 1137 if (is3denabled) 1114 1138 { 1115 VBOXHGCMSVCPARM parm; 1116 1117 parm.type = VBOX_HGCM_SVC_PARM_32BIT; 1118 parm.u.uint32 = uScreenId; 1119 1120 VMMDev *pVMMDev = mParent->getVMMDev(); 1121 if (pVMMDev) 1122 { 1123 #if 0 1124 if (mhCrOglSvc) 1125 pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_SCREEN_CHANGED, &parm, NULL, NULL); 1126 else 1127 AssertMsgFailed(("mhCrOglSvc is NULL\n")); 1128 #else 1129 pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SCREEN_CHANGED, SHCRGL_CPARMS_SCREEN_CHANGED, &parm); 1130 #endif 1131 } 1139 VBOXCRCMDCTL_HGCM data; 1140 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 1141 data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED; 1142 1143 data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 1144 data.aParms[0].u.uint32 = uScreenId; 1145 1146 crCtlSubmitSync(&data.Hdr, sizeof (data)); 1132 1147 } 1133 1148 } … … 1447 1462 if (mhCrOglSvc) 1448 1463 { 1449 RTRECT *pRectsCopy = (RTRECT *)RTMemAlloc( RT_MAX(cRect, 1)1450 * sizeof (RTRECT));1451 if (p RectsCopy)1464 VBOXCRCMDCTL_HGCM *pCtl = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(RT_MAX(cRect, 1) * sizeof (RTRECT) 1465 + sizeof (VBOXCRCMDCTL_HGCM)); 1466 if (pCtl) 1452 1467 { 1468 RTRECT *pRectsCopy = (RTRECT*)(pCtl+1); 1453 1469 memcpy(pRectsCopy, pRect, cRect * sizeof (RTRECT)); 1454 1470 1455 VBOXHGCMSVCPARM parm; 1456 1457 parm.type = VBOX_HGCM_SVC_PARM_PTR; 1458 parm.u.pointer.addr = pRectsCopy; 1459 parm.u.pointer.size = cRect * sizeof (RTRECT); 1460 1461 vmmDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_SET_VISIBLE_REGION, &parm, displayCrAsyncCmdCompletion, this); 1471 pCtl->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 1472 pCtl->Hdr.u32Function = SHCRGL_HOST_FN_SET_VISIBLE_REGION; 1473 1474 pCtl->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 1475 pCtl->aParms[0].u.pointer.addr = pRectsCopy; 1476 pCtl->aParms[0].u.pointer.size = cRect * sizeof (RTRECT); 1477 1478 int rc = crCtlSubmit(&pCtl->Hdr, sizeof (*pCtl), displayCrCmdFree, pCtl); 1479 if (!RT_SUCCESS(rc)) 1480 { 1481 AssertMsgFailed(("crCtlSubmit failed rc %n", rc)); 1482 RTMemFree(pCtl); 1483 } 1462 1484 } 1463 1485 else … … 2410 2432 if (is3denabled) 2411 2433 { 2412 VBOX HGCMSVCPARM parm;2413 2414 parm.type = VBOX_HGCM_SVC_PARM_32BIT;2415 parm.u.uint32 = aScreenId; 2416 2417 VMMDev *pVMMDev = mParent->getVMMDev();2434 VBOXCRCMDCTL_HGCM data; 2435 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 2436 data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED; 2437 2438 data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 2439 data.aParms[0].u.uint32 = aScreenId; 2418 2440 2419 2441 alock.release(); 2420 2442 2421 if (pVMMDev) 2422 { 2423 #if 0 2424 if (mhCrOglSvc) 2425 pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_SCREEN_CHANGED, &parm, NULL, NULL); 2426 else 2427 AssertMsgFailed(("mhCrOglSvc is NULL\n")); 2428 #else 2429 pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SCREEN_CHANGED, SHCRGL_CPARMS_SCREEN_CHANGED, &parm); 2430 #endif 2431 } 2432 /*ComAssertRCRet (vrc, E_FAIL);*/ 2443 crCtlSubmitSync(&data.Hdr, sizeof (data)); 2433 2444 2434 2445 alock.acquire(); … … 2560 2571 if (is3denabled && vmmDev) 2561 2572 { 2562 VBOXHGCMSVCPARM parm; 2563 2564 parm.type = VBOX_HGCM_SVC_PARM_PTR; 2565 /* NULL means disable */ 2566 parm.u.pointer.addr = NULL; 2567 parm.u.pointer.size = 0; /* <- means null rects, NULL pRects address and 0 rects means "disable" */ 2568 2569 if (mhCrOglSvc) 2570 vmmDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_SET_VISIBLE_REGION, &parm, NULL, NULL); 2571 else 2572 AssertMsgFailed(("mhCrOglSvc is NULL\n")); 2573 2573 VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof (VBOXCRCMDCTL_HGCM)); 2574 if (!pData) 2575 { 2576 AssertMsgFailed(("RTMemAlloc failed\n")); 2577 return VERR_NO_MEMORY; 2578 } 2579 2580 pData->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 2581 pData->Hdr.u32Function = SHCRGL_HOST_FN_SET_VISIBLE_REGION; 2582 2583 pData->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 2584 pData->aParms[0].u.pointer.addr = NULL; 2585 pData->aParms[0].u.pointer.size = 0; /* <- means null rects, NULL pRects address and 0 rects means "disable" */ 2586 2587 int rc = crCtlSubmit(&pData->Hdr, sizeof (*pData), displayCrCmdFree, pData); 2588 if (!RT_SUCCESS(rc)) 2589 { 2590 AssertMsgFailed(("crCtlSubmit failed rc %n", rc)); 2591 RTMemFree(pData); 2592 } 2574 2593 } 2575 2594 } … … 2602 2621 pScreenshot->pfnScreenshotEnd = NULL; 2603 2622 2604 VBOXHGCMSVCPARM parm; 2605 2606 parm.type = VBOX_HGCM_SVC_PARM_PTR; 2607 parm.u.pointer.addr = pScreenshot; 2608 parm.u.pointer.size = sizeof (*pScreenshot); 2609 2610 int rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_TAKE_SCREENSHOT, 1, &parm); 2623 VBOXCRCMDCTL_HGCM data; 2624 data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 2625 data.Hdr.u32Function = SHCRGL_HOST_FN_TAKE_SCREENSHOT; 2626 2627 data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 2628 data.aParms[0].u.pointer.addr = pScreenshot; 2629 data.aParms[0].u.pointer.size = sizeof (*pScreenshot); 2630 2631 int rc = pDisplay->crCtlSubmitSync(&data.Hdr, sizeof (data)); 2611 2632 2612 2633 RTMemFree(pScreenshot); … … 3590 3611 void Display::crViewportNotify(VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height) 3591 3612 { 3592 #if 0 3593 VBOXHGCMSVCPARM parm; 3594 3595 CRVBOXHGCMVIEWPORT *pViewportInfo = (CRVBOXHGCMVIEWPORT*)RTMemAlloc(sizeof (*pViewportInfo)); 3596 if(!pViewportInfo) 3597 { 3598 AssertMsgFailed(("RTMemAlloc failed!\n")); 3599 return; 3600 } 3601 3602 pViewportInfo->u32Screen = aScreenId; 3603 pViewportInfo->x = x; 3604 pViewportInfo->y = y; 3605 pViewportInfo->width = width; 3606 pViewportInfo->height = height; 3607 3608 parm.type = VBOX_HGCM_SVC_PARM_PTR; 3609 parm.u.pointer.addr = pViewportInfo; 3610 parm.u.pointer.size = sizeof (*pViewportInfo); 3611 3612 pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_VIEWPORT_CHANGED2, &parm, displayCrAsyncCmdCompletion, this); 3613 #else 3614 VBOXHGCMSVCPARM aParms[5]; 3615 3616 aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 3617 aParms[0].u.uint32 = aScreenId; 3618 3619 aParms[1].type = VBOX_HGCM_SVC_PARM_32BIT; 3620 aParms[1].u.uint32 = x; 3621 3622 aParms[2].type = VBOX_HGCM_SVC_PARM_32BIT; 3623 aParms[2].u.uint32 = y; 3624 3625 3626 aParms[3].type = VBOX_HGCM_SVC_PARM_32BIT; 3627 aParms[3].u.uint32 = width; 3628 3629 aParms[4].type = VBOX_HGCM_SVC_PARM_32BIT; 3630 aParms[4].u.uint32 = height; 3631 3632 pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_VIEWPORT_CHANGED, SHCRGL_CPARMS_VIEWPORT_CHANGED, aParms); 3633 #endif 3613 struct { 3614 VBOXCRCMDCTL_HGCM data; 3615 VBOXHGCMSVCPARM aParms[4]; 3616 } s; 3617 3618 s.data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 3619 s.data.Hdr.u32Function = SHCRGL_HOST_FN_VIEWPORT_CHANGED; 3620 3621 s.data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT; 3622 s.data.aParms[0].u.uint32 = aScreenId; 3623 3624 s.data.aParms[1].type = VBOX_HGCM_SVC_PARM_32BIT; 3625 s.data.aParms[1].u.uint32 = x; 3626 3627 s.data.aParms[2].type = VBOX_HGCM_SVC_PARM_32BIT; 3628 s.data.aParms[2].u.uint32 = y; 3629 3630 s.data.aParms[3].type = VBOX_HGCM_SVC_PARM_32BIT; 3631 s.data.aParms[3].u.uint32 = width; 3632 3633 s.data.aParms[4].type = VBOX_HGCM_SVC_PARM_32BIT; 3634 s.data.aParms[4].u.uint32 = height; 3635 3636 crCtlSubmitSync(&s.data.Hdr, RT_OFFSETOF(VBOXCRCMDCTL_HGCM, aParms[5])); 3634 3637 } 3635 3638 #endif … … 3662 3665 if (RT_SUCCESS(rc)) 3663 3666 { 3664 ULONG ul;3665 3666 for (ul = 0; ul < mcMonitors; ul++)3667 {3668 DISPLAYFBINFO *pFb = &maFramebuffers[ul];3669 if (!pFb->pendingViewportInfo.fPending)3670 continue;3671 3672 crViewportNotify(pVMMDev, ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y, pFb->pendingViewportInfo.width, pFb->pendingViewportInfo.height);3673 pFb->pendingViewportInfo.fPending = false;3674 }3675 3676 3667 mCrOglCallbacks = Completion.MainInterface; 3677 3668 … … 3913 3904 { 3914 3905 /* submit */ 3915 3916 VBOXHGCMSVCPARM parm; 3917 3918 parm.type = VBOX_HGCM_SVC_PARM_PTR; 3919 parm.u.pointer.addr = &pDisplay->mCrOglScreenshotData; 3920 parm.u.pointer.size = sizeof (pDisplay->mCrOglScreenshotData); 3921 3922 VMMDev *pVMMDev = pDisplay->mParent->getVMMDev(); 3923 if (pVMMDev) 3924 { 3925 int rc = pVMMDev->hgcmHostFastCallAsync(pDisplay->mhCrOglSvc, SHCRGL_HOST_FN_TAKE_SCREENSHOT, &parm, displayVRecCompletion, pDisplay); 3926 if (RT_SUCCESS(rc)) 3927 break; 3928 else 3929 AssertMsgFailed(("hgcmHostFastCallAsync failed %f\n", rc)); 3930 } 3931 else 3932 AssertMsgFailed(("no VMMDev\n")); 3906 VBOXCRCMDCTL_HGCM *pData = &pDisplay->mCrOglScreenshotCtl; 3907 3908 pData->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; 3909 pData->Hdr.u32Function = SHCRGL_HOST_FN_TAKE_SCREENSHOT; 3910 3911 pData->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR; 3912 pData->aParms[0].u.pointer.addr = &pDisplay->mCrOglScreenshotData; 3913 pData->aParms[0].u.pointer.size = sizeof (pDisplay->mCrOglScreenshotData); 3914 int rc = pDisplay->crCtlSubmit(&pData->Hdr, sizeof (*pData), displayCrCmdFree, pData); 3915 if (!RT_SUCCESS(rc)) 3916 AssertMsgFailed(("crCtlSubmit failed rc %n", rc)); 3933 3917 } 3934 3918 … … 4305 4289 void Display::handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam) 4306 4290 { 4307 mpDrv->pVBVACallbacks->pfnCrHgsmiControlCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVDMACMD_CHROMIUM_CTL)pParam->u.pointer.addr, result); 4291 PVBOXVDMACMD_CHROMIUM_CTL pCtl = (PVBOXVDMACMD_CHROMIUM_CTL)pParam->u.pointer.addr; 4292 mpDrv->pVBVACallbacks->pfnCrHgsmiControlCompleteAsync(mpDrv->pVBVACallbacks, pCtl, result); 4308 4293 } 4309 4294 … … 4349 4334 if (pVMMDev) 4350 4335 { 4336 bool fCheckPendingViewport = (pCtl->enmType == VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP); 4351 4337 rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm, Display::displayCrHgsmiControlCompletion, this); 4352 4338 AssertRC(rc); 4353 4339 if (RT_SUCCESS(rc)) 4340 { 4341 if (fCheckPendingViewport) 4342 { 4343 ULONG ul; 4344 for (ul = 0; ul < mcMonitors; ul++) 4345 { 4346 DISPLAYFBINFO *pFb = &maFramebuffers[ul]; 4347 if (!pFb->pendingViewportInfo.fPending) 4348 continue; 4349 4350 crViewportNotify(pVMMDev, ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y, pFb->pendingViewportInfo.width, pFb->pendingViewportInfo.height); 4351 pFb->pendingViewportInfo.fPending = false; 4352 } 4353 } 4354 4354 return; 4355 } 4355 4356 } 4356 4357 else … … 4387 4388 Display *pDisplay = (Display *)pvContext; 4388 4389 pDisplay->handleCrHgsmiControlCompletion(result, u32Function, pParam); 4390 4389 4391 } 4390 4392 #endif … … 4393 4395 { 4394 4396 VBOXCRCMDCTL *pCmd = (VBOXCRCMDCTL*)pParam->u.pointer.addr; 4395 if (pCmd-> pfnInternal)4396 ((PFNCRCTLCOMPLETION)pCmd-> pfnInternal)(pCmd, pParam->u.pointer.size, result, pvContext);4397 if (pCmd->u.pfnInternal) 4398 ((PFNCRCTLCOMPLETION)pCmd->u.pfnInternal)(pCmd, pParam->u.pointer.size, result, pvContext); 4397 4399 } 4398 4400 … … 4414 4416 parm.u.pointer.size = cbCmd; 4415 4417 4416 pCmd-> pfnInternal = (void(*)())pfnCompletion;4418 pCmd->u.pfnInternal = (void(*)())pfnCompletion; 4417 4419 int rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CTL, &parm, displayCrHgcmCtlSubmitCompletion, pvCompletion); 4418 4420 if (!RT_SUCCESS(rc)) … … 4432 4434 } 4433 4435 4436 int Display::crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion) 4437 { 4438 return mpDrv->pVBVACallbacks->pfnCrCtlSubmit(mpDrv->pVBVACallbacks, pCmd, cbCmd, pfnCompletion, pvCompletion); 4439 } 4440 4441 int Display::crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd) 4442 { 4443 return mpDrv->pVBVACallbacks->pfnCrCtlSubmitSync(mpDrv->pVBVACallbacks, pCmd, cbCmd); 4444 } 4445 4434 4446 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 4435 DECLCALLBACK(void) Display::displayCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext)4436 {4437 Display *pDisplay = (Display *)pvContext;4438 pDisplay->handleCrAsyncCmdCompletion(result, u32Function, pParam);4439 }4440 4441 4442 void Display::handleCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam)4443 {4444 if (pParam->type == VBOX_HGCM_SVC_PARM_PTR && pParam->u.pointer.addr)4445 RTMemFree(pParam->u.pointer.addr);4446 }4447 4448 4447 bool Display::handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp) 4449 4448 {
Note:
See TracChangeset
for help on using the changeset viewer.