VirtualBox

Ignore:
Timestamp:
Sep 7, 2009 6:08:33 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52036
Message:

video 2d accel: move overlay functionality to a separate class/files, make it easy to reuse with different framebuffers

Location:
trunk/src/VBox/Frontends/VirtualBox/include
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h

    r22737 r22816  
    7272                     const CConsole &console,
    7373                     VBoxDefs::RenderMode rm,
     74#ifdef VBOX_WITH_VIDEOHWACCEL
     75                     bool accelerate2DVideo,
     76#endif
    7477                     QWidget *parent = 0);
    7578    ~VBoxConsoleView();
     
    295298
    296299    VBoxDefs::RenderMode mode;
     300#ifdef VBOX_WITH_VIDEOHWACCEL
     301    bool mAccelerate2DVideo;
     302#endif
    297303
    298304    QRegion mLastVisibleRegion;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h

    r22794 r22816  
    8484        InvalidRenderMode, TimerMode, QImageMode, SDLMode, DDRAWMode, Quartz2DMode
    8585#ifdef VBOX_GUI_USE_QGL
    86         , QGLMode, QGLOverlayMode
     86        , QGLMode
    8787#endif
    8888    };
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22800 r22816  
    3535#include <QMoveEvent>
    3636#if defined (VBOX_GUI_USE_QGL)
    37 #include <QGLWidget>
     37#include "VBoxFBOverlay.h"
    3838#endif
    3939
     
    296296#if defined (VBOX_GUI_USE_QGL)
    297297
    298 #ifdef DEBUG
    299 #include "iprt/stream.h"
    300 #define VBOXQGLLOG(_m) RTPrintf _m
    301 #define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
    302 #else
    303 #define VBOXQGLLOG(_m)
    304 #define VBOXQGLLOGREL(_m) LogRel( _m )
    305 #endif
    306 #define VBOXQGLLOG_ENTER(_m)
    307 //do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
    308 #define VBOXQGLLOG_EXIT(_m)
    309 //do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
    310 #ifdef DEBUG
    311 #define VBOXQGL_ASSERTNOERR() \
    312     do { GLenum err = glGetError(); \
    313         if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error ocured (0x%x)\n", err)); \
    314         Assert(err == GL_NO_ERROR); \
    315     }while(0)
    316 
    317 #define VBOXQGL_CHECKERR(_op) \
    318     do { \
    319         glGetError(); \
    320         _op \
    321         VBOXQGL_ASSERTNOERR(); \
    322     }while(0)
    323 #else
    324 #define VBOXQGL_ASSERTNOERR() \
    325     do {}while(0)
    326 
    327 #define VBOXQGL_CHECKERR(_op) \
    328     do { \
    329         _op \
    330     }while(0)
    331 #endif
    332 
    333 #ifdef DEBUG
    334 #include <iprt/time.h>
    335 
    336 #define VBOXGETTIME() RTTimeNanoTS()
    337 
    338 #define VBOXPRINTDIF(_nano, _m) do{\
    339         uint64_t cur = VBOXGETTIME(); \
    340         VBOXQGLLOG(_m); \
    341         VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
    342     }while(0)
    343 
    344 class VBoxVHWADbgTimeCounter
    345 {
    346 public:
    347     VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
    348     ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
    349 private:
    350     uint64_t mTime;
    351     const char* mMsg;
    352 };
    353 
    354 #define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
    355 #else
    356 #define VBOXQGLLOG_METHODTIME(_m)
    357 #endif
    358 
    359 #define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
    360     VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
    361     }while(0)
    362 
    363 #define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
    364     VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
    365     }while(0)
    366 
    367 class VBoxVHWADirtyRect
    368 {
    369 public:
    370     VBoxVHWADirtyRect() :
    371         mIsClear(true)
    372     {}
    373 
    374     VBoxVHWADirtyRect(const QRect & aRect)
    375     {
    376         if(aRect.isEmpty())
    377         {
    378             mIsClear = false;
    379             mRect = aRect;
    380         }
    381         else
    382         {
    383             mIsClear = true;
    384         }
    385     }
    386 
    387     bool isClear() const { return mIsClear; }
    388 
    389     void add(const QRect & aRect)
    390     {
    391         if(aRect.isEmpty())
    392             return;
    393 
    394         mRect = mIsClear ? aRect : mRect.united(aRect);
    395         mIsClear = false;
    396     }
    397 
    398     void add(const VBoxVHWADirtyRect & aRect)
    399     {
    400         if(aRect.isClear())
    401             return;
    402         add(aRect.rect());
    403     }
    404 
    405     void set(const QRect & aRect)
    406     {
    407         if(aRect.isEmpty())
    408         {
    409             mIsClear = true;
    410         }
    411         else
    412         {
    413             mRect = aRect;
    414             mIsClear = false;
    415         }
    416     }
    417 
    418     void clear() { mIsClear = true; }
    419 
    420     const QRect & rect() const {return mRect;}
    421 
    422     const QRect & toRect()
    423     {
    424         if(isClear())
    425         {
    426             mRect.setCoords(0, 0, -1, -1);
    427         }
    428         return mRect;
    429     }
    430 
    431     bool intersects(const QRect & aRect) const {return mIsClear ? false : mRect.intersects(aRect);}
    432 
    433     bool intersects(const VBoxVHWADirtyRect & aRect) const {return mIsClear ? false : aRect.intersects(mRect);}
    434 
    435     QRect united(const QRect & aRect) const {return mIsClear ? aRect : aRect.united(mRect);}
    436 
    437     bool contains(const QRect & aRect) const {return mIsClear ? false : aRect.contains(mRect);}
    438 
    439     void subst(const VBoxVHWADirtyRect & aRect) { if(!mIsClear && aRect.contains(mRect)) clear(); }
    440 
    441 private:
    442     QRect mRect;
    443     bool mIsClear;
    444 };
    445 
    446 class VBoxVHWAColorKey
    447 {
    448 public:
    449     VBoxVHWAColorKey() :
    450         mUpper(0),
    451         mLower(0)
    452     {}
    453 
    454     VBoxVHWAColorKey(uint32_t aUpper, uint32_t aLower) :
    455         mUpper(aUpper),
    456         mLower(aLower)
    457     {}
    458 
    459     uint32_t upper() const {return mUpper; }
    460     uint32_t lower() const {return mLower; }
    461 
    462     bool operator==(const VBoxVHWAColorKey & other) const { return mUpper == other.mUpper && mLower == other.mLower; }
    463 private:
    464     uint32_t mUpper;
    465     uint32_t mLower;
    466 };
    467 
    468 class VBoxVHWAColorComponent
    469 {
    470 public:
    471     VBoxVHWAColorComponent() :
    472         mMask(0),
    473         mRange(0),
    474         mOffset(32),
    475         mcBits(0)
    476     {}
    477 
    478     VBoxVHWAColorComponent(uint32_t aMask);
    479 
    480     uint32_t mask() const { return mMask; }
    481     uint32_t range() const { return mRange; }
    482     uint32_t offset() const { return mOffset; }
    483     uint32_t cBits() const { return mcBits; }
    484     uint32_t colorVal(uint32_t col) const { return (col & mMask) >> mOffset; }
    485     float colorValNorm(uint32_t col) const { return ((float)colorVal(col))/mRange; }
    486 private:
    487     uint32_t mMask;
    488     uint32_t mRange;
    489     uint32_t mOffset;
    490     uint32_t mcBits;
    491 };
    492 
    493 class VBoxVHWAColorFormat
    494 {
    495 public:
    496 
    497 //    VBoxVHWAColorFormat(GLint aInternalFormat, GLenum aFormat, GLenum aType, uint32_t aDataFormat);
    498     VBoxVHWAColorFormat(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
    499     VBoxVHWAColorFormat(uint32_t fourcc);
    500     VBoxVHWAColorFormat(){}
    501     GLint internalFormat() const {return mInternalFormat; }
    502     GLenum format() const {return mFormat; }
    503     GLenum type() const {return mType; }
    504     bool isValid() const {return mBitsPerPixel != 0; }
    505     uint32_t fourcc() const {return mDataFormat;}
    506     uint32_t bitsPerPixel() const { return mBitsPerPixel; }
    507     uint32_t bitsPerPixelTex() const { return mBitsPerPixelTex; }
    508 //    uint32_t bitsPerPixelDd() const { return mBitsPerPixelDd; }
    509     void pixel2Normalized(uint32_t pix, float *r, float *g, float *b) const;
    510     uint32_t widthCompression() const {return mWidthCompression;}
    511     uint32_t heightCompression() const {return mHeightCompression;}
    512     const VBoxVHWAColorComponent& r() const {return mR;}
    513     const VBoxVHWAColorComponent& g() const {return mG;}
    514     const VBoxVHWAColorComponent& b() const {return mB;}
    515     const VBoxVHWAColorComponent& a() const {return mA;}
    516 
    517     bool equals (const VBoxVHWAColorFormat & other) const;
    518 
    519 private:
    520     void init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
    521     void init(uint32_t fourcc);
    522 
    523     GLint mInternalFormat;
    524     GLenum mFormat;
    525     GLenum mType;
    526     uint32_t mDataFormat;
    527 
    528     uint32_t mBitsPerPixel;
    529     uint32_t mBitsPerPixelTex;
    530 //    uint32_t mBitsPerPixelDd;
    531     uint32_t mWidthCompression;
    532     uint32_t mHeightCompression;
    533     VBoxVHWAColorComponent mR;
    534     VBoxVHWAColorComponent mG;
    535     VBoxVHWAColorComponent mB;
    536     VBoxVHWAColorComponent mA;
    537 };
    538 
    539 class VBoxVHWATexture
    540 {
    541 public:
    542     VBoxVHWATexture() {}
    543     VBoxVHWATexture(const QRect & aRect, const VBoxVHWAColorFormat &aFormat);
    544     virtual ~VBoxVHWATexture();
    545     virtual void init(uchar *pvMem);
    546     void setAddress(uchar *pvMem) {mAddress = pvMem;}
    547     void update(const QRect * pRect) { doUpdate(mAddress, pRect);}
    548     void bind() {glBindTexture(texTarget(), mTexture);}
    549 
    550     virtual void texCoord(int x, int y);
    551     virtual void multiTexCoord(GLenum texUnit, int x, int y);
    552 
    553 //    GLuint texture() {return mTexture;}
    554     const QRect & texRect() {return mTexRect;}
    555     const QRect & rect() {return mRect;}
    556     uchar * address(){ return mAddress; }
    557     uint32_t rectSizeTex(const QRect * pRect) {return pRect->width() * pRect->height() * mBytesPerPixelTex;}
    558     uchar * pointAddress(int x, int y)
    559     {
    560         x = toXTex(x);
    561         y = toYTex(y);
    562         return pointAddressTex(x, y);
    563     }
    564     uint32_t pointOffsetTex(int x, int y) { return y*mBytesPerLine + x*mBytesPerPixelTex; }
    565     uchar * pointAddressTex(int x, int y) { return mAddress + pointOffsetTex(x, y); }
    566     int toXTex(int x) {return x/mColorFormat.widthCompression();}
    567     int toYTex(int y) {return y/mColorFormat.heightCompression();}
    568     ulong memSize(){ return mBytesPerLine * mRect.height(); }
    569     uint32_t bytesPerLine() {return mBytesPerLine; }
    570 
    571 protected:
    572     virtual void doUpdate(uchar * pAddress, const QRect * pRect);
    573     virtual void initParams();
    574     virtual void load();
    575     virtual GLenum texTarget() {return GL_TEXTURE_2D; }
    576 
    577 
    578     QRect mTexRect; /* texture size */
    579     QRect mRect; /* img size */
    580     uchar * mAddress;
    581     GLuint mTexture;
    582     uint32_t mBytesPerPixel;
    583     uint32_t mBytesPerPixelTex;
    584     uint32_t mBytesPerLine;
    585     VBoxVHWAColorFormat mColorFormat;
    586 private:
    587     void uninit();
    588 };
    589 
    590 class VBoxVHWATextureNP2 : public VBoxVHWATexture
    591 {
    592 public:
    593     VBoxVHWATextureNP2() : VBoxVHWATexture() {}
    594     VBoxVHWATextureNP2(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
    595         VBoxVHWATexture(aRect, aFormat){
    596         mTexRect = QRect(0, 0, aRect.width()/aFormat.widthCompression(), aRect.height()/aFormat.heightCompression());
    597     }
    598 };
    599 
    600 class VBoxVHWATextureNP2Rect : public VBoxVHWATextureNP2
    601 {
    602 public:
    603     VBoxVHWATextureNP2Rect() : VBoxVHWATextureNP2() {}
    604     VBoxVHWATextureNP2Rect(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
    605         VBoxVHWATextureNP2(aRect, aFormat){}
    606 
    607     virtual void texCoord(int x, int y);
    608     virtual void multiTexCoord(GLenum texUnit, int x, int y);
    609 protected:
    610     virtual GLenum texTarget();
    611 };
    612 
    613 class VBoxVHWATextureNP2RectPBO : public VBoxVHWATextureNP2Rect
    614 {
    615 public:
    616         VBoxVHWATextureNP2RectPBO() : VBoxVHWATextureNP2Rect() {}
    617         VBoxVHWATextureNP2RectPBO(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
    618                 VBoxVHWATextureNP2Rect(aRect, aFormat){}
    619     virtual ~VBoxVHWATextureNP2RectPBO();
    620 
    621     virtual void init(uchar *pvMem);
    622 protected:
    623     virtual void load();
    624     virtual void doUpdate(uchar * pAddress, const QRect * pRect);
    625 private:
    626     GLuint mPBO;
    627 };
    628 
    629 class VBoxVHWAHandleTable
    630 {
    631 public:
    632     VBoxVHWAHandleTable(uint32_t initialSize);
    633     ~VBoxVHWAHandleTable();
    634     uint32_t put(void * data);
    635     bool mapPut(uint32_t h, void * data);
    636     void* get(uint32_t h);
    637     void* remove(uint32_t h);
    638 private:
    639     void doPut(uint32_t h, void * data);
    640     void doRemove(uint32_t h);
    641     void** mTable;
    642     uint32_t mcSize;
    643     uint32_t mcUsage;
    644     uint32_t mCursor;
    645 };
    646 
    647 /* data flow:
    648  * I. NON-Yinverted surface:
    649  * 1.direct memory update (paint, lock/unlock):
    650  *  mem->tex->fb
    651  * 2.blt
    652  *  srcTex->invFB->tex->fb
    653  *              |->mem
    654  *
    655  * II. Yinverted surface:
    656  * 1.direct memory update (paint, lock/unlock):
    657  *  mem->tex->fb
    658  * 2.blt
    659  *  srcTex->fb->tex
    660  *           |->mem
    661  *
    662  * III. flip support:
    663  * 1. Yinverted<->NON-YInverted conversion :
    664  *  mem->tex-(rotate model view, force LAZY complete fb update)->invFB->tex
    665  *  fb-->|                                                           |->mem
    666  * */
    667 class VBoxVHWASurfaceBase
    668 {
    669 public:
    670     VBoxVHWASurfaceBase(
    671             class VBoxGLWidget *mWidget,
    672 #if 0
    673             class VBoxVHWAGlContextState *aState,
    674             bool aIsYInverted,
    675 #endif
    676             const QSize & aSize,
    677             const QRect & aTargRect,
    678             const QRect & aSrcRect,
    679             const QRect & aVisTargRect,
    680             VBoxVHWAColorFormat & aColorFormat,
    681             VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey,
    682             VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey,
    683             bool bVGA);
    684 
    685     virtual ~VBoxVHWASurfaceBase();
    686 
    687     void init(VBoxVHWASurfaceBase * pPrimary, uchar *pvMem);
    688 
    689     void uninit();
    690 
    691     static void globalInit();
    692 
    693 //    int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect, const VBoxVHWAColorKey * pDstCKeyOverride, const VBoxVHWAColorKey * pSrcCKeyOverride);
    694 
    695     int lock(const QRect * pRect, uint32_t flags);
    696 
    697     int unlock();
    698 
    699     void updatedMem(const QRect * aRect);
    700 
    701     void performDisplay(VBoxVHWASurfaceBase *pPrimary);
    702 
    703     void setRects(VBoxVHWASurfaceBase *pPrimary, const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisibleTargRect, bool bForceReinit);
    704     void setTargRectPosition(VBoxVHWASurfaceBase *pPrimary, const QPoint & aPoint, const QRect & aVisibleTargRect);
    705     void updateVisibleTargRect(VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect);
    706 
    707     static ulong calcBytesPerPixel(GLenum format, GLenum type);
    708 
    709     static GLsizei makePowerOf2(GLsizei val);
    710 
    711     bool    addressAlocated() const { return mFreeAddress; }
    712     uchar * address(){ return mAddress; }
    713 
    714     ulong   memSize();
    715 
    716     ulong width()  { return mRect.width();  }
    717     ulong height() { return mRect.height(); }
    718     const QSize size() {return mRect.size();}
    719 
    720     GLenum format() {return mColorFormat.format(); }
    721     GLint  internalFormat() { return mColorFormat.internalFormat(); }
    722     GLenum type() { return mColorFormat.type(); }
    723     uint32_t fourcc() {return mColorFormat.fourcc(); }
    724 
    725 //    ulong  bytesPerPixel() { return mpTex[0]->bytesPerPixel(); }
    726     ulong  bitsPerPixel() { return mColorFormat.bitsPerPixel(); }
    727 //    ulong  bitsPerPixelDd() { return mColorFormat.bitsPerPixelDd(); }
    728     ulong  bytesPerLine() { return mpTex[0]->bytesPerLine(); }
    729 
    730     const VBoxVHWAColorKey * dstBltCKey() const { return mpDstBltCKey; }
    731     const VBoxVHWAColorKey * srcBltCKey() const { return mpSrcBltCKey; }
    732     const VBoxVHWAColorKey * dstOverlayCKey() const { return mpDstOverlayCKey; }
    733     const VBoxVHWAColorKey * defaultSrcOverlayCKey() const { return mpDefaultSrcOverlayCKey; }
    734     const VBoxVHWAColorKey * defaultDstOverlayCKey() const { return mpDefaultDstOverlayCKey; }
    735     const VBoxVHWAColorKey * srcOverlayCKey() const { return mpSrcOverlayCKey; }
    736     void resetDefaultSrcOverlayCKey() { mpSrcOverlayCKey = mpDefaultSrcOverlayCKey; }
    737     void resetDefaultDstOverlayCKey() { mpDstOverlayCKey = mpDefaultDstOverlayCKey; }
    738 
    739     void setDstBltCKey(const VBoxVHWAColorKey * ckey)
    740     {
    741         if(ckey)
    742         {
    743             mDstBltCKey = *ckey;
    744             mpDstBltCKey = &mDstBltCKey;
    745         }
    746         else
    747         {
    748             mpDstBltCKey = NULL;
    749         }
    750     }
    751 
    752     void setSrcBltCKey(const VBoxVHWAColorKey * ckey)
    753     {
    754         if(ckey)
    755         {
    756             mSrcBltCKey = *ckey;
    757             mpSrcBltCKey = &mSrcBltCKey;
    758         }
    759         else
    760         {
    761             mpSrcBltCKey = NULL;
    762         }
    763     }
    764 
    765     void setDefaultDstOverlayCKey(const VBoxVHWAColorKey * ckey)
    766     {
    767         if(ckey)
    768         {
    769             mDefaultDstOverlayCKey = *ckey;
    770             mpDefaultDstOverlayCKey = &mDefaultDstOverlayCKey;
    771         }
    772         else
    773         {
    774             mpDefaultDstOverlayCKey = NULL;
    775         }
    776     }
    777 
    778     void setDefaultSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
    779     {
    780         if(ckey)
    781         {
    782             mDefaultSrcOverlayCKey = *ckey;
    783             mpDefaultSrcOverlayCKey = &mDefaultSrcOverlayCKey;
    784         }
    785         else
    786         {
    787             mpDefaultSrcOverlayCKey = NULL;
    788         }
    789     }
    790 
    791     void setOverriddenDstOverlayCKey(const VBoxVHWAColorKey * ckey)
    792     {
    793         if(ckey)
    794         {
    795             mOverriddenDstOverlayCKey = *ckey;
    796             mpDstOverlayCKey = &mOverriddenDstOverlayCKey;
    797         }
    798         else
    799         {
    800             mpDstOverlayCKey = NULL;
    801         }
    802     }
    803 
    804     void setOverriddenSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
    805     {
    806         if(ckey)
    807         {
    808             mOverriddenSrcOverlayCKey = *ckey;
    809             mpSrcOverlayCKey = &mOverriddenSrcOverlayCKey;
    810         }
    811         else
    812         {
    813             mpSrcOverlayCKey = NULL;
    814         }
    815     }
    816 
    817     const VBoxVHWAColorKey * getActiveSrcOverlayCKey()
    818     {
    819         return mpSrcOverlayCKey;
    820     }
    821 
    822     const VBoxVHWAColorKey * getActiveDstOverlayCKey(VBoxVHWASurfaceBase * pPrimary)
    823     {
    824         return mpDstOverlayCKey ? mpDefaultDstOverlayCKey : pPrimary->mpDstOverlayCKey;
    825     }
    826 
    827     const VBoxVHWAColorFormat & colorFormat() {return mColorFormat; }
    828 
    829     void setAddress(uchar * addr);
    830 
    831     const QRect& rect() const {return mRect;}
    832     const QRect& srcRect() const {return mSrcRect; }
    833     const QRect& targRect() const {return mTargRect; }
    834     class VBoxVHWASurfList * getComplexList() {return mComplexList; }
    835 
    836     class VBoxVHWAGlProgramMngr * getGlProgramMngr();
    837     static int setCKey(class VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst);
    838 
    839     uint32_t handle() const {return mHGHandle;}
    840     void setHandle(uint32_t h) {mHGHandle = h;}
    841 
    842 private:
    843     void doSetRectValuesInternal(const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisTargRect);
    844 
    845     void setComplexList(VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
    846     void initDisplay(VBoxVHWASurfaceBase *pPrimary);
    847     void deleteDisplay();
    848 
    849     GLuint createDisplay(VBoxVHWASurfaceBase *pPrimary);
    850     void doDisplay(VBoxVHWASurfaceBase *pPrimary, VBoxVHWAGlProgramVHWA * pProgram, bool bBindDst);
    851     void synchTexMem(const QRect * aRect);
    852 
    853     int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
    854 
    855     void doTex2FB(const QRect * pDstRect, const QRect * pSrcRect);
    856     void doMultiTex2FB(const QRect * pDstRect, VBoxVHWATexture * pDstTex, const QRect * pSrcRect, int cSrcTex);
    857     void doMultiTex2FB(const QRect * pDstRect, const QRect * pSrcRect, int cSrcTex);
    858 
    859     QRect mRect; /* == Inv FB size */
    860 
    861     QRect mSrcRect;
    862     QRect mTargRect; /* == Vis FB size */
    863 
    864     QRect mVisibleTargRect;
    865     QRect mVisibleSrcRect;
    866 
    867     GLuint mVisibleDisplay;
    868 
    869     bool mVisibleDisplayInitialized;
    870 
    871     uchar * mAddress;
    872     VBoxVHWATexture *mpTex[3];
    873 
    874     VBoxVHWAColorFormat mColorFormat;
    875 
    876     VBoxVHWAColorKey *mpSrcBltCKey;
    877     VBoxVHWAColorKey *mpDstBltCKey;
    878     VBoxVHWAColorKey *mpSrcOverlayCKey;
    879     VBoxVHWAColorKey *mpDstOverlayCKey;
    880 
    881     VBoxVHWAColorKey *mpDefaultDstOverlayCKey;
    882     VBoxVHWAColorKey *mpDefaultSrcOverlayCKey;
    883 
    884     VBoxVHWAColorKey mSrcBltCKey;
    885     VBoxVHWAColorKey mDstBltCKey;
    886     VBoxVHWAColorKey mOverriddenSrcOverlayCKey;
    887     VBoxVHWAColorKey mOverriddenDstOverlayCKey;
    888     VBoxVHWAColorKey mDefaultDstOverlayCKey;
    889     VBoxVHWAColorKey mDefaultSrcOverlayCKey;
    890 
    891     int mLockCount;
    892     /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
    893     VBoxVHWADirtyRect mUpdateMem2TexRect;
    894 
    895     bool mFreeAddress;
    896 
    897     class VBoxVHWASurfList *mComplexList;
    898 
    899     class VBoxGLWidget *mWidget;
    900 
    901     uint32_t mHGHandle;
    902 
    903 #ifdef DEBUG
    904 public:
    905     uint64_t cFlipsCurr;
    906     uint64_t cFlipsTarg;
    907 #endif
    908     friend class VBoxVHWASurfList;
    909 };
    910 
    911 typedef std::list <VBoxVHWASurfaceBase*> SurfList;
    912 typedef std::list <VBoxVHWASurfList*> OverlayList;
    913 typedef std::list <struct _VBOXVHWACMD *> VHWACommandList;
    914 
    915 class VBoxVHWASurfList
    916 {
    917 public:
    918 
    919     VBoxVHWASurfList() : mCurrent(NULL) {}
    920     void add(VBoxVHWASurfaceBase *pSurf)
    921     {
    922         VBoxVHWASurfList * pOld = pSurf->getComplexList();
    923         if(pOld)
    924         {
    925             pOld->remove(pSurf);
    926         }
    927         mSurfaces.push_back(pSurf);
    928         pSurf->setComplexList(this);
    929     }
    930 
    931     void clear()
    932     {
    933         for (SurfList::iterator it = mSurfaces.begin();
    934              it != mSurfaces.end(); ++ it)
    935         {
    936             (*it)->setComplexList(NULL);
    937         }
    938         mSurfaces.clear();
    939         mCurrent = NULL;
    940     }
    941 
    942     size_t size() const {return mSurfaces.size(); }
    943 
    944     void remove(VBoxVHWASurfaceBase *pSurf)
    945     {
    946         mSurfaces.remove(pSurf);
    947         pSurf->setComplexList(NULL);
    948         if(mCurrent == pSurf)
    949             mCurrent = NULL;
    950     }
    951 
    952     bool empty() { return mSurfaces.empty(); }
    953 
    954     void setCurrentVisible(VBoxVHWASurfaceBase *pSurf)
    955     {
    956         mCurrent = pSurf;
    957     }
    958 
    959     VBoxVHWASurfaceBase * current() { return mCurrent; }
    960     const SurfList & surfaces() const {return mSurfaces;}
    961 
    962 private:
    963 
    964     SurfList mSurfaces;
    965     VBoxVHWASurfaceBase* mCurrent;
    966 };
    967 
    968 class VBoxVHWADisplay
    969 {
    970 public:
    971     VBoxVHWADisplay() :
    972         mSurfVGA(NULL)
    973 //        ,
    974 //        mSurfPrimary(NULL)
    975     {}
    976 
    977     VBoxVHWASurfaceBase * setVGA(VBoxVHWASurfaceBase * pVga)
    978     {
    979         VBoxVHWASurfaceBase * old = mSurfVGA;
    980         mSurfVGA = pVga;
    981         mPrimary.clear();
    982         if(pVga)
    983         {
    984             Assert(!pVga->getComplexList());
    985             mPrimary.add(pVga);
    986             mPrimary.setCurrentVisible(pVga);
    987         }
    988 //        mSurfPrimary = pVga;
    989         mOverlays.clear();
    990         return old;
    991     }
    992 
    993     VBoxVHWASurfaceBase * updateVGA(VBoxVHWASurfaceBase * pVga)
    994     {
    995         VBoxVHWASurfaceBase * old = mSurfVGA;
    996         Assert(old);
    997         mSurfVGA = pVga;
    998         return old;
    999     }
    1000 
    1001     VBoxVHWASurfaceBase * getVGA() const
    1002     {
    1003         return mSurfVGA;
    1004     }
    1005 
    1006     VBoxVHWASurfaceBase * getPrimary()
    1007     {
    1008         return mPrimary.current();
    1009     }
    1010 
    1011     void addOverlay(VBoxVHWASurfList * pSurf)
    1012     {
    1013         mOverlays.push_back(pSurf);
    1014     }
    1015 
    1016     void checkAddOverlay(VBoxVHWASurfList * pSurf)
    1017     {
    1018         if(!hasOverlay(pSurf))
    1019             addOverlay(pSurf);
    1020     }
    1021 
    1022     bool hasOverlay(VBoxVHWASurfList * pSurf)
    1023     {
    1024         for (OverlayList::iterator it = mOverlays.begin();
    1025              it != mOverlays.end(); ++ it)
    1026         {
    1027             if((*it) == pSurf)
    1028             {
    1029                 return true;
    1030             }
    1031         }
    1032         return false;
    1033     }
    1034 
    1035     void removeOverlay(VBoxVHWASurfList * pSurf)
    1036     {
    1037         mOverlays.remove(pSurf);
    1038     }
    1039 
    1040     void performDisplay()
    1041     {
    1042         VBoxVHWASurfaceBase * pPrimary = mPrimary.current();
    1043         pPrimary->performDisplay(NULL);
    1044 
    1045         for (OverlayList::const_iterator it = mOverlays.begin();
    1046              it != mOverlays.end(); ++ it)
    1047         {
    1048             VBoxVHWASurfaceBase * pOverlay = (*it)->current();
    1049             if(pOverlay)
    1050             {
    1051                 pOverlay->performDisplay(pPrimary);
    1052             }
    1053         }
    1054     }
    1055 
    1056     const OverlayList & overlays() const {return mOverlays;}
    1057     const VBoxVHWASurfList & primaries() const { return mPrimary; }
    1058 
    1059 private:
    1060     VBoxVHWASurfaceBase *mSurfVGA;
    1061     VBoxVHWASurfList mPrimary;
    1062 
    1063     OverlayList mOverlays;
    1064 };
    1065 
    1066 typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
    1067 
    1068 typedef void (*PFNVBOXQGLFUNC)(void*, void*);
    1069 
    1070 typedef enum
    1071 {
    1072     VBOXVHWA_PIPECMD_PAINT = 1,
    1073     VBOXVHWA_PIPECMD_VHWA,
    1074     VBOXVHWA_PIPECMD_OP,
    1075     VBOXVHWA_PIPECMD_FUNC,
    1076 }VBOXVHWA_PIPECMD_TYPE;
    1077 
    1078 typedef struct VBOXVHWACALLBACKINFO
    1079 {
    1080     VBoxGLWidget *pThis;
    1081     PFNVBOXQGLOP pfnCallback;
    1082     void * pContext;
    1083 }VBOXVHWACALLBACKINFO;
    1084 
    1085 typedef struct VBOXVHWAFUNCCALLBACKINFO
    1086 {
    1087     PFNVBOXQGLFUNC pfnCallback;
    1088     void * pContext1;
    1089     void * pContext2;
    1090 }VBOXVHWAFUNCCALLBACKINFO;
    1091 
    1092 class VBoxVHWACommandElement
    1093 {
    1094 public:
    1095     void setVHWACmd(struct _VBOXVHWACMD * pCmd)
    1096     {
    1097         mType = VBOXVHWA_PIPECMD_VHWA;
    1098         u.mpCmd = pCmd;
    1099     }
    1100 
    1101     void setPaintCmd(const QRect & aRect)
    1102     {
    1103         mType = VBOXVHWA_PIPECMD_PAINT;
    1104         mRect = aRect;
    1105     }
    1106 
    1107     void setOp(const VBOXVHWACALLBACKINFO & aOp)
    1108     {
    1109         mType = VBOXVHWA_PIPECMD_OP;
    1110         u.mCallback = aOp;
    1111     }
    1112 
    1113     void setFunc(const VBOXVHWAFUNCCALLBACKINFO & aOp)
    1114     {
    1115         mType = VBOXVHWA_PIPECMD_FUNC;
    1116         u.mFuncCallback = aOp;
    1117     }
    1118 
    1119     void setData(VBOXVHWA_PIPECMD_TYPE aType, void * pvData)
    1120     {
    1121         switch(aType)
    1122         {
    1123         case VBOXVHWA_PIPECMD_PAINT:
    1124             setPaintCmd(*((QRect*)pvData));
    1125             break;
    1126         case VBOXVHWA_PIPECMD_VHWA:
    1127             setVHWACmd((struct _VBOXVHWACMD *)pvData);
    1128             break;
    1129         case VBOXVHWA_PIPECMD_OP:
    1130             setOp(*((VBOXVHWACALLBACKINFO *)pvData));
    1131             break;
    1132         case VBOXVHWA_PIPECMD_FUNC:
    1133             setFunc(*((VBOXVHWAFUNCCALLBACKINFO *)pvData));
    1134             break;
    1135         default:
    1136             Assert(0);
    1137             break;
    1138         }
    1139     }
    1140 
    1141     VBOXVHWA_PIPECMD_TYPE type() const {return mType;}
    1142     const QRect & rect() const {return mRect;}
    1143     struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;}
    1144     const VBOXVHWACALLBACKINFO & op() const {return u.mCallback; }
    1145     const VBOXVHWAFUNCCALLBACKINFO & func() const {return u.mFuncCallback; }
    1146 
    1147     VBoxVHWACommandElement * mpNext;
    1148 private:
    1149     VBOXVHWA_PIPECMD_TYPE mType;
    1150     union
    1151     {
    1152         struct _VBOXVHWACMD * mpCmd;
    1153         VBOXVHWACALLBACKINFO mCallback;
    1154         VBOXVHWAFUNCCALLBACKINFO mFuncCallback;
    1155     }u;
    1156     QRect                 mRect;
    1157 };
    1158 
    1159 class VBoxVHWACommandElementPipe
    1160 {
    1161 public:
    1162     VBoxVHWACommandElementPipe() :
    1163         mpFirst(NULL),
    1164         mpLast(NULL)
    1165     {}
    1166 
    1167     void put(VBoxVHWACommandElement *pCmd)
    1168     {
    1169         if(mpLast)
    1170         {
    1171             Assert(mpFirst);
    1172             mpLast->mpNext = pCmd;
    1173             mpLast = pCmd;
    1174         }
    1175         else
    1176         {
    1177             Assert(!mpFirst);
    1178             mpFirst = pCmd;
    1179             mpLast = pCmd;
    1180         }
    1181         pCmd->mpNext= NULL;
    1182 
    1183     }
    1184 
    1185     VBoxVHWACommandElement * detachList()
    1186     {
    1187         if(mpLast)
    1188         {
    1189             VBoxVHWACommandElement * pHead = mpFirst;
    1190             mpFirst = NULL;
    1191             mpLast = NULL;
    1192             return pHead;
    1193         }
    1194         return NULL;
    1195     }
    1196 private:
    1197     VBoxVHWACommandElement *mpFirst;
    1198     VBoxVHWACommandElement *mpLast;
    1199 };
    1200 
    1201 class VBoxVHWACommandElementStack
    1202 {
    1203 public:
    1204     VBoxVHWACommandElementStack() :
    1205         mpFirst(NULL) {}
    1206 
    1207     void push(VBoxVHWACommandElement *pCmd)
    1208     {
    1209         pCmd->mpNext = mpFirst;
    1210         mpFirst = pCmd;
    1211     }
    1212 
    1213     void pusha(VBoxVHWACommandElement *pFirst, VBoxVHWACommandElement *pLast)
    1214     {
    1215         pLast->mpNext = mpFirst;
    1216         mpFirst = pFirst;
    1217     }
    1218 
    1219     VBoxVHWACommandElement * pop()
    1220     {
    1221         if(mpFirst)
    1222         {
    1223             VBoxVHWACommandElement * ret = mpFirst;
    1224             mpFirst = ret->mpNext;
    1225             return ret;
    1226         }
    1227         return NULL;
    1228     }
    1229 private:
    1230     VBoxVHWACommandElement *mpFirst;
    1231 };
    1232 
    1233 class VBoxVHWACommandElementProcessor
    1234 {
    1235 public:
    1236     VBoxVHWACommandElementProcessor(VBoxConsoleView *aView);
    1237     ~VBoxVHWACommandElementProcessor();
    1238     void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData);
    1239     class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
    1240 
    1241 private:
    1242     RTCRITSECT mCritSect;
    1243     class VBoxVHWACommandProcessEvent *mpFirstEvent;
    1244     class VBoxVHWACommandProcessEvent *mpLastEvent;
    1245     VBoxConsoleView *mView;
    1246     bool mbNewEvent;
    1247     VBoxVHWACommandElementStack mFreeElements;
    1248     VBoxVHWACommandElement mElementsBuffer[2048];
    1249 };
    1250 
    1251 class VBoxVHWACommandsQueue
    1252 {
    1253 public:
    1254     void enqueue(PFNVBOXQGLFUNC pfn, void* pContext1, void* pContext2);
    1255 
    1256     VBoxVHWACommandElement * detachList();
    1257 
    1258     void freeList(VBoxVHWACommandElement * pList);
    1259 
    1260 private:
    1261     VBoxVHWACommandElementPipe mCmds;
    1262 };
    1263 
    1264 class VBoxGLWidget : public QGLWidget
    1265 {
    1266 public:
    1267     VBoxGLWidget (VBoxConsoleView *aView, QWidget *aParent);
    1268     ~VBoxGLWidget();
    1269 
    1270     ulong vboxPixelFormat() { return mPixelFormat; }
    1271     bool vboxUsesGuestVRAM() { return mUsesGuestVRAM; }
    1272 
    1273     uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; }
    1274 
    1275 #ifdef VBOX_WITH_VIDEOHWACCEL
    1276     uchar *vboxVRAMAddressFromOffset(uint64_t offset);
    1277     uint64_t vboxVRAMOffsetFromAddress(uchar* addr);
    1278     uint64_t vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf);
    1279 
    1280     void vhwaSaveExec(struct SSMHANDLE * pSSM);
    1281     int vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
    1282 
    1283     int vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd);
    1284     int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd);
    1285     int vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd);
    1286     int vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd);
    1287     int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
    1288     int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd);
    1289     int vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd);
    1290     int vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmf);
    1291     int vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd);
    1292     int vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd);
    1293     int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd);
    1294     int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd);
    1295     int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
    1296 
    1297     bool hasSurfaces() const;
    1298     bool hasVisibleOverlays();
    1299     const QRect & overlaysRectUnion();
    1300 #endif
    1301 
    1302     ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
    1303     ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }
    1304     int vboxFbWidth() {return mDisplay.getVGA()->width(); }
    1305     int vboxFbHeight() {return mDisplay.getVGA()->height(); }
    1306     bool vboxIsInitialized() {return mDisplay.getVGA() != NULL; }
    1307 
    1308 //    void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe); }
    1309     void vboxResizeEvent (VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re); }
    1310 
    1311     void vboxProcessVHWACommands(class VBoxVHWACommandElementProcessor * pPipe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pPipe);}
    1312 #ifdef VBOX_WITH_VIDEOHWACCEL
    1313     void vboxVHWACmd (struct _VBOXVHWACMD * pCmd) {vboxPerformGLOp(&VBoxGLWidget::vboxDoVHWACmd, pCmd);}
    1314 #endif
    1315     class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr() { return mpMngr; }
    1316 
    1317     VBoxVHWASurfaceBase * vboxGetVGASurface() { return mDisplay.getVGA(); }
    1318 
    1319     static void doSetupMatrix(const QSize & aSize, bool bInverted);
    1320 
    1321     void vboxDoUpdateViewport(const QRect & aRect);
    1322     void vboxDoUpdateRect(const QRect * pRect);
    1323 
    1324     const QRect & vboxViewport() const {return mViewport;}
    1325 
    1326     void performDisplay() { mDisplay.performDisplay(); }
    1327 protected:
    1328 
    1329     void paintGL()
    1330     {
    1331         if(mpfnOp)
    1332         {
    1333             (this->*mpfnOp)(mOpContext);
    1334             mpfnOp = NULL;
    1335         }
    1336 //        else
    1337 //        {
    1338             mDisplay.performDisplay();
    1339 //        }
    1340     }
    1341 
    1342     void initializeGL();
    1343 
    1344 private:
    1345     static void setupMatricies(const QSize &display);
    1346     static void adjustViewport(const QSize &display, const QRect &viewport);
    1347     void vboxDoResize(void *re);
    1348 //    void vboxDoPaint(void *rec);
    1349 
    1350 
    1351 #ifdef VBOXQGL_DBG_SURF
    1352     void vboxDoTestSurfaces(void *context);
    1353 #endif
    1354 #ifdef VBOX_WITH_VIDEOHWACCEL
    1355     void vboxDoVHWACmdExec(void *cmd);
    1356     void vboxDoVHWACmdAndFree(void *cmd);
    1357     void vboxDoVHWACmd(void *cmd);
    1358 
    1359     void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
    1360     {
    1361         if (pSurface->addressAlocated())
    1362         {
    1363             uchar * addr = vboxVRAMAddressFromOffset(offset);
    1364             if(addr)
    1365             {
    1366                 pSurface->setAddress(addr);
    1367             }
    1368         }
    1369     }
    1370 
    1371     int vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps);
    1372     int vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
    1373     int vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible);
    1374     int vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
    1375     void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd);
    1376 #endif
    1377     static const QGLFormat & vboxGLFormat();
    1378 
    1379     VBoxVHWADisplay mDisplay;
    1380 
    1381 
    1382     /* we do all opengl stuff in the paintGL context,
    1383      * submit the operation to be performed
    1384      * @todo: could be moved outside the updateGL */
    1385     void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext)
    1386     {
    1387         mpfnOp = pfn;
    1388         mOpContext = pContext;
    1389         updateGL();
    1390     }
    1391 
    1392 //    /* posts op to UI thread */
    1393 //    int vboxExecOpSynch(PFNVBOXQGLOP pfn, void* pContext);
    1394 //    void vboxExecOnResize(PFNVBOXQGLOP pfn, void* pContext);
    1395 
    1396     void vboxDoProcessVHWACommands(void *pContext);
    1397 
    1398     class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd);
    1399 
    1400     VBoxVHWASurfaceBase* handle2Surface(uint32_t h)
    1401     {
    1402         VBoxVHWASurfaceBase* pSurf = (VBoxVHWASurfaceBase*)mSurfHandleTable.get(h);
    1403         Assert(pSurf);
    1404         return pSurf;
    1405     }
    1406 
    1407     VBoxVHWAHandleTable mSurfHandleTable;
    1408 
    1409     PFNVBOXQGLOP mpfnOp;
    1410     void *mOpContext;
    1411 
    1412     ulong  mPixelFormat;
    1413     bool   mUsesGuestVRAM;
    1414 //    bool   mbVGASurfCreated;
    1415     QRect mViewport;
    1416 
    1417     VBoxConsoleView *mView;
    1418 
    1419     VBoxVHWASurfList *mConstructingList;
    1420     int32_t mcRemaining2Contruct;
    1421 
    1422     /* this is used in saved state restore to postpone surface restoration
    1423      * till the framebuffer size is restored */
    1424     VHWACommandList mOnResizeCmdList;
    1425 
    1426     class VBoxVHWAGlProgramMngr *mpMngr;
    1427 };
    1428 
    1429 
    1430298class VBoxQGLFrameBuffer : public VBoxFrameBuffer
    1431299{
     
    1445313#ifdef VBOX_WITH_VIDEOHWACCEL
    1446314    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
    1447 
    1448 
    1449     static bool isAcceleration2DVideoAvailable();
    1450315#endif
    1451316
     
    1463328private:
    1464329//    void vboxMakeCurrent();
    1465     VBoxGLWidget * vboxWidget();
    1466 
    1467     VBoxVHWACommandElementProcessor mCmdPipe;
     330    class VBoxGLWidget * vboxWidget();
     331
     332    class VBoxVHWACommandElementProcessor mCmdPipe;
    1468333};
    1469334
    1470335#ifdef VBOX_WITH_VIDEOHWACCEL
    1471 class VBoxQGLOverlayFrameBuffer : public VBoxQImageFrameBuffer
    1472 {
    1473 public:
    1474     VBoxQGLOverlayFrameBuffer (VBoxConsoleView *aView);
     336class VBoxQImageOverlayFrameBuffer : public VBoxQImageFrameBuffer
     337{
     338public:
     339    VBoxQImageOverlayFrameBuffer (VBoxConsoleView *aView);
    1475340
    1476341
     
    1484349    void paintEvent (QPaintEvent *pe);
    1485350    void resizeEvent (VBoxResizeEvent *re);
    1486 
    1487     void vboxUpdateRect(const QRect * pRect);
    1488 
    1489     int vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version);
    1490     void vhwaSaveExec(struct SSMHANDLE * pSSM);
    1491 private:
    1492     void makeCurrent()
    1493     {
    1494         if(!mGlCurrent)
    1495         {
    1496             mGlCurrent = true;
    1497             mpOverlayWidget->makeCurrent();
    1498         }
    1499     }
    1500 
    1501     void performDisplayOverlay()
    1502     {
    1503         if(mOverlayVisible)
    1504         {
    1505 #if 0
    1506             mpOverlayWidget->updateGL();
    1507 #else
    1508             makeCurrent();
    1509             mpOverlayWidget->performDisplay();
    1510             mpOverlayWidget->swapBuffers();
    1511 #endif
    1512         }
    1513     }
    1514 
    1515     void vboxOpExit()
    1516     {
    1517         performDisplayOverlay();
    1518         mGlCurrent = false;
    1519     }
    1520 
    1521 
    1522     void vboxSetGlOn(bool on);
    1523     bool vboxGetGlOn() { return mGlOn; }
    1524     void vboxSynchGl();
    1525     void vboxDoVHWACmdExec(void *cmd);
    1526     void vboxShowOverlay(bool show);
    1527     void vboxDoCheckUpdateViewport();
    1528     void vboxDoVHWACmd(void *cmd);
    1529     void vboxDoUpdateRect(const QRect * pRect);
    1530 //    void vboxUpdateOverlayPosition(const QPoint & pos);
    1531     void vboxCheckUpdateOverlay(const QRect & rect);
    1532     VBoxVHWACommandElement * processCmdList(VBoxVHWACommandElement * pCmd);
    1533 
    1534     int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
    1535 
    1536     VBoxGLWidget *mpOverlayWidget;
    1537     bool mGlOn;
    1538     bool mOverlayWidgetVisible;
    1539     bool mOverlayVisible;
    1540     bool mGlCurrent;
    1541     bool mProcessingCommands;
    1542     QRect mOverlayViewport;
    1543     VBoxVHWADirtyRect mMainDirtyRect;
    1544 
    1545     VBoxVHWACommandElementProcessor mCmdPipe;
    1546 
    1547     /* this is used in saved state restore to postpone surface restoration
    1548      * till the framebuffer size is restored */
    1549     VHWACommandList mOnResizeCmdList;
     351private:
     352    VBoxQGLOverlay mOverlay;
    1550353};
    1551354#endif
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r22794 r22816  
    750750#ifdef VBOX_WITH_VIDEOHWACCEL
    751751    static bool isAcceleration2DVideoAvailable();
    752     VBoxDefs::RenderMode vmAcceleration2DVideoRenderMode() {
    753 #if 0
    754         return VBoxDefs::QGLOverlayMode;
    755 #else
    756         return VBoxDefs::QGLMode;
    757 #endif
    758         }
     752//    VBoxDefs::RenderMode vmAcceleration2DVideoRenderMode() {
     753//#if 0
     754//        return VBoxDefs::QGLOverlayMode;
     755//#else
     756//        return VBoxDefs::QGLMode;
     757//#endif
     758//        }
    759759#endif
    760760
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette