VirtualBox

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


Ignore:
Timestamp:
Jan 16, 2015 8:53:12 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97665
Message:

Host 3D: content scalling: export IDisplay interface and connect it to OpenGL HGCM service.

File:
1 edited

Legend:

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

    r53758 r53847  
    33983398    Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED);
    33993399    ASMAtomicWriteU32(&mfCrOglVideoRecState, CRVREC_STATE_IDLE);
     3400}
     3401
     3402HRESULT Display::notifyScaleFactorChange(uint32_t uScreen, uint32_t u32ScaleFactorWMultiplied, uint32_t u32ScaleFactorHMultiplied)
     3403{
     3404#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     3405    HRESULT hr = E_UNEXPECTED;
     3406
     3407    if (uScreen >= mcMonitors)
     3408        return E_INVALIDARG;
     3409
     3410    /* 3D acceleration enabled in VM config. */
     3411    if (mfIsCr3DEnabled)
     3412    {
     3413        /* VBoxSharedCrOpenGL HGCM host service is running. */
     3414        if (mhCrOglSvc)
     3415        {
     3416            VMMDev *pVMMDev = mParent->i_getVMMDev();
     3417            if (pVMMDev)
     3418            {
     3419                VBOXCRCMDCTL_HGCM *pCtl;
     3420                pCtl = (VBOXCRCMDCTL_HGCM *)RTMemAlloc(sizeof(CRVBOXHGCMSETSCALEFACTOR) + sizeof(VBOXCRCMDCTL_HGCM));
     3421                if (pCtl)
     3422                {
     3423                    CRVBOXHGCMSETSCALEFACTOR *pData = (CRVBOXHGCMSETSCALEFACTOR *)(pCtl + 1);
     3424                    int rc;
     3425
     3426                    pData->u32Screen                 = uScreen;
     3427                    pData->u32ScaleFactorWMultiplied = u32ScaleFactorWMultiplied;
     3428                    pData->u32ScaleFactorHMultiplied = u32ScaleFactorHMultiplied;
     3429
     3430                    pCtl->Hdr.enmType              = VBOXCRCMDCTL_TYPE_HGCM;
     3431                    pCtl->Hdr.u32Function          = SHCRGL_HOST_FN_SET_SCALE_FACTOR;
     3432                    pCtl->aParms[0].type           = VBOX_HGCM_SVC_PARM_PTR;
     3433                    pCtl->aParms[0].u.pointer.addr = pData;
     3434                    pCtl->aParms[0].u.pointer.size = sizeof(*pData);
     3435
     3436                    rc = i_crCtlSubmit(&pCtl->Hdr, sizeof(*pCtl), i_displayCrCmdFree, pCtl);
     3437                    if (RT_FAILURE(rc))
     3438                    {
     3439                        AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
     3440                        RTMemFree(pCtl);
     3441                    }
     3442                    else
     3443                        hr = S_OK;
     3444                }
     3445                else
     3446                {
     3447                    Log(("Running out of memory on attempt to set OpenGL content scale factor. Ignored.\n"));
     3448                    hr = E_OUTOFMEMORY;
     3449                }
     3450            }
     3451            else
     3452                Log(("Internal error occurred on attempt to set OpenGL content scale factor. Ignored.\n"));
     3453        }
     3454        else
     3455            Log(("Attempt to specify OpenGL content scale factor while corresponding HGCM host service not yet runing. Ignored.\n"));
     3456    }
     3457    else
     3458        Log(("Attempt to specify OpenGL content scale factor while 3D acceleration is disabled in VM config. Ignored.\n"));
     3459
     3460    return hr;
     3461#else
     3462    Log(("Attempt to specify OpenGL content scale factor while corresponding functionality is disabled."));
     3463    return E_UNEXPECTED;
     3464#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
    34003465}
    34013466
Note: See TracChangeset for help on using the changeset viewer.

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