VirtualBox

Changeset 50913 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Mar 27, 2014 5:56:50 PM (11 years ago)
Author:
vboxsync
Message:

wddm/graphics: new command submission working for 2D, more testing needed

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp

    r50859 r50913  
    519519    Assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
    520520
    521     PVBOXMP_CRSHGSMITRANSPORT pCon;
     521    PVBOXMP_CRSHGSMITRANSPORT pCon = (PVBOXMP_CRSHGSMITRANSPORT)pvContext;
    522522    PVBOXMP_DEVEXT pDevExt = pCon->pDevExt;
    523523    VBOXCMDVBVA_CRCMD_CMD *pCmd;
     
    10311031    }
    10321032
    1033 #if 1 /*def DEBUG_misha*/
     1033#ifndef DEBUG_misha
    10341034    g_VBoxMpCrHostCaps &= ~CR_VBOX_CAP_CMDVBVA;
    10351035#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp

    r50859 r50913  
    174174static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion)
    175175{
    176     const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, 0);
     176    const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ);
    177177    HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr);
    178178    if (offCmd == HGSMIOFFSET_VOID)
     
    293293    // LogFunc(("flags = 0x%08X\n", pCtx->pVBVA? pCtx->pVBVA->u32HostEvents: -1));
    294294
    295     if (   pCtx->pVBVA
    296         && (pCtx->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED))
     295    Assert(pCtx->pVBVA);
     296    /* we do not use u32HostEvents & VBVA_F_MODE_ENABLED,
     297     * VBVA stays enabled once ENABLE call succeeds, until it is disabled with DISABLED call */
     298//    if (   pCtx->pVBVA
     299//        && (pCtx->pVBVA->hostFlags.u32HostEvents & VBVA_F_MODE_ENABLED))
    297300    {
    298301        uint32_t indexRecordNext;
     
    366369}
    367370
     371DECLINLINE(bool) vboxVBVAExIsEntryInRangeOrEmpty(uint32_t u32First, uint32_t u32Entry, uint32_t u32Free)
     372{
     373    return vboxVBVAExIsEntryInRange(u32First, u32Entry, u32Free)
     374            || (    u32First == u32Entry
     375                 && u32Entry == u32Free);
     376}
    368377#ifdef DEBUG
    369378
     
    371380{
    372381    VBVABUFFER *pVBVA = pCtx->pVBVA;
    373     if (!vboxVBVAExIsEntryInRange(pCtx->indexRecordFirstUncompleted, pVBVA->indexRecordFirst, pVBVA->indexRecordFree))
     382    if (!vboxVBVAExIsEntryInRangeOrEmpty(pCtx->indexRecordFirstUncompleted, pVBVA->indexRecordFirst, pVBVA->indexRecordFree))
    374383    {
    375384        WARN(("invalid record set"));
    376385    }
    377386
    378     if (!vboxVBVAExIsEntryInRange(pCtx->off32DataUncompleted, pVBVA->off32Data, pVBVA->off32Free))
     387    if (!vboxVBVAExIsEntryInRangeOrEmpty(pCtx->off32DataUncompleted, pVBVA->off32Data, pVBVA->off32Free))
    379388    {
    380389        WARN(("invalid data set"));
     
    904913    int rc = VINF_SUCCESS;
    905914
     915    Assert(pCmd->u32FenceID);
     916
    906917    pCmd->u8State = VBOXCMDVBVA_STATE_SUBMITTED;
    907918    pVbva->u32FenceSubmitted = pCmd->u32FenceID;
    908919
    909     if (VBoxVBVAExGetSize(&pVbva->Vbva) > cbCmd)
     920    if (VBoxVBVAExGetSize(&pVbva->Vbva) < cbCmd)
    910921    {
    911922        WARN(("buffer does not fit the vbva buffer, we do not support splitting buffers"));
     
    10731084}
    10741085
    1075 
     1086#if 0
    10761087static uint32_t vboxCVDdiSysMemElBuild(VBOXCMDVBVA_SYSMEMEL *pEl, PMDL pMdl, uint32_t iPfn, uint32_t cPages)
    10771088{
     
    11031114    VBOXCMDVBVA_SYSMEMEL *pEl = pCmd->aSysMem;
    11041115
    1105     if (cbBuffer < sizeof (VBOXCMDVBVA_PAGING_TRANSFER))
    1106     {
    1107         WARN(("cbBuffer < sizeof (VBOXCMDVBVA_PAGING_TRANSFER)"));
    1108         goto done;
    1109     }
     1116    Assert(cbBuffer >= sizeof (VBOXCMDVBVA_PAGING_TRANSFER));
    11101117
    11111118    cbBuffer -= RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aSysMem);
     
    11161123    }
    11171124
    1118 done:
    11191125    *pcPagesWritten = cInitPages - cPages;
    11201126    return cbInitBuffer - cbBuffer;
    11211127}
     1128#endif
     1129
     1130uint32_t VBoxCVDdiPTransferVRamSysBuildEls(VBOXCMDVBVA_PAGING_TRANSFER *pCmd, PMDL pMdl, uint32_t iPfn, uint32_t cPages, uint32_t cbBuffer, uint32_t *pcPagesWritten)
     1131{
     1132    uint32_t cbInitBuffer = cbBuffer;
     1133    uint32_t i = 0;
     1134    VBOXCMDVBVAPAGEIDX *pPageNumbers = pCmd->aPageNumbers;
     1135
     1136    cbBuffer -= RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aPageNumbers);
     1137
     1138    for (; i < cPages && cbBuffer >= sizeof (*pPageNumbers); ++i, cbBuffer -= sizeof (*pPageNumbers))
     1139    {
     1140        pPageNumbers[i] = (VBOXCMDVBVAPAGEIDX)(MmGetMdlPfnArray(pMdl)[iPfn + i]);
     1141    }
     1142
     1143    *pcPagesWritten = i;
     1144    Assert(cbInitBuffer - cbBuffer == RT_OFFSETOF(VBOXCMDVBVA_PAGING_TRANSFER, aPageNumbers[i]));
     1145    return cbInitBuffer - cbBuffer;
     1146}
     1147
    11221148
    11231149int vboxCmdVbvaConConnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
     
    11441170        rc = pConnect->Hdr.i32Result;
    11451171        if (RT_SUCCESS(rc))
     1172        {
     1173            Assert(pConnect->Connect.Hdr.u32CmdClientId);
    11461174            *pu32ClientID = pConnect->Connect.Hdr.u32CmdClientId;
     1175        }
    11471176        else
    11481177            WARN(("VBOXCMDVBVA3DCTL_TYPE_CONNECT Disable failed %d", rc));
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r50898 r50913  
    19791979            memset(pCaps, 0, sizeof (*pCaps));
    19801980#endif
    1981 
    1982             pCaps->HighestAcceptableAddress.QuadPart = ~((uintptr_t)0);
     1981            pCaps->HighestAcceptableAddress.LowPart = ~0UL;
     1982#ifdef RT_ARCH_AMD64
     1983            /* driver talks to host in terms of page numbers when reffering to RAM
     1984             * we use uint32_t field to pass page index to host, so max would be (~0UL) << PAGE_OFFSET,
     1985             * which seems quite enough */
     1986            pCaps->HighestAcceptableAddress.HighPart = PAGE_OFFSET_MASK;
     1987#endif
    19831988            pCaps->MaxPointerWidth  = VBOXWDDM_C_POINTER_MAX_WIDTH;
    19841989            pCaps->MaxPointerHeight = VBOXWDDM_C_POINTER_MAX_HEIGHT;
     
    30953100    {
    30963101        cbCmd = pSubmitCommand->DmaBufferSubmissionEndOffset - pSubmitCommand->DmaBufferSubmissionStartOffset;
    3097         if (cbCmd < sizeof (VBOXCMDVBVA_HDR))
    3098         {
    3099             WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)",
    3100                     pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset,
    3101                     pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset,
    3102                     sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)));
    3103             return STATUS_INVALID_PARAMETER;
    3104         }
    3105 
    3106         if (cbCmd > 0xffff)
    3107         {
    3108             WARN(("cbCmd too big"));
    3109             return STATUS_INVALID_PARAMETER;
    3110         }
    3111 
    3112         if (VBOXWDDM_DUMMY_DMABUFFER_SIZE == cbCmd)
     3102        if (!cbCmd || VBOXWDDM_DUMMY_DMABUFFER_SIZE == cbCmd)
    31133103        {
    31143104            SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_NOPCMD;
     
    31193109        else
    31203110        {
     3111            if (cbCmd < sizeof (VBOXCMDVBVA_HDR))
     3112            {
     3113                WARN(("DmaBufferPrivateDataSubmissionEndOffset (%d) - DmaBufferPrivateDataSubmissionStartOffset (%d) < sizeof (VBOXCMDVBVA_HDR) (%d)",
     3114                        pSubmitCommand->DmaBufferPrivateDataSubmissionEndOffset,
     3115                        pSubmitCommand->DmaBufferPrivateDataSubmissionStartOffset,
     3116                        sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR)));
     3117                return STATUS_INVALID_PARAMETER;
     3118            }
     3119
     3120            if (cbCmd > 0xffff)
     3121            {
     3122                WARN(("cbCmd too big"));
     3123                return STATUS_INVALID_PARAMETER;
     3124            }
     3125
    31213126            SysMem.Hdr.u8OpCode = VBOXCMDVBVA_OPTYPE_SYSMEMCMD;
    31223127            SysMem.Hdr.u8Flags = cbCmd & 0xff;
    31233128            SysMem.Hdr.u.u8PrimaryID = (cbCmd >> 8) & 0xff;
    31243129            SysMem.Hdr.u8State = VBOXCMDVBVA_STATE_SUBMITTED;
    3125             SysMem.phSysMem = pSubmitCommand->DmaBufferPhysicalAddress.QuadPart + pSubmitCommand->DmaBufferSubmissionStartOffset;
    3126             if (SysMem.phSysMem & PAGE_OFFSET_MASK)
     3130            if (pSubmitCommand->DmaBufferPhysicalAddress.QuadPart & PAGE_OFFSET_MASK)
    31273131            {
    31283132                WARN(("command should be page aligned for now"));
    31293133                return STATUS_INVALID_PARAMETER;
    31303134            }
     3135            SysMem.iPage = (VBOXCMDVBVAPAGEIDX)(pSubmitCommand->DmaBufferPhysicalAddress.QuadPart >> PAGE_SHIFT);
     3136
     3137            cbCmd = sizeof (SysMem);
    31313138        }
    31323139
    31333140        pHdr = &SysMem.Hdr;
    3134         cbCmd = sizeof (SysMem);
    31353141    }
    31363142    else
     
    34033409    LOGF(("ENTER, context(0x%x)", hAdapter));
    34043410
    3405     /* paging buffer transfer is nop for hostID allocations */
    3406     if (pBuildPagingBuffer->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR))
    3407     {
    3408         WARN(("pBuildPagingBuffer->DmaBufferPrivateDataSize(%d) < sizeof VBOXCMDVBVA_HDR (%d)", pBuildPagingBuffer->DmaBufferPrivateDataSize , sizeof (VBOXCMDVBVA_HDR)));
    3409         /* @todo: can this actually happen? what status to return? */
    3410         return STATUS_INVALID_PARAMETER;
    3411     }
    3412 
    34133411    switch (pBuildPagingBuffer->Operation)
    34143412    {
     
    34713469            }
    34723470
    3473             uint32_t cPages = (uint32_t)((pBuildPagingBuffer->Transfer.TransferSize + 0xfff) >> PAGE_SHIFT);
    3474             uint32_t cTotalPages = cPages;
     3471            Assert(!(pBuildPagingBuffer->Transfer.TransferSize & PAGE_OFFSET_MASK));
     3472            Assert(!(offVRAM & PAGE_OFFSET_MASK));
     3473            uint32_t cPages = (uint32_t)(pBuildPagingBuffer->Transfer.TransferSize >> PAGE_SHIFT);
     3474            Assert(cPages > pBuildPagingBuffer->MultipassOffset);
    34753475            cPages -= pBuildPagingBuffer->MultipassOffset;
    3476             uint32_t iFirstPage = pBuildPagingBuffer->Transfer.MdlOffset + pBuildPagingBuffer->MultipassOffset;
     3476            uint32_t iFirstPage = pBuildPagingBuffer->MultipassOffset;
    34773477            uint32_t cPagesWritten;
    3478             offVRAM += pBuildPagingBuffer->Transfer.TransferOffset + pBuildPagingBuffer->MultipassOffset;
     3478            offVRAM += pBuildPagingBuffer->Transfer.TransferOffset + (pBuildPagingBuffer->MultipassOffset << PAGE_SHIFT);
    34793479
    34803480            pPaging->Alloc.u.offVRAM = offVRAM;
    34813481            if (fIn)
    34823482                pPaging->Hdr.u8Flags |= VBOXCMDVBVA_OPF_PAGING_TRANSFER_IN;
    3483             cbBuffer = VBoxCVDdiPTransferVRamSysBuildEls(pPaging, pMdl, iFirstPage, cPages, pBuildPagingBuffer->DmaBufferPrivateDataSize, &cPagesWritten);
     3483            cbBuffer = VBoxCVDdiPTransferVRamSysBuildEls(pPaging, pMdl, iFirstPage, cPages, pBuildPagingBuffer->DmaSize, &cPagesWritten);
    34843484            if (cPagesWritten != cPages)
    34853485                pBuildPagingBuffer->MultipassOffset += cPagesWritten;
     
    35003500            /** @todo: add necessary bits */
    35013501            WARN(("Impl!"));
     3502            cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
    35023503            break;
    35033504        }
     
    35103511                return STATUS_INVALID_PARAMETER;
    35113512            }
     3513            WARN(("Do we need to do anything here?"));
    35123514            break;
    35133515        }
     
    35213523    Assert(!cbPrivateData);
    35223524
     3525    Assert(pBuildPagingBuffer->Operation == DXGK_OPERATION_DISCARD_CONTENT || cbBuffer);
    35233526    pBuildPagingBuffer->pDmaBuffer = ((uint8_t*)pBuildPagingBuffer->pDmaBuffer) + cbBuffer;
    35243527    pBuildPagingBuffer->pDmaBufferPrivateData = ((uint8_t*)pBuildPagingBuffer->pDmaBufferPrivateData) + cbPrivateData;
     
    60886091//    LOGF(("ENTER, hContext(0x%x)", hContext));
    60896092
    6090     vboxVDbgBreakFv();
     6093    vboxVDbgBreakF();
    60916094
    60926095    PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext;
    60936096    PVBOXWDDM_DEVICE pDevice = pContext->pDevice;
    60946097    PVBOXMP_DEVEXT pDevExt = pDevice->pAdapter;
     6098    uint32_t cbBuffer = 0;
     6099    uint32_t cbPrivateData = 0;
    60956100
    60966101    if (pPresent->DmaBufferPrivateDataSize < sizeof (VBOXCMDVBVA_HDR))
     
    61916196
    61926197            paRects = pBlt->aRects;
    6193             cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects);
     6198            cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects);
     6199            cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData;
    61946200        }
    61956201        else
     
    62146220
    62156221            paRects = pBlt->aRects;
    6216             cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects);
    6217         }
     6222            cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects);
     6223            cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData;
     6224        }
     6225
     6226        cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
    62186227    }
    62196228    else if (pPresent->Flags.Flip)
     
    62476256        if (VBoxCVDdiFillAllocInfo(pHdr, &pFlip->src, pSrcAlloc, pSrc, false))
    62486257            u32SrcPatch = RT_OFFSETOF(VBOXCMDVBVA_FLIP, src.u.offVRAM);
     6258
     6259        cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
     6260        cbPrivateData = sizeof (*pFlip);
    62496261    }
    62506262    else if (pPresent->Flags.ColorFill)
     
    62786290
    62796291        paRects = pCFill->aRects;
    6280         cbMaxRects = pPresent->DmaBufferPrivateDataSize - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, aRects);
     6292        cbPrivateData = RT_OFFSETOF(VBOXCMDVBVA_CLRFILL, aRects);
     6293        cbMaxRects = pPresent->DmaBufferPrivateDataSize - cbPrivateData;
     6294
     6295        cbBuffer = VBOXWDDM_DUMMY_DMABUFFER_SIZE;
    62816296    }
    62826297    else
     
    63006315            pPresent->MultipassOffset = 0;
    63016316
     6317        Assert(cRects);
    63026318        const RECT *paDstSubRects = &pPresent->pDstSubRects[iStartRect];
    63036319        VBoxCVDdiPackRects(paRects, paDstSubRects, cRects);
     6320        cbPrivateData += (cRects * sizeof (VBOXCMDVBVA_RECT));
    63046321    }
    63056322
     
    63246341    pHdr->u32FenceID = 0;
    63256342
    6326     pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE;
     6343    Assert(cbBuffer);
     6344    Assert(cbPrivateData);
     6345    pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + cbBuffer;
     6346    pPresent->pDmaBufferPrivateData = ((uint8_t*)pPresent->pDmaBufferPrivateData) + cbPrivateData;
    63276347
    63286348    if (pPresent->MultipassOffset)
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