Changeset 72352 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- May 26, 2018 12:37:50 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122809
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r72014 r72352 1954 1954 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 1955 1955 if (pVMMDevPort) 1956 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, aWidth, aHeight, aBitsPerPixel, 1957 aDisplay, aOriginX, aOriginY, 1958 RT_BOOL(aEnabled), RT_BOOL(aChangeOrigin)); 1956 { 1957 VMMDevDisplayDef d; 1958 d.idDisplay = aDisplay; 1959 d.xOrigin = aOriginX; 1960 d.yOrigin = aOriginY; 1961 d.cx = aWidth; 1962 d.cy = aHeight; 1963 d.cBitsPerPixel = aBitsPerPixel; 1964 d.fDisplayFlags = VMMDEV_DISPLAY_CX | VMMDEV_DISPLAY_CY | VMMDEV_DISPLAY_BPP; 1965 if (!aEnabled) 1966 d.fDisplayFlags |= VMMDEV_DISPLAY_DISABLED; 1967 if (aChangeOrigin) 1968 d.fDisplayFlags |= VMMDEV_DISPLAY_ORIGIN; 1969 if (aDisplay == 0) 1970 d.fDisplayFlags |= VMMDEV_DISPLAY_PRIMARY; 1971 1972 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, 1, &d, false); 1973 } 1959 1974 } 1960 1975 return S_OK; … … 3122 3137 3123 3138 HRESULT Display::setScreenLayout(ScreenLayoutMode_T aScreenLayoutMode, 3124 const std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenInfo) 3125 { 3126 NOREF(aScreenLayoutMode); 3127 NOREF(aGuestScreenInfo); 3128 return E_NOTIMPL; 3139 const std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenInfo) 3140 { 3141 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3142 3143 if (aGuestScreenInfo.size() != mcMonitors) 3144 return E_INVALIDARG; 3145 3146 CHECK_CONSOLE_DRV(mpDrv); 3147 3148 /* 3149 * It is up to the guest to decide whether the hint is 3150 * valid. Therefore don't do any VRAM sanity checks here. 3151 */ 3152 3153 /* Have to release the lock because the pfnRequestDisplayChange 3154 * will call EMT. */ 3155 alock.release(); 3156 3157 VMMDev *pVMMDev = mParent->i_getVMMDev(); 3158 if (pVMMDev) 3159 { 3160 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 3161 if (pVMMDevPort) 3162 { 3163 uint32_t const cDisplays = (uint32_t)aGuestScreenInfo.size(); 3164 3165 size_t const cbAlloc = cDisplays * sizeof(VMMDevDisplayDef); 3166 VMMDevDisplayDef *paDisplayDefs = (VMMDevDisplayDef *)RTMemAlloc(cbAlloc); 3167 if (paDisplayDefs) 3168 { 3169 for (uint32_t i = 0; i < cDisplays; ++i) 3170 { 3171 VMMDevDisplayDef *p = &paDisplayDefs[i]; 3172 ComPtr<IGuestScreenInfo> pScreenInfo = aGuestScreenInfo[i]; 3173 3174 ULONG screenId = 0; 3175 GuestMonitorStatus_T guestMonitorStatus = GuestMonitorStatus_Enabled; 3176 BOOL origin = FALSE; 3177 BOOL primary = FALSE; 3178 LONG originX = 0; 3179 LONG originY = 0; 3180 ULONG width = 0; 3181 ULONG height = 0; 3182 ULONG bitsPerPixel = 0; 3183 3184 pScreenInfo->COMGETTER(ScreenId) (&screenId); 3185 pScreenInfo->COMGETTER(GuestMonitorStatus)(&guestMonitorStatus); 3186 pScreenInfo->COMGETTER(Primary) (&primary); 3187 pScreenInfo->COMGETTER(Origin) (&origin); 3188 pScreenInfo->COMGETTER(OriginX) (&originX); 3189 pScreenInfo->COMGETTER(OriginY) (&originY); 3190 pScreenInfo->COMGETTER(Width) (&width); 3191 pScreenInfo->COMGETTER(Height) (&height); 3192 pScreenInfo->COMGETTER(BitsPerPixel)(&bitsPerPixel); 3193 3194 LogFlowFunc(("%d %d,%d %dx%d\n", screenId, originX, originY, width, height)); 3195 3196 p->idDisplay = screenId; 3197 p->xOrigin = originX; 3198 p->yOrigin = originY; 3199 p->cx = width; 3200 p->cy = height; 3201 p->cBitsPerPixel = bitsPerPixel; 3202 p->fDisplayFlags = VMMDEV_DISPLAY_CX | VMMDEV_DISPLAY_CY | VMMDEV_DISPLAY_BPP; 3203 if (guestMonitorStatus == GuestMonitorStatus_Disabled) 3204 p->fDisplayFlags |= VMMDEV_DISPLAY_DISABLED; 3205 if (origin) 3206 p->fDisplayFlags |= VMMDEV_DISPLAY_ORIGIN; 3207 if (primary) 3208 p->fDisplayFlags |= VMMDEV_DISPLAY_PRIMARY; 3209 } 3210 3211 bool const fForce = aScreenLayoutMode == ScreenLayoutMode_Reset 3212 || aScreenLayoutMode == ScreenLayoutMode_Apply; 3213 pVMMDevPort->pfnRequestDisplayChange(pVMMDevPort, cDisplays, paDisplayDefs, fForce); 3214 3215 RTMemFree(paDisplayDefs); 3216 } 3217 } 3218 } 3219 return S_OK; 3129 3220 } 3130 3221 … … 3133 3224 NOREF(aScreenIds); 3134 3225 return E_NOTIMPL; 3226 } 3227 3228 HRESULT Display::createGuestScreenInfo(ULONG aDisplay, 3229 GuestMonitorStatus_T aStatus, 3230 BOOL aPrimary, 3231 BOOL aChangeOrigin, 3232 LONG aOriginX, 3233 LONG aOriginY, 3234 ULONG aWidth, 3235 ULONG aHeight, 3236 ULONG aBitsPerPixel, 3237 ComPtr<IGuestScreenInfo> &aGuestScreenInfo) 3238 { 3239 /* Create a new object. */ 3240 ComObjPtr<GuestScreenInfo> obj; 3241 HRESULT hr = obj.createObject(); 3242 if (SUCCEEDED(hr)) 3243 hr = obj->init(aDisplay, aStatus, aPrimary, aChangeOrigin, aOriginX, aOriginY, 3244 aWidth, aHeight, aBitsPerPixel); 3245 if (SUCCEEDED(hr)) 3246 obj.queryInterfaceTo(aGuestScreenInfo.asOutParam()); 3247 3248 return hr; 3249 } 3250 3251 3252 /* 3253 * GuestScreenInfo implementation. 3254 */ 3255 DEFINE_EMPTY_CTOR_DTOR(GuestScreenInfo) 3256 3257 HRESULT GuestScreenInfo::FinalConstruct() 3258 { 3259 return BaseFinalConstruct(); 3260 } 3261 3262 void GuestScreenInfo::FinalRelease() 3263 { 3264 uninit(); 3265 3266 BaseFinalRelease(); 3267 } 3268 3269 HRESULT GuestScreenInfo::init(ULONG aDisplay, 3270 GuestMonitorStatus_T aGuestMonitorStatus, 3271 BOOL aPrimary, 3272 BOOL aChangeOrigin, 3273 LONG aOriginX, 3274 LONG aOriginY, 3275 ULONG aWidth, 3276 ULONG aHeight, 3277 ULONG aBitsPerPixel) 3278 { 3279 LogFlowThisFunc(("[%u]\n", aDisplay)); 3280 3281 /* Enclose the state transition NotReady->InInit->Ready */ 3282 AutoInitSpan autoInitSpan(this); 3283 AssertReturn(autoInitSpan.isOk(), E_FAIL); 3284 3285 mScreenId = aDisplay; 3286 mGuestMonitorStatus = aGuestMonitorStatus; 3287 mPrimary = aPrimary; 3288 mOrigin = aChangeOrigin; 3289 mOriginX = aOriginX; 3290 mOriginY = aOriginY; 3291 mWidth = aWidth; 3292 mHeight = aHeight; 3293 mBitsPerPixel = aBitsPerPixel; 3294 3295 /* Confirm a successful initialization */ 3296 autoInitSpan.setSucceeded(); 3297 3298 return S_OK; 3299 } 3300 3301 void GuestScreenInfo::uninit() 3302 { 3303 /* Enclose the state transition Ready->InUninit->NotReady */ 3304 AutoUninitSpan autoUninitSpan(this); 3305 if (autoUninitSpan.uninitDone()) 3306 return; 3307 3308 LogFlowThisFunc(("[%u]\n", mScreenId)); 3309 } 3310 3311 HRESULT GuestScreenInfo::getScreenId(ULONG *aScreenId) 3312 { 3313 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3314 *aScreenId = mScreenId; 3315 return S_OK; 3316 } 3317 3318 HRESULT GuestScreenInfo::getGuestMonitorStatus(GuestMonitorStatus_T *aGuestMonitorStatus) 3319 { 3320 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3321 *aGuestMonitorStatus = mGuestMonitorStatus; 3322 return S_OK; 3323 } 3324 3325 HRESULT GuestScreenInfo::getPrimary(BOOL *aPrimary) 3326 { 3327 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3328 *aPrimary = mPrimary; 3329 return S_OK; 3330 } 3331 3332 HRESULT GuestScreenInfo::getOrigin(BOOL *aOrigin) 3333 { 3334 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3335 *aOrigin = mOrigin; 3336 return S_OK; 3337 } 3338 3339 HRESULT GuestScreenInfo::getOriginX(LONG *aOriginX) 3340 { 3341 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3342 *aOriginX = mOriginX; 3343 return S_OK; 3344 } 3345 3346 HRESULT GuestScreenInfo::getOriginY(LONG *aOriginY) 3347 { 3348 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3349 *aOriginY = mOriginY; 3350 return S_OK; 3351 } 3352 3353 HRESULT GuestScreenInfo::getWidth(ULONG *aWidth) 3354 { 3355 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3356 *aWidth = mWidth; 3357 return S_OK; 3358 } 3359 3360 HRESULT GuestScreenInfo::getHeight(ULONG *aHeight) 3361 { 3362 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3363 *aHeight = mHeight; 3364 return S_OK; 3365 } 3366 3367 HRESULT GuestScreenInfo::getBitsPerPixel(ULONG *aBitsPerPixel) 3368 { 3369 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3370 *aBitsPerPixel = mBitsPerPixel; 3371 return S_OK; 3372 } 3373 3374 HRESULT GuestScreenInfo::getExtendedInfo(com::Utf8Str &aExtendedInfo) 3375 { 3376 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3377 aExtendedInfo = com::Utf8Str(); 3378 return S_OK; 3135 3379 } 3136 3380
Note:
See TracChangeset
for help on using the changeset viewer.