VirtualBox

Ignore:
Timestamp:
Jun 15, 2022 3:15:06 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151873
Message:

WDDM: use VRAM segment for primary surfaces. 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/VBoxMPWddm.cpp

    r95234 r95290  
    21582158                    {
    21592159                        case VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE:
     2160                            if (SvgaIsDXSupported(pDevExt))
     2161                            {
     2162                                pAllocationInfo->PreferredSegment.Value      = 0;
     2163                                pAllocationInfo->SupportedReadSegmentSet     = 1; /* VRAM */
     2164                                pAllocationInfo->SupportedWriteSegmentSet    = 1; /* VRAM */
     2165                                /// @todo Required?  pAllocationInfo->Flags.CpuVisible = 1;
     2166                            }
    21602167                            break;
    21612168                        case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC:
     
    22242231                        case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE:
    22252232                        case VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE:
     2233                            if (SvgaIsDXSupported(pDevExt))
     2234                            {
     2235                                pAllocationInfo->PreferredSegment.Value      = 0;
     2236                                pAllocationInfo->SupportedReadSegmentSet     = 1; /* VRAM */
     2237                                pAllocationInfo->SupportedWriteSegmentSet    = 1; /* VRAM */
     2238                            }
    22262239                            pAllocationInfo->Flags.CpuVisible = 1;
    22272240                            break;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/Svga.cpp

    r95250 r95290  
    10071007        case SVGA_3D_CMD_DEFINE_GB_SURFACE:
    10081008        case SVGA_3D_CMD_DESTROY_GB_SURFACE:
    1009         case SVGA_3D_CMD_BIND_GB_SURFACE:
    1010         case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH:
    1011         case SVGA_3D_CMD_COND_BIND_GB_SURFACE:
    10121009        case SVGA_3D_CMD_READBACK_GB_SURFACE:
    10131010        case SVGA_3D_CMD_READBACK_GB_IMAGE:
     
    10211018            AssertFailed();
    10221019            break;
     1020        case SVGA_3D_CMD_BIND_GB_SURFACE:
     1021        case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH:
     1022        case SVGA_3D_CMD_COND_BIND_GB_SURFACE:
    10231023        case SVGA_3D_CMD_UPDATE_GB_IMAGE:
    10241024        case SVGA_3D_CMD_UPDATE_GB_SURFACE:
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPDX.cpp

    r95234 r95290  
    6363        if (NT_SUCCESS(Status))
    6464        {
    65             if (pAllocation->dx.SegmentId == 3)
     65            if (   pAllocation->dx.SegmentId == 3
     66                || pAllocation->dx.desc.fPrimary)
    6667            {
    6768                pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_BIND_GB_SURFACE, sizeof(SVGA3dCmdBindGBSurface), SVGA3D_INVALID_ID);
     
    8889static void svgaFreeGBMobForAllocation(VBOXWDDM_EXT_VMSVGA *pSvga, PVBOXWDDM_ALLOCATION pAllocation)
    8990{
    90     AssertReturnVoid(pAllocation->dx.SegmentId == 3);
     91    AssertReturnVoid(pAllocation->dx.SegmentId == 3 || pAllocation->dx.desc.fPrimary);
    9192
    9293    void *pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_DESTROY_GB_MOB, sizeof(SVGA3dCmdDestroyGBMob), SVGA3D_INVALID_ID);
     
    116117static NTSTATUS svgaCreateGBMobForAllocation(VBOXWDDM_EXT_VMSVGA *pSvga, PVBOXWDDM_ALLOCATION pAllocation)
    117118{
    118     AssertReturn(pAllocation->dx.SegmentId == 3, STATUS_INVALID_PARAMETER);
     119    AssertReturn(pAllocation->dx.SegmentId == 3 || pAllocation->dx.desc.fPrimary, STATUS_INVALID_PARAMETER);
    119120
    120121    uint32_t const cbGB = RT_ALIGN_32(pAllocation->dx.desc.cbAllocation, PAGE_SIZE);
     
    172173    {
    173174        /* USAGE_DEFAULT */
    174 /// @todo Might need to put primaries in a CPU visible segment for readback.
    175 //        if (pAllocation->dx.desc.fPrimary)
    176 //        {
    177 //            /* Put primaries to the CPU visible segment. */
    178 //            pAllocationInfo->PreferredSegment.Value      = 0;
    179 //            pAllocationInfo->SupportedReadSegmentSet     = 1; /* VRAM */
    180 //            pAllocationInfo->SupportedWriteSegmentSet    = 1; /* VRAM */
    181 //            pAllocationInfo->Flags.CpuVisible            = 1;
    182 //
    183 //            pAllocation->dx.SegmentId = 1;
    184 //        }
    185 //        else
     175        if (pAllocation->dx.desc.fPrimary)
     176        {
     177            /* Put primaries to the CPU visible segment. Because VidPn code currently assumes that they are there. */
     178            pAllocationInfo->PreferredSegment.Value      = 0;
     179            pAllocationInfo->SupportedReadSegmentSet     = 1; /* VRAM */
     180            pAllocationInfo->SupportedWriteSegmentSet    = 1; /* VRAM */
     181            pAllocationInfo->Flags.CpuVisible            = 1;
     182
     183            pAllocation->dx.SegmentId = 1;
     184        }
     185        else
    186186        {
    187187            pAllocationInfo->PreferredSegment.Value      = 0;
     
    226226    /* Allocations in the host VRAM still need guest backing. */
    227227    NTSTATUS Status;
    228     if (pAllocation->dx.SegmentId == 3)
     228    if (pAllocation->dx.SegmentId == 3 || pAllocation->dx.desc.fPrimary)
    229229    {
    230230        Status = svgaCreateGBMobForAllocation(pSvga, pAllocation);
     
    270270    {
    271271        void *pvCmd;
    272         if (pAllocation->dx.SegmentId == 3)
     272        if (pAllocation->dx.SegmentId == 3 || pAllocation->dx.desc.fPrimary)
    273273        {
    274274            pvCmd = SvgaCmdBuf3dCmdReserve(pSvga, SVGA_3D_CMD_BIND_GB_SURFACE, sizeof(SVGA3dCmdBindGBSurface), SVGA3D_INVALID_ID);
     
    292292        Status = SvgaSurfaceIdFree(pSvga, pAllocation->dx.sid);
    293293
    294         if (pAllocation->dx.SegmentId == 3)
     294        if (pAllocation->dx.SegmentId == 3 || pAllocation->dx.desc.fPrimary)
    295295            svgaFreeGBMobForAllocation(pSvga, pAllocation);
    296296
     
    358358        Status = STATUS_INVALID_PARAMETER;
    359359    AssertReturnStmt(NT_SUCCESS(Status), GaMemFree(pAllocation), Status);
     360
     361    /* Legacy fields for VidPn code. */
     362    pAllocation->AllocData.SurfDesc.VidPnSourceId = pAllocation->dx.desc.fPrimary
     363                                                  ? pAllocation->dx.desc.PrimaryDesc.VidPnSourceId
     364                                                  : 0;
     365    pAllocation->AllocData.hostID = pAllocation->dx.sid;
     366    pAllocation->AllocData.Addr.SegmentId = pAllocation->dx.SegmentId;
     367    pAllocation->AllocData.Addr.offVram = VBOXVIDEOOFFSET_VOID;
    360368
    361369    return Status;
     
    598606        case 1: /* VRAM */
    599607        {
    600             uint64_t const offVRAM = pBuildPagingBuffer->Fill.Destination.SegmentAddress.QuadPart;
    601             AssertReturn(   offVRAM < pDevExt->cbVRAMCpuVisible
    602                          && pBuildPagingBuffer->Fill.FillSize <= pDevExt->cbVRAMCpuVisible - offVRAM, STATUS_INVALID_PARAMETER);
    603             ASMMemFill32((uint8_t *)pDevExt->pvVisibleVram + offVRAM, pBuildPagingBuffer->Fill.FillSize, pBuildPagingBuffer->Fill.FillPattern);
    604             break;
    605         }
     608            if (!pAllocation->dx.desc.fPrimary)
     609            {
     610                uint64_t const offVRAM = pBuildPagingBuffer->Fill.Destination.SegmentAddress.QuadPart;
     611                AssertReturn(   offVRAM < pDevExt->cbVRAMCpuVisible
     612                             && pBuildPagingBuffer->Fill.FillSize <= pDevExt->cbVRAMCpuVisible - offVRAM, STATUS_INVALID_PARAMETER);
     613                ASMMemFill32((uint8_t *)pDevExt->pvVisibleVram + offVRAM, pBuildPagingBuffer->Fill.FillSize, pBuildPagingBuffer->Fill.FillPattern);
     614                break;
     615            }
     616        }
     617        RT_FALL_THRU();
    606618        case 2: /* Aperture */
    607619        case 3: /* Host */
     
    611623
    612624            void *pvDst;
    613             if (pBuildPagingBuffer->Fill.Destination.SegmentId == 3)
     625            if (pBuildPagingBuffer->Fill.Destination.SegmentId == 3 || pAllocation->dx.desc.fPrimary)
    614626            {
    615627                AssertReturn(pAllocation->dx.gb.hMemObjGB != NIL_RTR0MEMOBJ, STATUS_INVALID_PARAMETER);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaUtils.cpp

    r93115 r95290  
    2525#ifdef DEBUG
    2626    | GALOG_GROUP_TEST
    27     | GALOG_GROUP_HOSTOBJECTS
     27//    | GALOG_GROUP_HOSTOBJECTS
    2828//    | GALOG_GROUP_PRESENT
    2929//    | GALOG_GROUP_DXGK
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/gallium/VBoxMPGaWddm.cpp

    r95234 r95290  
    12761276    SvgaFlush(pDevExt->pGa->hw.pSvga);
    12771277
    1278     GALOG(("pDmaBuffer %p, cbDmaBuffer %u, PatchStart %u, cPatches %u, Flags 0xx, context type %d\n",
     1278    GALOG(("pDmaBuffer %p, cbDmaBuffer %u, PatchStart %u, cPatches %u, Flags 0x%x, context type %d\n",
    12791279           pPatch->pDmaBuffer, pPatch->DmaBufferSubmissionEndOffset - pPatch->DmaBufferSubmissionStartOffset,
    12801280           pPatch->PatchLocationListSubmissionStart, pPatch->PatchLocationListSubmissionLength, pPatch->Flags.Value,
Note: See TracChangeset for help on using the changeset viewer.

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