VirtualBox

Changeset 32107 in vbox


Ignore:
Timestamp:
Aug 31, 2010 6:50:53 AM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: issue render cmd on flush for shared resources to notify d3d runtime about surf contents change (not completed)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxVideo.h

    r30788 r32107  
    11801180    VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY,
    11811181    VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL,
    1182     VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP
     1182    VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP,
     1183    VBOXVDMACMD_TYPE_DMA_NOP
    11831184} VBOXVDMACMD_TYPE;
    11841185
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r32061 r32107  
    40114011            if (pAlloc->pSecondaryOpenedD3DIf)
    40124012                pAlloc->pSecondaryOpenedD3DIf->Release();
     4013
     4014            EnterCriticalSection(&pDevice->DirtyAllocListLock);
     4015            if (pAlloc->DirtyAllocListEntry.pNext)
     4016                RTListNodeRemove(&pAlloc->DirtyAllocListEntry);
     4017            LeaveCriticalSection(&pDevice->DirtyAllocListLock);
    40134018        }
    40144019    }
     
    41824187    return hr;
    41834188}
     4189
     4190typedef struct VBOXWDDMDISP_NSCADD
     4191{
     4192    VOID* pvCommandBuffer;
     4193    UINT cbCommandBuffer;
     4194    D3DDDI_ALLOCATIONLIST* pAllocationList;
     4195    UINT cAllocationList;
     4196    D3DDDI_PATCHLOCATIONLIST* pPatchLocationList;
     4197    UINT cPatchLocationList;
     4198    UINT cAllocations;
     4199}VBOXWDDMDISP_NSCADD, *PVBOXWDDMDISP_NSCADD;
     4200
     4201static HRESULT vboxWddmNSCAddAlloc(PVBOXWDDMDISP_NSCADD pData, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bWrite)
     4202{
     4203    HRESULT hr = S_OK;
     4204    if (pData->cAllocationList && pData->cPatchLocationList && pData->cbCommandBuffer > 4)
     4205    {
     4206        memset(pData->pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST));
     4207        pData->pAllocationList[0].hAllocation = pAlloc->hAllocation;
     4208        if (bWrite)
     4209            pData->pAllocationList[0].WriteOperation = 1;
     4210
     4211        memset(pData->pPatchLocationList, 0, sizeof (D3DDDI_PATCHLOCATIONLIST));
     4212        pData->pPatchLocationList[0].PatchOffset = pData->cAllocations*4;
     4213        pData->pPatchLocationList[0].AllocationIndex = pData->cAllocations;
     4214
     4215        pData->cbCommandBuffer -= 4;
     4216        --pData->cAllocationList;
     4217        --pData->cPatchLocationList;
     4218        ++pData->cAllocations;
     4219    }
     4220    else
     4221        hr = S_FALSE;
     4222
     4223    ++pData->pAllocationList;
     4224    ++pData->pPatchLocationList;
     4225    pData->pvCommandBuffer = (VOID*)(((uint8_t*)pData->pvCommandBuffer) + 4);
     4226
     4227    return hr;
     4228}
     4229
     4230static HRESULT vboxWddmNotifySharedChange(PVBOXWDDMDISP_DEVICE pDevice)
     4231{
     4232    VBOXWDDMDISP_NSCADD NscAdd;
     4233
     4234    do
     4235    {
     4236        NscAdd.pvCommandBuffer = pDevice->DefaultContext.ContextInfo.pCommandBuffer;
     4237        NscAdd.cbCommandBuffer = pDevice->DefaultContext.ContextInfo.CommandBufferSize;
     4238        NscAdd.pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList;
     4239        NscAdd.cAllocationList = pDevice->DefaultContext.ContextInfo.AllocationListSize;
     4240        NscAdd.pPatchLocationList = pDevice->DefaultContext.ContextInfo.pPatchLocationList;
     4241        NscAdd.cPatchLocationList = pDevice->DefaultContext.ContextInfo.PatchLocationListSize;
     4242        NscAdd.cAllocations = 0;
     4243
     4244        EnterCriticalSection(&pDevice->DirtyAllocListLock);
     4245
     4246        PVBOXWDDMDISP_ALLOCATION pAlloc = RTListNodeGetFirst(&pDevice->DirtyAllocList, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry);
     4247        if (pAlloc)
     4248        {
     4249            HRESULT tmpHr = vboxWddmNSCAddAlloc(&NscAdd, pAlloc, TRUE);
     4250            Assert(tmpHr == S_OK || tmpHr == S_FALSE);
     4251            if (tmpHr == S_OK)
     4252            {
     4253                RTListNodeRemove(&pAlloc->DirtyAllocListEntry);
     4254                LeaveCriticalSection(&pDevice->DirtyAllocListLock);
     4255                continue;
     4256            }
     4257
     4258            LeaveCriticalSection(&pDevice->DirtyAllocListLock);
     4259
     4260        }
     4261        else
     4262        {
     4263            LeaveCriticalSection(&pDevice->DirtyAllocListLock);
     4264            if (!NscAdd.cAllocations)
     4265                break;
     4266        }
     4267
     4268        D3DDDICB_RENDER RenderData = {0};
     4269        RenderData.CommandLength = pDevice->DefaultContext.ContextInfo.CommandBufferSize - NscAdd.cbCommandBuffer;
     4270        Assert(RenderData.CommandLength);
     4271        Assert(RenderData.CommandLength < UINT32_MAX/2);
     4272        RenderData.CommandOffset = 0;
     4273        RenderData.NumAllocations = pDevice->DefaultContext.ContextInfo.AllocationListSize - NscAdd.cAllocationList;
     4274        Assert(RenderData.NumAllocations == NscAdd.cAllocations);
     4275        RenderData.NumPatchLocations = pDevice->DefaultContext.ContextInfo.PatchLocationListSize - NscAdd.cPatchLocationList;
     4276        Assert(RenderData.NumPatchLocations == NscAdd.cAllocations);
     4277        RenderData.NewCommandBufferSize = sizeof (VBOXVDMACMD) + 4 * (100);
     4278        RenderData.NewAllocationListSize = 100;
     4279        RenderData.NewPatchLocationListSize = 100;
     4280        RenderData.hContext = pDevice->DefaultContext.ContextInfo.hContext;
     4281
     4282        HRESULT hr = pDevice->RtCallbacks.pfnRenderCb(pDevice->hDevice, &RenderData);
     4283        Assert(hr == S_OK);
     4284        if (hr == S_OK)
     4285        {
     4286            pDevice->DefaultContext.ContextInfo.CommandBufferSize = RenderData.NewCommandBufferSize;
     4287            pDevice->DefaultContext.ContextInfo.pCommandBuffer = RenderData.pNewCommandBuffer;
     4288            pDevice->DefaultContext.ContextInfo.AllocationListSize = RenderData.NewAllocationListSize;
     4289            pDevice->DefaultContext.ContextInfo.pAllocationList = RenderData.pNewAllocationList;
     4290            pDevice->DefaultContext.ContextInfo.PatchLocationListSize = RenderData.NewPatchLocationListSize;
     4291            pDevice->DefaultContext.ContextInfo.pPatchLocationList = RenderData.pNewPatchLocationList;
     4292        }
     4293        else
     4294            break;
     4295    } while (1);
     4296
     4297    return S_OK;
     4298}
     4299
    41844300static HRESULT APIENTRY vboxWddmDDevFlush(HANDLE hDevice)
    41854301{
     
    42104326            }
    42114327        }
     4328
     4329        vboxWddmNotifySharedChange(pDevice);
    42124330    }
    42134331    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    48154933#endif
    48164934
     4935    if (pDstRc->RcDesc.fFlags.SharedResource)
     4936    {
     4937        PVBOXWDDMDISP_ALLOCATION pAlloc = &pDstRc->aAllocations[pData->DstSubResourceIndex];
     4938        EnterCriticalSection(&pDevice->DirtyAllocListLock);
     4939        if (!pAlloc->DirtyAllocListEntry.pNext)
     4940            RTListAppend(&pDevice->DirtyAllocList, &pAlloc->DirtyAllocListEntry);
     4941        LeaveCriticalSection(&pDevice->DirtyAllocListLock);
     4942    }
     4943
    48174944    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
    48184945    return hr;
     
    55815708        pDevice->ViewPort.MinZ = 0.;
    55825709        pDevice->ViewPort.MaxZ = 1.;
     5710
     5711        InitializeCriticalSection(&pDevice->DirtyAllocListLock);
     5712        RTListInit(&pDevice->DirtyAllocList);
    55835713
    55845714        Assert(!pCreateData->AllocationListSize);
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h

    r31797 r32107  
    9595    IDirect3DDevice9 *pDevice9If;
    9696    struct VBOXWDDMDISP_RESOURCE *pRenderTargetRc;
     97    struct VBOXWDDMDISP_RESOURCE *pDstSharedRc;
    9798    uint32_t iRenderTargetFrontBuf;
    9899    HWND hWnd;
     
    124125    D3DVIEWPORT9 ViewPort;
    125126    VBOXWDDMDISP_CONTEXT DefaultContext;
     127
     128    CRITICAL_SECTION DirtyAllocListLock;
     129    RTLISTNODE DirtyAllocList;
    126130
    127131    UINT iPrimaryScreen;
     
    160164    IUnknown *pSecondaryOpenedD3DIf;
    161165    VBOXDISP_D3DIFTYPE enmD3DIfType;
     166    RTLISTNODE DirtyAllocListEntry;
    162167    HANDLE hSharedHandle;
    163168    VBOXWDDMDISP_LOCKINFO LockInfo;
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp

    r31797 r32107  
    19541954                break;
    19551955            }
     1956            case VBOXVDMACMD_TYPE_DMA_NOP:
     1957                break;
    19561958            default:
    19571959            {
     
    23102312            break;
    23112313        }
     2314        case VBOXVDMACMD_TYPE_DMA_NOP:
     2315        {
     2316            PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pSubmitCommand->hContext;
     2317            Assert(pContext);
     2318            Status = vboxWddmDmaCmdNotifyCompletion(pDevExt, pContext, pSubmitCommand->SubmissionFenceId);
     2319            Assert(Status == STATUS_SUCCESS);
     2320            break;
     2321        }
    23122322        default:
    23132323        {
     
    37793789    drprintf(("==> "__FUNCTION__ ", !!NOT_IMPLEMENTED!! hContext(0x%x)\n", hContext));
    37803790
     3791    pRender->pDmaBuffer = ((uint8_t*)pRender->pDmaBuffer) + pRender->CommandLength;
     3792    /* @todo: impl  */
    37813793    AssertBreakpoint();
    37823794
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