VirtualBox

Changeset 54582 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Mar 2, 2015 3:42:16 PM (10 years ago)
Author:
vboxsync
Message:

Host 3D unscaled HiDPI output: privide notifyHiDPIOutputPolicyChange() IDisplay interface to GUI in ouder to notify 3D about corresponding user option value change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r54567 r54582  
    35653565#else
    35663566    AssertMsgFailed(("Attempt to specify OpenGL content scale factor while corresponding functionality is disabled."));
     3567    return E_UNEXPECTED;
     3568#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
     3569}
     3570
     3571HRESULT Display::notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI)
     3572{
     3573#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     3574    HRESULT hr = E_UNEXPECTED;
     3575
     3576    /* 3D acceleration enabled in VM config. */
     3577    if (mfIsCr3DEnabled)
     3578    {
     3579        /* VBoxSharedCrOpenGL HGCM host service is running. */
     3580        if (mhCrOglSvc)
     3581        {
     3582            VMMDev *pVMMDev = mParent->i_getVMMDev();
     3583            if (pVMMDev)
     3584            {
     3585                VBOXCRCMDCTL_HGCM *pCtl;
     3586                pCtl = (VBOXCRCMDCTL_HGCM *)RTMemAlloc(sizeof(CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT) + sizeof(VBOXCRCMDCTL_HGCM));
     3587                if (pCtl)
     3588                {
     3589                    CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *pData = (CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *)(pCtl + 1);
     3590                    int rc;
     3591
     3592                    pData->fUnscaledHiDPI          = fUnscaledHiDPI;
     3593
     3594                    pCtl->Hdr.enmType              = VBOXCRCMDCTL_TYPE_HGCM;
     3595                    pCtl->Hdr.u32Function          = SHCRGL_HOST_FN_SET_UNSCALED_HIDPI;
     3596                    pCtl->aParms[0].type           = VBOX_HGCM_SVC_PARM_PTR;
     3597                    pCtl->aParms[0].u.pointer.addr = pData;
     3598                    pCtl->aParms[0].u.pointer.size = sizeof(*pData);
     3599
     3600                    rc = i_crCtlSubmitSync(&pCtl->Hdr, sizeof(*pCtl));
     3601                    if (RT_FAILURE(rc))
     3602                        AssertMsgFailed(("crCtlSubmitSync failed (rc=%Rrc)\n", rc));
     3603                    else
     3604                        hr = S_OK;
     3605
     3606                    RTMemFree(pCtl);
     3607                }
     3608                else
     3609                {
     3610                    LogRel(("Running out of memory on attempt to notify OpenGL about HiDPI output scaling policy change. Ignored.\n"));
     3611                    hr = E_OUTOFMEMORY;
     3612                }
     3613            }
     3614            else
     3615                LogRel(("Internal error occurred on attempt to notify OpenGL about HiDPI output scaling policy change. Ignored.\n"));
     3616        }
     3617        else
     3618            LogRel(("Attempt to notify OpenGL about HiDPI output scaling policy change while corresponding HGCM host service not yet runing. Ignored.\n"));
     3619    }
     3620    else
     3621    {
     3622        hr = S_OK;
     3623        /* Need an interface like this here (and the #ifdefs needs adjusting):
     3624        PPDMIDISPLAYPORT pUpPort = mpDrv ? mpDrv->pUpPort : NULL;
     3625        if (pUpPort && pUpPort->pfnSetScaleFactor)
     3626            pUpPort->pfnSetScaleFactor(pUpPort, aScreeId, aScaleFactorWMultiplied, aScaleFactorHMultiplied); */
     3627    }
     3628
     3629    return hr;
     3630#else
     3631    AssertMsgFailed(("Attempt to notify OpenGL about HiDPI output scaling policy change while corresponding functionality is disabled."));
    35673632    return E_UNEXPECTED;
    35683633#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
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