Changeset 21253 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 6, 2009 2:29:39 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49581
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h ¶
r20985 r21253 354 354 } 355 355 356 void add(const VBoxVHWADirtyRect & aRect) 357 { 358 if(aRect.isClear()) 359 return; 360 add(aRect.rect()); 361 } 362 356 363 void set(const QRect & aRect) 357 364 { … … 464 471 }; 465 472 473 /* data flow: 474 * I. NON-Yinverted surface: 475 * 1.direct memory update (paint, lock/unlock): 476 * mem->tex->fb 477 * 2.blt 478 * srcTex->invFB->tex->fb 479 * |->mem 480 * 481 * II. Yinverted surface: 482 * 1.direct memory update (paint, lock/unlock): 483 * mem->tex->fb 484 * 2.blt 485 * srcTex->fb->tex 486 * |->mem 487 * */ 466 488 class VBoxVHWASurfaceBase 467 489 { 468 490 public: 469 VBoxVHWASurfaceBase( GLsizei aWidth, GLsizei aHeight,491 VBoxVHWASurfaceBase(class VBoxVHWAGlContextState *aState, bool aIsYInverted, GLsizei aWidth, GLsizei aHeight, 470 492 VBoxVHWAColorFormat & aColorFormat, 471 493 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, … … 518 540 519 541 /* clients should treat the returned texture as read-only */ 520 GLuint textureSynched(const QRect * aRect) { synchTex ture(aRect); return mTexture; }542 GLuint textureSynched(const QRect * aRect) { synchTex(aRect); return mTexture; } 521 543 522 544 void setAddress(uchar * addr); … … 529 551 // virtual bool isMainFramebuffer() = 0; 530 552 virtual void makeCurrent() = 0; 553 virtual void makeYInvertedCurrent() = 0; 554 555 bool isYInverted() {return mIsYInverted; } 556 531 557 #ifdef VBOX_WITH_VIDEOHWACCEL 532 558 virtual class VBoxVHWAGlProgramMngr * getGlProgramMngr() = 0; … … 536 562 void initDisplay(); 537 563 void deleteDisplay(); 538 void updateTexture(const QRect * aRect); 539 void synchTexture(const QRect * aRect); 564 void synchTex(const QRect * aRect); 565 void synchTexMem(const QRect * aRect); 566 void synchTexFB(const QRect * aRect); 540 567 void synchMem(const QRect * aRect); 568 void synchFB(const QRect * aRect); 569 570 void doTex2FB(const QRect * aRect); 571 572 541 573 542 574 QRect mRect; … … 567 599 int mLockCount; 568 600 /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock */ 569 VBoxVHWADirtyRect mUpdateMemRect; 601 VBoxVHWADirtyRect mUpdateMem2TexRect; 602 /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock */ 603 VBoxVHWADirtyRect mUpdateTex2FBRect; 570 604 /*in case of blit we blit from another surface's texture, so our current texture gets durty */ 571 605 VBoxVHWADirtyRect mUpdateFB2TexRect; … … 574 608 575 609 bool mFreeAddress; 610 611 bool mIsYInverted; 612 typedef std::list <VBoxVHWASurfaceBase*> OverlayList; 613 VBoxVHWASurfaceBase * mOverlayed; 614 OverlayList mOverlays; 615 protected: 616 virtual void init(uchar *pvMem, bool bInverted); 617 618 class VBoxVHWAGlContextState *mState; 619 620 }; 621 622 class VBoxVHWAGlContextState 623 { 624 public: 625 VBoxVHWAGlContextState() : mContext(NULL), mInverted(false) {} 626 627 void assertCurrent(class VBoxVHWASurfaceBase *aContext, bool bInverted) 628 { 629 mContext = aContext; 630 if(aContext && aContext->isYInverted()) 631 { 632 mInverted = true; 633 } 634 else 635 { 636 mInverted = bInverted; 637 } 638 } 639 640 void makeYInvertedCurrent(class VBoxVHWASurfaceBase *aContext) 641 { 642 if(mContext != aContext) 643 { 644 // aContext->makeCurrent(); 645 aContext->makeYInvertedCurrent(); 646 assertCurrent(aContext, true); 647 } 648 else 649 { 650 if(!aContext->isYInverted() && !mInverted) 651 { 652 // aContext->makeCurrent(); 653 aContext->makeYInvertedCurrent(); 654 mInverted = true; 655 } 656 } 657 } 658 659 void makeCurrent(class VBoxVHWASurfaceBase *aContext) 660 { 661 if(mContext != aContext) 662 { 663 aContext->makeCurrent(); 664 assertCurrent(aContext, false); 665 } 666 else 667 { 668 if(!aContext->isYInverted() && mInverted) 669 { 670 aContext->makeCurrent(); 671 mInverted = false; 672 } 673 } 674 } 675 676 class VBoxVHWASurfaceBase * getCurrent() {return mContext; } 677 bool isCurrentYInverted() {return mInverted; } 678 679 private: 680 681 class VBoxVHWASurfaceBase *mContext; 682 bool mInverted; 576 683 }; 577 684 … … 579 686 { 580 687 public: 581 VBoxVHWASurfaceQGL( GLsizei aWidth, GLsizei aHeight,688 VBoxVHWASurfaceQGL(class VBoxVHWAGlContextState *aState, GLsizei aWidth, GLsizei aHeight, 582 689 VBoxVHWAColorFormat & aColorFormat, 583 690 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, 584 691 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey, 585 692 class VBoxGLWidget *pWidget, 586 bool b BackBuffer) :587 VBoxVHWASurfaceBase(a Width, aHeight,693 bool bInvisibleBuffer) : 694 VBoxVHWASurfaceBase(aState, bInvisibleBuffer, aWidth, aHeight, 588 695 aColorFormat, 589 696 pSrcBltCKey, pDstBltCKey, pSrcOverlayCKey, pDstOverlayCKey), 590 697 mWidget(pWidget), 591 m CreateBuf(bBackBuffer)698 mBuffer(NULL) 592 699 {} 593 700 701 ~VBoxVHWASurfaceQGL(); 702 594 703 void makeCurrent(); 704 void makeYInvertedCurrent(); 595 705 596 706 void init(uchar *pvMem); 707 708 void uninit(); 709 710 int flip(VBoxVHWASurfaceQGL * aCurrSurface); 597 711 598 712 // int unlock() … … 609 723 class VBoxGLWidget *mWidget; 610 724 class QGLPixelBuffer *mBuffer; 611 bool mCreateBuf; 725 protected: 726 virtual void init(uchar *pvMem, bool bInverted); 612 727 }; 613 728 … … 631 746 void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe);} 632 747 void vboxResizeEvent (VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re);} 748 #ifdef DEBUG_misha 749 void vboxTestSurfaces () {vboxPerformGLOp(&VBoxGLWidget::vboxDoTestSurfaces, NULL);} 750 #endif 633 751 #ifdef VBOX_WITH_VIDEOHWACCEL 634 752 void vboxVHWACmd (struct _VBOXVHWACMD * pCmd) {vboxPerformGLOp(&VBoxGLWidget::vboxDoVHWACmd, pCmd);} … … 640 758 // void resizeGL (int height, int width); 641 759 642 void paintGL() { (this->*mpfnOp)(mOpContext); } 760 void paintGL() 761 { 762 Assert(mState.getCurrent() == NULL); 763 /* we are called with QGLWidget context */ 764 mState.assertCurrent(pDisplay, false); 765 (this->*mpfnOp)(mOpContext); 766 /* restore the context */ 767 mState.makeCurrent(pDisplay); 768 /* clear*/ 769 mState.assertCurrent(NULL, false); 770 } 643 771 644 772 void initializeGL(); … … 650 778 void vboxDoResize(void *re); 651 779 void vboxDoPaint(void *rec); 780 #ifdef DEBUG_misha 781 void vboxDoTestSurfaces(void *context); 782 #endif 652 783 #ifdef VBOX_WITH_VIDEOHWACCEL 653 784 void vboxDoVHWACmd(void *cmd); … … 669 800 int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd); 670 801 int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd); 802 int vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd); 671 803 int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd); 672 804 int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd); … … 674 806 675 807 VBoxVHWASurfaceQGL * pDisplay; 808 676 809 /* we need to do all opengl stuff in the paintGL context, 677 810 * submit the operation to be performed */ … … 684 817 ulong mPixelFormat; 685 818 bool mUsesGuestVRAM; 819 820 VBoxVHWAGlContextState mState; 686 821 687 822 #ifdef VBOX_WITH_VIDEOHWACCEL … … 718 853 719 854 private: 720 void vboxMakeCurrent();855 // void vboxMakeCurrent(); 721 856 VBoxGLWidget * vboxWidget(); 722 857 };
Note:
See TracChangeset
for help on using the changeset viewer.