VirtualBox

Ignore:
Timestamp:
Nov 6, 2009 6:39:07 PM (15 years ago)
Author:
vboxsync
Message:

2d accel: lazy QGLWidget creation to avoid conflicting with 3D on Mac

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

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

    r24431 r24471  
    12521252
    12531253    int reset();
     1254       
     1255    void initGl();
    12541256
    12551257    VBoxGLWidget *mpOverlayWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r24437 r24471  
    798798#ifdef VBOX_WITH_VIDEOHWACCEL
    799799    /* Need to force the QGL framebuffer in case 2D Video Acceleration is supported & enabled */
    800     bool bAccelerate2DVideo = machine.GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable();
     800    bool bAccelerate2DVideo = machine.GetAccelerate2DVideoEnabled()
     801# ifndef Q_WS_MAC /* @todo: fixme: temporary disable the check on Mac until we move it to a separate app */
     802            && VBoxGlobal::isAcceleration2DVideoAvailable()
     803# endif
     804    ;
    801805#endif
    802806
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r24451 r24471  
    710710
    711711            mSrcLowerR = 0.0; mSrcLowerG = 0.0; mSrcLowerB = 0.0;
     712
    712713            VBOXQGL_CHECKERR(
    713714                    vboxglUniform4f(mUniSrcLowerColor, 0.0, 0.0, 0.0, 0.0);
     
    25032504    vboxFormat.setDepth(false);
    25042505    Assert(!vboxFormat.depth());
     2506//  vboxFormat.setRedBufferSize(8);
     2507//  vboxFormat.setGreenBufferSize(8);
     2508//  vboxFormat.setBlueBufferSize(8);
    25052509    return vboxFormat;
    25062510}
     
    42764280//    Assert(format().alpha());
    42774281//    Assert(format().alphaBufferSize() == 8);
     4282    VBOXQGLLOG(("format().blueBufferSize()(%d)\n", format().blueBufferSize()));
     4283    VBOXQGLLOG(("format().greenBufferSize()(%d)\n", format().greenBufferSize()));
     4284    VBOXQGLLOG(("format().redBufferSize()(%d)\n", format().redBufferSize()));
    42784285    Assert(format().blueBufferSize() == 8);
    42794286    Assert(format().greenBufferSize() == 8);
     
    47294736
    47304737VBoxQGLOverlay::VBoxQGLOverlay (VBoxConsoleView *aView, VBoxFrameBuffer * aContainer)
    4731     : mView(aView),
     4738    : mpOverlayWidget(NULL),
     4739      mView(aView),
    47324740      mContainer(aContainer),
    47334741      mGlOn(false),
     
    47404748      mCmdPipe(aView)
    47414749{
    4742     mpOverlayWidget = new VBoxGLWidget (aView, aView->viewport());
    4743 
     4750    /* postpone the gl widget initialization to avoid conflict with 3D on Mac */
     4751}
     4752
     4753void VBoxQGLOverlay::initGl()
     4754{
     4755        if(mpOverlayWidget)
     4756                return;
     4757       
     4758    mpOverlayWidget = new VBoxGLWidget (mView, mView->viewport());
     4759       
    47444760    VBoxGLContext *pc = (VBoxGLContext*)mpOverlayWidget->context();
    47454761    pc->allowDoneCurrent(false);
    4746 
     4762       
    47474763    mOverlayWidgetVisible = true; /* to ensure it is set hidden with vboxShowOverlay */
    47484764    vboxShowOverlay(false);
    4749 
     4765       
    47504766    mpOverlayWidget->setMouseTracking(true);
    4751 
    4752 //    resizeEvent (new VBoxResizeEvent (FramebufferPixelFormat_Opaque,
    4753 //                                      NULL, 0, 0, 640, 480));
    47544767}
    47554768
     
    47884801        }
    47894802
     4803#ifdef DEBUG
    47904804        VBoxVHWACommandElement *pTest = mCmdPipe.detachCmdList(pHead, pTail);
    47914805        Assert(!pTest);
    47924806        NOREF(pTest);
     4807#endif
    47934808    }
    47944809    return VINF_SUCCESS;
     
    51345149{
    51355150    struct _VBOXVHWACMD * pCmd = (struct _VBOXVHWACMD *)cmd;
    5136     makeCurrent();
    51375151    switch(pCmd->enmCmd)
    51385152    {
     
    51405154        {
    51415155            VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE);
     5156            makeCurrent();
    51425157            pCmd->rc = mpOverlayWidget->vhwaSurfaceCanCreate(pBody);
    51435158        } break;
     
    51455160        {
    51465161            VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE);
     5162            makeCurrent();
    51475163            vboxSetGlOn(true);
    51485164            pCmd->rc = mpOverlayWidget->vhwaSurfaceCreate(pBody);
     
    51655181        {
    51665182            VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);
     5183            makeCurrent();
    51675184            pCmd->rc = mpOverlayWidget->vhwaSurfaceDestroy(pBody);
    51685185            if(!mpOverlayWidget->hasSurfaces())
     
    51845201        {
    51855202            VBOXVHWACMD_SURF_LOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_LOCK);
     5203            makeCurrent();
    51865204            pCmd->rc = mpOverlayWidget->vhwaSurfaceLock(pBody);
    51875205        } break;
     
    51895207        {
    51905208            VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK);
     5209            makeCurrent();
    51915210            pCmd->rc = vhwaSurfaceUnlock(pBody);
    51925211            /* mNeedOverlayRepaint is set inside the vhwaSurfaceUnlock */
     
    51955214        {
    51965215            VBOXVHWACMD_SURF_BLT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_BLT);
     5216            makeCurrent();
    51975217            pCmd->rc = mpOverlayWidget->vhwaSurfaceBlt(pBody);
    51985218            mNeedOverlayRepaint = true;
     
    52015221        {
    52025222            VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
     5223            makeCurrent();
    52035224            pCmd->rc = mpOverlayWidget->vhwaSurfaceFlip(pBody);
    52045225            mNeedOverlayRepaint = true;
     
    52075228        {
    52085229            VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE);
     5230            makeCurrent();
    52095231            pCmd->rc = mpOverlayWidget->vhwaSurfaceOverlayUpdate(pBody);
    52105232            mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     
    52195241        {
    52205242            VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
     5243            makeCurrent();
    52215244            pCmd->rc = mpOverlayWidget->vhwaSurfaceOverlaySetPosition(pBody);
    52225245            mOverlayVisible = mpOverlayWidget->hasVisibleOverlays();
     
    52315254        {
    52325255            VBOXVHWACMD_SURF_COLORKEY_SET * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_COLORKEY_SET);
     5256            makeCurrent();
    52335257            pCmd->rc = mpOverlayWidget->vhwaSurfaceColorkeySet(pBody);
    52345258            mNeedOverlayRepaint = true;
     
    52375261        {
    52385262            VBOXVHWACMD_QUERYINFO1 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1);
     5263            initGl();
     5264            makeCurrent();
    52395265            pCmd->rc = mpOverlayWidget->vhwaQueryInfo1(pBody);
    52405266        } break;
     
    52425268        {
    52435269            VBOXVHWACMD_QUERYINFO2 * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2);
     5270            makeCurrent();
    52445271            pCmd->rc = mpOverlayWidget->vhwaQueryInfo2(pBody);
    52455272        } break;
    52465273        case VBOXVHWACMD_TYPE_ENABLE:
     5274                        initGl();
    52475275        case VBOXVHWACMD_TYPE_DISABLE:
    52485276            pCmd->rc = VINF_SUCCESS;
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