Changeset 53847 in vbox
- Timestamp:
- Jan 16, 2015 8:53:12 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
include/VBox/HostServices/VBoxCrOpenGLSvc.h (modified) (2 diffs)
-
include/VBox/VBoxOGL.h (modified) (1 diff)
-
src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp (modified) (2 diffs)
-
src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp (modified) (1 diff)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (2 diffs)
-
src/VBox/Main/include/DisplayImpl.h (modified) (2 diffs)
-
src/VBox/Main/src-client/DisplayImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h
r51330 r53847 51 51 #define SHCRGL_HOST_FN_WINDOWS_SHOW (25) 52 52 #define SHCRGL_HOST_FN_CTL (26) 53 #define SHCRGL_HOST_FN_SET_SCALE_FACTOR (27) 54 53 55 /* crOpenGL guest functions */ 54 56 #define SHCRGL_GUEST_FN_WRITE (2) … … 410 412 } CRVBOXHGCMTAKESCREENSHOT; 411 413 414 typedef struct 415 { 416 uint32_t u32Screen; 417 uint32_t u32ScaleFactorWMultiplied; 418 uint32_t u32ScaleFactorHMultiplied; 419 } CRVBOXHGCMSETSCALEFACTOR; 420 412 421 #endif -
trunk/include/VBox/VBoxOGL.h
r53815 r53847 27 27 28 28 #include <iprt/cdefs.h> 29 #include <iprt/types.h> 29 30 30 31 RT_C_DECLS_BEGIN 32 33 /* GUI and VBox OpenGL code require scaling factor value to be stored in container 34 * of type of 'double'. Communication between them is done via Main. In the same time, 35 * currently, Main does not like type of 'double' to be used for an interface method parameter. 36 * An integer type should be used instead. This value is used in order to specify scaling factor in type 37 * of 'integer' units. It is assumed that GUI feeds Main with its internal scaling factor value 38 * (which is originally of type of 'double') multiplied by this constant and converted resulting 39 * value to type of 'uint32_t'. Then Main provides this data to OpenGL HGCM thread. Finally, VBox OpenGL 40 * code divides received scalar by this constant and converts result to type of 'double'. 41 * This constant can be increased (multiplied by 10^n) in order to get better precision 42 * for scaling factor manipulations. */ 43 #define VBOX_OGL_SCALE_FACTOR_MULTIPLIER 100.0 31 44 32 45 bool RTCALL VBoxOglIsOfflineRenderingAppropriate(void); 33 46 bool RTCALL VBoxOglIs3DAccelerationSupported(void); 34 47 48 DECLEXPORT(int) VBoxOglSetScaleFactor(uint32_t idScreen, double dScaleFactorW, double dScaleFactorH); 49 35 50 RT_C_DECLS_END 36 51 -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r53103 r53847 38 38 #include <VBox/HostServices/VBoxCrOpenGLSvc.h> 39 39 #include <VBox/vmm/ssm.h> 40 #include <VBox/VBoxOGL.h> 40 41 41 42 #include "cr_mem.h" … … 1366 1367 break; 1367 1368 } 1369 case SHCRGL_HOST_FN_SET_SCALE_FACTOR: 1370 { 1371 /* Verify parameter count and types. */ 1372 if (cParms != 1 1373 || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR 1374 || paParms[0].u.pointer.size != sizeof(CRVBOXHGCMSETSCALEFACTOR) 1375 || !paParms[0].u.pointer.addr) 1376 { 1377 WARN(("invalid parameter")); 1378 rc = VERR_INVALID_PARAMETER; 1379 break; 1380 } 1381 1382 CRVBOXHGCMSETSCALEFACTOR *pData = (CRVBOXHGCMSETSCALEFACTOR *)paParms[0].u.pointer.addr; 1383 double dScaleFactorW = (double)(pData->u32ScaleFactorWMultiplied) / VBOX_OGL_SCALE_FACTOR_MULTIPLIER; 1384 double dScaleFactorH = (double)(pData->u32ScaleFactorHMultiplied) / VBOX_OGL_SCALE_FACTOR_MULTIPLIER; 1385 1386 rc = VBoxOglSetScaleFactor(pData->u32Screen, dScaleFactorW, dScaleFactorH); 1387 1388 /* Log scaling factor rounded to nearest 'int' value (not so precise). */ 1389 LogRel(("OpenGL: Set 3D content scale factor to (%u, %u), multiplier %d.\n", 1390 pData->u32ScaleFactorWMultiplied, 1391 pData->u32ScaleFactorHMultiplied, 1392 (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER)); 1393 1394 break; 1395 } 1368 1396 default: 1369 1397 WARN(("svcHostCallPerform: unexpected u32Function %d", u32Function)); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
r53158 r53847 1829 1829 } 1830 1830 1831 extern "C" DECLEXPORT(int) VBoxOglSetScaleFactor(uint32_t idScreen, double dScaleFactorW, double dScaleFactorH) 1832 { 1833 if (idScreen >= CR_MAX_GUEST_MONITORS) 1834 { 1835 WARN(("invalid idScreen %d", idScreen)); 1836 return VERR_INVALID_PARAMETER; 1837 } 1838 1839 CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen]; 1840 if (pDpInfo->pDpWin) 1841 { 1842 CrFbWindow *pWin = pDpInfo->pDpWin->getWindow(); 1843 if (pWin) 1844 { 1845 bool rc; 1846 rc = pWin->SetScaleFactor((GLdouble)dScaleFactorW, (GLdouble)dScaleFactorH); 1847 return rc ? 0 : VERR_LOCK_FAILED; 1848 } 1849 } 1850 1851 return VERR_INVALID_PARAMETER; 1852 } 1853 1831 1854 int CrPMgrScreenChanged(uint32_t idScreen) 1832 1855 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r53385 r53847 15812 15812 <interface 15813 15813 name="IDisplay" extends="$unknown" 15814 uuid=" dc19253d-e6b8-4b2c-8923-c8ecf80d1909"15814 uuid="772FBD91-65B5-4CFB-814C-E40E61AC7070" 15815 15815 wsmap="managed" 15816 15816 wrap-hint-server-addinterfaces="IEventListener" … … 16112 16112 <param name="screenId" type="unsigned long" dir="in"/> 16113 16113 <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/> 16114 </method> 16115 16116 <method name="notifyScaleFactorChange"> 16117 <desc> 16118 Obtains the guest screen bitmap parameters. 16119 </desc> 16120 <param name="screenId" type="unsigned long" dir="in"/> 16121 <param name="u32ScaleFactorWMultiplied" type="unsigned long" dir="in"/> 16122 <param name="u32ScaleFactorHMultiplied" type="unsigned long" dir="in"/> 16114 16123 </method> 16115 16124 -
trunk/src/VBox/Main/include/DisplayImpl.h
r53748 r53847 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 170 170 void i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp); 171 171 void i_handleVRecCompletion(); 172 HRESULT notifyScaleFactorChange(uint32_t uScreen, uint32_t u32ScaleFactorWMultiplied, uint32_t u32ScaleFactorHMultiplied); 172 173 #endif 173 174 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r53758 r53847 3398 3398 Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED); 3399 3399 ASMAtomicWriteU32(&mfCrOglVideoRecState, CRVREC_STATE_IDLE); 3400 } 3401 3402 HRESULT 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 */ 3400 3465 } 3401 3466
Note:
See TracChangeset
for help on using the changeset viewer.

