VirtualBox

vbox的更動 46065 路徑 trunk/src/VBox/Main/src-client


忽略:
時間撮記:
2013-5-14 下午01:15:42 (12 年 以前)
作者:
vboxsync
訊息:

Main/DisplayImpl: 6711: Fix for the race condition where in GA sends the new resize rectangle dimensions while framebuffer is still resizing. At this moment DisplayImpl doesn't have the updated framebuffer rectangles and as a result the intersection between the new rectangles passed by GA and current frambuffe is NULL. Thus DisplayImpl rejects the rectangles passed from GA and GUI receives NULL for drawing.
The fix for the issue is to let DisplayImpl save the rectangles passed from the GA till the point framebuffer is completely resized and then pass these rectangle to GUI after checking for intersection with the curent newly resized framebuffer.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r46057 r46065  
    123123    int rc = RTCritSectInit(&mVBVALock);
    124124    AssertRC(rc);
     125   
     126    rc = RTCritSectInit(&mSaveSeamlessRectLock);
     127    AssertRC(rc);
     128   
    125129    mfu32PendingVideoAccelDisable = false;
    126130
     
    143147        RTCritSectDelete (&mVBVALock);
    144148        memset (&mVBVALock, 0, sizeof (mVBVALock));
     149    }
     150   
     151    if (RTCritSectIsInitialized (&mSaveSeamlessRectLock))
     152    {
     153        RTCritSectDelete (&mSaveSeamlessRectLock);
     154        memset (&mSaveSeamlessRectLock, 0, sizeof (mSaveSeamlessRectLock));
    145155    }
    146156    BaseFinalRelease();
     
    821831        }
    822832        LogRelFlow(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat));
     833       
     834        /* Handle the case if there are some saved visible region that needs to be
     835         * applied after the resize of the framebuffer is completed
     836         */
     837        if (pFBInfo->mcSavedVisibleRegion)
     838        {
     839            handleSetVisibleRegion(pFBInfo->mcSavedVisibleRegion,
     840                                   pFBInfo->mpSavedVisibleRegion);
     841
     842            SaveSeamlessRectLock();
     843            if (pFBInfo->mpSavedVisibleRegion)
     844                RTMemFree(pFBInfo->mpSavedVisibleRegion);
     845            pFBInfo->mpSavedVisibleRegion = NULL;
     846            pFBInfo->mcSavedVisibleRegion = 0;
     847            SaveSeamlessRectUnLock();
     848        }
     849
    823850
    824851#ifdef DEBUG_sunlover
     
    10821109        if (!pFBInfo->pFramebuffer.isNull())
    10831110        {
     1111            if (pFBInfo->u32ResizeStatus != ResizeStatus_Void)
     1112            {
     1113                /* handle the case where new rectangles are received from the GA
     1114                 * when framebuffer resizing is in progress.
     1115                 * Just save the rectangles to be applied for later time when FB resizing is complete
     1116                 * (from handleResizeCompletedEMT).
     1117                 * This is done to prevent a race condition where a new rectangles are received
     1118                 * from the GA after a resize event and framebuffer resizing is still in progress
     1119                 * As a result the coordinates of the framebuffer are still
     1120                 * not updated and hence there is no intersection with the new rectangles passed
     1121                 * for the new region (THis is checked in the above if condition ). With 0 intersection,
     1122                 * cRectVisibleRegions = 0  is returned to the GUI and if GUI has invalidated its
     1123                 * earlier region then it draws nothihing and seamless mode doesn't display the
     1124                 * guest desktop.
     1125                 */
     1126                SaveSeamlessRectLock();
     1127                if(pFBInfo->mpSavedVisibleRegion)
     1128                    RTMemFree(pFBInfo->mpSavedVisibleRegion);
     1129               
     1130                pFBInfo->mpSavedVisibleRegion = (RTRECT *)RTMemTmpAlloc(  RT_MAX(cRect, 1)
     1131                                                                        * sizeof (RTRECT));
     1132                if (pFBInfo->mpSavedVisibleRegion)
     1133                {
     1134                    memcpy(pFBInfo->mpSavedVisibleRegion, pRect, cRect * sizeof(RTRECT));
     1135                    pFBInfo->mcSavedVisibleRegion = cRect;
     1136                }
     1137                SaveSeamlessRectUnLock();
     1138                continue;
     1139            }
    10841140            /* Prepare a new array of rectangles which intersect with the framebuffer.
    10851141             */
     
    11231179                }
    11241180            }
    1125 
    11261181            pFBInfo->pFramebuffer->SetVisibleRegion((BYTE *)pVisibleRegion, cRectVisibleRegion);
    11271182        }
     
    13611416    RTCritSectLeave(&mVBVALock);
    13621417}
     1418 
     1419int Display::SaveSeamlessRectLock(void)
     1420{
     1421    return RTCritSectEnter(&mSaveSeamlessRectLock);
     1422}
     1423   
     1424void Display::SaveSeamlessRectUnLock(void)
     1425{
     1426    RTCritSectLeave(&mSaveSeamlessRectLock);
     1427}
     1428   
    13631429
    13641430/**
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette