VirtualBox

Changeset 20349 in vbox


Ignore:
Timestamp:
Jun 5, 2009 9:26:13 PM (16 years ago)
Author:
vboxsync
Message:

Video HW Accel: blt, lock, unlock, destroySorface commands implementation for QGLFramebuffer

File:
1 edited

Legend:

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

    r20331 r20349  
    323323
    324324#if defined (VBOX_GUI_USE_QGL)
     325class VBoxVHWADirtyRect
     326{
     327public:
     328    VBoxVHWADirtyRect() :
     329        mIsClear(false)
     330    {}
     331
     332    VBoxVHWADirtyRect(const QRect & aRect)
     333    {
     334        if(aRect.isEmpty())
     335        {
     336            mIsClear = false;
     337            mRect = aRect;
     338        }
     339        else
     340        {
     341            mIsClear = true;
     342        }
     343    }
     344
     345    bool isClear() { return mIsClear; }
     346
     347    void add(const QRect & aRect)
     348    {
     349        if(aRect.isEmpty())
     350            return;
     351
     352        mRect = mIsClear ? aRect : mRect.united(aRect);
     353        mIsClear = false;
     354    }
     355
     356    void set(const QRect & aRect)
     357    {
     358        if(aRect.isEmpty())
     359        {
     360            mIsClear = true;
     361        }
     362        else
     363        {
     364            mRect = aRect;
     365        }
     366    }
     367
     368    void clear() { mIsClear = true; }
     369
     370    const QRect & rect() {return mRect;}
     371
     372    bool intersects(const QRect & aRect) {return mIsClear ? false : mRect.intersects(aRect);}
     373
     374private:
     375    QRect mRect;
     376    bool mIsClear;
     377};
    325378
    326379class VBoxVHWASurfaceBase
     
    338391    static void globalInit();
    339392
    340     int blt(VBoxVHWASurfaceBase * pToSurface, QRect * pSrcRect, QRect * pDstRect);
    341 
    342     int lock(QRect * pRect);
     393    int blt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrtSurface, const QRect * pSrcRect);
     394
     395    int lock(const QRect * pRect);
    343396
    344397    int unlock();
     
    355408
    356409    uchar * address(){ return mAddress; }
    357     ulong   bufferSize(){ return mBytesPerLine * mDisplayHeight; }
     410    uchar * pointAddress(int x, int y) { return mAddress + y*mBytesPerLine + x*mBytesPerPixel; }
     411    ulong   memSize(){ return mBytesPerLine * mDisplayHeight; }
    358412
    359413    ulong width()  { return mDisplayWidth;  }
     
    366420    ulong  bytesPerLine() { return mBytesPerLine; }
    367421
     422    /* clients should treat the rerurned texture as read-only */
     423    GLuint textureSynched(const QRect * aRect) { synchTexture(aRect); return mTexture; }
     424
    368425private:
    369426    void initDisplay();
    370427    void deleteDisplay();
    371428    void updateTexture(const QRect * pRect);
     429    void synchTexture(const QRect * pRect);
     430    void synchMem(const QRect * pRect);
    372431
    373432    GLuint mDisplay;
     
    385444    ulong  mBytesPerLine;
    386445
    387     QRect mLockedRect;
    388     bool mLocked;
     446    VBoxVHWADirtyRect mLockedRect;
     447    /*in case of blit we blit from another surface's texture, so our current texture gets durty  */
     448    VBoxVHWADirtyRect mUpdateFB2TexRect;
     449    /*in case of blit the memory buffer does not get updated until we need it, e.g. for pain or lock operations */
     450    VBoxVHWADirtyRect mUpdateFB2MemRect;
     451
    389452    bool mFreeAddress;
    390453};
     
    483546
    484547private:
     548#ifdef VBOX_WITH_VIDEOHWACCEL
     549    int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd);
     550    int vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd);
     551    int vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd);
     552    int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
     553    int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd);
     554#endif
    485555    void vboxMakeCurrent();
    486556    VBoxGLWidget * vboxWidget();
Note: See TracChangeset for help on using the changeset viewer.

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