Changeset 39063 in vbox
- Timestamp:
- Oct 20, 2011 4:41:44 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 74485
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r39023 r39063 159 159 160 160 NOREF(uScreenId); 161 QApplication::postEvent (m_pMachineView, 162 new UIResizeEvent(uPixelFormat, pVRAM, uBitsPerPixel, 163 uBytesPerLine, uWidth, uHeight)); 161 /* A resize event can happen while we are switching machine view classes, 162 * but we synchronise afterwards so that shouldn't be a problem. We must 163 * temporarily remove the framebuffer in Display though while switching 164 * to respect the thread synchronisation logic (see UIFrameBuffer.h). */ 165 if (m_pMachineView) 166 QApplication::postEvent(m_pMachineView, 167 new UIResizeEvent(uPixelFormat, pVRAM, 168 uBitsPerPixel, uBytesPerLine, 169 uWidth, uHeight)); 170 else 171 { 172 /* Report to the VM thread that we finished resizing and rely on the 173 * synchronisation when the new view is attached. */ 174 *pbFinished = TRUE; 175 return S_OK; 176 } 164 177 165 178 *pbFinished = FALSE; … … 250 263 AssertBreakpoint(); 251 264 } 265 #endif 252 266 253 267 void UIFrameBuffer::setView(UIMachineView * pView) … … 256 270 m_WinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0; 257 271 } 258 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r39023 r39063 276 276 #ifdef VBOX_GUI_USE_QIMAGE 277 277 case VBoxDefs::QImageMode: 278 { 279 UIFrameBuffer* pFrameBuffer = uisession()->frameBuffer(screenId()); 280 if (pFrameBuffer) 281 pFrameBuffer->setView(this); 282 else 283 { 278 284 # ifdef VBOX_WITH_VIDEOHWACCEL 279 if (m_fAccelerate2DVideo) 280 { 281 UIFrameBuffer* pFramebuffer = uisession()->frameBuffer(screenId()); 282 if (pFramebuffer) 283 pFramebuffer->setView(this); 285 if (m_fAccelerate2DVideo) 286 { 287 /** these two additional template args is a workaround to 288 * this [VBox|UI] duplication 289 * @todo: they are to be removed once VBox stuff is gone */ 290 pFrameBuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session(), (uint32_t)screenId()); 291 } 284 292 else 285 { 286 /* these two additional template args is a workaround to this [VBox|UI] duplication 287 * @todo: they are to be removed once VBox stuff is gone */ 288 pFramebuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session(), (uint32_t)screenId()); 289 uisession()->setFrameBuffer(screenId(), pFramebuffer); 290 } 291 m_pFrameBuffer = pFramebuffer; 292 } 293 else 294 m_pFrameBuffer = new UIFrameBufferQImage(this); 293 pFrameBuffer = new UIFrameBufferQImage(this); 295 294 # else /* VBOX_WITH_VIDEOHWACCEL */ 296 m_pFrameBuffer = new UIFrameBufferQImage(this);295 pFrameBuffer = new UIFrameBufferQImage(this); 297 296 # endif /* !VBOX_WITH_VIDEOHWACCEL */ 298 break; 297 uisession()->setFrameBuffer(screenId(), pFrameBuffer); 298 } 299 m_pFrameBuffer = pFrameBuffer; 300 break; 301 } 299 302 #endif /* VBOX_GUI_USE_QIMAGE */ 300 303 #ifdef VBOX_GUI_USE_QGLFB … … 393 396 CDisplay display = session().GetConsole().GetDisplay(); 394 397 Assert(!display.isNull()); 395 #ifdef VBOX_WITH_VIDEOHWACCEL396 398 CFramebuffer fb(NULL); 397 if (m_fAccelerate2DVideo) 398 { 399 LONG XOrigin, YOrigin; 400 /* Check if the framebuffer is already assigned; 401 * in this case we do not need to re-assign it neither do we need to AddRef. */ 402 display.GetFramebuffer(m_uScreenId, fb, XOrigin, YOrigin); 403 } 404 if (fb.raw() != m_pFrameBuffer) /* <-this will evaluate to true iff m_fAccelerate2DVideo is disabled or iff no framebuffer is yet assigned */ 405 #endif /* VBOX_WITH_VIDEOHWACCEL */ 399 LONG XOrigin, YOrigin; 400 /* Check if the framebuffer is already assigned; 401 * in this case we do not need to re-assign it neither do we need to AddRef. */ 402 display.GetFramebuffer(m_uScreenId, fb, XOrigin, YOrigin); 403 if (fb.raw() != m_pFrameBuffer) /* <-this will evaluate to true iff no framebuffer is yet assigned */ 406 404 { 407 405 m_pFrameBuffer->AddRef(); … … 504 502 /* Process pending frame-buffer resize events: */ 505 503 QApplication::sendPostedEvents(this, VBoxDefs::ResizeEventType); 506 #ifdef VBOX_WITH_VIDEOHWACCEL 507 if (m_fAccelerate2DVideo) 508 { 509 /* When 2D is enabled we do not re-create Framebuffers. This is done to 510 * 1. avoid 2D command loss during the time slot when no framebuffer is assigned to the display 511 * 2. make it easier to preserve the current 2D state */ 504 if ( m_fAccelerate2DVideo 505 || vboxGlobal().vmRenderMode() == VBoxDefs::QImageMode) 506 { 512 507 Assert(m_pFrameBuffer == uisession()->frameBuffer(screenId())); 508 CDisplay display = session().GetConsole().GetDisplay(); 509 /* Temporarily remove the framebuffer in Display while unsetting 510 * the view in order to respect the thread synchonisation logic 511 * (see UIFrameBuffer.h). */ 512 /** @note VBOX_WITH_CROGL additionally requires us to call 513 * SetFramebuffer to ensure 3D gets notified of view being 514 * destroyed */ 515 display.SetFramebuffer(m_uScreenId, CFramebuffer(NULL)); 513 516 m_pFrameBuffer->setView(NULL); 514 #ifdef VBOX_WITH_CROGL515 /* Call SetFramebuffer to ensure 3D gets notified of view being destroyed */516 CDisplay display = session().GetConsole().GetDisplay();517 517 display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer)); 518 #endif519 518 } 520 519 else 521 #endif /* VBOX_WITH_VIDEOHWACCEL */522 520 { 523 521 /* Warn framebuffer about its no more necessary: */
Note:
See TracChangeset
for help on using the changeset viewer.