VirtualBox

Changeset 27682 in vbox for trunk/src


Ignore:
Timestamp:
Mar 24, 2010 6:37:48 PM (15 years ago)
Author:
vboxsync
Message:

2d: unified code for VBoxXxx & UIXxx, moved 2D state logic outside QGLWidget

Location:
trunk/src/VBox
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r27433 r27682  
    10901090
    10911091        pBody->pVM = pVM;
     1092        pBody->pvVRAM = pVGAState->vram_ptrR3;
     1093        pBody->cbVRAM = pVGAState->vram_size;
    10921094
    10931095        int rc = vbvaVHWAHHCommandPost(pVGAState, pCmd);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r27206 r27682  
    756756    setFrameStyle (QFrame::NoFrame);
    757757
    758 #ifdef VBOX_GUI_USE_QGL
     758#ifdef VBOX_GUI_USE_QGLFB
    759759    QWidget *pViewport;
    760760    switch (mode)
     
    806806    switch (mode)
    807807    {
    808 #if defined (VBOX_GUI_USE_QGL)
     808#if defined (VBOX_GUI_USE_QGLFB)
    809809        case VBoxDefs::QGLMode:
    810810            mFrameBuf = new VBoxQGLFrameBuffer (this);
     
    818818            mFrameBuf =
    819819#ifdef VBOX_WITH_VIDEOHWACCEL
    820                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer> (this, &mainWnd->session()) :
     820                    /* these two additional template args is a workaround to this [VBox|UI] duplication
     821                     * @todo: they are to be removed once VBox stuff is gone */
     822                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQImageFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) :
    821823#endif
    822824                    new VBoxQImageFrameBuffer (this);
     
    835837            mFrameBuf =
    836838#if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
    837                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer> (this, &mainWnd->session()) :
     839                    /* these two additional template args is a workaround to this [VBox|UI] duplication
     840                     * @todo: they are to be removed once VBox stuff is gone */
     841                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxSDLFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) :
    838842#endif
    839843                    new VBoxSDLFrameBuffer (this);
     
    858862            mFrameBuf =
    859863#ifdef VBOX_WITH_VIDEOHWACCEL
    860                     mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer> (this, &mainWnd->session()) :
     864                    /* these two additional template args is a workaround to this [VBox|UI] duplication
     865                     * @todo: they are to be removed once VBox stuff is gone */
     866                    mAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer, VBoxConsoleView, VBoxResizeEvent> (this, viewport(), &mainWnd->session()) :
    861867#endif
    862868                    new VBoxQuartz2DFrameBuffer (this);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r27006 r27682  
    11811181}
    11821182
    1183 VBoxVHWASurfaceBase::VBoxVHWASurfaceBase(class VBoxGLWidget *aWidget,
     1183VBoxVHWASurfaceBase::VBoxVHWASurfaceBase(class VBoxVHWAImage *pImage,
    11841184        const QSize & aSize,
    11851185        const QRect & aTargRect,
     
    12031203                mComplexList(NULL),
    12041204                mpPrimary(NULL),
    1205                 mWidget(aWidget),
    1206                 mHGHandle(VBOXVHWA_SURFHANDLE_INVALID)
     1205                mHGHandle(VBOXVHWA_SURFHANDLE_INVALID),
     1206                mpImage(pImage)
    12071207#ifdef DEBUG
    12081208                ,
     
    15491549
    15501550#ifdef VBOXVHWA_PROFILE_FPS
    1551     mWidget->reportNewFrame();
     1551    mpImage->reportNewFrame();
    15521552#endif
    15531553
     
    18921892class VBoxVHWAGlProgramMngr * VBoxVHWASurfaceBase::getGlProgramMngr()
    18931893{
    1894     return mWidget->vboxVHWAGetGlProgramMngr();
     1894    return mpImage->vboxVHWAGetGlProgramMngr();
    18951895}
    18961896
     
    19171917};
    19181918
    1919 VBoxGLWidget::VBoxGLWidget (CConsole console, QWidget *aParent, VBoxVHWASettings *aSettings)
    1920     : QGLWidget (new VBoxGLContext(VBoxGLWidget::vboxGLFormat()), aParent),
    1921     mSurfHandleTable(128), /* 128 should be enough */
    1922     mpfnOp(NULL),
    1923     mOpContext(NULL),
    1924     mPixelFormat(0),
    1925     mUsesGuestVRAM(false),
     1919
     1920VBoxGLWgt::VBoxGLWgt(VBoxVHWAImage * pImage,
     1921            QWidget* parent, const QGLWidget* shareWidget)
     1922
     1923        : QGLWidget(new VBoxGLContext(shareWidget->format()), parent, shareWidget),
     1924          mpImage(pImage)
     1925{
     1926    /* work-around to disable done current needed to old ATI drivers on Linux */
     1927    VBoxGLContext *pc = (VBoxGLContext*)context();
     1928    pc->allowDoneCurrent (false);
     1929}
     1930
     1931
     1932VBoxVHWAImage::VBoxVHWAImage ()
     1933    : mSurfHandleTable(128), /* 128 should be enough */
    19261934    mRepaintNeeded(false),
    19271935//    mbVGASurfCreated(false),
    1928     m_console(console),
    19291936    mConstructingList(NULL),
    19301937    mcRemaining2Contruct(0),
    1931     mSettings(aSettings)
     1938    mSettings(NULL)
    19321939#ifdef VBOXVHWA_PROFILE_FPS
    19331940    ,
     
    19411948}
    19421949
    1943 const QGLFormat & VBoxGLWidget::vboxGLFormat()
     1950int VBoxVHWAImage::init(VBoxVHWASettings *aSettings)
     1951{
     1952    mSettings = aSettings;
     1953    return VINF_SUCCESS;
     1954}
     1955
     1956const QGLFormat & VBoxVHWAImage::vboxGLFormat()
    19441957{
    19451958    static QGLFormat vboxFormat = QGLFormat();
     
    19581971}
    19591972
    1960 VBoxGLWidget::~VBoxGLWidget()
     1973
     1974VBoxVHWAImage::~VBoxVHWAImage()
    19611975{
    19621976    delete mpMngr;
     
    19641978
    19651979#ifdef VBOXVHWA_OLD_COORD
    1966 void VBoxGLWidget::doSetupMatrix(const QSize & aSize, bool bInverted)
     1980void VBoxVHWAImage::doSetupMatrix(const QSize & aSize, bool bInverted)
    19671981{
    19681982    VBOXQGL_CHECKERR(
     
    19912005#endif
    19922006
    1993 void VBoxGLWidget::adjustViewport(const QSize &display, const QRect &viewport)
     2007void VBoxVHWAImage::adjustViewport(const QSize &display, const QRect &viewport)
    19942008{
    19952009    glViewport(-viewport.x(),
     
    19992013}
    20002014
    2001 void VBoxGLWidget::setupMatricies(const QSize &display, bool bInverted)
     2015void VBoxVHWAImage::setupMatricies(const QSize &display, bool bInverted)
    20022016{
    20032017    glMatrixMode(GL_PROJECTION);
     
    20132027}
    20142028
    2015 VBoxVHWACommandElement * VBoxGLWidget::processCmdList(VBoxVHWACommandElement * pCmd)
    2016 {
    2017     VBoxVHWACommandElement * pCur;
    2018     do
    2019     {
    2020         pCur = pCmd;
    2021         switch(pCmd->type())
    2022         {
    2023         case VBOXVHWA_PIPECMD_PAINT:
    2024             vboxDoUpdateRect(&pCmd->rect());
    2025             break;
    2026 #ifdef VBOX_WITH_VIDEOHWACCEL
    2027         case VBOXVHWA_PIPECMD_VHWA:
    2028             vboxDoVHWACmd(pCmd->vhwaCmd());
    2029             break;
    2030         case VBOXVHWA_PIPECMD_OP:
    2031         {
    2032             const VBOXVHWACALLBACKINFO & info = pCmd->op();
    2033             (info.pThis->*(info.pfnCallback))(info.pContext);
    2034             break;
    2035         }
    2036         case VBOXVHWA_PIPECMD_FUNC:
    2037         {
    2038             const VBOXVHWAFUNCCALLBACKINFO & info = pCmd->func();
    2039             info.pfnCallback(info.pContext1, info.pContext2);
    2040             break;
    2041         }
    2042 #endif
    2043         default:
    2044             Assert(0);
    2045         }
    2046         pCmd = pCmd->mpNext;
    2047     } while(pCmd);
    2048 
    2049     return pCur;
    2050 }
    2051 
    2052 void VBoxGLWidget::vboxDoProcessVHWACommands(void *pContext)
    2053 {
    2054     VBoxVHWACommandElementProcessor * pPipe = (VBoxVHWACommandElementProcessor*)pContext;
    2055     VBoxVHWACommandElement * pFirst = pPipe->detachCmdList(NULL, NULL);
    2056     do
    2057     {
    2058         VBoxVHWACommandElement * pLast = processCmdList(pFirst);
    2059 
    2060         pFirst = pPipe->detachCmdList(pFirst, pLast);
    2061     } while(pFirst);
    2062 }
    2063 
    2064 int VBoxGLWidget::reset(VHWACommandList * pCmdList)
     2029//VBoxVHWACommandElement * VBoxVHWAImage::processCmdList(VBoxVHWACommandElement * pCmd)
     2030//{
     2031//    VBoxVHWACommandElement * pCur;
     2032//    do
     2033//    {
     2034//        pCur = pCmd;
     2035//        switch(pCmd->type())
     2036//        {
     2037//        case VBOXVHWA_PIPECMD_PAINT:
     2038//            vboxDoUpdateRect(&pCmd->rect());
     2039//            break;
     2040//#ifdef VBOX_WITH_VIDEOHWACCEL
     2041//        case VBOXVHWA_PIPECMD_VHWA:
     2042//            vboxDoVHWACmd(pCmd->vhwaCmd());
     2043//            break;
     2044//        case VBOXVHWA_PIPECMD_FUNC:
     2045//        {
     2046//            const VBOXVHWAFUNCCALLBACKINFO & info = pCmd->func();
     2047//            info.pfnCallback(info.pContext1, info.pContext2);
     2048//            break;
     2049//        }
     2050//#endif
     2051//        default:
     2052//            Assert(0);
     2053//        }
     2054//        pCmd = pCmd->mpNext;
     2055//    } while(pCmd);
     2056//
     2057//    return pCur;
     2058//}
     2059//
     2060//void VBoxVHWAImage::vboxDoProcessVHWACommands(void *pContext)
     2061//{
     2062//    VBoxVHWACommandElementProcessor * pPipe = (VBoxVHWACommandElementProcessor*)pContext;
     2063//    VBoxVHWACommandElement * pFirst = pPipe->detachCmdList(NULL, NULL);
     2064//    do
     2065//    {
     2066//        VBoxVHWACommandElement * pLast = processCmdList(pFirst);
     2067//
     2068//        pFirst = pPipe->detachCmdList(pFirst, pLast);
     2069//    } while(pFirst);
     2070//}
     2071
     2072int VBoxVHWAImage::reset(VHWACommandList * pCmdList)
    20652073{
    20662074    VBOXVHWACMD * pCmd;
     
    21162124
    21172125#ifdef VBOX_WITH_VIDEOHWACCEL
    2118 void VBoxGLWidget::vboxDoVHWACmd(void *cmd)
    2119 {
    2120     vboxDoVHWACmdExec(cmd);
    2121 
    2122     CDisplay display = m_console.GetDisplay();
    2123     Assert (!display.isNull());
    2124 
    2125     display.CompleteVHWACommand((BYTE*)cmd);
    2126 }
    2127 
    2128 void VBoxGLWidget::vboxDoVHWACmdAndFree(void *cmd)
    2129 {
    2130     vboxDoVHWACmdExec(cmd);
    2131 
    2132     free(cmd);
    2133 }
    2134 
    2135 void VBoxGLWidget::vboxDoVHWACmdExec(void *cmd)
    2136 {
    2137     struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd;
    2138     switch(pCmd->enmCmd)
    2139     {
    2140         case VBOXVHWACMD_TYPE_SURF_CANCREATE:
    2141         {
    2142             VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE);
    2143             pCmd->rc = vhwaSurfaceCanCreate(pBody);
    2144         } break;
    2145         case VBOXVHWACMD_TYPE_SURF_CREATE:
    2146         {
    2147             VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE);
    2148             pCmd->rc = vhwaSurfaceCreate(pBody);
    2149         } break;
    2150         case VBOXVHWACMD_TYPE_SURF_DESTROY:
    2151         {
    2152             VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);
    2153             pCmd->rc = vhwaSurfaceDestroy(pBody);
    2154         } break;
    2155         case VBOXVHWACMD_TYPE_SURF_LOCK:
    2156         {
    2157             VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK);
    2158             pCmd->rc = vhwaSurfaceLock(pBody);
    2159         } break;
    2160         case VBOXVHWACMD_TYPE_SURF_UNLOCK:
    2161         {
    2162             VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK);
    2163             pCmd->rc = vhwaSurfaceUnlock(pBody);
    2164         } break;
    2165         case VBOXVHWACMD_TYPE_SURF_BLT:
    2166         {
    2167             VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);
    2168             pCmd->rc = vhwaSurfaceBlt(pBody);
    2169         } break;
    2170         case VBOXVHWACMD_TYPE_SURF_FLIP:
    2171         {
    2172             VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
    2173             pCmd->rc = vhwaSurfaceFlip(pBody);
    2174         } break;
    2175         case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE:
    2176         {
    2177             VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);
    2178             pCmd->rc = vhwaSurfaceOverlayUpdate(pBody);
    2179         } break;
    2180         case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION:
    2181         {
    2182             VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
    2183             pCmd->rc = vhwaSurfaceOverlaySetPosition(pBody);
    2184         } break;
    2185         case VBOXVHWACMD_TYPE_SURF_COLORKEY_SET:
    2186         {
    2187             VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);
    2188             pCmd->rc = vhwaSurfaceColorkeySet(pBody);
    2189         } break;
    2190         case VBOXVHWACMD_TYPE_QUERY_INFO1:
    2191         {
    2192             VBOXVHWACMD_QUERYINFO1 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1);
    2193             pCmd->rc = vhwaQueryInfo1(pBody);
    2194         } break;
    2195         case VBOXVHWACMD_TYPE_QUERY_INFO2:
    2196         {
    2197             VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2);
    2198             pCmd->rc = vhwaQueryInfo2(pBody);
    2199         } break;
    2200         case VBOXVHWACMD_TYPE_ENABLE:
    2201         case VBOXVHWACMD_TYPE_DISABLE:
    2202             pCmd->rc = VINF_SUCCESS;
    2203             break;
    2204         case VBOXVHWACMD_TYPE_HH_CONSTRUCT:
    2205         {
    2206             VBOXVHWACMD_HH_CONSTRUCT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_CONSTRUCT);
    2207             pCmd->rc = vhwaConstruct(pBody);
    2208         } break;
    2209         default:
    2210             Assert(0);
    2211             pCmd->rc = VERR_NOT_IMPLEMENTED;
    2212             break;
    2213     }
    2214 }
    2215 
    2216 int VBoxGLWidget::vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd)
     2126//void VBoxVHWAImage::vboxDoVHWACmd(void *cmd)
     2127//{
     2128//    vboxDoVHWACmdExec(cmd);
     2129//
     2130//    CDisplay display = m_console.GetDisplay();
     2131//    Assert (!display.isNull());
     2132//
     2133//    display.CompleteVHWACommand((BYTE*)cmd);
     2134//}
     2135//
     2136//void VBoxVHWAImage::vboxDoVHWACmdAndFree(void *cmd)
     2137//{
     2138//    vboxDoVHWACmdExec(cmd);
     2139//
     2140//    free(cmd);
     2141//}
     2142//
     2143//void VBoxVHWAImage::vboxDoVHWACmdExec(void *cmd)
     2144//{
     2145//    struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd;
     2146//    switch(pCmd->enmCmd)
     2147//    {
     2148//        case VBOXVHWACMD_TYPE_SURF_CANCREATE:
     2149//        {
     2150//            VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE);
     2151//            pCmd->rc = vhwaSurfaceCanCreate(pBody);
     2152//        } break;
     2153//        case VBOXVHWACMD_TYPE_SURF_CREATE:
     2154//        {
     2155//            VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE);
     2156//            pCmd->rc = vhwaSurfaceCreate(pBody);
     2157//        } break;
     2158//        case VBOXVHWACMD_TYPE_SURF_DESTROY:
     2159//        {
     2160//            VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);
     2161//            pCmd->rc = vhwaSurfaceDestroy(pBody);
     2162//        } break;
     2163//        case VBOXVHWACMD_TYPE_SURF_LOCK:
     2164//        {
     2165//            VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK);
     2166//            pCmd->rc = vhwaSurfaceLock(pBody);
     2167//        } break;
     2168//        case VBOXVHWACMD_TYPE_SURF_UNLOCK:
     2169//        {
     2170//            VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK);
     2171//            pCmd->rc = vhwaSurfaceUnlock(pBody);
     2172//        } break;
     2173//        case VBOXVHWACMD_TYPE_SURF_BLT:
     2174//        {
     2175//            VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);
     2176//            pCmd->rc = vhwaSurfaceBlt(pBody);
     2177//        } break;
     2178//        case VBOXVHWACMD_TYPE_SURF_FLIP:
     2179//        {
     2180//            VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
     2181//            pCmd->rc = vhwaSurfaceFlip(pBody);
     2182//        } break;
     2183//        case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE:
     2184//        {
     2185//            VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);
     2186//            pCmd->rc = vhwaSurfaceOverlayUpdate(pBody);
     2187//        } break;
     2188//        case VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION:
     2189//        {
     2190//            VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
     2191//            pCmd->rc = vhwaSurfaceOverlaySetPosition(pBody);
     2192//        } break;
     2193//        case VBOXVHWACMD_TYPE_SURF_COLORKEY_SET:
     2194//        {
     2195//            VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);
     2196//            pCmd->rc = vhwaSurfaceColorkeySet(pBody);
     2197//        } break;
     2198//        case VBOXVHWACMD_TYPE_QUERY_INFO1:
     2199//        {
     2200//            VBOXVHWACMD_QUERYINFO1 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1);
     2201//            pCmd->rc = vhwaQueryInfo1(pBody);
     2202//        } break;
     2203//        case VBOXVHWACMD_TYPE_QUERY_INFO2:
     2204//        {
     2205//            VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2);
     2206//            pCmd->rc = vhwaQueryInfo2(pBody);
     2207//        } break;
     2208//        case VBOXVHWACMD_TYPE_ENABLE:
     2209//        case VBOXVHWACMD_TYPE_DISABLE:
     2210//            pCmd->rc = VINF_SUCCESS;
     2211//            break;
     2212//        case VBOXVHWACMD_TYPE_HH_CONSTRUCT:
     2213//        {
     2214//            VBOXVHWACMD_HH_CONSTRUCT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_CONSTRUCT);
     2215//            pCmd->rc = vhwaConstruct(pBody);
     2216//        } break;
     2217//        default:
     2218//            Assert(0);
     2219//            pCmd->rc = VERR_NOT_IMPLEMENTED;
     2220//            break;
     2221//    }
     2222//}
     2223
     2224int VBoxVHWAImage::vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd)
    22172225{
    22182226    VBOXQGLLOG_ENTER(("\n"));
    22192227
    2220     const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(context());
     2228    const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL);
    22212229
    22222230    if(!(pCmd->SurfInfo.flags & VBOXVHWA_SD_CAPS))
     
    23122320}
    23132321
    2314 int VBoxGLWidget::vhwaSurfaceCreate (struct _VBOXVHWACMD_SURF_CREATE *pCmd)
     2322int VBoxVHWAImage::vhwaSurfaceCreate (struct _VBOXVHWACMD_SURF_CREATE *pCmd)
    23152323{
    23162324    VBOXQGLLOG_ENTER (("\n"));
     
    23282336
    23292337    VBoxVHWASurfaceBase *surf = NULL;
     2338    const VBoxVHWASurfaceBase *existingSurf = NULL;
    23302339    bool bNoPBO = false;
    23312340    bool bPrimary = false;
     
    23602369        bNoPBO = true;
    23612370        bPrimary = true;
    2362         VBoxVHWASurfaceBase * pVga = vboxGetVGASurface();
     2371        VBoxVHWASurfaceBase * pVga = vgaSurface();
    23632372
    23642373        Assert((pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OFFSCREENPLAIN) == 0);
     
    23782387                                                pCmd->SurfInfo.PixelFormat.m2.rgbGBitMask,
    23792388                                                pCmd->SurfInfo.PixelFormat.m3.rgbBBitMask);
    2380                     Assert(pVga->colorFormat().equals(format));
    2381 //                    if(pVga->colorFormat().equals(format))
     2389                    Assert(pVga->pixelFormat().equals(format));
     2390//                    if(pVga->pixelFormat().equals(format))
    23822391                    {
     2392                        existingSurf = pVga;
    23832393                        surf = pVga;
    23842394
     
    24582468
    24592469        uchar * addr = vboxVRAMAddressFromOffset(pCmd->SurfInfo.offSurface);
    2460         surf->init(mDisplay.getPrimary(), addr);
     2470        if (!existingSurf)
     2471            surf->init(mDisplay.getPrimary(), addr);
    24612472
    24622473        if(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OVERLAY)
     
    24822493        else
    24832494        {
    2484             VBoxVHWASurfaceBase * pVga = vboxGetVGASurface();
     2495            VBoxVHWASurfaceBase * pVga = vgaSurface();
    24852496            Assert(pVga->handle() != VBOXVHWA_SURFHANDLE_INVALID);
    24862497            Assert(pVga != surf); NOREF(pVga);
     
    25342545}
    25352546
    2536 int VBoxGLWidget::vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd)
     2547int VBoxVHWAImage::vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd)
    25372548{
    25382549    VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf);
     
    26102621                 (_pr)->bottom - (_pr)->top)
    26112622
    2612 int VBoxGLWidget::vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd)
     2623int VBoxVHWAImage::vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd)
    26132624{
    26142625    VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf);
     
    26232634}
    26242635
    2625 int VBoxGLWidget::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd)
     2636int VBoxVHWAImage::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd)
    26262637{
    26272638    VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf);
     
    26642675}
    26652676
    2666 int VBoxGLWidget::vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd)
     2677int VBoxVHWAImage::vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd)
    26672678{
    26682679    Q_UNUSED(pCmd);
     
    26702681}
    26712682
    2672 int VBoxGLWidget::vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd)
     2683int VBoxVHWAImage::vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd)
    26732684{
    26742685    VBoxVHWASurfaceBase *pTargSurf = handle2Surface(pCmd->u.in.hTargSurf);
     
    26952706}
    26962707
    2697 void VBoxGLWidget::vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)
     2708void VBoxVHWAImage::vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)
    26982709{
    26992710    if(pCmd->u.in.flags & VBOXVHWA_OVER_KEYDEST)
     
    27752786}
    27762787
    2777 int VBoxGLWidget::vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)
     2788int VBoxVHWAImage::vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd)
    27782789{
    27792790    VBoxVHWASurfaceBase *pSrcSurf = handle2Surface(pCmd->u.in.hSrcSurf);
     
    28292840}
    28302841
    2831 int VBoxGLWidget::vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd)
     2842int VBoxVHWAImage::vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd)
    28322843{
    28332844    VBoxVHWASurfaceBase *pDstSurf = handle2Surface(pCmd->u.in.hDstSurf);
     
    28702881}
    28712882
    2872 int VBoxGLWidget::vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd)
     2883int VBoxVHWAImage::vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd)
    28732884{
    28742885    VBoxVHWASurfaceBase *pSurf = handle2Surface(pCmd->u.in.hSurf);
     
    29042915}
    29052916
    2906 int VBoxGLWidget::vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd)
     2917int VBoxVHWAImage::vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd)
    29072918{
    29082919    VBOXQGLLOG_ENTER(("\n"));
    29092920    bool bEnabled = false;
    2910     const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(context());
     2921    const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL);
    29112922    if(info.isVHWASupported())
    29122923    {
     
    30073018}
    30083019
    3009 int VBoxGLWidget::vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd)
     3020int VBoxVHWAImage::vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd)
    30103021{
    30113022    VBOXQGLLOG_ENTER(("\n"));
    30123023
    3013     const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(context());
     3024    const VBoxVHWAInfo & info = vboxVHWAGetSupportInfo(NULL);
    30143025    uint32_t aFourcc[VBOXVHWA_NUMFOURCC];
    30153026    int num = mSettings->getIntersection(info, VBOXVHWA_NUMFOURCC, aFourcc);
     
    30233034}
    30243035
    3025 static DECLCALLBACK(void) vboxQGLSaveExec(PSSMHANDLE pSSM, void *pvUser)
    3026 {
    3027     VBoxGLWidget * pw = (VBoxGLWidget*)pvUser;
    3028     pw->vhwaSaveExec(pSSM);
    3029 }
    3030 
    3031 static DECLCALLBACK(int) vboxQGLLoadExec(PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version, uint32_t uPass)
    3032 {
    3033     Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
    3034     VBoxGLWidget * pw = (VBoxGLWidget*)pvUser;
    3035     return VBoxGLWidget::vhwaLoadExec(&pw->onResizeCmdList(), pSSM, u32Version);
    3036 }
    3037 
    3038 int VBoxGLWidget::vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps)
     3036//static DECLCALLBACK(void) vboxQGLSaveExec(PSSMHANDLE pSSM, void *pvUser)
     3037//{
     3038//    VBoxVHWAImage * pw = (VBoxVHWAImage*)pvUser;
     3039//    pw->vhwaSaveExec(pSSM);
     3040//}
     3041//
     3042//static DECLCALLBACK(int) vboxQGLLoadExec(PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version, uint32_t uPass)
     3043//{
     3044//    Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
     3045//    VBoxVHWAImage * pw = (VBoxVHWAImage*)pvUser;
     3046//    return VBoxVHWAImage::vhwaLoadExec(&pw->onResizeCmdList(), pSSM, u32Version);
     3047//}
     3048
     3049int VBoxVHWAImage::vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps)
    30393050{
    30403051    VBOXQGL_SAVE_SURFSTART(pSSM);
     
    30913102    }
    30923103
    3093     const VBoxVHWAColorFormat & format = pSurf->colorFormat();
     3104    const VBoxVHWAColorFormat & format = pSurf->pixelFormat();
    30943105    flags = 0;
    30953106    if(format.fourcc())
     
    31153126}
    31163127
    3117 int VBoxGLWidget::vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t cBackBuffers, uint32_t u32Version)
     3128int VBoxVHWAImage::vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t cBackBuffers, uint32_t u32Version)
    31183129{
    31193130    Q_UNUSED(u32Version);
     
    31853196
    31863197        pCmdList->push_back(pCmd);
    3187 //        vboxExecOnResize(&VBoxGLWidget::vboxDoVHWACmdAndFree, pCmd); AssertRC(rc);
     3198//        vboxExecOnResize(&VBoxVHWAImage::vboxDoVHWACmdAndFree, pCmd); AssertRC(rc);
    31883199//        if(RT_SUCCESS(rc))
    31893200//        {
     
    31983209}
    31993210
    3200 int VBoxGLWidget::vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible)
     3211int VBoxVHWAImage::vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible)
    32013212{
    32023213    VBOXQGL_SAVE_OVERLAYSTART(pSSM);
     
    32733284}
    32743285
    3275 int VBoxGLWidget::vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)
     3286int VBoxVHWAImage::vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)
    32763287{
    32773288    Q_UNUSED(u32Version);
     
    33283339}
    33293340
    3330 void VBoxGLWidget::vhwaSaveExecVoid(struct SSMHANDLE * pSSM)
     3341void VBoxVHWAImage::vhwaSaveExecVoid(struct SSMHANDLE * pSSM)
    33313342{
    33323343    VBOXQGL_SAVE_START(pSSM);
     
    33353346}
    33363347
    3337 void VBoxGLWidget::vhwaSaveExec(struct SSMHANDLE * pSSM)
     3348void VBoxVHWAImage::vhwaSaveExec(struct SSMHANDLE * pSSM)
    33383349{
    33393350    VBOXQGL_SAVE_START(pSSM);
     
    34293440}
    34303441
    3431 int VBoxGLWidget::vhwaLoadVHWAEnable(VHWACommandList * pCmdList)
     3442int VBoxVHWAImage::vhwaLoadVHWAEnable(VHWACommandList * pCmdList)
    34323443{
    34333444    char *buf = (char*)malloc(sizeof(VBOXVHWACMD));
     
    34463457}
    34473458
    3448 int VBoxGLWidget::vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)
     3459int VBoxVHWAImage::vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version)
    34493460{
    34503461    VBOXQGL_LOAD_START(pSSM);
     
    35173528}
    35183529
    3519 int VBoxGLWidget::vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd)
    3520 {
    3521     PVM pVM = (PVM)pCmd->pVM;
    3522     uint32_t intsId = 0; /* @todo: set the proper id */
    3523 
    3524     char nameFuf[sizeof(VBOXQGL_STATE_NAMEBASE) + 8];
    3525 
    3526     char * pszName = nameFuf;
    3527     sprintf(pszName, "%s%d", VBOXQGL_STATE_NAMEBASE, intsId);
    3528     int rc = SSMR3RegisterExternal(
    3529             pVM,                    /* The VM handle*/
    3530             pszName,                /* Data unit name. */
    3531             intsId,                 /* The instance identifier of the data unit.
    3532                                      * This must together with the name be unique. */
    3533             VBOXQGL_STATE_VERSION,   /* Data layout version number. */
    3534             128,             /* The approximate amount of data in the unit.
    3535                               * Only for progress indicators. */
    3536             NULL, NULL, NULL, /* pfnLiveXxx */
    3537             NULL,            /* Prepare save callback, optional. */
    3538             vboxQGLSaveExec, /* Execute save callback, optional. */
    3539             NULL,            /* Done save callback, optional. */
    3540             NULL,            /* Prepare load callback, optional. */
    3541             vboxQGLLoadExec, /* Execute load callback, optional. */
    3542             NULL,            /* Done load callback, optional. */
    3543             this             /* User argument. */
    3544             );
    3545     AssertRC(rc);
    3546     return rc;
    3547 }
    3548 
    3549 uchar * VBoxGLWidget::vboxVRAMAddressFromOffset(uint64_t offset)
    3550 {
    3551     return ((offset != VBOXVHWA_OFFSET64_VOID) && vboxUsesGuestVRAM()) ? vboxAddress() + offset : NULL;
    3552 }
    3553 
    3554 uint64_t VBoxGLWidget::vboxVRAMOffsetFromAddress(uchar* addr)
    3555 {
    3556     return uint64_t(addr - vboxAddress());
    3557 }
    3558 
    3559 uint64_t VBoxGLWidget::vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf)
     3530int VBoxVHWAImage::vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd)
     3531{
     3532//    PVM pVM = (PVM)pCmd->pVM;
     3533//    uint32_t intsId = 0; /* @todo: set the proper id */
     3534//
     3535//    char nameFuf[sizeof(VBOXQGL_STATE_NAMEBASE) + 8];
     3536//
     3537//    char * pszName = nameFuf;
     3538//    sprintf(pszName, "%s%d", VBOXQGL_STATE_NAMEBASE, intsId);
     3539//    int rc = SSMR3RegisterExternal(
     3540//            pVM,                    /* The VM handle*/
     3541//            pszName,                /* Data unit name. */
     3542//            intsId,                 /* The instance identifier of the data unit.
     3543//                                     * This must together with the name be unique. */
     3544//            VBOXQGL_STATE_VERSION,   /* Data layout version number. */
     3545//            128,             /* The approximate amount of data in the unit.
     3546//                              * Only for progress indicators. */
     3547//            NULL, NULL, NULL, /* pfnLiveXxx */
     3548//            NULL,            /* Prepare save callback, optional. */
     3549//            vboxQGLSaveExec, /* Execute save callback, optional. */
     3550//            NULL,            /* Done save callback, optional. */
     3551//            NULL,            /* Prepare load callback, optional. */
     3552//            vboxQGLLoadExec, /* Execute load callback, optional. */
     3553//            NULL,            /* Done load callback, optional. */
     3554//            this             /* User argument. */
     3555//            );
     3556//    AssertRC(rc);
     3557    mpvVRAM = pCmd->pvVRAM;
     3558    mcbVRAM = pCmd->cbVRAM;
     3559    return VINF_SUCCESS;
     3560}
     3561
     3562uchar * VBoxVHWAImage::vboxVRAMAddressFromOffset(uint64_t offset)
     3563{
     3564    /* @todo: check vramSize() */
     3565    return (offset != VBOXVHWA_OFFSET64_VOID) ? ((uint8_t*)vramBase()) + offset : NULL;
     3566}
     3567
     3568uint64_t VBoxVHWAImage::vboxVRAMOffsetFromAddress(uchar* addr)
     3569{
     3570    return uint64_t(addr - ((uchar*)vramBase()));
     3571}
     3572
     3573uint64_t VBoxVHWAImage::vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf)
    35603574{
    35613575    return pSurf->addressAlocated() ? VBOXVHWA_OFFSET64_VOID : vboxVRAMOffsetFromAddress(pSurf->address());
     
    35633577
    35643578#endif
    3565 
    3566 void VBoxGLWidget::initializeGL()
    3567 {
    3568     vboxVHWAGetSupportInfo(context());
    3569     VBoxVHWASurfaceBase::globalInit();
    3570 }
    35713579
    35723580#ifdef VBOXQGL_DBG_SURF
     
    35753583VBoxVHWASurfaceBase * g_apSurf[] = {NULL, NULL, NULL};
    35763584
    3577 void VBoxGLWidget::vboxDoTestSurfaces(void* context)
     3585void VBoxVHWAImage::vboxDoTestSurfaces(void* context)
    35783586{
    35793587    if(g_iCur >= RT_ELEMENTS(g_apSurf))
     
    35873595#endif
    35883596
    3589 void VBoxGLWidget::vboxDoUpdateViewport(const QRect & aRect)
     3597void VBoxVHWAImage::vboxDoUpdateViewport(const QRect & aRect)
    35903598{
    35913599    adjustViewport(mDisplay.getPrimary()->size(), aRect);
     
    36313639}
    36323640
    3633 bool VBoxGLWidget::hasSurfaces() const
     3641bool VBoxVHWAImage::hasSurfaces() const
    36343642{
    36353643    if(mDisplay.overlays().size() != 0)
     
    36403648}
    36413649
    3642 bool VBoxGLWidget::hasVisibleOverlays()
     3650bool VBoxVHWAImage::hasVisibleOverlays()
    36433651{
    36443652    const OverlayList & overlays = mDisplay.overlays();
     
    36533661}
    36543662
    3655 QRect VBoxGLWidget::overlaysRectUnion()
     3663QRect VBoxVHWAImage::overlaysRectUnion()
    36563664{
    36573665    const OverlayList & overlays = mDisplay.overlays();
     
    36693677}
    36703678
    3671 QRect VBoxGLWidget::overlaysRectIntersection()
     3679QRect VBoxVHWAImage::overlaysRectIntersection()
    36723680{
    36733681    const OverlayList & overlays = mDisplay.overlays();
     
    36953703}
    36963704
    3697 void VBoxGLWidget::vboxDoUpdateRect(const QRect * pRect)
     3705void VBoxVHWAImage::vboxDoUpdateRect(const QRect * pRect)
    36983706{
    36993707    mDisplay.getPrimary()->updatedMem(pRect);
    37003708}
    37013709
    3702 void VBoxGLWidget::vboxDoResize(void *resize)
    3703 {
    3704     VBOXQGLLOG(("format().blueBufferSize()(%d)\n", format().blueBufferSize()));
    3705     VBOXQGLLOG(("format().greenBufferSize()(%d)\n", format().greenBufferSize()));
    3706     VBOXQGLLOG(("format().redBufferSize()(%d)\n", format().redBufferSize()));
    3707 #ifdef DEBUG_misha
    3708     Assert(format().blueBufferSize() == 8);
    3709     Assert(format().greenBufferSize() == 8);
    3710     Assert(format().redBufferSize() == 8);
    3711 #endif
    3712 
    3713     Assert(format().directRendering());
    3714     Assert(format().doubleBuffer());
    3715     Assert(format().hasOpenGL());
    3716     VBOXQGLLOG(("hasOpenGLOverlays(%d), hasOverlay(%d)\n", format().hasOpenGLOverlays(), format().hasOverlay()));
    3717     Assert(format().plane() == 0);
    3718     Assert(format().rgba());
    3719     Assert(!format().sampleBuffers());
    3720     Assert(!format().stereo());
    3721     VBOXQGLLOG(("swapInterval(%d)\n", format().swapInterval()));
     3710void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size)
     3711{
     3712//    VBOXQGLLOG(("format().blueBufferSize()(%d)\n", format().blueBufferSize()));
     3713//    VBOXQGLLOG(("format().greenBufferSize()(%d)\n", format().greenBufferSize()));
     3714//    VBOXQGLLOG(("format().redBufferSize()(%d)\n", format().redBufferSize()));
     3715//#ifdef DEBUG_misha
     3716//    Assert(format().blueBufferSize() == 8);
     3717//    Assert(format().greenBufferSize() == 8);
     3718//    Assert(format().redBufferSize() == 8);
     3719//#endif
     3720//
     3721//    Assert(format().directRendering());
     3722//    Assert(format().doubleBuffer());
     3723//    Assert(format().hasOpenGL());
     3724//    VBOXQGLLOG(("hasOpenGLOverlays(%d), hasOverlay(%d)\n", format().hasOpenGLOverlays(), format().hasOverlay()));
     3725//    Assert(format().plane() == 0);
     3726//    Assert(format().rgba());
     3727//    Assert(!format().sampleBuffers());
     3728//    Assert(!format().stereo());
     3729//    VBOXQGLLOG(("swapInterval(%d)\n", format().swapInterval()));
    37223730
    37233731
     
    37263734        );
    37273735
    3728     VBoxResizeEvent *re = (VBoxResizeEvent*)resize;
    37293736    bool remind = false;
    37303737    bool fallback = false;
    37313738
    37323739    VBOXQGLLOG(("resizing: fmt=%d, vram=%p, bpp=%d, bpl=%d, width=%d, height=%d\n",
    3733                       re->pixelFormat(), re->VRAM(),
    3734                       re->bitsPerPixel(), re->bytesPerLine(),
    3735                       re->width(), re->height()));
     3740                      size.pixelFormat(), size.VRAM(),
     3741                      size.bitsPerPixel(), size.bytesPerLine(),
     3742                      size.width(), size.height()));
    37363743
    37373744    /* clean the old values first */
     
    37403747    uint32_t bitsPerPixel;
    37413748    uint32_t b = 0xff, g = 0xff00, r = 0xff0000;
     3749    ulong pixelFormat;
     3750    bool bUsesGuestVram;
    37423751
    37433752    /* check if we support the pixel format and can use the guest VRAM directly */
    3744     if (re->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)
    3745     {
    3746 
    3747         bitsPerPixel = re->bitsPerPixel();
    3748         bytesPerLine = re->bytesPerLine();
     3753    if (size.pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)
     3754    {
     3755
     3756        bitsPerPixel = size.bitsPerPixel();
     3757        bytesPerLine = size.bytesPerLine();
    37493758        ulong bitsPerLine = bytesPerLine * 8;
    37503759
     
    37853794        {
    37863795            /* QImage only supports 32-bit aligned scan lines... */
    3787             Assert ((re->bytesPerLine() & 3) == 0);
    3788             fallback = ((re->bytesPerLine() & 3) != 0);
     3796            Assert ((size.bytesPerLine() & 3) == 0);
     3797            fallback = ((size.bytesPerLine() & 3) != 0);
    37893798        }
    37903799        if (!fallback)
    37913800        {
    37923801            /* ...and the scan lines ought to be a whole number of pixels. */
    3793             Assert ((bitsPerLine & (re->bitsPerPixel() - 1)) == 0);
    3794             fallback = ((bitsPerLine & (re->bitsPerPixel() - 1)) != 0);
     3802            Assert ((bitsPerLine & (size.bitsPerPixel() - 1)) == 0);
     3803            fallback = ((bitsPerLine & (size.bitsPerPixel() - 1)) != 0);
    37953804        }
    37963805        if (!fallback)
    37973806        {
    3798             // ulong virtWdt = bitsPerLine / re->bitsPerPixel();
    3799             mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
    3800             mUsesGuestVRAM = true;
     3807            // ulong virtWdt = bitsPerLine / size.bitsPerPixel();
     3808            pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
     3809            bUsesGuestVram = true;
    38013810        }
    38023811    }
     
    38143823        g = 0xff00;
    38153824        r = 0xff0000;
    3816         bytesPerLine = re->width()*bitsPerPixel/8;
    3817         mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
    3818         mUsesGuestVRAM = false;
     3825        bytesPerLine = size.width()*bitsPerPixel/8;
     3826        pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
     3827        bUsesGuestVram = false;
    38193828    }
    38203829
    38213830    ulong bytesPerPixel = bitsPerPixel/8;
    38223831    ulong displayWidth = bytesPerLine/bytesPerPixel;
    3823     ulong displayHeight = re->height();
     3832    ulong displayHeight = size.height();
    38243833
    38253834#ifdef VBOXQGL_DBG_SURF
     
    38553864#endif
    38563865            0);
    3857     pDisplay->init(NULL, mUsesGuestVRAM ? re->VRAM() : NULL);
     3866    pDisplay->init(NULL, bUsesGuestVram ? size.VRAM() : NULL);
    38583867    mDisplay.setVGA(pDisplay);
    38593868//    VBOXQGLLOG(("\n\n*******\n\n     viewport size is: (%d):(%d)\n\n*******\n\n", size().width(), size().height()));
     
    39283937#endif
    39293938
    3930     if(!mOnResizeCmdList.empty())
    3931     {
    3932         for (VHWACommandList::const_iterator it = mOnResizeCmdList.begin();
    3933              it != mOnResizeCmdList.end(); ++ it)
    3934         {
    3935             VBOXVHWACMD * pCmd = (*it);
    3936             vboxDoVHWACmdExec(pCmd);
    3937             free(pCmd);
    3938         }
    3939         mOnResizeCmdList.clear();
    3940     }
     3939//    if(!mOnResizeCmdList.empty())
     3940//    {
     3941//        for (VHWACommandList::const_iterator it = mOnResizeCmdList.begin();
     3942//             it != mOnResizeCmdList.end(); ++ it)
     3943//        {
     3944//            VBOXVHWACMD * pCmd = (*it);
     3945//            vboxDoVHWACmdExec(pCmd);
     3946//            free(pCmd);
     3947//        }
     3948//        mOnResizeCmdList.clear();
     3949//    }
    39413950
    39423951    if (remind)
     
    39533962            }
    39543963        };
    3955         (new RemindEvent (re->bitsPerPixel()))->post();
     3964        (new RemindEvent (size.bitsPerPixel()))->post();
    39563965    }
    39573966}
     
    41204129}
    41214130
    4122 VBoxQGLOverlay::VBoxQGLOverlay (VBoxConsoleView *aView, VBoxFrameBuffer * aContainer, CSession * aSession)
    4123     : mpOverlayWidget (NULL),
    4124       mView (aView),
    4125       mContainer (aContainer),
     4131VBoxQGLOverlay::VBoxQGLOverlay (QWidget *pViewport,QObject *pPostEventObject,  CSession * aSession)
     4132    : mpOverlayWgt (NULL),
     4133      mpViewport (pViewport),
    41264134      mGlOn (false),
    41274135      mOverlayWidgetVisible (false),
     
    41314139      mNeedOverlayRepaint (false),
    41324140      mNeedSetVisible (false),
    4133       mCmdPipe (aView),
    4134       mSettings (*aSession)
     4141      mCmdPipe (pPostEventObject),
     4142      mSettings (*aSession),
     4143      mpSession(aSession)
    41354144{
    41364145    /* postpone the gl widget initialization to avoid conflict with 3D on Mac */
    41374146}
    41384147
     4148class VBoxGLShareWgt : public QGLWidget
     4149{
     4150public:
     4151    VBoxGLShareWgt() :
     4152        QGLWidget(VBoxVHWAImage::vboxGLFormat())
     4153    {}
     4154
     4155protected:
     4156    void initializeGL()
     4157    {
     4158        vboxVHWAGetSupportInfo(context());
     4159        VBoxVHWASurfaceBase::globalInit();
     4160    }
     4161};
    41394162void VBoxQGLOverlay::initGl()
    41404163{
    4141     if(mpOverlayWidget)
     4164    if(mpOverlayWgt)
     4165    {
     4166        Assert(mpShareWgt);
    41424167        return;
    4143 
    4144     mpOverlayWidget = new VBoxGLWidget (mView->console(), mView->viewport(), &mSettings);
    4145 
    4146     VBoxGLContext *pc = (VBoxGLContext*)mpOverlayWidget->context();
    4147     pc->allowDoneCurrent (false);
     4168    }
     4169
     4170    if (!mpShareWgt)
     4171    {
     4172        mpShareWgt = new VBoxGLShareWgt();
     4173        /* force initializeGL */
     4174        mpShareWgt->updateGL();
     4175    }
     4176
     4177    mOverlayImage.init(&mSettings);
     4178    mpOverlayWgt = new VBoxGLWgt(&mOverlayImage, mpViewport, mpShareWgt);
    41484179
    41494180    mOverlayWidgetVisible = true; /* to ensure it is set hidden with vboxShowOverlay */
    41504181    vboxShowOverlay (false);
    41514182
    4152     mpOverlayWidget->setMouseTracking (true);
     4183    mpOverlayWgt->setMouseTracking (true);
    41534184}
    41544185
     
    41594190    if(pHead)
    41604191    {
    4161         CDisplay display = mView->console().GetDisplay();
     4192        CDisplay display = mpSession->GetConsole().GetDisplay();
    41624193        Assert (!display.isNull());
    41634194
     
    41744205                    display.CompleteVHWACommand((BYTE*)pCmd);
    41754206                }
    4176                 break;
    4177             case VBOXVHWA_PIPECMD_OP:
    4178                 /* should not happen, don't handle this for now */
    4179                 Assert(0);
    41804207                break;
    41814208            case VBOXVHWA_PIPECMD_FUNC:
     
    42104237int VBoxQGLOverlay::resetGl()
    42114238{
    4212     if(mpOverlayWidget)
    4213     {
    4214         VHWACommandList list;
    4215         int rc = mpOverlayWidget->reset(&list);
    4216         if(RT_SUCCESS(rc))
    4217         {
    4218             for (VHWACommandList::const_iterator sIt = list.begin();
     4239    VHWACommandList list;
     4240    int rc = mOverlayImage.reset(&list);
     4241    AssertRC(rc);
     4242    if (RT_SUCCESS(rc))
     4243    {
     4244        for (VHWACommandList::const_iterator sIt = list.begin();
    42194245                    sIt != list.end(); ++ sIt)
    4220             {
    4221                 VBOXVHWACMD *pCmd = (*sIt);
    4222                 VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandFreeCmd, pCmd);
    4223                 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0);
    4224             }
     4246        {
     4247            VBOXVHWACMD *pCmd = (*sIt);
     4248            VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandFreeCmd, pCmd);
     4249            mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0);
    42254250        }
    42264251    }
     
    42984323}
    42994324
    4300 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re)
    4301 {
    4302     Q_UNUSED(re);
    4303 }
    4304 
    4305 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re)
    4306 {
    4307     Q_UNUSED(re);
     4325void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxFBSizeInfo &re, const QPoint & topLeft)
     4326{
     4327    mSizeInfo = re;
     4328    mContentsTopLeft = topLeft;
    43084329
    43094330    if(mGlOn)
     
    43454366    }
    43464367
    4347     mView->viewport()->repaint (rect.x() - mView->contentsX(),
    4348             rect.y() - mView->contentsY(),
     4368    mpViewport->repaint (rect.x() - mContentsTopLeft.x(),
     4369            rect.y() - mContentsTopLeft.y(),
    43494370            rect.width(), rect.height());
    43504371
     
    43564377    vboxDoVHWACmdExec(cmd);
    43574378
    4358     CDisplay display = mView->console().GetDisplay();
     4379    CDisplay display = mpSession->GetConsole().GetDisplay();
    43594380    Assert (!display.isNull());
    43604381
     
    43644385bool VBoxQGLOverlay::vboxSynchGl()
    43654386{
    4366     if(mpOverlayWidget->vboxIsInitialized()
    4367             && mContainer->pixelFormat() == mpOverlayWidget->vboxPixelFormat()
    4368             && mContainer->address() == mpOverlayWidget->vboxAddress()
    4369             && mContainer->bitsPerPixel() == mpOverlayWidget->vboxBitsPerPixel()
    4370             && mContainer->bytesPerLine() == mpOverlayWidget->vboxBytesPerLine()
    4371             && (int)mContainer->width() == mpOverlayWidget->vboxFbWidth()
    4372             && (int)mContainer->height() == mpOverlayWidget->vboxFbHeight())
     4387    VBoxVHWASurfaceBase * pVGA = mOverlayImage.vgaSurface();
     4388    if(pVGA
     4389            && mSizeInfo.pixelFormat() == pVGA->pixelFormat().toVBoxPixelFormat()
     4390            && mSizeInfo.VRAM() == pVGA->address()
     4391            && mSizeInfo.bitsPerPixel() == pVGA->bitsPerPixel()
     4392            && mSizeInfo.bytesPerLine() == pVGA->bytesPerLine()
     4393            && mSizeInfo.width() == pVGA->width()
     4394            && mSizeInfo.height() == pVGA->height()
     4395            )
    43734396    {
    43744397        return false;
     
    43764399    /* create and issue a resize event to the gl widget to ensure we have all gl data initialized
    43774400     * and synchronized with the framebuffer */
    4378     VBoxResizeEvent re(mContainer->pixelFormat(),
    4379             mContainer->address(),
    4380             mContainer->bitsPerPixel(),
    4381             mContainer->bytesPerLine(),
    4382             mContainer->width(),
    4383             mContainer->height());
    4384 
    4385     mpOverlayWidget->vboxDoResize(&re);
     4401    mOverlayImage.resize(mSizeInfo);
    43864402    return true;
    43874403}
     
    43974413    {
    43984414        /* need to ensure we have gl functions initialized */
    4399         mpOverlayWidget->makeCurrent();
    4400         vboxVHWAGetSupportInfo(mpOverlayWidget->context());
     4415        mpOverlayWgt->makeCurrent();
     4416        vboxVHWAGetSupportInfo(mpOverlayWgt->context());
    44014417
    44024418        VBOXQGLLOGREL(("Switching Gl mode on\n"));
    4403         Assert(!mpOverlayWidget->isVisible());
     4419        Assert(!mpOverlayWgt->isVisible());
    44044420        /* just to ensure */
    44054421        vboxShowOverlay(false);
     
    44244440    }
    44254441
    4426     int cX = mView->contentsX();
    4427     int cY = mView->contentsY();
    4428     QRect fbVp(cX, cY, mView->viewport()->width(), mView->viewport()->height());
     4442    int cX = mContentsTopLeft.x();
     4443    int cY = mContentsTopLeft.y();
     4444    QRect fbVp(cX, cY, mpViewport->width(), mpViewport->height());
    44294445    QRect overVp = fbVp.intersected(mOverlayViewport);
    44304446
     
    44354451    else
    44364452    {
    4437         if(overVp != mpOverlayWidget->vboxViewport())
     4453        if(overVp != mOverlayImage.vboxViewport())
    44384454        {
    44394455            makeCurrent();
    4440             mpOverlayWidget->vboxDoUpdateViewport(overVp);
     4456            mOverlayImage.vboxDoUpdateViewport(overVp);
    44414457            mNeedOverlayRepaint = true;
    44424458        }
     
    44494465
    44504466        /* workaround for linux ATI issue: need to update gl viewport after widget becomes visible */
    4451         mpOverlayWidget->vboxDoUpdateViewport(overVp);
     4467        mOverlayImage.vboxDoUpdateViewport(overVp);
    44524468    }
    44534469}
     
    44574473    if(mOverlayWidgetVisible != show)
    44584474    {
    4459         mpOverlayWidget->setVisible(show);
     4475        mpOverlayWgt->setVisible(show);
    44604476        mOverlayWidgetVisible = show;
    44614477        mGlCurrent = false;
    44624478        if(!show)
    44634479        {
    4464             mMainDirtyRect.add(mpOverlayWidget->vboxViewport());
     4480            mMainDirtyRect.add(mOverlayImage.vboxViewport());
    44654481        }
    44664482    }
     
    44694485void VBoxQGLOverlay::vboxCheckUpdateOverlay(const QRect & rect)
    44704486{
    4471     QRect overRect(mpOverlayWidget->pos(), mpOverlayWidget->size());
     4487    QRect overRect(mpOverlayWgt->pos(), mpOverlayWgt->size());
    44724488    if(overRect.x() != rect.x() || overRect.y() != rect.y())
    44734489    {
    44744490#if defined(RT_OS_WINDOWS)
    4475         mpOverlayWidget->setVisible(false);
     4491        mpOverlayWgt->setVisible(false);
    44764492        mNeedSetVisible = true;
    44774493#endif
    44784494        VBOXQGLLOG_QRECT("moving wgt to " , &rect, "\n");
    4479         mpOverlayWidget->move(rect.x(), rect.y());
     4495        mpOverlayWgt->move(rect.x(), rect.y());
    44804496        mGlCurrent = false;
    44814497    }
     
    44844500    {
    44854501#if defined(RT_OS_WINDOWS)
    4486         mpOverlayWidget->setVisible(false);
     4502        mpOverlayWgt->setVisible(false);
    44874503        mNeedSetVisible = true;
    44884504#endif
    44894505        VBOXQGLLOG(("resizing wgt to w(%d) ,h(%d)\n" , rect.width(), rect.height()));
    4490         mpOverlayWidget->resize(rect.width(), rect.height());
     4506        mpOverlayWgt->resize(rect.width(), rect.height());
    44914507        mGlCurrent = false;
    44924508    }
     
    44984514    if(mGlOn)
    44994515    {
    4500         mpOverlayWidget->vboxDoUpdateRect(&aRect);
     4516        mOverlayImage.vboxDoUpdateRect(&aRect);
    45014517        mNeedOverlayRepaint = true;
    45024518    }
     
    45054521int VBoxQGLOverlay::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd)
    45064522{
    4507     int rc = mpOverlayWidget->vhwaSurfaceUnlock(pCmd);
    4508     VBoxVHWASurfaceBase * pVGA = mpOverlayWidget->vboxGetVGASurface();
     4523    int rc = mOverlayImage.vhwaSurfaceUnlock(pCmd);
     4524    VBoxVHWASurfaceBase * pVGA = mOverlayImage.vgaSurface();
    45094525    const VBoxVHWADirtyRect & rect = pVGA->getDirtyRect();
    45104526    mNeedOverlayRepaint = true;
     
    45254541            VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE);
    45264542            makeCurrent();
    4527             pCmd->rc = mpOverlayWidget->vhwaSurfaceCanCreate(pBody);
     4543            pCmd->rc = mOverlayImage.vhwaSurfaceCanCreate(pBody);
    45284544        } break;
    45294545        case VBOXVHWACMD_TYPE_SURF_CREATE:
     
    45324548            makeCurrent();
    45334549            vboxSetGlOn(true);
    4534             pCmd->rc = mpOverlayWidget->vhwaSurfaceCreate(pBody);
    4535             if(!mpOverlayWidget->hasSurfaces())
     4550            pCmd->rc = mOverlayImage.vhwaSurfaceCreate(pBody);
     4551            if(!mOverlayImage.hasSurfaces())
    45364552            {
    45374553                vboxSetGlOn(false);
     
    45394555            else
    45404556            {
    4541                 mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     4557                mOverlayVisible = mOverlayImage.hasVisibleOverlays();
    45424558                if(mOverlayVisible)
    45434559                {
    4544                     mOverlayViewport = mpOverlayWidget->overlaysRectUnion();
     4560                    mOverlayViewport = mOverlayImage.overlaysRectUnion();
    45454561                }
    45464562                vboxDoCheckUpdateViewport();
     
    45524568            VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);
    45534569            makeCurrent();
    4554             pCmd->rc = mpOverlayWidget->vhwaSurfaceDestroy(pBody);
    4555             if(!mpOverlayWidget->hasSurfaces())
     4570            pCmd->rc = mOverlayImage.vhwaSurfaceDestroy(pBody);
     4571            if(!mOverlayImage.hasSurfaces())
    45564572            {
    45574573                vboxSetGlOn(false);
     
    45594575            else
    45604576            {
    4561                 mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     4577                mOverlayVisible = mOverlayImage.hasVisibleOverlays();
    45624578                if(mOverlayVisible)
    45634579                {
    4564                     mOverlayViewport = mpOverlayWidget->overlaysRectUnion();
     4580                    mOverlayViewport = mOverlayImage.overlaysRectUnion();
    45654581                }
    45664582                vboxDoCheckUpdateViewport();
     
    45724588            VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK);
    45734589            makeCurrent();
    4574             pCmd->rc = mpOverlayWidget->vhwaSurfaceLock(pBody);
     4590            pCmd->rc = mOverlayImage.vhwaSurfaceLock(pBody);
    45754591        } break;
    45764592        case VBOXVHWACMD_TYPE_SURF_UNLOCK:
     
    45854601            VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);
    45864602            makeCurrent();
    4587             pCmd->rc = mpOverlayWidget->vhwaSurfaceBlt(pBody);
     4603            pCmd->rc = mOverlayImage.vhwaSurfaceBlt(pBody);
    45884604            mNeedOverlayRepaint = true;
    45894605        } break;
     
    45924608            VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
    45934609            makeCurrent();
    4594             pCmd->rc = mpOverlayWidget->vhwaSurfaceFlip(pBody);
     4610            pCmd->rc = mOverlayImage.vhwaSurfaceFlip(pBody);
    45954611            mNeedOverlayRepaint = true;
    45964612        } break;
     
    45994615            VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);
    46004616            makeCurrent();
    4601             pCmd->rc = mpOverlayWidget->vhwaSurfaceOverlayUpdate(pBody);
    4602             mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     4617            pCmd->rc = mOverlayImage.vhwaSurfaceOverlayUpdate(pBody);
     4618            mOverlayVisible = mOverlayImage.hasVisibleOverlays();
    46034619            if(mOverlayVisible)
    46044620            {
    4605                 mOverlayViewport = mpOverlayWidget->overlaysRectUnion();
     4621                mOverlayViewport = mOverlayImage.overlaysRectUnion();
    46064622            }
    46074623            vboxDoCheckUpdateViewport();
     
    46124628            VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
    46134629            makeCurrent();
    4614             pCmd->rc = mpOverlayWidget->vhwaSurfaceOverlaySetPosition(pBody);
    4615             mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     4630            pCmd->rc = mOverlayImage.vhwaSurfaceOverlaySetPosition(pBody);
     4631            mOverlayVisible = mOverlayImage.hasVisibleOverlays();
    46164632            if(mOverlayVisible)
    46174633            {
    4618                 mOverlayViewport = mpOverlayWidget->overlaysRectUnion();
     4634                mOverlayViewport = mOverlayImage.overlaysRectUnion();
    46194635            }
    46204636            vboxDoCheckUpdateViewport();
     
    46254641            VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);
    46264642            makeCurrent();
    4627             pCmd->rc = mpOverlayWidget->vhwaSurfaceColorkeySet(pBody);
     4643            pCmd->rc = mOverlayImage.vhwaSurfaceColorkeySet(pBody);
    46284644            /* this is here to ensure we have color key changes picked up */
    46294645            vboxDoCheckUpdateViewport();
     
    46354651            initGl();
    46364652            makeCurrent();
    4637             pCmd->rc = mpOverlayWidget->vhwaQueryInfo1(pBody);
     4653            pCmd->rc = mOverlayImage.vhwaQueryInfo1(pBody);
    46384654        } break;
    46394655        case VBOXVHWACMD_TYPE_QUERY_INFO2:
     
    46414657            VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2);
    46424658            makeCurrent();
    4643             pCmd->rc = mpOverlayWidget->vhwaQueryInfo2(pBody);
     4659            pCmd->rc = mOverlayImage.vhwaQueryInfo2(pBody);
    46444660        } break;
    46454661        case VBOXVHWACMD_TYPE_ENABLE:
     
    46754691int VBoxQGLOverlay::vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version)
    46764692{
    4677     return VBoxGLWidget::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version);
     4693    return VBoxVHWAImage::vhwaLoadExec(&mOnResizeCmdList, pSSM, u32Version);
    46784694}
    46794695
    46804696void VBoxQGLOverlay::vhwaSaveExec(struct SSMHANDLE * pSSM)
    46814697{
    4682     if(mpOverlayWidget)
    4683         mpOverlayWidget->vhwaSaveExec(pSSM);
    4684     else
    4685         VBoxGLWidget::vhwaSaveExecVoid(pSSM);
     4698    mOverlayImage.vhwaSaveExec(pSSM);
    46864699}
    46874700
     
    47134726            );
    47144727    AssertRC(rc);
     4728    if (RT_SUCCESS(rc))
     4729    {
     4730        rc = mOverlayImage.vhwaConstruct(pCmd);
     4731        AssertRC(rc);
     4732    }
    47154733    return rc;
    47164734}
     
    47564774            vboxDoVHWACmd(pCmd->vhwaCmd());
    47574775            break;
    4758         case VBOXVHWA_PIPECMD_OP:
    4759         {
    4760             const VBOXVHWACALLBACKINFO & info = pCmd->op();
    4761             (info.pThis->*(info.pfnCallback))(info.pContext);
    4762             break;
    4763         }
    47644776        case VBOXVHWA_PIPECMD_FUNC:
    47654777        {
     
    51765188    uint32_t type = calcProgramType(pDst, pDstCKey, pSrcCKey, bNotIntersected);
    51775189
    5178     return mProgramMngr->getProgram(type, &colorFormat(), pDst ? &pDst->colorFormat() : NULL);
     5190    return mProgramMngr->getProgram(type, &pixelFormat(), pDst ? &pDst->pixelFormat() : NULL);
    51795191}
    51805192
     
    52655277        if(pSrcCKey)
    52665278        {
    5267             VBoxVHWATextureImage::setCKey(pProgram, &colorFormat(), pSrcCKey, false);
     5279            VBoxVHWATextureImage::setCKey(pProgram, &pixelFormat(), pSrcCKey, false);
    52685280        }
    52695281        if(pDstCKey)
    52705282        {
    5271             VBoxVHWATextureImage::setCKey(pProgram, &pDst->colorFormat(), pDstCKey, true);
     5283            VBoxVHWATextureImage::setCKey(pProgram, &pDst->pixelFormat(), pDstCKey, true);
    52725284        }
    52735285        pProgram->stop();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h

    r26862 r27682  
    242242    bool equals (const VBoxVHWAColorFormat & other) const;
    243243
     244    ulong toVBoxPixelFormat() const
     245    {
     246        if (!mDataFormat)
     247        {
     248            /* RGB data */
     249            switch (mFormat)
     250            {
     251                case GL_BGRA_EXT:
     252                    return FramebufferPixelFormat_FOURCC_RGB;
     253            }
     254        }
     255        return FramebufferPixelFormat_Opaque;
     256    }
     257
    244258private:
    245259    void init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
     
    493507    uint32_t bytesPerLine() { return mpTex[0]->bytesPerLine(); }
    494508
    495     const VBoxVHWAColorFormat &colorFormat() { return mColorFormat; }
     509    const VBoxVHWAColorFormat &pixelFormat() { return mColorFormat; }
    496510
    497511    uint32_t numComponents() {return mcTex;}
     
    737751{
    738752public:
    739     VBoxVHWASurfaceBase (
    740             class VBoxGLWidget *aWidget,
     753    VBoxVHWASurfaceBase (class VBoxVHWAImage *pImage,
    741754            const QSize & aSize,
    742755            const QRect & aTargRect,
     
    778791    ulong   memSize();
    779792
    780     ulong width() { return mRect.width();  }
    781     ulong height() { return mRect.height(); }
    782     const QSize size() {return mRect.size();}
    783 
    784     uint32_t fourcc() {return mImage->colorFormat().fourcc(); }
    785 
    786     ulong  bitsPerPixel() { return mImage->colorFormat().bitsPerPixel(); }
    787     ulong  bytesPerLine() { return mImage->bytesPerLine(); }
     793    ulong width() const { return mRect.width();  }
     794    ulong height() const { return mRect.height(); }
     795    const QSize size() const {return mRect.size();}
     796
     797    uint32_t fourcc() const {return mImage->pixelFormat().fourcc(); }
     798
     799    ulong  bitsPerPixel() const { return mImage->pixelFormat().bitsPerPixel(); }
     800    ulong  bytesPerLine() const { return mImage->bytesPerLine(); }
    788801
    789802    const VBoxVHWAColorKey * dstBltCKey() const { return mpDstBltCKey; }
     
    884897    }
    885898
    886     const VBoxVHWAColorFormat & colorFormat() { return mImage->colorFormat(); }
     899    const VBoxVHWAColorFormat & pixelFormat() const { return mImage->pixelFormat(); }
    887900
    888901    void setAddress(uchar * addr);
     
    951964    VBoxVHWASurfaceBase *mpPrimary;
    952965
    953     class VBoxGLWidget *mWidget;
    954 
    955966    uint32_t mHGHandle;
     967
     968    class VBoxVHWAImage *mpImage;
    956969
    957970#ifdef DEBUG
     
    11331146};
    11341147
    1135 typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
    1136 
    11371148typedef void (*PFNVBOXQGLFUNC)(void*, void*);
    11381149
     
    11411152    VBOXVHWA_PIPECMD_PAINT = 1,
    11421153    VBOXVHWA_PIPECMD_VHWA,
    1143     VBOXVHWA_PIPECMD_OP,
    1144     VBOXVHWA_PIPECMD_FUNC,
     1154    VBOXVHWA_PIPECMD_FUNC
    11451155}VBOXVHWA_PIPECMD_TYPE;
    1146 
    1147 typedef struct VBOXVHWACALLBACKINFO
    1148 {
    1149     VBoxGLWidget *pThis;
    1150     PFNVBOXQGLOP pfnCallback;
    1151     void * pContext;
    1152 }VBOXVHWACALLBACKINFO;
    11531156
    11541157typedef struct VBOXVHWAFUNCCALLBACKINFO
     
    11721175        mType = VBOXVHWA_PIPECMD_PAINT;
    11731176        mRect = aRect;
    1174     }
    1175 
    1176     void setOp(const VBOXVHWACALLBACKINFO & aOp)
    1177     {
    1178         mType = VBOXVHWA_PIPECMD_OP;
    1179         u.mCallback = aOp;
    11801177    }
    11811178
     
    11951192        case VBOXVHWA_PIPECMD_VHWA:
    11961193            setVHWACmd((struct _VBOXVHWACMD *)pvData);
    1197             break;
    1198         case VBOXVHWA_PIPECMD_OP:
    1199             setOp(*((VBOXVHWACALLBACKINFO *)pvData));
    12001194            break;
    12011195        case VBOXVHWA_PIPECMD_FUNC:
     
    12111205    const QRect & rect() const {return mRect;}
    12121206    struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;}
    1213     const VBOXVHWACALLBACKINFO & op() const {return u.mCallback; }
    12141207    const VBOXVHWAFUNCCALLBACKINFO & func() const {return u.mFuncCallback; }
    12151208
     
    12201213    {
    12211214        struct _VBOXVHWACMD * mpCmd;
    1222         VBOXVHWACALLBACKINFO mCallback;
    12231215        VBOXVHWAFUNCCALLBACKINFO mFuncCallback;
    12241216    }u;
     
    13351327};
    13361328
    1337 class VBoxGLWidget : public QGLWidget
    1338 {
    1339 public:
    1340     VBoxGLWidget (CConsole console, QWidget *aParent, VBoxVHWASettings *aSettings);
    1341     ~VBoxGLWidget();
    1342 
    1343     ulong vboxPixelFormat() { return mPixelFormat; }
    1344     bool vboxUsesGuestVRAM() { return mUsesGuestVRAM; }
    1345 
    1346     uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; }
    1347 
     1329/* added to workaround this ** [VBox|UI] duplication */
     1330class VBoxFBSizeInfo
     1331{
     1332public:
     1333    VBoxFBSizeInfo() {}
     1334    template<class T> VBoxFBSizeInfo(T * e) :
     1335        mPixelFormat(e->pixelFormat()), mVRAM(e->VRAM()), mBitsPerPixel(e->bitsPerPixel()),
     1336        mBytesPerLine(e->bytesPerLine()), mWidth(e->width()), mHeight(e->height()) {}
     1337
     1338    VBoxFBSizeInfo(ulong aPixelFormat, uchar *aVRAM,
     1339                     ulong aBitsPerPixel, ulong aBytesPerLine,
     1340                     ulong aWidth, ulong aHeight) :
     1341        mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
     1342        mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {}
     1343    ulong pixelFormat() const { return mPixelFormat; }
     1344    uchar *VRAM() const { return mVRAM; }
     1345    ulong bitsPerPixel() const { return mBitsPerPixel; }
     1346    ulong bytesPerLine() const { return mBytesPerLine; }
     1347    ulong width() const { return mWidth; }
     1348    ulong height() const { return mHeight; }
     1349
     1350private:
     1351    ulong mPixelFormat;
     1352    uchar *mVRAM;
     1353    ulong mBitsPerPixel;
     1354    ulong mBytesPerLine;
     1355    ulong mWidth;
     1356    ulong mHeight;
     1357};
     1358
     1359class VBoxVHWAImage
     1360{
     1361public:
     1362    VBoxVHWAImage ();
     1363    ~VBoxVHWAImage();
     1364
     1365    int init(VBoxVHWASettings *aSettings);
    13481366#ifdef VBOX_WITH_VIDEOHWACCEL
    13491367    uchar *vboxVRAMAddressFromOffset(uint64_t offset);
     
    13691387    int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
    13701388
     1389    void *vramBase() { return mpvVRAM; }
     1390    uint32_t vramSize() { return mcbVRAM; }
     1391
    13711392    bool hasSurfaces() const;
    13721393    bool hasVisibleOverlays();
     
    13751396#endif
    13761397
     1398    static const QGLFormat & vboxGLFormat();
     1399
    13771400    int reset(VHWACommandList * pCmdList);
    13781401
    1379     ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
    1380     ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }
     1402//    ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
     1403//    ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }
    13811404    int vboxFbWidth() {return mDisplay.getVGA()->width(); }
    13821405    int vboxFbHeight() {return mDisplay.getVGA()->height(); }
    1383     bool vboxIsInitialized() {return mDisplay.getVGA() != NULL; }
    1384 
    1385     void vboxDoResize(void *re);
    1386 
    1387     void vboxResizeEvent (void *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re); }
    1388 
    1389     void vboxProcessVHWACommands(class VBoxVHWACommandElementProcessor * pPipe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pPipe);}
     1406    bool isInitialized() {return mDisplay.getVGA() != NULL; }
     1407
     1408    void resize(const VBoxFBSizeInfo & size);
    13901409
    13911410    class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr() { return mpMngr; }
    13921411
    1393     VBoxVHWASurfaceBase * vboxGetVGASurface() { return mDisplay.getVGA(); }
     1412    VBoxVHWASurfaceBase * vgaSurface() { return mDisplay.getVGA(); }
    13941413
    13951414#ifdef VBOXVHWA_OLD_COORD
     
    14061425#endif
    14071426
    1408     bool performDisplayAndSwap(bool bForce)
     1427    bool performDisplay(bool bForce)
    14091428    {
    14101429        bForce = mDisplay.performDisplay(bForce | mRepaintNeeded);
    1411         if(bForce)
    1412         {
    1413             swapBuffers();
    1414         }
    14151430
    14161431#ifdef VBOXVHWA_PROFILE_FPS
     
    14291444    }
    14301445
    1431     VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; }
     1446//    VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; }
    14321447
    14331448    static void pushSettingsAndSetupViewport(const QSize &display, const QRect &viewport)
     
    14481463    }
    14491464
    1450 protected:
    1451 
    1452     void paintGL()
    1453     {
    1454         if(mpfnOp)
    1455         {
    1456             (this->*mpfnOp)(mOpContext);
    1457             mpfnOp = NULL;
    1458         }
    1459         VBOXQGLLOG(("paintGL\n"));
    1460 
    1461         mDisplay.performDisplay(true);
    1462     }
    1463 
    1464     void initializeGL();
    1465 
    14661465private:
    14671466    static void setupMatricies(const QSize &display, bool bInvert);
     
    14731472#endif
    14741473#ifdef VBOX_WITH_VIDEOHWACCEL
    1475     void vboxDoVHWACmdExec(void *cmd);
    1476     void vboxDoVHWACmdAndFree(void *cmd);
    1477     void vboxDoVHWACmd(void *cmd);
     1474//    void vboxDoVHWACmdExec(void *cmd);
     1475//    void vboxDoVHWACmdAndFree(void *cmd);
     1476//    void vboxDoVHWACmd(void *cmd);
    14781477
    14791478    void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
     
    14971496    void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd);
    14981497#endif
    1499     static const QGLFormat & vboxGLFormat();
    15001498
    15011499    VBoxVHWADisplay mDisplay;
    15021500
    1503 
    1504     /* we do all opengl stuff in the paintGL context,
    1505      * submit the operation to be performed
    1506      * @todo: could be moved outside the updateGL */
    1507     void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext)
    1508     {
    1509         mpfnOp = pfn;
    1510         mOpContext = pContext;
    1511         updateGL();
    1512     }
    1513 
    1514     void vboxDoProcessVHWACommands(void *pContext);
    1515 
    1516     class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd);
     1501//    void vboxDoProcessVHWACommands(void *pContext);
     1502
     1503//    class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd);
    15171504
    15181505    VBoxVHWASurfaceBase* handle2Surface(uint32_t h)
     
    15251512    VBoxVHWAHandleTable mSurfHandleTable;
    15261513
    1527     PFNVBOXQGLOP mpfnOp;
    1528     void *mOpContext;
    1529 
    1530     ulong  mPixelFormat;
    1531     bool   mUsesGuestVRAM;
    1532 
    15331514    bool mRepaintNeeded;
    15341515
    15351516    QRect mViewport;
    1536 
    1537     CConsole m_console;
    15381517
    15391518    VBoxVHWASurfList *mConstructingList;
     
    15421521    /* this is used in saved state restore to postpone surface restoration
    15431522     * till the framebuffer size is restored */
    1544     VHWACommandList mOnResizeCmdList;
     1523//    VHWACommandList mOnResizeCmdList;
    15451524
    15461525    class VBoxVHWAGlProgramMngr *mpMngr;
    15471526
    15481527    VBoxVHWASettings *mSettings;
     1528
     1529    void    *mpvVRAM;
     1530    uint32_t mcbVRAM;
    15491531
    15501532#ifdef VBOXVHWA_PROFILE_FPS
     
    15521534    bool mbNewFrame;
    15531535#endif
     1536};
     1537
     1538class VBoxGLWgt : public QGLWidget
     1539{
     1540public:
     1541    VBoxGLWgt(VBoxVHWAImage * pImage,
     1542            QWidget* parent, const QGLWidget* shareWidget);
     1543
     1544protected:
     1545    void paintGL()
     1546    {
     1547        mpImage->performDisplay(true);
     1548    }
     1549private:
     1550    VBoxVHWAImage * mpImage;
    15541551};
    15551552
     
    16451642        T::update(pRect);
    16461643
    1647         VBoxGLWidget::pushSettingsAndSetupViewport(rect().size(), rect());
     1644        VBoxVHWAImage::pushSettingsAndSetupViewport(rect().size(), rect());
    16481645        mFBO.bind();
    16491646        T::display();
    16501647        mFBO.unbind();
    1651         VBoxGLWidget::popSettingsAfterSetupViewport();
     1648        VBoxVHWAImage::popSettingsAfterSetupViewport();
    16521649    }
    16531650
     
    16731670{
    16741671public:
    1675     VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer, CSession * aSession);
     1672    VBoxQGLOverlay (QWidget *pViewport, QObject *pPostEventObject, CSession * aSession);
     1673    ~VBoxQGLOverlay()
     1674    {
     1675        if (mpShareWgt)
     1676            delete mpShareWgt;
     1677    }
     1678
     1679    void updateViewport(QWidget *pViewport);
    16761680
    16771681    int onVHWACommand (struct _VBOXVHWACMD * pCommand);
     
    16991703    }
    17001704
    1701     void onResizeEvent (const class VBoxResizeEvent *re);
    1702     void onResizeEventPostprocess (const class VBoxResizeEvent *re);
     1705    void onResizeEventPostprocess (const VBoxFBSizeInfo &re, const QPoint & topLeft);
    17031706
    17041707    void onViewportResized (QResizeEvent * /*re*/)
     
    17081711    }
    17091712
    1710     void onViewportScrolled (int /*dx*/, int /*dy*/)
    1711     {
     1713    void onViewportScrolled (const QPoint & newTopLeft)
     1714    {
     1715        mContentsTopLeft = newTopLeft;
    17121716        vboxDoCheckUpdateViewport();
    17131717        mGlCurrent = false;
     
    17371741        {
    17381742            mNeedSetVisible = false;
    1739             mpOverlayWidget->setVisible (true);
     1743            mpOverlayWgt->setVisible (true);
    17401744        }
    17411745    }
     
    17481752    void makeCurrent()
    17491753    {
    1750         if(!mGlCurrent)
     1754        if (!mGlCurrent)
    17511755        {
    17521756            mGlCurrent = true;
    1753             mpOverlayWidget->makeCurrent();
     1757            mpOverlayWgt->makeCurrent();
    17541758        }
    17551759    }
     
    17571761    void performDisplayOverlay()
    17581762    {
    1759         if(mOverlayVisible)
     1763        if (mOverlayVisible)
    17601764        {
    17611765            makeCurrent();
    1762             mpOverlayWidget->performDisplayAndSwap (false);
     1766            if (mOverlayImage.performDisplay(false))
     1767                mpOverlayWgt->swapBuffers();
    17631768        }
    17641769    }
     
    17831788    void initGl();
    17841789
    1785     VBoxGLWidget *mpOverlayWidget;
    1786     class VBoxConsoleView *mView;
    1787     class VBoxFrameBuffer *mContainer;
     1790    VBoxGLWgt *mpOverlayWgt;
     1791    VBoxVHWAImage mOverlayImage;
     1792    QWidget *mpViewport;
    17881793    bool mGlOn;
    17891794    bool mOverlayWidgetVisible;
     
    18031808
    18041809    VBoxVHWASettings mSettings;
    1805 };
    1806 
    1807 
    1808 template <class T>
     1810    CSession * mpSession;
     1811
     1812    VBoxFBSizeInfo mSizeInfo;
     1813    QPoint mContentsTopLeft;
     1814
     1815    QGLWidget *mpShareWgt;
     1816};
     1817
     1818/* these two additional class V, class R are to workaround the [VBox|UI] duplication,
     1819 * @todo: remove them once VBox stuff is removed */
     1820template <class T, class V, class R>
    18091821class VBoxOverlayFrameBuffer : public T
    18101822{
    18111823public:
    1812     VBoxOverlayFrameBuffer (class VBoxConsoleView *aView, CSession * aSession)
    1813         : T (aView),
    1814           mOverlay (aView, this, aSession)
     1824    VBoxOverlayFrameBuffer (V *pView, QWidget *pWidget, CSession * aSession)
     1825        : T (pView),
     1826          mOverlay (pWidget, pView, aSession),
     1827          mpView (pView)
    18151828    {}
    18161829
     
    18521865    }
    18531866
    1854     void resizeEvent (VBoxResizeEvent *re)
    1855     {
    1856         mOverlay.onResizeEvent (re);
     1867    void resizeEvent (R *re)
     1868    {
    18571869        T::resizeEvent (re);
    1858         mOverlay.onResizeEventPostprocess (re);
     1870        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(re),
     1871                QPoint(mpView->contentsX(), mpView->contentsY()));
    18591872    }
    18601873
     
    18671880    void viewportScrolled (int dx, int dy)
    18681881    {
    1869         mOverlay.onViewportScrolled (dx, dy);
     1882        mOverlay.onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY()));
    18701883        T::viewportScrolled (dx, dy);
    18711884    }
    18721885private:
    18731886    VBoxQGLOverlay mOverlay;
     1887    V *mpView;
    18741888};
    18751889
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp

    r26719 r27682  
    1919 * additional information or have any questions.
    2020 */
    21 #if defined (VBOX_GUI_USE_QGL)
     21#if defined (VBOX_GUI_USE_QGLFB)
    2222
    2323#ifdef VBOX_WITH_PRECOMPILED_HEADERS
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp

    r26719 r27682  
    450450/////////////////////////////////////////////////////////////////////////////
    451451
    452 #if defined (VBOX_GUI_USE_QGL)
     452#if defined (VBOX_GUI_USE_QGLFB)
    453453
    454454/* The class is defined in VBoxFBQGL.cpp */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.h

    r26719 r27682  
    296296/////////////////////////////////////////////////////////////////////////////
    297297
    298 #if defined (VBOX_GUI_USE_QGL)
     298#if defined (VBOX_GUI_USE_QGLFB)
    299299
    300300class VBoxQGLFrameBuffer : public VBoxFrameBuffer
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h

    r27609 r27682  
    8383    {
    8484        InvalidRenderMode, TimerMode, QImageMode, SDLMode, DDRAWMode, Quartz2DMode
    85 #ifdef VBOX_GUI_USE_QGL
     85#ifdef VBOX_GUI_USE_QGLFB
    8686        , QGLMode
    8787#endif
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r27600 r27682  
    576576            mode = VBoxDefs::Quartz2DMode;
    577577#endif
    578 #if defined (VBOX_GUI_USE_QGL)
     578#if defined (VBOX_GUI_USE_QGLFB)
    579579        else if (::strcmp (aModeStr, "qgl") == 0)
    580580            mode = VBoxDefs::QGLMode;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQGL.cpp

    r27107 r27682  
    1919 * additional information or have any questions.
    2020 */
    21 #if defined (VBOX_GUI_USE_QGL)
     21#if defined (VBOX_GUI_USE_QGLFB)
    2222
    2323#ifdef VBOX_WITH_PRECOMPILED_HEADERS
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQGL.h

    r26797 r27682  
    2626/* Global includes */
    2727#include "UIFrameBuffer.h"
    28 #if defined (VBOX_GUI_USE_QGL)
     28#if defined (VBOX_GUI_USE_QGLFB)
    2929#include "VBoxFBOverlay.h"
    3030
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r27454 r27682  
    3737#include "UIFrameBufferQuartz2D.h"
    3838#include "UIFrameBufferSDL.h"
     39#include "VBoxFBOverlay.h"
    3940#include "UISession.h"
    4041#include "UIActionsPool.h"
     
    463464{
    464465    /* Prepare viewport: */
    465 #ifdef VBOX_GUI_USE_QGL
     466#ifdef VBOX_GUI_USE_QGLFB
    466467    QWidget *pViewport;
    467468    switch (mode())
     
    486487#ifdef VBOX_GUI_USE_QIMAGE
    487488        case VBoxDefs::QImageMode:
    488 //# ifdef VBOX_WITH_VIDEOHWACCEL
    489 //            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQImage>(this, &machineWindowWrapper()->session()) : new UIFrameBufferQImage(this);
    490 //# else
     489# ifdef VBOX_WITH_VIDEOHWACCEL
     490            /* these two additional template args is a workaround to this [VBox|UI] duplication
     491             * @todo: they are to be removed once VBox stuff is gone */
     492            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferQImage(this);
     493# else
    491494            m_pFrameBuffer = new UIFrameBufferQImage(this);
    492 //# endif
     495# endif
    493496            break;
    494497#endif /* VBOX_GUI_USE_QIMAGE */
    495 #ifdef VBOX_GUI_USE_QGL
     498#ifdef VBOX_GUI_USE_QGLFB
    496499        case VBoxDefs::QGLMode:
    497500            m_pFrameBuffer = new UIFrameBufferQGL(this);
     
    500503//            m_pFrameBuffer = new UIQGLOverlayFrameBuffer(this);
    501504//            break;
    502 #endif /* VBOX_GUI_USE_QGL */
     505#endif /* VBOX_GUI_USE_QGLFB */
    503506#ifdef VBOX_GUI_USE_SDL
    504507        case VBoxDefs::SDLMode:
     
    510513            XFlush(QX11Info::display());
    511514# endif
    512 //# if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
    513 //            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UISDLFrameBuffer> (this, &machineWindowWrapper()->session()) : new UISDLFrameBuffer(this);
    514 //# else
     515# if defined(VBOX_WITH_VIDEOHWACCEL) && defined(DEBUG_misha) /* not tested yet */
     516            /* these two additional template args is a workaround to this [VBox|UI] duplication
     517             * @todo: they are to be removed once VBox stuff is gone */
     518            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<UIFrameBufferSDL, UIMachineView, UIResizeEvent> (this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferSDL(this);
     519# else
    515520            m_pFrameBuffer = new UIFrameBufferSDL(this);
    516 //# endif
     521# endif
    517522            /* Disable scrollbars because we cannot correctly draw in a scrolled window using SDL: */
    518523            horizontalScrollBar()->setEnabled(false);
     
    538543            /* Indicate that we are doing all drawing stuff ourself: */
    539544            viewport()->setAttribute(Qt::WA_PaintOnScreen);
    540 //# ifdef VBOX_WITH_VIDEOHWACCEL
    541 //            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer>(this, &machineWindowWrapper()->session()) : new UIFrameBufferQuartz2D(this);
    542 //# else
     545# ifdef VBOX_WITH_VIDEOHWACCEL
     546            /* these two additional template args is a workaround to this [VBox|UI] duplication
     547             * @todo: they are to be removed once VBox stuff is gone */
     548            m_pFrameBuffer = m_fAccelerate2DVideo ? new VBoxOverlayFrameBuffer<VBoxQuartz2DFrameBuffer, UIMachineView, UIResizeEvent>(this, viewport(), &machineWindowWrapper()->session()) : new UIFrameBufferQuartz2D(this);
     549# else
    543550            m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
    544 //# endif
     551# endif
    545552            break;
    546553#endif /* VBOX_GUI_USE_QUARTZ2D */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r27679 r27682  
    264264    friend class UIFrameBufferQuartz2D;
    265265    friend class UIFrameBufferQGL;
     266    template<class UIFrameBufferQImage, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer;
     267    template<class UIFrameBufferQuartz2D, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer;
     268    template<class UIFrameBufferSDL, class UIMachineView, class UIResizeEvent> friend class VBoxOverlayFrameBuffer;
    266269};
    267270
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