VirtualBox

Changeset 22247 in vbox


Ignore:
Timestamp:
Aug 13, 2009 9:04:28 PM (15 years ago)
Author:
vboxsync
Message:

video hw accel: more saved state support impl, bugfixes

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxVideo.h

    r22215 r22247  
    257257#define VBOXVHWA_VERSION_MAJ 0
    258258#define VBOXVHWA_VERSION_MIN 0
    259 #define VBOXVHWA_VERSION_BLD 2
     259#define VBOXVHWA_VERSION_BLD 3
    260260#define VBOXVHWA_VERSION_RSV 0
    261261
     
    318318typedef unsigned int VBOXVHWACMD_LENGTH;
    319319typedef uint64_t VBOXVHWA_SURFHANDLE;
    320 #define VBOXVHWACMD_SURFHANDLE_INVALID 0
     320#define VBOXVHWA_SURFHANDLE_INVALID 0
    321321#define VBOXVHWACMD_BODY(_p, _t) ((_t*)(_p)->body)
    322322#define VBOXVHWACMD_HEAD(_pb) ((VBOXVHWACMD*)((uint8_t *)(_pb) - RT_OFFSETOF(VBOXVHWACMD, body)))
     
    387387    uint32_t surfCaps;
    388388    uint32_t Reserved2;
     389    VBOXVHWA_SURFHANDLE hSurf;
     390    uint64_t offSurface;
    389391} VBOXVHWA_SURFACEDESC;
    390392
     
    564566} VBOXVHWACMD_QUERYINFO2;
    565567
    566 #define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWAINFO2, FourCC[_cFourCC])
     568#define VBOXVHWAINFO2_SIZE(_cFourCC) RT_OFFSETOF(VBOXVHWACMD_QUERYINFO2, FourCC[_cFourCC])
    567569
    568570typedef struct _VBOXVHWACMD_SURF_CANCREATE
     
    587589{
    588590    VBOXVHWA_SURFACEDESC SurfInfo;
    589     union
    590     {
    591         struct
    592         {
    593             uint64_t offSurface;
    594         } in;
    595 
    596         struct
    597         {
    598             VBOXVHWA_SURFHANDLE hSurf;
    599         } out;
    600     } u;
    601591} VBOXVHWACMD_SURF_CREATE;
    602592
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c

    r22136 r22247  
    657657            if (lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
    658658            {
    659                 pBody->u.in.offSurface = 0;
     659                pBody->SurfInfo.offSurface = 0;
    660660            }
    661661            else
    662662            {
    663                 pBody->u.in.offSurface = VBOXVHWA_OFFSET64_VOID;
     663                pBody->SurfInfo.offSurface = VBOXVHWA_OFFSET64_VOID;
    664664            }
    665665
     
    674674                        uint32_t surfSizeX = pBody->SurfInfo.sizeX;
    675675                        uint32_t surfSizeY = pBody->SurfInfo.sizeY;
    676                     pDesc->hHostHandle = pBody->u.out.hSurf;
     676                    pDesc->hHostHandle = pBody->SurfInfo.hSurf;
    677677                    lpSurfaceGlobal->dwReserved1 = (ULONG_PTR)pDesc;
    678678                    lPitch = pBody->SurfInfo.pitch;
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r22136 r22247  
    109109    volatile uint32_t cPendingFlipsTarg;
    110110#ifdef DEBUG
    111     volatile uint64_t cFlipsCurr;
    112     volatile uint64_t cFlipsTarg;
     111    volatile uint32_t cFlipsCurr;
     112    volatile uint32_t cFlipsTarg;
    113113#endif
    114114//    uint32_t cBitsPerPixel;
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/vbox.c

    r22189 r22247  
    911911VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PPDEV ppdev, uint32_t numFourCC)
    912912{
    913     VBOXVHWACMD* pCmd = vboxVHWACommandCreate (ppdev, VBOXVHWACMD_TYPE_QUERY_INFO2, sizeof(VBOXVHWACMD_QUERYINFO2));
     913    VBOXVHWACMD* pCmd = vboxVHWACommandCreate (ppdev, VBOXVHWACMD_TYPE_QUERY_INFO2, VBOXVHWAINFO2_SIZE(numFourCC));
    914914    VBOXVHWACMD_QUERYINFO2 *pInfo2;
    915915    if (!pCmd)
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22215 r22247  
    123123    VBOXVHWA_PIPECMD_PAINT = 1,
    124124    VBOXVHWA_PIPECMD_VHWA,
    125 
     125    VBOXVHWA_PIPECMD_OP,
    126126}VBOXVHWA_PIPECMD_TYPE;
     127
     128typedef DECLCALLBACK(void) FNVBOXVHWACALLBACK(void * pContext);
     129typedef FNVBOXVHWACALLBACK *PFNVBOXVHWACALLBACK;
     130
     131typedef struct VBOXVHWACALLBACKINFO
     132{
     133    PFNVBOXVHWACALLBACK pfnCallback;
     134    void * pContext;
     135}VBOXVHWACALLBACKINFO;
    127136class VBoxVHWACommandElement
    128137{
     
    131140    {
    132141        mType = VBOXVHWA_PIPECMD_VHWA;
    133         mpCmd = pCmd;
     142        u.mpCmd = pCmd;
    134143    }
    135144
     
    138147        mType = VBOXVHWA_PIPECMD_PAINT;
    139148        mRect = aRect;
     149    }
     150
     151    void setOp(const VBOXVHWACALLBACKINFO & aOp)
     152    {
     153        mType = VBOXVHWA_PIPECMD_OP;
     154        u.mCallback = aOp;
    140155    }
    141156
     
    150165            setVHWACmd((struct _VBOXVHWACMD *)pvData);
    151166            break;
     167        case VBOXVHWA_PIPECMD_OP:
     168            setOp(*((VBOXVHWACALLBACKINFO *)pvData));
     169            break;
     170        default:
     171            Assert(0);
     172            break;
    152173        }
    153174    }
     
    155176    VBOXVHWA_PIPECMD_TYPE type() const {return mType;}
    156177    const QRect & rect() const {return mRect;}
    157     struct _VBOXVHWACMD * vhwaCmd() const {return mpCmd;}
     178    struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;}
    158179
    159180private:
    160181    VBoxVHWACommandElement * mpNext;
    161182    VBOXVHWA_PIPECMD_TYPE mType;
    162     struct _VBOXVHWACMD * mpCmd;
     183    union
     184    {
     185        struct _VBOXVHWACMD * mpCmd;
     186        VBOXVHWACALLBACKINFO mCallback;
     187    }u;
    163188    QRect                 mRect;
    164189
     
    756781};
    757782
     783class VBoxVHWAHandleTable
     784{
     785public:
     786    VBoxVHWAHandleTable(uint32_t initialSize);
     787    ~VBoxVHWAHandleTable();
     788    uint32_t put(void * data);
     789    bool mapPut(uint32_t h, void * data);
     790    void* get(uint32_t h);
     791    void* remove(uint32_t h);
     792private:
     793    void doPut(uint32_t h, void * data);
     794    void doRemove(uint32_t h);
     795    void** mTable;
     796    uint32_t mcSize;
     797    uint32_t mcUsage;
     798    uint32_t mCursor;
     799};
     800
    758801/* data flow:
    759802 * I. NON-Yinverted surface:
     
    935978    const VBoxVHWAColorFormat & colorFormat() {return mColorFormat; }
    936979
    937     /* clients should treat the returned texture as read-only */
    938 //    GLuint textureSynched(const QRect * aRect) { /*synchTex(aRect); */synchTexMem(aRect);  return mTexture; }
    939 
    940980    void setAddress(uchar * addr);
    941981
    942982    const QRect& rect() {return mRect;}
    943 //    const QRect& texRect() {return mTexRect;}
    944 
    945 //    /* surface currently being displayed in a flip chain */
    946 //    virtual bool isPrimary() = 0;
    947 //    /* surface representing the main framebuffer. */
    948 //    virtual bool isMainFramebuffer() = 0;
    949 #if 0
    950     virtual void makeCurrent() = 0;
    951     virtual void makeYInvertedCurrent() = 0;
    952     bool isYInverted() {return mIsYInverted; }
    953 
    954     bool isHidden() {return mIsYInverted; }
    955     void setHidden(bool hidden)
    956     {
    957         if(hidden == mIsYInverted)
    958             return;
    959 
    960         invert();
    961     }
    962     int invert();
    963 
    964     bool isFrontBuffer() {return !mIsYInverted; }
    965 #endif
    966983
    967984    class VBoxVHWASurfList * getComplexList() {return mComplexList; }
     
    969986    class VBoxVHWAGlProgramMngr * getGlProgramMngr();
    970987    static int setCKey(class VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst);
     988
     989    uint64_t handle() {return mHGHandle;}
     990    void setHandle(uint64_t h) {mHGHandle = h;}
    971991private:
    972992    void setComplexList(VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
    973993    void initDisplay(VBoxVHWASurfaceBase *pPrimary);
    974994    void deleteDisplay();
    975 //    void initDisplay(bool bInverted);
    976 //    void deleteDisplay(bool bInverted);
    977     GLuint createDisplay(VBoxVHWASurfaceBase *pPrimary
    978 #if 0
    979             bool bInverted
    980 #endif
    981             );
     995
     996    GLuint createDisplay(VBoxVHWASurfaceBase *pPrimary);
    982997    void doDisplay(VBoxVHWASurfaceBase *pPrimary, VBoxVHWAGlProgramVHWA * pProgram, bool bBindDst);
    983998    void synchTexMem(const QRect * aRect);
    984 #if 0
    985     void synchTex(const QRect * aRect);
    986     void synchTexFB(const QRect * aRect);
    987     void synchMem(const QRect * aRect);
    988     void synchFB(const QRect * aRect);
    989     void synch(const QRect * aRect);
    990 #endif
     999
    9911000    int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
    9921001
    993 //    void doTex2FB(const QRect * aRect);
    9941002    void doTex2FB(const QRect * pDstRect, const QRect * pSrcRect);
    9951003    void doMultiTex2FB(const QRect * pDstRect, VBoxVHWATexture * pDstTex, const QRect * pSrcRect, int cSrcTex);
    9961004    void doMultiTex2FB(const QRect * pDstRect, const QRect * pSrcRect, int cSrcTex);
    997 //    void doMultiTex2FB(GLenum tex, const QRect * pDstRect, const QRect * pSrcRect);
    9981005
    9991006    void doSetupMatrix(const QSize * pSize , bool bInverted);
    10001007
    10011008    QRect mRect; /* == Inv FB size */
    1002 //    QRect mTexRect; /* texture size */
    10031009
    10041010    QRect mSrcRect;
    10051011    QRect mTargRect; /* == Vis FB size */
    10061012    QRect mTargSize;
    1007 #if 0
    1008     GLuint mYInvertedDisplay;
    1009 #endif
     1013
    10101014    GLuint mVisibleDisplay;
    1011 #if 0
    1012     bool mYInvertedDisplayInitialized;
    1013 #endif
     1015
    10141016    bool mVisibleDisplayInitialized;
    10151017
     
    10371039    /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
    10381040    VBoxVHWADirtyRect mUpdateMem2TexRect;
    1039 #if 0
    1040     /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
    1041     VBoxVHWADirtyRect mUpdateTex2FBRect;
    1042     /*in case of blit we blit from another surface's texture, so our current texture gets durty  */
    1043     VBoxVHWADirtyRect mUpdateFB2TexRect;
    1044     /*in case of blit the memory buffer does not get updated until we need it, e.g. for paint or lock operations */
    1045     VBoxVHWADirtyRect mUpdateFB2MemRect;
    1046 #endif
    10471041
    10481042    bool mFreeAddress;
    1049 #if 0
    1050     bool mIsYInverted;
    1051 #endif
    10521043
    10531044    class VBoxVHWASurfList *mComplexList;
     
    10551046    class VBoxGLWidget *mWidget;
    10561047
     1048    uint64_t mHGHandle;
    10571049protected:
    1058 #if 0
    1059     virtual void init(uchar *pvMem, bool bInverted);
    1060     class VBoxVHWAGlContextState *mState;
    1061 #endif
    10621050
    10631051    friend class VBoxVHWASurfList;
     
    12161204};
    12171205
     1206typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
     1207
    12181208class VBoxGLWidget : public QGLWidget
    12191209{
     
    12361226    ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
    12371227    ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : NULL; }
    1238 
    1239 typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
    12401228
    12411229    void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe);}
     
    12761264#endif
    12771265#ifdef VBOX_WITH_VIDEOHWACCEL
     1266    void vboxDoVHWACmdExec(void *cmd);
    12781267    void vboxDoVHWACmd(void *cmd);
     1268
    12791269    void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
    12801270    {
     
    13251315    void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext) {mpfnOp = pfn; mOpContext = pContext; updateGL();}
    13261316
     1317    /* posts op to UI thread */
     1318    int vboxExecOpSynch(PFNVBOXQGLOP pfn, void* pContext);
     1319
    13271320    void cmdPipeInit();
    13281321    void cmdPipeDelete();
     
    13311324    VBoxVHWACommandElement * detachCmdList(VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
    13321325    VBoxVHWACommandElement * processCmdList(VBoxVHWACommandElement * pCmd);
     1326
     1327    VBoxVHWASurfaceBase* handle2Surface(uint32_t h) { return (VBoxVHWASurfaceBase*)mSurfHandleTable.get(h); }
     1328
     1329    VBoxVHWAHandleTable mSurfHandleTable;
    13331330
    13341331    PFNVBOXQGLOP mpfnOp;
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