Changeset 22797 in vbox
- Timestamp:
- Sep 6, 2009 5:32:44 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r22796 r22797 1282 1282 static void doSetupMatrix(const QSize & aSize, bool bInverted); 1283 1283 1284 void vboxDoUpdateViewport(const QRect * pRect); 1284 void vboxDoUpdateViewport(const QRect & aRect); 1285 void vboxDoUpdateRect(const QRect * pRect); 1286 1285 1287 const QRect & vboxViewport() const {return mViewport;} 1286 1288 … … 1310 1312 1311 1313 1312 void vboxDoUpdateRect(const QRect * pRect);1313 1314 #ifdef VBOXQGL_DBG_SURF 1314 1315 void vboxDoTestSurfaces(void *context); … … 1449 1450 void vboxUpdateRect(const QRect * pRect); 1450 1451 private: 1452 void makeCurrent() 1453 { 1454 if(!mGlCurrent) 1455 { 1456 mGlCurrent = true; 1457 mpOverlayWidget->makeCurrent(); 1458 } 1459 } 1460 1461 void performDisplayOverlay() 1462 { 1463 if(mOverlayVisible) 1464 { 1465 #if 0 1466 mpOverlayWidget->updateGL(); 1467 #else 1468 makeCurrent(); 1469 mpOverlayWidget->performDisplay(); 1470 mpOverlayWidget->swapBuffers(); 1471 #endif 1472 } 1473 } 1474 1475 void vboxOpExit() 1476 { 1477 performDisplayOverlay(); 1478 mGlCurrent = false; 1479 } 1480 1481 1451 1482 void vboxSetGlOn(bool on); 1452 1483 bool vboxGetGlOn() { return mGlOn; } … … 1454 1485 void vboxDoVHWACmdExec(void *cmd); 1455 1486 void vboxShowOverlay(bool show); 1487 bool vboxDoCheckUpdateViewport(); 1488 void vboxDoVHWACmd(void *cmd); 1489 void vboxDoUpdateRect(const QRect * pRect); 1456 1490 void vboxUpdateOverlayPosition(const QPoint & pos); 1457 1491 void vboxUpdateOverlay(const QRect & rect, bool show); … … 1460 1494 bool mGlOn; 1461 1495 bool mOverlayVisible; 1496 bool mGlCurrent; 1497 bool mProcessingCommands; 1498 QRect mOverlayViewportCoords; 1462 1499 VBoxVHWADirtyRect mMainDirtyRect; 1463 1500 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp
r22796 r22797 3003 3003 if(vp != pw->vboxViewport()) 3004 3004 { 3005 pw->vboxDoUpdateViewport( &vp);3005 pw->vboxDoUpdateViewport(vp); 3006 3006 } 3007 3007 … … 3560 3560 } 3561 3561 3562 Assert(handle != VBOXVHWA_SURFHANDLE_INVALID); 3563 Assert(surf->handle() == VBOXVHWA_SURFHANDLE_INVALID); 3562 3564 surf->setHandle(handle); 3565 Assert(surf->handle() == handle); 3563 3566 3564 3567 VBOXQGLLOG_EXIT(("pSurf (0x%x)\n",surf)); … … 4628 4631 #endif 4629 4632 4630 void VBoxGLWidget::vboxDoUpdateViewport(const QRect * pRect)4631 { 4632 adjustViewport(mDisplay.getPrimary()->size(), *pRect);4633 mViewport = *pRect;4633 void VBoxGLWidget::vboxDoUpdateViewport(const QRect & aRect) 4634 { 4635 adjustViewport(mDisplay.getPrimary()->size(), aRect); 4636 mViewport = aRect; 4634 4637 4635 4638 const SurfList & primaryList = mDisplay.primaries().surfaces(); … … 4639 4642 { 4640 4643 VBoxVHWASurfaceBase *pSurf = *pr; 4641 pSurf->updateVisibleTargRect(NULL, *pRect);4644 pSurf->updateVisibleTargRect(NULL, aRect); 4642 4645 } 4643 4646 … … 4653 4656 { 4654 4657 VBoxVHWASurfaceBase *pSurf = *sit; 4655 pSurf->updateVisibleTargRect(mDisplay.getPrimary(), *pRect);4658 pSurf->updateVisibleTargRect(mDisplay.getPrimary(), aRect); 4656 4659 } 4657 4660 } … … 5229 5232 mGlOn(false), 5230 5233 mOverlayVisible(false), 5234 mGlCurrent(false), 5235 mProcessingCommands(false), 5231 5236 mCmdPipe(aView) 5232 5237 { … … 5252 5257 { 5253 5258 Q_UNUSED(pEvent); 5259 Assert(!mProcessingCommands); 5260 mProcessingCommands = true; 5261 Assert(!mGlCurrent); 5262 mGlCurrent = false; /* just a fall-back */ 5254 5263 VBoxVHWACommandElement * pFirst = mCmdPipe.detachCmdList(NULL, NULL); 5255 5264 do … … 5259 5268 pFirst = mCmdPipe.detachCmdList(pFirst, pLast); 5260 5269 } while(pFirst); 5270 5271 mProcessingCommands = false; 5272 vboxOpExit(); 5261 5273 } 5262 5274 … … 5264 5276 ULONG aW, ULONG aH) 5265 5277 { 5278 #if 1 5266 5279 QRect r(aX, aY, aW, aH); 5267 5280 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r); 5268 5281 return S_OK; 5282 #else 5283 /* We're not on the GUI thread and update() isn't thread safe in 5284 * Qt 4.3.x on the Win, Qt 3.3.x on the Mac (4.2.x is), 5285 * on Linux (didn't check Qt 4.x there) and probably on other 5286 * non-DOS platforms, so post the event instead. */ 5287 QApplication::postEvent (mView, 5288 new VBoxRepaintEvent (aX, aY, aW, aH)); 5289 5290 return S_OK; 5291 #endif 5292 } 5293 5294 bool VBoxQGLOverlayFrameBuffer::vboxDoCheckUpdateViewport() 5295 { 5296 Assert(0); 5297 // QRect vp(mView->contentsX(), mView->contentsY(), mpOverlayWidget->width(), mpOverlayWidget->height()); 5298 // if(vp != mpOverlayWidget->vboxViewport()) 5299 // { 5300 // mpOverlayWidget->vboxDoUpdateViewport(vp); 5301 // return true; 5302 // } 5303 return false; 5269 5304 } 5270 5305 5271 5306 void VBoxQGLOverlayFrameBuffer::paintEvent (QPaintEvent *pe) 5272 5307 { 5308 if(mOverlayVisible && !mProcessingCommands) 5309 { 5310 Assert(!mGlCurrent); 5311 vboxOpExit(); 5312 } 5313 5273 5314 VBoxQImageFrameBuffer::paintEvent (pe); 5274 5315 } … … 5280 5321 if(mGlOn) 5281 5322 { 5323 Assert(!mGlCurrent); 5324 mGlCurrent = false; 5325 makeCurrent(); 5282 5326 /* need to ensure we're in synch */ 5283 5327 vboxSynchGl(); 5284 } 5328 vboxOpExit(); 5329 Assert(mGlCurrent == false); 5330 } 5331 } 5332 5333 void VBoxQGLOverlayFrameBuffer::vboxDoVHWACmd(void *cmd) 5334 { 5335 vboxDoVHWACmdExec(cmd); 5336 5337 CDisplay display = mView->console().GetDisplay(); 5338 Assert (!display.isNull()); 5339 5340 display.CompleteVHWACommand((BYTE*)cmd); 5341 } 5342 5343 void VBoxQGLOverlayFrameBuffer::vboxDoUpdateRect(const QRect * pRect) 5344 { 5345 if(mGlOn) 5346 { 5347 makeCurrent(); 5348 mpOverlayWidget->vboxDoUpdateRect(pRect); 5349 // if(mOverlayVisible) 5350 // { 5351 // mpOverlayWidget->performDisplay(); 5352 // mpOverlayWidget->swapBuffers(); 5353 // } 5354 vboxOpExit(); 5355 } 5356 5357 mView->viewport()->repaint (pRect->x() - mView->contentsX(), 5358 pRect->y() - mView->contentsY(), 5359 pRect->width(), pRect->height()); 5360 5361 /* translate to widget coords 5362 * @todo: may eliminate this */ 5363 // QPaintEvent pe(pRect->translated(-mView->contentsX(), -mView->contentsY())); 5364 // VBoxQImageFrameBuffer::paintEvent (&pe); 5285 5365 } 5286 5366 … … 5324 5404 { 5325 5405 mpOverlayWidget->setVisible(show); 5406 mOverlayVisible = show; 5326 5407 } 5327 5408 5328 5409 void VBoxQGLOverlayFrameBuffer::vboxUpdateOverlayPosition(const QPoint & pos) 5329 5410 { 5411 makeCurrent(); 5412 5330 5413 mpOverlayWidget->move(pos); 5414 5415 /* */ 5416 QRect rect = mpOverlayWidget->vboxViewport(); 5417 rect.moveTo(pos); 5418 mpOverlayWidget->vboxDoUpdateViewport(rect); 5331 5419 } 5332 5420 … … 5335 5423 mpOverlayWidget->move(rect.x(), rect.y()); 5336 5424 mpOverlayWidget->resize(rect.width(), rect.height()); 5337 mpOverlayWidget->setVisible(show); 5425 5426 mpOverlayWidget->vboxDoUpdateViewport(rect); 5427 5428 vboxShowOverlay(show); 5338 5429 } 5339 5430 … … 5341 5432 { 5342 5433 struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd; 5434 makeCurrent(); 5343 5435 switch(pCmd->enmCmd) 5344 5436 { … … 5401 5493 vboxUpdateOverlay(overRect, true); 5402 5494 } 5495 else 5496 { 5497 vboxShowOverlay(false); 5498 } 5403 5499 } break; 5404 5500 case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION: … … 5452 5548 { 5453 5549 case VBOXVHWA_PIPECMD_PAINT: 5454 //vboxDoUpdateRect(&pCmd->rect());5550 vboxDoUpdateRect(&pCmd->rect()); 5455 5551 break; 5456 5552 #ifdef VBOX_WITH_VIDEOHWACCEL 5457 5553 case VBOXVHWA_PIPECMD_VHWA: 5458 //vboxDoVHWACmd(pCmd->vhwaCmd());5554 vboxDoVHWACmd(pCmd->vhwaCmd()); 5459 5555 break; 5460 5556 case VBOXVHWA_PIPECMD_OP:
Note:
See TracChangeset
for help on using the changeset viewer.