Changeset 50848 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- Mar 24, 2014 10:15:41 AM (11 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note:
See TracChangeset
for help on using the changeset viewer.