VirtualBox

Changeset 22834 in vbox


Ignore:
Timestamp:
Sep 8, 2009 12:03:54 PM (15 years ago)
Author:
vboxsync
Message:

video hw accel: bugfixes & perf improvements

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

Legend:

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

    r22816 r22834  
    138138    void requestToResize (const QSize &aSize);
    139139
     140#ifdef VBOX_WITH_VIDEOHWACCEL
     141    void scrollContentsBy (int dx, int dy);
     142#endif
     143
    140144#if defined(Q_WS_MAC)
    141145    void updateDockIcon();
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h

    r22826 r22834  
    572572    void setHandle(uint32_t h) {mHGHandle = h;}
    573573
     574    const VBoxVHWADirtyRect & getDirtyRect() { return mUpdateMem2TexRect; }
     575
    574576private:
    575577    void doSetRectValuesInternal(const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisTargRect);
     
    11871189    void onResizeEventPostprocess (const class VBoxResizeEvent *re);
    11881190
     1191    void viewportResized(QResizeEvent * re)
     1192    {
     1193        vboxDoCheckUpdateViewport();
     1194        mGlCurrent = false;
     1195    }
     1196
     1197    void viewportScrolled(int dx, int dy)
     1198    {
     1199        vboxDoCheckUpdateViewport();
     1200        mGlCurrent = false;
     1201    }
     1202
    11891203    static bool isAcceleration2DVideoAvailable();
    11901204
     
    11931207    void vhwaSaveExec(struct SSMHANDLE * pSSM);
    11941208private:
     1209    int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
     1210
     1211    void repaintMain();
     1212    void repaintOverlay()
     1213    {
     1214        if(mNeedOverlayRepaint)
     1215        {
     1216            mNeedOverlayRepaint = false;
     1217            performDisplayOverlay();
     1218        }
     1219    }
     1220    void repaint()
     1221    {
     1222        repaintOverlay();
     1223        repaintMain();
     1224    }
    11951225
    11961226    void makeCurrent()
     
    12171247    }
    12181248
    1219     void vboxOpExit()
    1220     {
    1221         performDisplayOverlay();
    1222         mGlCurrent = false;
    1223     }
     1249//    void vboxOpExit()
     1250//    {
     1251//        performDisplayOverlay();
     1252//        mGlCurrent = false;
     1253//    }
    12241254
    12251255
    12261256    void vboxSetGlOn(bool on);
    12271257    bool vboxGetGlOn() { return mGlOn; }
    1228     void vboxSynchGl();
     1258    bool vboxSynchGl();
    12291259    void vboxDoVHWACmdExec(void *cmd);
    12301260    void vboxShowOverlay(bool show);
    12311261    void vboxDoCheckUpdateViewport();
    12321262    void vboxDoVHWACmd(void *cmd);
    1233     void vboxDoUpdateRect(const QRect * pRect);
     1263    void addMainDirtyRect(const QRect & aRect);
    12341264//    void vboxUpdateOverlayPosition(const QPoint & pos);
    12351265    void vboxCheckUpdateOverlay(const QRect & rect);
     
    12461276    bool mGlCurrent;
    12471277    bool mProcessingCommands;
     1278    bool mNeedOverlayRepaint;
    12481279    QRect mOverlayViewport;
    12491280    VBoxVHWADirtyRect mMainDirtyRect;
     
    13101341        mOverlay.onResizeEventPostprocess(re);
    13111342    }
     1343
     1344    void viewportResized(QResizeEvent * re)
     1345    {
     1346        mOverlay.viewportResized(re);
     1347        T::viewportResized(re);
     1348    }
     1349
     1350    void viewportScrolled(int dx, int dy)
     1351    {
     1352        mOverlay.viewportScrolled(dx, dy);
     1353        T::viewportScrolled(dx, dy);
     1354    }
    13121355private:
    13131356    VBoxQGLOverlay mOverlay;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h

    r22822 r22834  
    243243     * the event is framebuffer implementation specific */
    244244    virtual void doProcessVHWACommand(QEvent * pEvent);
     245
     246    virtual void viewportResized(QResizeEvent * re){}
     247
     248    virtual void viewportScrolled(int dx, int dy){}
    245249#endif
    246250
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r22822 r22834  
    17331733}
    17341734
     1735#ifdef VBOX_WITH_VIDEOHWACCEL
     1736void VBoxConsoleView::scrollContentsBy (int dx, int dy)
     1737{
     1738    if (mAttached && mFrameBuf)
     1739    {
     1740        mFrameBuf->viewportScrolled(dx, dy);
     1741    }
     1742    QAbstractScrollArea::scrollContentsBy (dx, dy);
     1743}
     1744#endif
     1745
     1746
    17351747bool VBoxConsoleView::eventFilter (QObject *watched, QEvent *e)
    17361748{
     
    17831795                if (mMouseCaptured)
    17841796                    updateMouseClipping();
     1797#ifdef VBOX_WITH_VIDEOHWACCEL
     1798                if (mFrameBuf)
     1799                {
     1800                    mFrameBuf->viewportResized((QResizeEvent*)e);
     1801                }
     1802#endif
    17851803                break;
    17861804            }
     
    29772995{
    29782996#if 1
    2979    
     2997
    29802998    LogRel3(("%s: type=%03d x=%03d y=%03d btns=%08X wdelta=%03d wdir=%s\n",
    29812999             __PRETTY_FUNCTION__ , aType, aPos.x(), aPos.y(),
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp

    r22826 r22834  
    50875087      mGlCurrent(false),
    50885088      mProcessingCommands(false),
     5089      mNeedOverlayRepaint(false),
    50895090      mCmdPipe(aView)
    50905091{
     
    51275128
    51285129    mProcessingCommands = false;
    5129     vboxOpExit();
     5130    repaint();
     5131//    vboxOpExit();
     5132    mGlCurrent = false;
    51305133}
    51315134
     
    51545157    Q_UNUSED(pRect);
    51555158
    5156     if(mOverlayWidgetVisible && !mProcessingCommands)
     5159//    if(mOverlayWidgetVisible && !mProcessingCommands)
     5160//    {
     5161//        Assert(!mGlCurrent);
     5162//        vboxDoCheckUpdateViewport();
     5163//        vboxOpExit();
     5164//    }
     5165    return VBOXFBOVERLAY_UNTOUCHED;
     5166}
     5167
     5168void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re)
     5169{
     5170    Q_UNUSED(re);
     5171}
     5172
     5173void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re)
     5174{
     5175    Q_UNUSED(re);
     5176
     5177    if(mGlOn)
    51575178    {
    51585179        Assert(!mGlCurrent);
    5159         vboxDoCheckUpdateViewport();
    5160         vboxOpExit();
    5161     }
    5162     return VBOXFBOVERLAY_UNTOUCHED;
    5163 }
    5164 
    5165 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re)
    5166 {
    5167     Q_UNUSED(re);
    5168 }
    5169 
    5170 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re)
    5171 {
    5172     Q_UNUSED(re);
    5173 
    5174     bool bDoOpExit = false;
    5175 
    5176     if(mGlOn)
    5177     {
    5178         Assert(!mGlCurrent);
     5180        Assert(!mNeedOverlayRepaint);
    51795181        mGlCurrent = false;
    51805182        makeCurrent();
    51815183        /* need to ensure we're in synch */
    5182         vboxSynchGl();
    5183         bDoOpExit = true;
     5184        mNeedOverlayRepaint = vboxSynchGl();
    51845185    }
    51855186
     
    51945195        }
    51955196        mOnResizeCmdList.clear();
    5196         bDoOpExit = true;
    5197     }
    5198 
    5199     if(bDoOpExit)
    5200     {
    5201         vboxOpExit();
    5202     }
    5203     Assert(mGlCurrent == false);
    5204 
     5197    }
     5198
     5199    repaintOverlay();
     5200    mGlCurrent = false;
     5201}
     5202
     5203void VBoxQGLOverlay::repaintMain()
     5204{
     5205    if(mMainDirtyRect.isClear())
     5206        return;
     5207
     5208    const QRect &rect = mMainDirtyRect.rect();
     5209    if(mOverlayWidgetVisible)
     5210    {
     5211        if(mOverlayViewport.contains(rect))
     5212            return;
     5213    }
     5214
     5215    mView->viewport()->repaint (rect.x() - mView->contentsX(),
     5216            rect.y() - mView->contentsY(),
     5217            rect.width(), rect.height());
     5218
     5219    mMainDirtyRect.clear();
    52055220}
    52065221
     
    52155230}
    52165231
    5217 void VBoxQGLOverlay::vboxDoUpdateRect(const QRect * pRect)
    5218 {
    5219     if(mGlOn)
    5220     {
    5221         makeCurrent();
    5222         mpOverlayWidget->vboxDoUpdateRect(pRect);
    5223         vboxOpExit();
    5224     }
    5225 
    5226     mView->viewport()->repaint (pRect->x() - mView->contentsX(),
    5227             pRect->y() - mView->contentsY(),
    5228             pRect->width(), pRect->height());
    5229 
    5230     /* translate to widget coords
    5231      * @todo: may eliminate this */
    5232 //    QPaintEvent pe(pRect->translated(-mView->contentsX(), -mView->contentsY()));
    5233 //    VBoxQImageFrameBuffer::paintEvent (&pe);
    5234 }
    5235 
    5236 void VBoxQGLOverlay::vboxSynchGl()
     5232//void VBoxQGLOverlay::vboxDoUpdateRect(const QRect * pRect)
     5233//{
     5234//    if(mGlOn)
     5235//    {
     5236//        makeCurrent();
     5237//        mpOverlayWidget->vboxDoUpdateRect(pRect);
     5238//        vboxOpExit();
     5239//    }
     5240//
     5241//    mView->viewport()->repaint (pRect->x() - mView->contentsX(),
     5242//            pRect->y() - mView->contentsY(),
     5243//            pRect->width(), pRect->height());
     5244//
     5245//    /* translate to widget coords
     5246//     * @todo: may eliminate this */
     5247////    QPaintEvent pe(pRect->translated(-mView->contentsX(), -mView->contentsY()));
     5248////    VBoxQImageFrameBuffer::paintEvent (&pe);
     5249//}
     5250
     5251bool VBoxQGLOverlay::vboxSynchGl()
    52375252{
    52385253    if(mpOverlayWidget->vboxIsInitialized()
     
    52445259            && mContainer->height() == mpOverlayWidget->vboxFbHeight())
    52455260    {
    5246         return;
     5261        return false;
    52475262    }
    52485263    /* create and issue a resize event to the gl widget to ensure we have all gl data initialized
     
    52565271
    52575272    mpOverlayWidget->vboxResizeEvent(&re);
     5273    return true;
    52585274}
    52595275
     
    53065322            makeCurrent();
    53075323            mpOverlayWidget->vboxDoUpdateViewport(overVp);
     5324            mNeedOverlayRepaint = true;
    53085325        }
    53095326
     
    53535370//
    53545371//    vboxShowOverlay(show);
     5372}
     5373
     5374void VBoxQGLOverlay::addMainDirtyRect(const QRect & aRect)
     5375{
     5376    mMainDirtyRect.add(aRect);
     5377    if(mGlOn)
     5378    {
     5379        mpOverlayWidget->vboxDoUpdateRect(&aRect);
     5380        if(aRect.intersects(mpOverlayWidget->vboxViewport()))
     5381        {
     5382            mNeedOverlayRepaint = true;
     5383        }
     5384    }
     5385}
     5386
     5387int VBoxQGLOverlay::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd)
     5388{
     5389    int rc = mpOverlayWidget->vhwaSurfaceUnlock(pCmd);
     5390    VBoxVHWASurfaceBase * pVGA = mpOverlayWidget->vboxGetVGASurface();
     5391    const VBoxVHWADirtyRect & rect = pVGA->getDirtyRect();
     5392    if(!rect.isClear())
     5393    {
     5394        mMainDirtyRect.add(rect);
     5395    }
     5396    return rc;
    53555397}
    53565398
     
    54115453        {
    54125454            VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK);
    5413             pCmd->rc = mpOverlayWidget->vhwaSurfaceUnlock(pBody);
     5455            pCmd->rc = vhwaSurfaceUnlock(pBody);
    54145456        } break;
    54155457        case VBOXVHWACMD_TYPE_SURF_BLT:
     
    54225464            VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
    54235465            pCmd->rc = mpOverlayWidget->vhwaSurfaceFlip(pBody);
     5466            mNeedOverlayRepaint = true;
    54245467        } break;
    54255468        case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE:
     
    55535596        {
    55545597        case VBOXVHWA_PIPECMD_PAINT:
    5555             vboxDoUpdateRect(&pCmd->rect());
     5598            addMainDirtyRect(pCmd->rect());
    55565599            break;
    55575600#ifdef VBOX_WITH_VIDEOHWACCEL
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