Changeset 53858 in vbox
- Timestamp:
- Jan 19, 2015 9:56:10 AM (10 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
r53856 r53858 1845 1845 bool rc; 1846 1846 rc = pWin->SetScaleFactor((GLdouble)dScaleFactorW, (GLdouble)dScaleFactorH); 1847 1848 /* Sync framebuffer with scaling factor changes. */1849 HCR_FRAMEBUFFER pFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;1850 if (pFb && pFb->pDisplay)1851 pFb->pDisplay->FramebufferChanged(pFb);1852 1853 1847 return rc ? 0 : VERR_LOCK_FAILED; 1854 1848 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h
r53816 r53858 211 211 int Reparent(uint64_t parentId); 212 212 int SetVisible(bool fVisible); 213 int SetSize(uint32_t width, uint32_t height );213 int SetSize(uint32_t width, uint32_t height, bool fForced=false); 214 214 int SetPosition(int32_t x, int32_t y); 215 215 int SetVisibleRegionsChanged(); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp
r53854 r53858 128 128 129 129 130 int CrFbWindow::SetSize(uint32_t width, uint32_t height) 131 { 132 if (!checkInitedUpdating()) 133 { 134 WARN(("err")); 135 return VERR_INVALID_STATE; 136 } 137 138 if (mWidth != width || mHeight != height) 130 int CrFbWindow::SetSize(uint32_t width, uint32_t height, bool fForced) 131 { 132 if (!checkInitedUpdating() && !fForced) 133 { 134 crDebug("CrFbWindow: SetSize request dropped because window is currently updating" 135 "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight); 136 return VERR_INVALID_STATE; 137 } 138 139 if (mWidth != width || mHeight != height || fForced) 139 140 { 140 141 GLdouble scaleFactorW, scaleFactorH; 142 uint32_t scaledWidth, scaledHeight; 141 143 142 144 /* Reset to default values if operation was unsuccessfull. */ … … 145 147 146 148 mFlags.fCompositoEntriesModified = 1; 147 mWidth = scaleFactorW ? (uint32_t)((GLdouble)width * scaleFactorW) : width; 148 mHeight = scaleFactorH ? (uint32_t)((GLdouble)height * scaleFactorH) : height; 149 150 LOG(("CrWIN: Size [%d ; %d]", width, height)); 149 150 /* Keep mWidth and mHeight unchanged (not multiplied by scale factor scalar). */ 151 mWidth = width; 152 mHeight = height; 153 154 scaledWidth = (uint32_t)((GLdouble)width * scaleFactorW); 155 scaledHeight = (uint32_t)((GLdouble)height * scaleFactorH); 151 156 152 157 if (mSpuWindow) 153 cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight); 154 } 158 { 159 cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight); 160 crDebug("CrFbWindow: SetSize request performed successfully " 161 "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight); 162 } 163 else 164 crDebug("CrFbWindow: SetSize request skipped because mSpuWindow not yet constructed " 165 "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight); 166 } 167 else 168 crDebug("CrFbWindow: SetSize request skipped because window arleady has requested size " 169 "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight); 155 170 156 171 return VINF_SUCCESS; … … 162 177 if (!checkInitedUpdating()) 163 178 { 164 WARN(("err"));179 crDebug("CrFbWindow: SetPosition request dropped because window is currently updating (x=%d, y=%d).", x, y); 165 180 return VERR_INVALID_STATE; 166 181 } … … 174 189 if (mSpuWindow) 175 190 cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, x, y); 191 crDebug("CrFbWindow: SetPosition performed successfully (x=%d, y=%d).", x, y); 176 192 } 177 193 … … 215 231 if ( !( (scaleFactorW >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorW <= VBOX_OGL_SCALE_FACTOR_MAX) 216 232 && (scaleFactorH >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorH <= VBOX_OGL_SCALE_FACTOR_MAX))) 233 { 234 crDebug("CrFbWindow: attempt to set scale factor out of valid values range: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.", 235 (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 236 (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER); 237 217 238 return false; 239 } 218 240 219 241 rc = RTSemRWRequestWrite(scaleFactorLock, RT_INDEFINITE_WAIT); … … 223 245 mScaleFactorHStorage = scaleFactorH; 224 246 RTSemRWReleaseWrite(scaleFactorLock); 247 248 crDebug("CrFbWindow: set scale factor: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.", 249 (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 250 (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER); 251 252 /* Update window geometry. Do not wait for GAs to send SetSize() and SetPosition() 253 * events since they might not be running or installed at all. */ 254 SetSize(mWidth, mHeight, true); 255 SetPosition(mxPos, myPos); 256 225 257 return true; 226 258 } 259 260 crDebug("CrFbWindow: unable to set scale factor because RW lock cannot be aquired: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.", 261 (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), 262 (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER); 227 263 228 264 return false; … … 295 331 VBOXVR_SCR_COMPOSITOR TmpCompositor; 296 332 RTRECT Rect; 297 Rect.xLeft = 0;298 Rect.yTop = 0;299 Rect.xRight = mWidth;300 Rect.yBottom = mHeight;333 Rect.xLeft = 0; 334 Rect.yTop = 0; 335 Rect.xRight = (uint32_t)((GLdouble)mWidth * scaleFactorW); 336 Rect.yBottom = (uint32_t)((GLdouble)mHeight * scaleFactorH); 301 337 CrVrScrCompositorInit(&TmpCompositor, &Rect); 302 338 CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactorW, scaleFactorH); … … 343 379 } 344 380 345 cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight); 381 GLdouble scaleFactorW, scaleFactorH; 382 /* Reset to default values if operation was unseccessfull. */ 383 if (!GetScaleFactor(&scaleFactorW, &scaleFactorH)) 384 scaleFactorW = scaleFactorH = 1.0; 385 386 uint32_t scaledWidth, scaledHeight; 387 388 scaledWidth = (uint32_t)((GLdouble)mWidth * scaleFactorW); 389 scaledHeight = (uint32_t)((GLdouble)mHeight * scaleFactorH); 390 391 cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight); 346 392 cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos); 347 393
Note:
See TracChangeset
for help on using the changeset viewer.