Changeset 51458 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 29, 2014 11:56:56 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r51436 r51458 49 49 , m_fIsMarkedAsUnused(false) 50 50 , m_fIsAutoEnabled(false) 51 , m_fIsUpdatesAllowed(true) 51 52 #ifdef Q_OS_WIN 52 53 , m_iRefCnt(0) … … 288 289 } 289 290 290 void UIFrameBuffer::notifyChange( ULONG aScreenId)291 { 292 /* Disable screen updates.*/291 void UIFrameBuffer::notifyChange() 292 { 293 /* Lock access to frame-buffer: */ 293 294 lock(); 294 295 295 if (mpPendingSourceBitmap.isNull()) 296 { 297 /* Do nothing. Change event already processed. */ 298 LogRelFlow(("notifyChange: already processed.\n")); 296 /* If there is NO pending source bitmap: */ 297 if (m_pendingSourceBitmap.isNull()) 298 { 299 /* Do nothing, change-event already processed: */ 300 LogRelFlow(("UIFrameBuffer::notifyChange: Already processed.\n")); 301 /* Unlock access to frame-buffer: */ 299 302 unlock(); 303 /* Return immediately: */ 300 304 return; 301 305 } 302 306 303 /* Disable screen updates. */ 304 mfUpdates = false; 305 306 /* Release the current bitmap and keep the pending one. */ 307 mpSourceBitmap = mpPendingSourceBitmap; 308 mpPendingSourceBitmap = 0; 309 307 /* Disable screen updates: */ 308 m_fIsUpdatesAllowed = false; 309 310 /* Release the current bitmap and keep the pending one: */ 311 m_sourceBitmap = m_pendingSourceBitmap; 312 m_pendingSourceBitmap = 0; 313 314 /* Unlock access to frame-buffer: */ 310 315 unlock(); 311 316 317 /* Acquire source bitmap: */ 312 318 BYTE *pAddress = NULL; 313 319 ULONG ulWidth = 0; … … 316 322 ULONG ulBytesPerLine = 0; 317 323 ULONG ulPixelFormat = 0; 318 319 mpSourceBitmap.QueryBitmapInfo(pAddress, 324 m_sourceBitmap.QueryBitmapInfo(pAddress, 320 325 ulWidth, 321 326 ulHeight, … … 324 329 ulPixelFormat); 325 330 331 /* Perform frame-buffer resize: */ 326 332 UIResizeEvent e(FramebufferPixelFormat_Opaque, pAddress, 327 333 ulBitsPerPixel, ulBytesPerLine, ulWidth, ulHeight); … … 329 335 } 330 336 331 STDMETHODIMP UIFrameBuffer::NotifyChange(ULONG aScreenId, 332 ULONG aXOrigin, 333 ULONG aYOrigin, 334 ULONG aWidth, 335 ULONG aHeight) 336 { 337 LogRelFlow(("NotifyChange: %d %d,%d %dx%d\n", 338 aScreenId, aXOrigin, aYOrigin, aWidth, aHeight)); 339 340 /* Obtain the new screen bitmap. */ 337 /** 338 * EMT callback: Informs about source bitmap change. 339 * @param uScreenId Guest screen number. 340 * @param uX Horizontal origin of the update rectangle, in pixels. 341 * @param uY Vertical origin of the update rectangle, in pixels. 342 * @param uWidth Width of the guest display, in pixels. 343 * @param uHeight Height of the guest display, in pixels. 344 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 345 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 346 */ 347 STDMETHODIMP UIFrameBuffer::NotifyChange(ULONG uScreenId, 348 ULONG uX, 349 ULONG uY, 350 ULONG uWidth, 351 ULONG uHeight) 352 { 353 /* Lock access to frame-buffer: */ 341 354 lock(); 342 355 343 /* Make sure frame-buffer is used: @todo still required?*/356 /* Make sure frame-buffer is used: */ 344 357 if (m_fIsMarkedAsUnused) 345 358 { 346 LogRelFlow(("UIFrameBuffer::NotifyChange: Ignored!\n")); 359 LogRel(("UIFrameBuffer::NotifyChange: Screen=%lu, Origin=%lux%lu, Size=%lux%lu, Ignored!\n", 360 (unsigned long)uScreenId, 361 (unsigned long)uX, (unsigned long)uY, 362 (unsigned long)uWidth, (unsigned long)uHeight)); 363 364 /* Unlock access to frame-buffer: */ 347 365 unlock(); 366 367 /* Ignore NotifyChange: */ 348 368 return E_FAIL; 349 369 } 350 370 351 /* Save the new bitmap. */ 352 mpPendingSourceBitmap = 0; 353 m_pMachineView->session().GetConsole().GetDisplay().QuerySourceBitmap(aScreenId, mpPendingSourceBitmap); 354 355 unlock(); 371 /* Acquire new pending bitmap: */ 372 m_pendingSourceBitmap = 0; 373 m_pMachineView->session().GetConsole().GetDisplay().QuerySourceBitmap(uScreenId, m_pendingSourceBitmap); 356 374 357 375 /* Widget resize is NOT thread-safe and *probably* never will be, 358 376 * We have to notify machine-view with the async-signal to perform resize operation. */ 359 LogRelFlow(("UIFrameBuffer::NotifyChange: Sending to async-handler...\n")); 360 emit sigNotifyChange(aScreenId, aWidth, aHeight); 361 377 LogRel(("UIFrameBuffer::NotifyChange: Screen=%lu, Origin=%lux%lu, Size=%lux%lu, Sending to async-handler..\n", 378 (unsigned long)uScreenId, 379 (unsigned long)uX, (unsigned long)uY, 380 (unsigned long)uWidth, (unsigned long)uHeight)); 381 emit sigNotifyChange(uScreenId, uWidth, uHeight); 382 383 /* Unlock access to frame-buffer: */ 384 unlock(); 385 386 /* Give up control token to other thread: */ 362 387 RTThreadYield(); 363 388 389 /* Confirm NotifyChange: */ 364 390 return S_OK; 365 391 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r51438 r51458 152 152 ULONG uWidth, ULONG uHeight, 153 153 BOOL *pbFinished); 154 STDMETHOD(NotifyChange)(ULONG aScreenId,155 ULONG aXOrigin,156 ULONG aYOrigin,157 ULONG aWidth,158 ULONG aHeight);154 STDMETHOD(NotifyChange)(ULONG uScreenId, 155 ULONG uX, 156 ULONG uY, 157 ULONG uWidth, 158 ULONG uHeight); 159 159 160 160 STDMETHOD(NotifyUpdate) (ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight); … … 204 204 virtual void applyVisibleRegion(const QRegion ®ion); 205 205 206 void notifyChange( ULONG uScreenId);206 void notifyChange(); 207 207 208 208 #ifdef VBOX_WITH_VIDEOHWACCEL … … 240 240 bool m_fIsAutoEnabled; 241 241 242 CDisplaySourceBitmap mpSourceBitmap; 243 CDisplaySourceBitmap mpPendingSourceBitmap; 244 bool mfUpdates; 242 /** Source bitmap from IDisplay. */ 243 CDisplaySourceBitmap m_sourceBitmap; 244 /** Source bitmap from IDisplay acquired but not yet applied. */ 245 CDisplaySourceBitmap m_pendingSourceBitmap; 246 /** Reflects whether screen-updates allowed. */ 247 bool m_fIsUpdatesAllowed; 245 248 246 249 /* To avoid a seamless flicker, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
r51436 r51458 145 145 else 146 146 popupCenter().forgetAboutWrongColorDepth(m_pMachineView->machineWindow()); 147 148 /* Enable screen updates: */ 147 149 lock(); 148 m fUpdates= true;150 m_fIsUpdatesAllowed = true; 149 151 unlock(); 150 152 } … … 164 166 if (!m_pMachineView) 165 167 return; 166 168 169 /* Lock access to frame-buffer: */ 167 170 lock(); 168 if (!mfUpdates) 169 { 170 unlock(); 171 return; 171 172 /* But if updates disabled: */ 173 if (!m_fIsUpdatesAllowed) 174 { 175 /* Unlock access to frame-buffer: */ 176 unlock(); 177 /* And return immediately: */ 178 return; 172 179 } 173 180 … … 213 220 break; 214 221 } 222 223 /* Unlock access to frame-buffer: */ 215 224 unlock(); 216 225 } … … 387 396 * 2. or the machine is in the state which breaks link between 388 397 * the framebuffer and the actual video-memory: */ 389 if (!m pSourceBitmap.isNull())398 if (!m_sourceBitmap.isNull()) 390 399 { 391 400 BYTE *pAddress = NULL; … … 396 405 ULONG ulPixelFormat = 0; 397 406 398 m pSourceBitmap.QueryBitmapInfo(pAddress,407 m_sourceBitmap.QueryBitmapInfo(pAddress, 399 408 ulWidth, 400 409 ulHeight, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r51440 r51458 307 307 308 308 /* Perform frame-buffer mode-change: */ 309 frameBuffer()->notifyChange( uScreenId);309 frameBuffer()->notifyChange(); 310 310 311 311 /* Scale-mode doesn't need this.. */
Note:
See TracChangeset
for help on using the changeset viewer.