VirtualBox

Changeset 51013 in vbox


Ignore:
Timestamp:
Apr 9, 2014 2:00:52 PM (11 years ago)
Author:
vboxsync
Message:

Main/crOpenGL/DevVGA: synchronization, bugfixes, cleanup

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmifs.h

    r50962 r51013  
    30733073     * @param   pCmd                The Video HW Acceleration Command that was
    30743074     *                              completed.
    3075      * @todo r=bird: if async means asynchronous; then
    3076      *                   s/pfnVHWACommandCompleteAsynch/pfnVHWACommandCompleteAsync/;
    3077      *               fi
    3078      */
    3079     DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsynch, (PPDMIDISPLAYVBVACALLBACKS pInterface,
     3075     */
     3076    DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync, (PPDMIDISPLAYVBVACALLBACKS pInterface,
    30803077                                                             PVBOXVHWACMD pCmd));
    30813078
     
    30953092} PDMIDISPLAYVBVACALLBACKS;
    30963093/** PDMIDISPLAYVBVACALLBACKS  */
    3097 #define PDMIDISPLAYVBVACALLBACKS_IID            "193b2975-215f-480a-abef-42f029ae890f"
     3094#define PDMIDISPLAYVBVACALLBACKS_IID            "ddac0bd0-332d-4671-8853-732921a80216"
    30983095
    30993096/** Pointer to a PCI raw connector interface. */
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r51005 r51013  
    59835983#if defined(VBOX_WITH_HGSMI)
    59845984# if defined(VBOX_WITH_VIDEOHWACCEL)
    5985     pThis->IVBVACallbacks.pfnVHWACommandCompleteAsynch = vbvaVHWACommandCompleteAsynch;
     5985    pThis->IVBVACallbacks.pfnVHWACommandCompleteAsync = vbvaVHWACommandCompleteAsync;
    59865986# endif
    59875987#if defined(VBOX_WITH_CRHGSMI)
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r51005 r51013  
    605605
    606606# ifdef VBOX_WITH_VIDEOHWACCEL
    607 int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
     607int vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
    608608int vbvaVHWAConstruct (PVGASTATE pVGAState);
    609609int vbvaVHWAReset (PVGASTATE pVGAState);
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r50940 r51013  
    802802    {
    803803        Assert(pCommand->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH);
    804         vbvaVHWACommandCompleteAsynch(&pVGAState->IVBVACallbacks, pCommand);
     804        vbvaVHWACommandCompleteAsync(&pVGAState->IVBVACallbacks, pCommand);
    805805    }
    806806    else
     
    12411241}
    12421242
    1243 int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)
     1243int vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)
    12441244{
    12451245    int rc;
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r51007 r51013  
    13341334            }
    13351335
    1336             rc = VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, false);
     1336            rc = VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, true);
    13371337            if (RT_FAILURE(rc))
    13381338            {
     
    27522752    }
    27532753    else
    2754         WARN(("vdmaVBVACtlSubmit failed %d\n", rc));
     2754        Log(("vdmaVBVACtlSubmit failed %d\n", rc));
    27552755
    27562756    RTSemEventDestroy(Data.hEvent);
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r50940 r51013  
    244244
    245245#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
    246     void crViewportNotify(class VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
     246    int crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
    247247#endif
    248248
     
    346346    /* for fast host hgcm calls */
    347347    HGCMCVSHANDLE mhCrOglSvc;
     348    RTCRITSECTRW mCrOglLock;
    348349#endif
    349350#ifdef VBOX_WITH_CROGL
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r50963 r51013  
    152152#ifdef VBOX_WITH_CRHGSMI
    153153    mhCrOglSvc = NULL;
     154    rc = RTCritSectRwInit(&mCrOglLock);
     155    AssertRC(rc);
    154156#endif
    155157#ifdef VBOX_WITH_CROGL
     
    182184        RT_ZERO(mSaveSeamlessRectLock);
    183185    }
     186
     187#ifdef VBOX_WITH_CRHGSMI
     188    if (RTCritSectRwIsInitialized (&mCrOglLock))
     189    {
     190        RTCritSectRwDelete (&mCrOglLock);
     191        RT_ZERO(mCrOglLock);
     192    }
     193#endif
    184194    BaseFinalRelease();
    185195}
     
    34863496{
    34873497#ifdef VBOX_WITH_VIDEOHWACCEL
    3488     mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsynch(mpDrv->pVBVACallbacks, (PVBOXVHWACMD)pCommand);
     3498    mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVHWACMD)pCommand);
    34893499    return S_OK;
    34903500#else
     
    35083518    if (is3denabled)
    35093519    {
    3510         VMMDev *pVMMDev = mParent->getVMMDev();
    3511 
    3512         if (pVMMDev)
    3513         {
    3514             crViewportNotify(pVMMDev, aScreenId, x, y, width, height);
    3515         }
    3516         else
     3520        int rc = crViewportNotify(aScreenId, x, y, width, height);
     3521        if (RT_FAILURE(rc))
    35173522        {
    35183523            DISPLAYFBINFO *pFb = &maFramebuffers[aScreenId];
     
    36113616
    36123617#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
    3613 void Display::crViewportNotify(VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
    3614 {
     3618int Display::crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
     3619{
     3620    VMMDev *pVMMDev = mParent->getVMMDev();
     3621    if (!pVMMDev)
     3622        return VERR_INVALID_STATE;
     3623
    36153624    struct {
    36163625        VBOXCRCMDCTL_HGCM data;
     
    36363645    s.data.aParms[4].u.uint32 = height;
    36373646
    3638     crCtlSubmitSync(&s.data.Hdr, RT_OFFSETOF(VBOXCRCMDCTL_HGCM, aParms[5]));
     3647    return crCtlSubmitSync(&s.data.Hdr, RT_OFFSETOF(VBOXCRCMDCTL_HGCM, aParms[5]));
    36393648}
    36403649#endif
     
    36453654    VMMDev *pVMMDev = mParent->getVMMDev();
    36463655    Assert(pVMMDev);
    3647     int rc = VERR_GENERAL_FAILURE;
     3656    int rc = RTCritSectRwEnterExcl(&mCrOglLock);
     3657    AssertRC(rc);
     3658
    36483659    if (pVMMDev)
    36493660        rc = pVMMDev->hgcmHostSvcHandleCreate("VBoxSharedCrOpenGL", &mhCrOglSvc);
     3661    else
     3662        rc = VERR_GENERAL_FAILURE;
    36503663
    36513664    if (RT_SUCCESS(rc))
     
    36663679        rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_CRHGSMI_CTL, 1, &parm);
    36673680        if (RT_SUCCESS(rc))
    3668         {
    36693681            mCrOglCallbacks = Completion.MainInterface;
    3670 
    3671             return;
    3672         }
    3673 
    3674         AssertMsgFailed(("VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_COMPLETION failed rc %d", rc));
    3675     }
    3676 
     3682        else
     3683            AssertMsgFailed(("VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_COMPLETION failed rc %d", rc));
     3684    }
     3685
     3686    if (RT_FAILURE(rc))
     3687        mhCrOglSvc = NULL;
     3688
     3689    RTCritSectRwLeaveExcl(&mCrOglLock);
     3690}
     3691
     3692void Display::destructCrHgsmiData(void)
     3693{
     3694    int rc = RTCritSectRwEnterExcl(&mCrOglLock);
     3695    AssertRC(rc);
    36773696    mhCrOglSvc = NULL;
    3678 }
    3679 
    3680 void Display::destructCrHgsmiData(void)
    3681 {
    3682     mhCrOglSvc = NULL;
     3697    RTCritSectRwLeaveExcl(&mCrOglLock);
    36833698}
    36843699#endif
     
    43504365                            continue;
    43514366
    4352                         crViewportNotify(pVMMDev, ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y, pFb->pendingViewportInfo.width, pFb->pendingViewportInfo.height);
    4353                         pFb->pendingViewportInfo.fPending = false;
     4367                        rc = crViewportNotify(ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y, pFb->pendingViewportInfo.width, pFb->pendingViewportInfo.height);
     4368                        if (RT_SUCCESS(rc))
     4369                            pFb->pendingViewportInfo.fPending = false;
     4370                        else
     4371                        {
     4372                            AssertMsgFailed(("crViewportNotify failed %d\n", rc));
     4373                            rc = VINF_SUCCESS;
     4374                        }
    43544375                    }
    43554376                }
     
    44394460int Display::crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion)
    44404461{
    4441     return mpDrv->pVBVACallbacks->pfnCrCtlSubmit(mpDrv->pVBVACallbacks, pCmd, cbCmd, pfnCompletion, pvCompletion);
     4462    int rc = RTCritSectRwEnterShared(&mCrOglLock);
     4463    if (RT_SUCCESS(rc))
     4464    {
     4465        if (mhCrOglSvc)
     4466            rc = mpDrv->pVBVACallbacks->pfnCrCtlSubmit(mpDrv->pVBVACallbacks, pCmd, cbCmd, pfnCompletion, pvCompletion);
     4467        else
     4468            rc = VERR_NOT_SUPPORTED;
     4469
     4470        RTCritSectRwLeaveShared(&mCrOglLock);
     4471    }
     4472    return rc;
    44424473}
    44434474
    44444475int Display::crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
    44454476{
    4446     return mpDrv->pVBVACallbacks->pfnCrCtlSubmitSync(mpDrv->pVBVACallbacks, pCmd, cbCmd);
     4477    int rc = RTCritSectRwEnterShared(&mCrOglLock);
     4478    if (RT_SUCCESS(rc))
     4479    {
     4480        if (mhCrOglSvc)
     4481            rc = mpDrv->pVBVACallbacks->pfnCrCtlSubmitSync(mpDrv->pVBVACallbacks, pCmd, cbCmd);
     4482        else
     4483            rc = VERR_NOT_SUPPORTED;
     4484
     4485        RTCritSectRwLeaveShared(&mCrOglLock);
     4486    }
     4487    return rc;
    44474488}
    44484489
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette