VirtualBox

Ignore:
Timestamp:
Jun 17, 2009 9:26:02 AM (16 years ago)
Author:
vboxsync
Message:

video hw accel: fixes for basic ddraw op hanlding

File:
1 edited

Legend:

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

    r20478 r20653  
    327327public:
    328328    VBoxVHWADirtyRect() :
    329         mIsClear(false)
     329        mIsClear(true)
    330330    {}
    331331
     
    343343    }
    344344
    345     bool isClear() { return mIsClear; }
     345    bool isClear() const { return mIsClear; }
    346346
    347347    void add(const QRect & aRect)
     
    363363        {
    364364            mRect = aRect;
     365            mIsClear = false;
    365366        }
    366367    }
     
    368369    void clear() { mIsClear = true; }
    369370
    370     const QRect & rect() {return mRect;}
    371 
    372     bool intersects(const QRect & aRect) {return mIsClear ? false : mRect.intersects(aRect);}
     371    const QRect & rect() const {return mRect;}
     372
     373    bool intersects(const QRect & aRect) const {return mIsClear ? false : mRect.intersects(aRect);}
     374
     375    bool intersects(const VBoxVHWADirtyRect & aRect) const {return mIsClear ? false : aRect.intersects(mRect);}
     376
     377    QRect united(const QRect & aRect) const {return mIsClear ? aRect : aRect.united(mRect);}
     378
     379    bool contains(const QRect & aRect) const {return mIsClear ? false : aRect.contains(mRect);}
     380
     381    void subst(const VBoxVHWADirtyRect & aRect) { if(!mIsClear && aRect.contains(mRect)) clear(); }
    373382
    374383private:
     
    391400    static void globalInit();
    392401
    393     int blt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrtSurface, const QRect * pSrcRect);
    394 
    395     int lock(const QRect * pRect);
     402    int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect);
     403
     404    int lock(const QRect * pRect, uint32_t flags);
    396405
    397406    int unlock();
     
    399408    virtual void makeCurrent() = 0;
    400409
    401     void paint(const QRect * pRect);
     410    void paint(const QRect * aRect);
    402411
    403412    void performDisplay() { Assert(mDisplayInitialized); glCallList(mDisplay); }
     
    407416    static GLsizei makePowerOf2(GLsizei val);
    408417
     418    bool    addressAlocated() const { return mFreeAddress; }
    409419    uchar * address(){ return mAddress; }
    410420    uchar * pointAddress(int x, int y) { return mAddress + y*mBytesPerLine + x*mBytesPerPixel; }
    411     ulong   memSize(){ return mBytesPerLine * mDisplayHeight; }
    412 
    413     ulong width()  { return mDisplayWidth;  }
    414     ulong height() { return mDisplayHeight; }
     421    ulong   memSize(){ return mBytesPerLine * mRect.height(); }
     422
     423    ulong width()  { return mRect.width();  }
     424    ulong height() { return mRect.height(); }
    415425
    416426    GLenum format() {return mFormat; }
     
    420430    ulong  bytesPerLine() { return mBytesPerLine; }
    421431
    422     /* clients should treat the rerurned texture as read-only */
     432    /* clients should treat the returned texture as read-only */
    423433    GLuint textureSynched(const QRect * aRect) { synchTexture(aRect); return mTexture; }
    424434
     435    void setAddress(uchar * addr);
     436
     437    const QRect& rect() {return mRect;}
     438
     439    virtual bool isPrimary() = 0;
    425440private:
    426441    void initDisplay();
    427442    void deleteDisplay();
    428     void updateTexture(const QRect * pRect);
    429     void synchTexture(const QRect * pRect);
    430     void synchMem(const QRect * pRect);
     443    void updateTexture(const QRect * aRect);
     444    void synchTexture(const QRect * aRect);
     445    void synchMem(const QRect * aRect);
     446
     447    QRect mRect;
    431448
    432449    GLuint mDisplay;
     
    439456    GLint  mInternalFormat;
    440457    GLenum mType;
    441     ulong  mDisplayWidth;
    442     ulong  mDisplayHeight;
     458//    ulong  mDisplayWidth;
     459//    ulong  mDisplayHeight;
    443460    ulong  mBytesPerPixel;
    444461    ulong  mBytesPerLine;
    445462
    446     VBoxVHWADirtyRect mLockedRect;
     463    int mLockCount;
     464    /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
     465    VBoxVHWADirtyRect mUpdateMemRect;
    447466    /*in case of blit we blit from another surface's texture, so our current texture gets durty  */
    448467    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 */
     468    /*in case of blit the memory buffer does not get updated until we need it, e.g. for paint or lock operations */
    450469    VBoxVHWADirtyRect mUpdateFB2MemRect;
    451470
     
    464483    {}
    465484
     485    bool isPrimary() {return true;}
    466486    void makeCurrent();
    467487private:
     
    536556    bool usesGuestVRAM() { return vboxWidget()->vboxUsesGuestVRAM(); }
    537557
    538     uchar *address() { /*Assert(0); */return vboxWidget()->vboxAddress(); }
     558    uchar *address() { return vboxWidget()->vboxAddress(); }
    539559    ulong bitsPerPixel() { return vboxWidget()->vboxBitsPerPixel(); }
    540560    ulong bytesPerLine() { return vboxWidget()->vboxBytesPerLine(); }
     561
     562    uchar *vramAddressFromOffset(uint64_t offset);
    541563
    542564    void paintEvent (QPaintEvent *pe);
     
    548570private:
    549571#ifdef VBOX_WITH_VIDEOHWACCEL
     572    void checkUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
     573    {
     574        if (pSurface->addressAlocated())
     575        {
     576            uchar * addr = vramAddressFromOffset(offset);
     577            if(addr)
     578            {
     579                pSurface->setAddress(addr);
     580            }
     581        }
     582    }
    550583    int vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd);
    551584    int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd);
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