VirtualBox

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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));
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