VirtualBox

Changeset 22215 in vbox


Ignore:
Timestamp:
Aug 13, 2009 12:41:04 AM (15 years ago)
Author:
vboxsync
Message:

video hw accel: basics for saved state support

Location:
trunk
Files:
6 edited

Legend:

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

    r22189 r22215  
    257257#define VBOXVHWA_VERSION_MAJ 0
    258258#define VBOXVHWA_VERSION_MIN 0
    259 #define VBOXVHWA_VERSION_BLD 1
     259#define VBOXVHWA_VERSION_BLD 2
    260260#define VBOXVHWA_VERSION_RSV 0
    261261
     
    275275    VBOXVHWACMD_TYPE_QUERY_INFO2,
    276276    VBOXVHWACMD_TYPE_ENABLE,
    277     VBOXVHWACMD_TYPE_DISABLE
     277    VBOXVHWACMD_TYPE_DISABLE,
     278    VBOXVHWACMD_TYPE_HH_CONSTRUCT
    278279} VBOXVHWACMD_TYPE;
    279280
     
    291292/* the host has copied the VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION command and returned it to the guest */
    292293#define VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED      0x00020000
     294/* this is the host->host cmd, i.e. a configuration command posted by the host to the framebuffer */
     295#define VBOXVHWACMD_FLAG_HH_CMD                  0x10000000
    293296
    294297typedef struct _VBOXVHWACMD
     
    300303    uint64_t GuestVBVAReserved1; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
    301304    uint64_t GuestVBVAReserved2; /* field internally used by the guest VBVA cmd handling, must NOT be modified by clients */
     305    volatile uint32_t cRefs;
     306    int32_t Reserved;
    302307    union
    303308    {
     
    729734    } u;
    730735} VBOXVHWACMD_SURF_OVERLAY_SETPOSITION;
     736
     737typedef struct _VBOXVHWACMD_HH_CONSTRUCT
     738{
     739    void * pVM;
     740} VBOXVHWACMD_HH_CONSTRUCT;
    731741
    732742#pragma pack()
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r21957 r22215  
    52915291{
    52925292    vga_save(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE));
     5293#ifdef VBOX_WITH_VIDEOHWACCEL
     5294    return vbvaVHWASaveStateExec(pDevIns, pSSMHandle);
     5295#else
    52935296    return VINF_SUCCESS;
    5294 }
    5295 
     5297#endif
     5298}
     5299
     5300#ifdef VBOX_WITH_VIDEOHWACCEL
     5301static DECLCALLBACK(int) vgaR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     5302{
     5303    return vbvaVHWASaveStatePrep(pDevIns, pSSM);
     5304}
     5305#endif
    52965306
    52975307/**
     
    53035313 * @param   u32Version  The data unit version number.
    53045314 */
    5305 static DECLCALLBACK(int) vgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
     5315static DECLCALLBACK(int) vgaR3xec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
    53065316{
    53075317    if (vga_load(pSSMHandle, PDMINS_2_DATA(pDevIns, PVGASTATE), u32Version))
    53085318        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     5319#ifdef VBOX_WITH_VIDEOHWACCEL
     5320    return vbvaVHWALoadStateExec(pDevIns, pSSMHandle);
     5321#else
    53095322    return VINF_SUCCESS;
     5323#endif
    53105324}
    53115325
     
    55465560                        rc = VERR_INTERNAL_ERROR;
    55475561                    }
     5562#ifdef VBOX_WITH_VIDEOHWACCEL
     5563                    if(rc == VINF_SUCCESS)
     5564                    {
     5565                        rc = vbvaVHWAConstruct(pThis);
     5566                        Assert(RT_SUCCESS(rc));
     5567                    }
     5568#endif
    55485569                }
    55495570                else
     
    59225943    /* save */
    59235944    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, VGA_SAVEDSTATE_VERSION,
    5924                               sizeof(*pThis), NULL, vgaR3SaveExec, NULL, NULL, vgaR3LoadExec, NULL);
     5945                              sizeof(*pThis),
     5946#ifdef VBOX_WITH_VIDEOHWACCEL
     5947                              NULL, vgaR3SaveExec, NULL,
     5948#else
     5949                              NULL, vgaR3SaveExec, NULL,
     5950#endif
     5951                              NULL, vgaR3xec, NULL);
    59255952    if (RT_FAILURE(rc))
    59265953        return rc;
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r20444 r22215  
    453453# ifdef VBOX_WITH_VIDEOHWACCEL
    454454int vbvaVHWACommandCompleteAsynch(PPDMDDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
     455
     456int vbvaVHWAConstruct (PVGASTATE pVGAState);
     457int vbvaVHWADisable (PVGASTATE pVGAState);
     458int vbvaVHWASaveStatePrep (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
     459int vbvaVHWASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
     460int vbvaVHWALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
    455461# endif
    456462#endif /* VBOX_WITH_HGSMI */
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r22099 r22215  
    203203VirtualBox_LIBS = $(LIB_DDU)
    204204
     205ifdef VBOX_WITH_VIDEOHWACCEL
     206# Necessary for save state support
     207VirtualBox_LIBS += $(LIB_VMM)
     208endif
    205209ifeq ($(KBUILD_TYPE),release)
    206210 VirtualBox_LDFLAGS.win  += /SUBSYSTEM:windows
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22189 r22215  
    640640    uint32_t widthCompression() const {return mWidthCompression;}
    641641    uint32_t heightCompression() const {return mHeightCompression;}
    642 //    uint32_t r(uint32_t pix);
    643 //    uint32_t g(uint32_t pix);
    644 //    uint32_t b(uint32_t pix);
     642    const VBoxVHWAColorComponent& r() const {return mR;}
     643    const VBoxVHWAColorComponent& g() const {return mG;}
     644    const VBoxVHWAColorComponent& b() const {return mB;}
     645    const VBoxVHWAColorComponent& a() const {return mA;}
    645646
    646647private:
     
    10331034    VBoxVHWAColorKey mDefaultSrcOverlayCKey;
    10341035
    1035 
    1036 //    GLenum mFormat;
    1037 //    GLint  mInternalFormat;
    1038 //    GLenum mType;
    1039 //    ulong  mDisplayWidth;
    1040 //    ulong  mDisplayHeight;
    1041 //    ulong  mBytesPerPixel;
    1042 //    ulong  mBytesPerLine;
    1043 
    10441036    int mLockCount;
    10451037    /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock  */
     
    10781070
    10791071typedef std::list <VBoxVHWASurfaceBase*> SurfList;
     1072typedef std::list <VBoxVHWASurfList*> OverlayList;
    10801073
    10811074class VBoxVHWASurfList
     
    11981191    }
    11991192
    1200 
    12011193    void performDisplay()
    12021194    {
     
    12111203            {
    12121204                pOverlay->performDisplay(pPrimary);
    1213 //                pPrimary->overlay(pOverlay);
    12141205            }
    12151206        }
    12161207    }
     1208
     1209    const OverlayList & overlays() const {return mOverlays;}
    12171210
    12181211private:
     
    12201213    VBoxVHWASurfList mPrimary;
    12211214
    1222     typedef std::list <VBoxVHWASurfList*> OverlayList;
    1223 
    12241215    OverlayList mOverlays;
    12251216};
     
    12351226
    12361227    uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; }
     1228
    12371229#ifdef VBOX_WITH_VIDEOHWACCEL
    12381230    uchar *vboxVRAMAddressFromOffset(uint64_t offset);
    1239 #endif
     1231
     1232    void vhwaSaveExec(struct SSMHANDLE * pSSM);
     1233    int vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version);
     1234#endif
     1235
    12401236    ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
    12411237    ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : NULL; }
    12421238
    12431239typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
    1244 //typedef FNVBOXQGLOP *PFNVBOXQGLOP;
    12451240
    12461241    void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe);}
    12471242    void vboxResizeEvent (VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re);}
    1248 //#ifdef VBOXQGL_DBG_SURF
    1249 //    void vboxTestSurfaces () {vboxPerformGLOp(&VBoxGLWidget::vboxDoTestSurfaces, NULL);}
    1250 //#endif
     1243
    12511244    void vboxProcessVHWACommands(VBoxVHWACommandProcessEvent * pEvent) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pEvent);}
    12521245#ifdef VBOX_WITH_VIDEOHWACCEL
     
    12591252    void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData);
    12601253protected:
    1261 //    void resizeGL (int height, int width);
    12621254
    12631255    void paintGL()
    12641256    {
    1265 //        Assert(mState.getCurrent() == NULL);
    1266 //        /* we are called with QGLWidget context */
    1267 //        mState.assertCurrent(mDisplay.getVGA(), false);
    12681257        if(mpfnOp)
    12691258        {
     
    12751264            mDisplay.performDisplay();
    12761265        }
    1277 //        /* restore the context */
    1278 //        mState.makeCurrent(mDisplay.getVGA());
    1279 //        /* clear*/
    1280 //        mState.assertCurrent(NULL, false);
    12811266    }
    12821267
    12831268    void initializeGL();
    12841269private:
    1285 //    void vboxDoInitDisplay();
    1286 //    void vboxDoDeleteDisplay();
    1287 //    void vboxDoPerformDisplay() { Assert(mDisplayInitialized); glCallList(mDisplay); }
    12881270    void vboxDoResize(void *re);
    12891271    void vboxDoPaint(void *rec);
     
    13241306    int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd);
    13251307    int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd);
     1308    int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
     1309
     1310    int vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps);
     1311    int vhwaLoadSurface(struct SSMHANDLE * pSSM, uint32_t u32Version);
     1312    int vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf);
     1313    int vhwaLoadOverlayData(struct SSMHANDLE * pSSM, uint32_t u32Version);
    13261314
    13271315    void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd);
     
    13291317    static const QGLFormat & vboxGLFormat();
    13301318
    1331 //    VBoxVHWASurfaceQGL * pDisplay;
    13321319    VBoxVHWADisplay mDisplay;
    13331320
    13341321
    1335     /* we need to do all opengl stuff in the paintGL context,
    1336      * submit the operation to be performed */
     1322    /* we do all opengl stuff in the paintGL context,
     1323     * submit the operation to be performed
     1324     * @todo: could be moved outside the updateGL */
    13371325    void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext) {mpfnOp = pfn; mOpContext = pContext; updateGL();}
    13381326
     
    13471335    void *mOpContext;
    13481336
    1349 //    ulong  mBitsPerPixel;
    13501337    ulong  mPixelFormat;
    13511338    bool   mUsesGuestVRAM;
    1352 #if 0
    1353     VBoxVHWAGlContextState mState;
    1354 #endif
     1339    bool   mVGASurfCreated;
    13551340
    13561341    RTCRITSECT mCritSect;
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r21878 r22215  
    23492349        if(FAILED(hr))
    23502350        {
    2351             rc = VERR_GENERAL_FAILURE;
     2351            rc = (hr == E_NOTIMPL) ? VERR_NOT_IMPLEMENTED : VERR_GENERAL_FAILURE;
    23522352        }
    23532353
     
    23632363    {
    23642364        /* tell the guest the command is complete */
     2365        pCommand->Flags &= (~VBOXVHWACMD_FLAG_HG_ASYNCH);
    23652366        pCommand->rc = rc;
    23662367    }
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