Changeset 51436 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 28, 2014 9:12:15 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93991
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r51359 r51436 33 33 34 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 35 36 #include "CConsole.h" 37 #include "CDisplay.h" 35 38 36 39 #if defined (Q_OS_WIN32) … … 282 285 283 286 /* Confirm RequestResize: */ 287 return S_OK; 288 } 289 290 void UIFrameBuffer::notifyChange(ULONG aScreenId) 291 { 292 /* Disable screen updates. */ 293 lock(); 294 295 if (mpPendingSourceBitmap.isNull()) 296 { 297 /* Do nothing. Change event already processed. */ 298 LogRelFlow(("notifyChange: already processed.\n")); 299 unlock(); 300 return; 301 } 302 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 310 unlock(); 311 312 BYTE *pAddress = NULL; 313 ULONG ulWidth = 0; 314 ULONG ulHeight = 0; 315 ULONG ulBitsPerPixel = 0; 316 ULONG ulBytesPerLine = 0; 317 ULONG ulPixelFormat = 0; 318 319 mpSourceBitmap.QueryBitmapInfo(pAddress, 320 ulWidth, 321 ulHeight, 322 ulBitsPerPixel, 323 ulBytesPerLine, 324 ulPixelFormat); 325 326 UIResizeEvent e(FramebufferPixelFormat_Opaque, pAddress, 327 ulBitsPerPixel, ulBytesPerLine, ulWidth, ulHeight); 328 resizeEvent(&e); 329 } 330 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. */ 341 lock(); 342 343 /* Make sure frame-buffer is used: @todo still required? */ 344 if (m_fIsMarkedAsUnused) 345 { 346 LogRelFlow(("UIFrameBuffer::NotifyChange: Ignored!\n")); 347 unlock(); 348 return E_FAIL; 349 } 350 351 /* Save the new bitmap. */ 352 mpPendingSourceBitmap = 0; 353 m_pMachineView->session().GetConsole().GetDisplay().QuerySourceBitmap(aScreenId, mpPendingSourceBitmap); 354 355 unlock(); 356 357 /* Widget resize is NOT thread-safe and *probably* never will be, 358 * 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 362 RTThreadYield(); 363 284 364 return S_OK; 285 365 } … … 606 686 m_pMachineView, SLOT(sltHandleRequestResize(int, uchar*, int, int, int, int)), 607 687 Qt::QueuedConnection); 688 connect(this, SIGNAL(sigNotifyChange(ulong, int, int)), 689 m_pMachineView, SLOT(sltHandleNotifyChange(ulong, int, int)), 690 Qt::QueuedConnection); 608 691 connect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)), 609 692 m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int)), … … 621 704 disconnect(this, SIGNAL(sigRequestResize(int, uchar*, int, int, int, int)), 622 705 m_pMachineView, SLOT(sltHandleRequestResize(int, uchar*, int, int, int, int))); 706 disconnect(this, SIGNAL(sigNotifyChange(ulong, int, int)), 707 m_pMachineView, SLOT(sltHandleNotifyChange(ulong, int, int))); 623 708 disconnect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)), 624 709 m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int))); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r51187 r51436 28 28 /* COM includes: */ 29 29 #include "CFramebuffer.h" 30 #include "CDisplaySourceBitmap.h" 30 31 31 32 /* Other VBox includes: */ … … 96 97 int iBitsPerPixel, int iBytesPerLine, 97 98 int iWidth, int iHeight); 99 void sigNotifyChange(ulong uScreenId, int iWidth, int iHeight); 98 100 void sigNotifyUpdate(int iX, int iY, int iWidth, int iHeight); 99 101 void sigSetVisibleRegion(QRegion region); … … 150 152 ULONG uWidth, ULONG uHeight, 151 153 BOOL *pbFinished); 154 STDMETHOD(NotifyChange)(ULONG aScreenId, 155 ULONG aXOrigin, 156 ULONG aYOrigin, 157 ULONG aWidth, 158 ULONG aHeight); 152 159 153 160 STDMETHOD(NotifyUpdate) (ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight); … … 196 203 virtual void paintEvent(QPaintEvent *pEvent) = 0; 197 204 virtual void applyVisibleRegion(const QRegion ®ion); 205 206 void notifyChange(ulong uScreenId); 198 207 199 208 #ifdef VBOX_WITH_VIDEOHWACCEL … … 230 239 bool m_fIsMarkedAsUnused; 231 240 bool m_fIsAutoEnabled; 241 242 CDisplaySourceBitmap mpSourceBitmap; 243 CDisplaySourceBitmap mpPendingSourceBitmap; 244 bool mfUpdates; 232 245 233 246 /* To avoid a seamless flicker, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
r51404 r51436 145 145 else 146 146 popupCenter().forgetAboutWrongColorDepth(m_pMachineView->machineWindow()); 147 lock(); 148 mfUpdates = true; 149 unlock(); 147 150 } 148 151 … … 161 164 if (!m_pMachineView) 162 165 return; 166 167 lock(); 168 if (!mfUpdates) 169 { 170 unlock(); 171 return; 172 } 163 173 164 174 /* If the machine is NOT in 'running', 'paused' or 'saving' state, … … 203 213 break; 204 214 } 215 unlock(); 205 216 } 206 217 … … 376 387 * 2. or the machine is in the state which breaks link between 377 388 * the framebuffer and the actual video-memory: */ 378 m_img = QImage(m_width, m_height, QImage::Format_RGB32); 379 m_img.fill(0); 380 m_uPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 381 m_bUsesGuestVRAM = false; 382 } 383 389 if (!mpSourceBitmap.isNull()) 390 { 391 BYTE *pAddress = NULL; 392 ULONG ulWidth = 0; 393 ULONG ulHeight = 0; 394 ULONG ulBitsPerPixel = 0; 395 ULONG ulBytesPerLine = 0; 396 ULONG ulPixelFormat = 0; 397 398 mpSourceBitmap.QueryBitmapInfo(pAddress, 399 ulWidth, 400 ulHeight, 401 ulBitsPerPixel, 402 ulBytesPerLine, 403 ulPixelFormat); 404 405 m_img = QImage(pAddress, ulWidth, ulHeight, ulBytesPerLine, QImage::Format_RGB32); 406 m_uPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 407 m_bUsesGuestVRAM = true; 408 } 409 } 410 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r51404 r51436 276 276 } 277 277 278 /* Report to the VM thread that we finished resizing: */279 session().GetConsole().GetDisplay().ResizeCompleted(screenId());280 281 278 /* Emit a signal about guest was resized: */ 282 279 emit resizeHintDone(); … … 288 285 (unsigned long)m_uScreenId, iPixelFormat, 289 286 iBitsPerPixel, iBytesPerLine, iWidth, iHeight)); 287 } 288 289 void UIMachineView::sltHandleNotifyChange(ulong uScreenId, int iWidth, int iHeight) 290 { 291 LogRelFlow(("UIMachineView::HandleNotifyChange: Screen=%d, Size=%dx%d.\n", 292 (unsigned long)m_uScreenId, iWidth, iHeight)); 293 294 // TODO: Move to appropriate place! 295 /* Some situations require frame-buffer resize-events to be ignored at all, 296 * leaving machine-window, machine-view and frame-buffer sizes preserved: */ 297 if (uisession()->isGuestResizeIgnored()) 298 return; 299 300 /* If machine-window is visible: */ 301 if (uisession()->isScreenVisible(m_uScreenId)) 302 { 303 // TODO: Move to appropriate place! 304 /* Adjust 'scale' mode for current machine-view size: */ 305 if (visualStateType() == UIVisualStateType_Scale) 306 frameBuffer()->setScaledSize(size()); 307 308 /* Perform frame-buffer mode-change: */ 309 frameBuffer()->notifyChange(uScreenId); 310 311 /* Scale-mode doesn't need this.. */ 312 if (visualStateType() != UIVisualStateType_Scale) 313 { 314 /* Adjust maximum-size restriction for machine-view: */ 315 setMaximumSize(sizeHint()); 316 317 /* Disable the resize hint override hack: */ 318 m_sizeHintOverride = QSize(-1, -1); 319 320 /* Force machine-window update own layout: */ 321 QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest); 322 323 /* Update machine-view sliders: */ 324 updateSliders(); 325 326 /* By some reason Win host forgets to update machine-window central-widget 327 * after main-layout was updated, let's do it for all the hosts: */ 328 machineWindow()->centralWidget()->update(); 329 330 /* Normalize machine-window geometry: */ 331 if (visualStateType() == UIVisualStateType_Normal) 332 machineWindow()->normalizeGeometry(true /* adjust position */); 333 } 334 335 #ifdef Q_WS_MAC 336 /* Update MacOS X dock icon size: */ 337 machineLogic()->updateDockIconSize(screenId(), iWidth, iHeight); 338 #endif /* Q_WS_MAC */ 339 } 340 341 /* Emit a signal about guest was resized: */ 342 emit resizeHintDone(); 343 344 LogRelFlow(("UIMachineView::ResizeHandled: Screen=%d, Size=%dx%d.\n", 345 (unsigned long)m_uScreenId, iWidth, iHeight)); 290 346 } 291 347 … … 354 410 /* Ask for full guest display update (it will also update 355 411 * the viewport through IFramebuffer::NotifyUpdate): */ 356 if (m_previousState == KMachineState_Paused || 357 m_previousState == KMachineState_TeleportingPausedVM) 358 { 359 CDisplay dsp = session().GetConsole().GetDisplay(); 360 dsp.InvalidateAndUpdate(); 361 } 412 CDisplay dsp = session().GetConsole().GetDisplay(); 413 dsp.InvalidateAndUpdate(); 362 414 } 363 415 } … … 497 549 Assert(!display.isNull()); 498 550 CFramebuffer fb(NULL); 499 LONG XOrigin, YOrigin;500 551 /* Check if the framebuffer is already assigned; 501 552 * in this case we do not need to re-assign it neither do we need to AddRef. */ 502 display. GetFramebuffer(m_uScreenId, fb, XOrigin, YOrigin);553 display.QueryFramebuffer(m_uScreenId, fb); 503 554 if (fb.raw() != m_pFrameBuffer) /* <-this will evaluate to true iff no framebuffer is yet assigned */ 504 555 { 505 556 m_pFrameBuffer->AddRef(); 506 557 } 507 /* Always perform SetFramebuffer to ensure 3D gets notified: */ 508 display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer)); 558 /* Always perform AttachFramebuffer to ensure 3D gets notified: */ 559 if (!fb.isNull()) 560 display.DetachFramebuffer(m_uScreenId); 561 display.AttachFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer)); 509 562 } 510 563 … … 629 682 /* Temporarily detach the framebuffer from IDisplay before detaching 630 683 * from view in order to respect the thread synchonisation logic (see UIFrameBuffer.h). 631 * Note: VBOX_WITH_CROGL additionally requires us to call SetFramebuffer684 * Note: VBOX_WITH_CROGL additionally requires us to call DetachFramebuffer 632 685 * to ensure 3D gets notified of view being destroyed... */ 633 686 CDisplay display = session().GetConsole().GetDisplay(); 634 display. SetFramebuffer(m_uScreenId, CFramebuffer(NULL));687 display.DetachFramebuffer(m_uScreenId); 635 688 636 689 /* Detach framebuffer from view: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r51187 r51436 97 97 int iBitsPerPixel, int iBytesPerLine, 98 98 int iWidth, int iHeight); 99 100 /* Handler: Frame-buffer NotifyChange stuff: */ 101 virtual void sltHandleNotifyChange(ulong uScreenId, int iWidth, int iHeight); 99 102 100 103 /* Handler: Frame-buffer NotifyUpdate stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r51395 r51436 1230 1230 /* Detach framebuffer from Display: */ 1231 1231 CDisplay display = session().GetConsole().GetDisplay(); 1232 display. SetFramebuffer(i, CFramebuffer(NULL));1232 display.DetachFramebuffer(i); 1233 1233 /* Release framebuffer reference: */ 1234 1234 pFb->Release();
Note:
See TracChangeset
for help on using the changeset viewer.