- Timestamp:
- Apr 17, 2014 8:36:20 PM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r51081 r51101 14 14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 15 15 */ 16 //#include <VBox/VMMDev.h>16 #include <VBox/VMMDev.h> 17 17 #include <VBox/vmm/pdmdev.h> 18 18 #include <VBox/VBoxVideo.h> … … 107 107 VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE, 108 108 VBVAEXHOSTCTL_TYPE_GHH_ENABLE, 109 VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED, 109 110 VBVAEXHOSTCTL_TYPE_GHH_DISABLE, 110 111 VBVAEXHOSTCTL_TYPE_GH_MIN = VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE, … … 254 255 } 255 256 257 static int VBoxVBVAExHPPause(struct VBVAEXHOSTCONTEXT *pCmdVbva) 258 { 259 if (pCmdVbva->i32EnableState < VBVAEXHOSTCONTEXT_ESTATE_PAUSED) 260 { 261 WARN(("Invalid state\n")); 262 return VERR_INVALID_STATE; 263 } 264 265 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_PAUSED); 266 return VINF_SUCCESS; 267 } 268 269 static int VBoxVBVAExHPResume(struct VBVAEXHOSTCONTEXT *pCmdVbva) 270 { 271 if (pCmdVbva->i32EnableState != VBVAEXHOSTCONTEXT_ESTATE_PAUSED) 272 { 273 WARN(("Invalid state\n")); 274 return VERR_INVALID_STATE; 275 } 276 277 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_ENABLED); 278 return VINF_SUCCESS; 279 } 280 281 256 282 static bool vboxVBVAExHPCheckProcessCtlInternal(struct VBVAEXHOSTCONTEXT *pCmdVbva, VBVAEXHOSTCTL* pCtl) 257 283 { … … 259 285 { 260 286 case VBVAEXHOSTCTL_TYPE_HH_INTERNAL_PAUSE: 261 if (pCmdVbva->i32EnableState > VBVAEXHOSTCONTEXT_ESTATE_PAUSED)262 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_PAUSED);287 { 288 int rc = VBoxVBVAExHPPause(pCmdVbva); 263 289 VBoxVBVAExHPDataCompleteCtl(pCmdVbva, pCtl, VINF_SUCCESS); 264 290 return true; 291 } 265 292 case VBVAEXHOSTCTL_TYPE_HH_INTERNAL_RESUME: 266 if (pCmdVbva->i32EnableState == VBVAEXHOSTCONTEXT_ESTATE_PAUSED)267 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_ENABLED);293 { 294 int rc = VBoxVBVAExHPResume(pCmdVbva); 268 295 VBoxVBVAExHPDataCompleteCtl(pCmdVbva, pCtl, VINF_SUCCESS); 269 296 return true; 297 } 270 298 default: 271 299 return false; … … 1352 1380 static int vboxVDMACrGuestCtlProcess(struct VBOXVDMAHOST *pVdma, VBVAEXHOSTCTL *pCmd) 1353 1381 { 1354 switch (pCmd->enmType) 1382 VBVAEXHOSTCTL_TYPE enmType = pCmd->enmType; 1383 switch (enmType) 1355 1384 { 1356 1385 case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE: … … 1362 1391 return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd); 1363 1392 case VBVAEXHOSTCTL_TYPE_GHH_ENABLE: 1393 case VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED: 1364 1394 { 1365 1395 VBVAENABLE *pEnable = (VBVAENABLE *)pCmd->u.cmd.pu8Cmd; 1366 1396 Assert(pCmd->u.cmd.cbCmd == sizeof (VBVAENABLE)); 1367 1397 uint32_t u32Offset = pEnable->u32Offset; 1368 return vdmaVBVAEnableProcess(pVdma, u32Offset); 1398 int rc = vdmaVBVAEnableProcess(pVdma, u32Offset); 1399 if (!RT_SUCCESS(rc)) 1400 { 1401 WARN(("vdmaVBVAEnableProcess failed %d\n", rc)); 1402 return rc; 1403 } 1404 1405 if (enmType == VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED) 1406 { 1407 rc = VBoxVBVAExHPPause(&pVdma->CmdVbva); 1408 if (!RT_SUCCESS(rc)) 1409 { 1410 WARN(("VBoxVBVAExHPPause failed %d\n", rc)); 1411 return rc; 1412 } 1413 } 1414 1415 return VINF_SUCCESS; 1369 1416 } 1370 1417 case VBVAEXHOSTCTL_TYPE_GHH_DISABLE: … … 2639 2686 } 2640 2687 2641 static int vdmaVBVACtlEnableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)2688 static int vdmaVBVACtlEnableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, bool fPaused, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete) 2642 2689 { 2643 2690 int rc; 2644 VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, VBVAEXHOSTCTL_TYPE_GHH_ENABLE);2691 VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, fPaused ? VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED : VBVAEXHOSTCTL_TYPE_GHH_ENABLE); 2645 2692 if (pHCtl) 2646 2693 { … … 2667 2714 } 2668 2715 2669 static int vdmaVBVACtlEnableSubmitSync(PVBOXVDMAHOST pVdma, uint32_t offVram )2716 static int vdmaVBVACtlEnableSubmitSync(PVBOXVDMAHOST pVdma, uint32_t offVram, bool fPaused) 2670 2717 { 2671 2718 VBVAENABLE Enable = {0}; … … 2682 2729 } 2683 2730 2684 rc = vdmaVBVACtlEnableSubmitInternal(pVdma, &Enable, vdmaVBVACtlSubmitSyncCompletion, &Data);2731 rc = vdmaVBVACtlEnableSubmitInternal(pVdma, &Enable, fPaused, vdmaVBVACtlSubmitSyncCompletion, &Data); 2685 2732 if (RT_SUCCESS(rc)) 2686 2733 { … … 2731 2778 } 2732 2779 2780 static DECLCALLBACK(int) vdmaVBVANotifyEnable(PVGASTATE pVGAState) 2781 { 2782 for (uint32_t i = 0; i < pVGAState->cMonitors; i++) 2783 { 2784 int rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, i, NULL); 2785 if (!RT_SUCCESS(rc)) 2786 { 2787 WARN(("pfnVBVAEnable failed %d\n", rc)); 2788 for (uint32_t j = 0; j < i; j++) 2789 { 2790 pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, j); 2791 } 2792 2793 return rc; 2794 } 2795 } 2796 return VINF_SUCCESS; 2797 } 2798 2799 static DECLCALLBACK(int) vdmaVBVANotifyDisable(PVGASTATE pVGAState) 2800 { 2801 for (uint32_t i = 0; i < pVGAState->cMonitors; i++) 2802 { 2803 pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, i); 2804 } 2805 return VINF_SUCCESS; 2806 } 2807 2808 static DECLCALLBACK(void) vboxCmdVBVACmdCtlGuestEnableDisableCompletion(VBVAEXHOSTCONTEXT *pVbva, struct VBVAEXHOSTCTL *pCtl, int rc, void *pvContext) 2809 { 2810 if (rc == VINF_SUCCESS) 2811 { 2812 /* we need to inform Main about VBVA enable/disable 2813 * main expects notifications to be done from the main thread 2814 * submit it there */ 2815 PVBOXVDMAHOST pVdma = RT_FROM_MEMBER(pVbva, VBOXVDMAHOST, CmdVbva); 2816 PVGASTATE pVGAState = pVdma->pVGAState; 2817 2818 if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva)) 2819 VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyEnable, 1, pVGAState); 2820 else 2821 VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyDisable, 1, pVGAState); 2822 } 2823 2824 vboxCmdVBVACmdCtlGuestCompletion(pVbva, pCtl, rc, pvContext); 2825 } 2826 2733 2827 static int vdmaVBVACtlEnableDisableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete) 2734 2828 { 2735 2829 bool fEnable = ((pEnable->u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_ENABLE); 2736 2830 if (fEnable) 2737 return vdmaVBVACtlEnableSubmitInternal(pVdma, pEnable, pfnComplete, pvComplete);2831 return vdmaVBVACtlEnableSubmitInternal(pVdma, pEnable, false, pfnComplete, pvComplete); 2738 2832 return vdmaVBVACtlDisableSubmitInternal(pVdma, pEnable, pfnComplete, pvComplete); 2739 2833 } … … 2742 2836 { 2743 2837 VBoxSHGSMICommandMarkAsynchCompletion(&pEnable->Hdr); 2744 int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuest Completion, pVdma);2838 int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuestEnableDisableCompletion, pVdma); 2745 2839 if (RT_SUCCESS(rc)) 2746 2840 return VINF_SUCCESS; … … 3071 3165 { 3072 3166 #ifdef VBOX_WITH_CRHGSMI 3073 rc = vdmaVBVACtlEnableSubmitSync(pVdma, u32 );3167 rc = vdmaVBVACtlEnableSubmitSync(pVdma, u32, true); 3074 3168 AssertRCReturn(rc, rc); 3075 3169 3076 rc = vdmaVBVAPause(pVdma); 3077 AssertRCReturn(rc, rc); 3170 Assert(pVdma->CmdVbva.i32State == VBVAEXHOSTCONTEXT_ESTATE_PAUSED); 3171 3172 vdmaVBVANotifyEnable(pVdma->pVGAState); 3078 3173 3079 3174 VBVAEXHOSTCTL HCtl; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r51094 r51101 4772 4772 } 4773 4773 4774 static void crVBoxServerCrCmdBltPrimaryUpdate(const RTRECT *pRects, uint32_t cRects, uint32_t u32PrimaryID)4774 static void crVBoxServerCrCmdBltPrimaryUpdate(const VBVAINFOSCREEN *pScreen, const RTRECT *pRects, uint32_t cRects, uint32_t u32PrimaryID) 4775 4775 { 4776 4776 if (!cRects) … … 4827 4827 if (dirtyRect.xRight - dirtyRect.xLeft) 4828 4828 { 4829 cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u32PrimaryID, dirtyRect.xLeft,dirtyRect.yTop,4829 cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u32PrimaryID, pScreen->i32OriginX + dirtyRect.xLeft, pScreen->i32OriginY + dirtyRect.yTop, 4830 4830 dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop); 4831 4831 } … … 4937 4937 4938 4938 crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects); 4939 4940 return 0; 4939 4941 } 4940 4942 else … … 4956 4958 } 4957 4959 4958 crVBoxServerCrCmdBltPrimaryUpdate( pRects, cRects, u32PrimaryID);4960 crVBoxServerCrCmdBltPrimaryUpdate(CrFbGetScreenInfo(hFb), pRects, cRects, u32PrimaryID); 4959 4961 4960 4962 return 0; … … 5107 5109 5108 5110 crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects); 5111 5112 return 0; 5109 5113 } 5110 5114 else … … 5137 5141 } 5138 5142 5139 crVBoxServerCrCmdBltPrimaryUpdate( pRects, cRects, u32PrimaryID);5143 crVBoxServerCrCmdBltPrimaryUpdate(CrFbGetScreenInfo(hFb), pRects, cRects, u32PrimaryID); 5140 5144 5141 5145 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.