VirtualBox

Ignore:
Timestamp:
Sep 14, 2010 10:14:46 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: multi-swapchain fixes (for win7 & multi-monitor)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp

    r32241 r32496  
    307307{
    308308    PVBOXWDDM_CONTEXT pContext = pRectsInfo->pContext;
     309    PVBOXWDDM_SWAPCHAIN pSwapchain = pRectsInfo->pSwapchain;
    309310    PDEVICE_EXTENSION pDevExt = pContext->pDevice->pAdapter;
    310311    PVBOXWDDM_RECTS_INFO pRects = &pRectsInfo->ContextsRects.UpdateRects;
     
    314315    Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);
    315316    ExAcquireFastMutex(&pDevExt->ContextMutex);
    316     for (PLIST_ENTRY pCur = pDevExt->ContextList3D.Flink; pCur != &pDevExt->ContextList3D; pCur = pCur->Flink)
    317     {
    318         if (pCur != &pContext->ListEntry)
    319         {
    320             PVBOXWDDM_CONTEXT pCurContext = VBOXWDDMENTRY_2_CONTEXT(pCur);
     317    for (PLIST_ENTRY pCur = pDevExt->SwapchainList3D.Flink; pCur != &pDevExt->SwapchainList3D; pCur = pCur->Flink)
     318    {
     319        if (pCur != &pSwapchain->DevExtListEntry)
     320        {
     321            PVBOXWDDM_SWAPCHAIN pCurSwapchain = VBOXWDDMENTRY_2_SWAPCHAIN(pCur);
    321322            if (!pCmdInternal)
    322323            {
    323                 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pCurContext->CmContext, cbCmdInternal);
     324                pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdCreate(&pCurSwapchain->pContext->CmContext, cbCmdInternal);
    324325                Assert(pCmdInternal);
    325326                if (!pCmdInternal)
     
    331332            else
    332333            {
    333                 pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pCurContext->CmContext);
     334                pCmdInternal = (PVBOXVIDEOCM_CMD_RECTS_INTERNAL)vboxVideoCmCmdReinitForContext(pCmdInternal, &pCurSwapchain->pContext->CmContext);
    334335            }
    335336
    336             vboxVdmaDirtyRectsCalcIntersection(&pCurContext->ViewRect, pRects, &pCmdInternal->Cmd.RectsInfo);
     337            vboxVdmaDirtyRectsCalcIntersection(&pCurSwapchain->ViewRect, pRects, &pCmdInternal->Cmd.RectsInfo);
    337338            if (pCmdInternal->Cmd.RectsInfo.cRects)
    338339            {
     
    340341                pCmdInternal->Cmd.fFlags.Value = 0;
    341342                pCmdInternal->Cmd.fFlags.bAddHiddenRects = 1;
    342                 if (pCurContext->pLastReportedRects)
    343                 {
    344                     if (pCurContext->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)
     343                if (pCurSwapchain->pLastReportedRects)
     344                {
     345                    if (pCurSwapchain->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)
    345346                    {
    346347                        RECT *paPrevRects;
    347348                        uint32_t cPrevRects;
    348                         if (pCurContext->pLastReportedRects->Cmd.fFlags.bSetViewRect)
     349                        if (pCurSwapchain->pLastReportedRects->Cmd.fFlags.bSetViewRect)
    349350                        {
    350                             paPrevRects = &pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects[1];
    351                             cPrevRects = pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects - 1;
     351                            paPrevRects = &pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[1];
     352                            cPrevRects = pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects - 1;
    352353                        }
    353354                        else
    354355                        {
    355                             paPrevRects = &pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects[0];
    356                             cPrevRects = pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects;
     356                            paPrevRects = &pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[0];
     357                            cPrevRects = pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects;
    357358                        }
    358359
     
    365366                    else
    366367                    {
    367                         Assert(pCurContext->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);
    368                         if (!vboxVdmaDirtyRectsIsCover(pCurContext->pLastReportedRects->Cmd.RectsInfo.aRects,
    369                                 pCurContext->pLastReportedRects->Cmd.RectsInfo.cRects,
     368                        Assert(pCurSwapchain->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);
     369                        if (!vboxVdmaDirtyRectsIsCover(pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects,
     370                                pCurSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects,
    370371                                pCmdInternal->Cmd.RectsInfo.aRects, pCmdInternal->Cmd.RectsInfo.cRects))
    371372                        {
     
    379380                if (bSend)
    380381                {
    381                     if (pCurContext->pLastReportedRects)
    382                         vboxVideoCmCmdRelease(pCurContext->pLastReportedRects);
    383 
    384                     pCmdInternal->VidPnSourceId = pRectsInfo->VidPnSourceId;
     382                    if (pCurSwapchain->pLastReportedRects)
     383                        vboxVideoCmCmdRelease(pCurSwapchain->pLastReportedRects);
     384
     385                    pCmdInternal->hSwapchainUm = pCurSwapchain->hSwapchainUm;
    385386
    386387                    vboxVideoCmCmdRetain(pCmdInternal);
    387                     pCurContext->pLastReportedRects = pCmdInternal;
     388                    pCurSwapchain->pLastReportedRects = pCmdInternal;
    388389                    vboxVideoCmCmdSubmit(pCmdInternal, VBOXVIDEOCM_CMD_RECTS_INTERNAL_SIZE4CRECTS(pCmdInternal->Cmd.RectsInfo.cRects));
    389390                    pCmdInternal = NULL;
     
    394395        {
    395396            RECT * pContextRect = &pRectsInfo->ContextsRects.ContextRect;
    396             bool bRectShanged = (pContext->ViewRect.left != pContextRect->left
    397                     || pContext->ViewRect.top != pContextRect->top
    398                     || pContext->ViewRect.right != pContextRect->right
    399                     || pContext->ViewRect.bottom != pContextRect->bottom);
     397            bool bRectShanged = (pSwapchain->ViewRect.left != pContextRect->left
     398                    || pSwapchain->ViewRect.top != pContextRect->top
     399                    || pSwapchain->ViewRect.right != pContextRect->right
     400                    || pSwapchain->ViewRect.bottom != pContextRect->bottom);
    400401            PVBOXVIDEOCM_CMD_RECTS_INTERNAL pDrCmdInternal;
    401402
     
    416417                pDrCmdInternal->Cmd.fFlags.bSetViewRect = 1;
    417418                pDrCmdInternal->Cmd.RectsInfo.aRects[0] = *pContextRect;
    418                 pContext->ViewRect = *pContextRect;
     419                pSwapchain->ViewRect = *pContextRect;
    419420                memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[1], pRects->aRects, sizeof (RECT) * pRects->cRects);
    420421                bSend = true;
     
    441442                memcpy(&pDrCmdInternal->Cmd.RectsInfo.aRects[0], pRects->aRects, sizeof (RECT) * pRects->cRects);
    442443
    443                 if (pContext->pLastReportedRects)
    444                 {
    445                     if (pContext->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)
     444                if (pSwapchain->pLastReportedRects)
     445                {
     446                    if (pSwapchain->pLastReportedRects->Cmd.fFlags.bSetVisibleRects)
    446447                    {
    447448                        RECT *paRects;
    448449                        uint32_t cRects;
    449                         if (pContext->pLastReportedRects->Cmd.fFlags.bSetViewRect)
     450                        if (pSwapchain->pLastReportedRects->Cmd.fFlags.bSetViewRect)
    450451                        {
    451                             paRects = &pContext->pLastReportedRects->Cmd.RectsInfo.aRects[1];
    452                             cRects = pContext->pLastReportedRects->Cmd.RectsInfo.cRects - 1;
     452                            paRects = &pSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[1];
     453                            cRects = pSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects - 1;
    453454                        }
    454455                        else
    455456                        {
    456                             paRects = &pContext->pLastReportedRects->Cmd.RectsInfo.aRects[0];
    457                             cRects = pContext->pLastReportedRects->Cmd.RectsInfo.cRects;
     457                            paRects = &pSwapchain->pLastReportedRects->Cmd.RectsInfo.aRects[0];
     458                            cRects = pSwapchain->pLastReportedRects->Cmd.RectsInfo.cRects;
    458459                        }
    459460                        bSend = (pDrCmdInternal->Cmd.RectsInfo.cRects != cRects)
     
    462463                    else
    463464                    {
    464                         Assert(pContext->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);
     465                        Assert(pSwapchain->pLastReportedRects->Cmd.fFlags.bAddHiddenRects);
    465466                        bSend = true;
    466467                    }
     
    474475            if (bSend)
    475476            {
    476                 if (pContext->pLastReportedRects)
    477                     vboxVideoCmCmdRelease(pContext->pLastReportedRects);
     477                if (pSwapchain->pLastReportedRects)
     478                    vboxVideoCmCmdRelease(pSwapchain->pLastReportedRects);
    478479
    479480                pDrCmdInternal->Cmd.fFlags.bSetVisibleRects = 1;
    480                 pDrCmdInternal->VidPnSourceId = pRectsInfo->VidPnSourceId;
     481                pDrCmdInternal->hSwapchainUm = pSwapchain->hSwapchainUm;
    481482
    482483                vboxVideoCmCmdRetain(pDrCmdInternal);
    483                 pContext->pLastReportedRects = pDrCmdInternal;
     484                pSwapchain->pLastReportedRects = pDrCmdInternal;
    484485                vboxVideoCmCmdSubmit(pDrCmdInternal, VBOXVIDEOCM_SUBMITSIZE_DEFAULT);
    485486            }
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