VirtualBox

Ignore:
Timestamp:
Jun 3, 2022 6:49:41 PM (3 years ago)
Author:
vboxsync
Message:

WDDM: render should output all patch locations; when allocation is deleted then detach it from VidPN source if necessary. bugref:9845

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r94927 r95191  
    202202#endif
    203203    VBOXUHGSMI_BUFFER_TYPE_FLAGS fUhgsmiType;
     204    int                         CurVidPnSourceId;              /* Source index if used for a source, otherwise -1. */
    204205#ifdef VBOX_WITH_VMSVGA3D_DX
    205206    /* Direct3D driver data for .enmType == VBOXWDDM_ALLOC_TYPE_D3D. */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r95157 r95191  
    21402140            KeInitializeSpinLock(&pAllocation->OpenLock);
    21412141            InitializeListHead(&pAllocation->OpenList);
     2142            pAllocation->CurVidPnSourceId = -1;
    21422143
    21432144            switch (pAllocInfo->enmType)
     
    23952396    vboxVDbgBreakFv();
    23962397
     2398    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter;
     2399
     2400    for (UINT i = 0; i < pDestroyAllocation->NumAllocations; ++i)
     2401    {
     2402        PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)pDestroyAllocation->pAllocationList[0];
     2403        if (pAllocation->CurVidPnSourceId != -1)
     2404        {
     2405            VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pAllocation->CurVidPnSourceId];
     2406            vboxWddmAssignPrimary(pSource, NULL, pAllocation->CurVidPnSourceId);
     2407        }
     2408    }
     2409
    23972410#ifdef VBOX_WITH_VMSVGA3D_DX
    23982411    /* Check if this is a request from the D3D driver. */
     
    24082421
    24092422    PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)pDestroyAllocation->hResource;
    2410     PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter;
    2411 
    24122423    if (pRc)
    24132424    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r93115 r95191  
    122122        pOldAlloc->bAssigned = FALSE;
    123123        Assert(pOldAlloc->AllocData.SurfDesc.VidPnSourceId == srcId);
     124        pOldAlloc->CurVidPnSourceId = -1;
    124125    }
    125126
     
    129130        pAllocation->bAssigned = TRUE;
    130131        pAllocation->bVisible = pSource->bVisible;
     132        pAllocation->CurVidPnSourceId = srcId;
    131133
    132134        if (pSource->AllocData.hostID != pAllocation->AllocData.hostID)
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPDX.cpp

    r95086 r95191  
    215215        pAllocation->dx.SegmentId = 2;
    216216    }
     217    else
     218        AssertFailedReturn(STATUS_INVALID_PARAMETER);
     219
    217220    pAllocationInfo->EvictionSegmentSet              = 0;
    218221    pAllocationInfo->MaximumRenamingListLength       = 1;
     
    343346    pAllocation->dx.pMDL = 0;
    344347
    345     /* Legacy. Unused. */
    346348    KeInitializeSpinLock(&pAllocation->OpenLock);
    347349    InitializeListHead(&pAllocation->OpenList);
     350    pAllocation->CurVidPnSourceId = -1;
    348351
    349352    if (pAllocation->dx.desc.enmAllocationType == VBOXDXALLOCATIONTYPE_SURFACE)
     
    372375    AssertReturn(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_D3D, STATUS_INVALID_PARAMETER);
    373376
     377    Assert(pAllocation->cOpens == 0);
     378
    374379    if (pAllocation->dx.desc.enmAllocationType == VBOXDXALLOCATIONTYPE_SURFACE)
    375380        Status = svgaDestroyAllocationSurface(pDevExt->pGa->hw.pSvga, pAllocation);
     
    429434    for (unsigned i = 0; i < pRender->PatchLocationListInSize; ++i)
    430435    {
     436        if (cOut >= pRender->PatchLocationListOutSize)
     437        {
     438            /** @todo Merge generation of patches witht SvgaRenderCommandsD3D in order to correctly
     439             * split a command buffer in case of STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER?
     440             */
     441            DEBUG_BREAKPOINT_TEST();
     442            Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER;
     443            break;
     444        }
     445
    431446        D3DDDI_PATCHLOCATIONLIST const *pIn = &pRender->pPatchLocationListIn[i];
    432447        void * const pPatchAddress = (uint8_t *)pvDmaBuffer + pIn->PatchOffset;
    433448        VBOXDXALLOCATIONTYPE const enmAllocationType = (VBOXDXALLOCATIONTYPE)pIn->DriverId;
     449
     450        /* "Even though the driver's DxgkDdiRender function pre-patches the DMA buffer, the driver
     451         *  must still insert all of the references to allocations into the output patch-location list
     452         *  that the pPatchLocationListOut member of DXGKARG_RENDER specifies."
     453         */
     454        pRender->pPatchLocationListOut[cOut] = *pIn;
    434455
    435456        DXGK_ALLOCATIONLIST *pAllocationListEntry = &pRender->pAllocationList[pIn->AllocationIndex];
     
    442463            if (enmAllocationType == VBOXDXALLOCATIONTYPE_SURFACE)
    443464            {
    444                 /* Surfaces might also need a mobid. */
    445                 if (pAllocationListEntry->SegmentId == 3)
    446                 {
    447                     /* DEFAULT resources only require the sid, because they exist outside the guest. */
    448                     Assert(pAllocation->dx.sid != SVGA3D_INVALID_ID);
    449                     Assert(pAllocation->dx.mobid != SVGA3D_INVALID_ID);
    450                     Assert(pAllocation->dx.SegmentId == 3);
    451 
     465                if (   pAllocation->dx.sid != SVGA3D_INVALID_ID
     466                    && pAllocation->dx.mobid != SVGA3D_INVALID_ID)
    452467                    *(uint32_t *)pPatchAddress = pAllocation->dx.sid;
    453                     continue;
    454                 }
    455                 else
    456                 {
    457                     /* For Aperture segment, the surface need a mob too, which must be created in BuildPagingBuffer. */
    458                     if (   pAllocation->dx.sid != SVGA3D_INVALID_ID
    459                         && pAllocation->dx.mobid != SVGA3D_INVALID_ID)
    460                     {
    461                         *(uint32_t *)pPatchAddress = pAllocation->dx.sid;
    462                         continue;
    463                     }
    464                 }
    465468            }
    466469            else if (   enmAllocationType == VBOXDXALLOCATIONTYPE_SHADERS
     
    468471            {
    469472                if (pAllocation->dx.mobid != SVGA3D_INVALID_ID)
    470                 {
    471473                    *(uint32_t *)pPatchAddress = pAllocation->dx.mobid;
    472                     continue;
    473                 }
    474474            }
    475475        }
     
    479479                || enmAllocationType == VBOXDXALLOCATIONTYPE_SHADERS
    480480                || enmAllocationType == VBOXDXALLOCATIONTYPE_CO)
    481             {
    482481                *(uint32_t *)pPatchAddress = SVGA3D_INVALID_ID;
    483                 continue;
    484             }
    485         }
    486 
    487         pRender->pPatchLocationListOut[cOut++] = *pIn;
     482        }
     483
     484        ++cOut;
    488485    }
    489486
     
    919916NTSTATUS APIENTRY DxgkDdiDXPatch(PVBOXMP_DEVEXT pDevExt, const DXGKARG_PATCH *pPatch)
    920917{
    921     GALOG(("pDmaBuffer = %p, cbDmaBuffer = %u, cPatches = %u\n",
    922            pPatch->pDmaBuffer, pPatch->DmaBufferSubmissionEndOffset - pPatch->DmaBufferSubmissionStartOffset,
    923            pPatch->PatchLocationListSubmissionLength));
    924 
    925918    //DEBUG_BREAKPOINT_TEST();
    926919
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp

    r95086 r95191  
    12761276    SvgaFlush(pDevExt->pGa->hw.pSvga);
    12771277
    1278     GALOG(("pDmaBuffer = %p, cbDmaBuffer = %u, cPatches = %u\n",
     1278    GALOG(("pDmaBuffer %p, cbDmaBuffer %u, PatchStart %u, cPatches %u, Flags 0xx, context type %d\n",
    12791279           pPatch->pDmaBuffer, pPatch->DmaBufferSubmissionEndOffset - pPatch->DmaBufferSubmissionStartOffset,
    1280            pPatch->PatchLocationListSubmissionLength));
    1281 
    1282     /* The driver does not need to modify paging and present commands here. */
    1283     if (pPatch->Flags.Paging || pPatch->Flags.Present)
     1280           pPatch->PatchLocationListSubmissionStart, pPatch->PatchLocationListSubmissionLength, pPatch->Flags.Value,
     1281           ((PVBOXWDDM_CONTEXT)pPatch->hContext)->enmType));
     1282
     1283    /* The driver does not need to modify paging commands. */
     1284    if (pPatch->Flags.Paging)
    12841285        return STATUS_SUCCESS;
    12851286
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