Changeset 30536 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jun 30, 2010 5:37:24 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
r30515 r30536 328 328 } 329 329 330 DECLINLINE(bool) vboxWddmRectIsEqual(const RECT *pRect1, const RECT *pRect2) 331 { 332 Assert(pRect1); 333 Assert(pRect2); 334 if (pRect1->left != pRect2->left) 335 return false; 336 if (pRect1->top != pRect2->top) 337 return false; 338 if (pRect1->right != pRect2->right) 339 return false; 340 if (pRect1->bottom != pRect2->bottom) 341 return false; 342 return true; 343 } 344 330 345 DECLINLINE(bool) vboxWddmRectIsCoveres(const RECT *pRect, const RECT *pCovered) 331 346 { -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r30515 r30536 1491 1491 { 1492 1492 pAllocation->enmType = pAllocInfo->enmType; 1493 pAllocation->fRcFlags = pAllocInfo->fFlags; 1493 1494 pAllocation->offVram = VBOXVIDEOOFFSET_VOID; 1494 1495 pAllocation->SurfDesc = pAllocInfo->SurfDesc; … … 1933 1934 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_SOURCE_INDEX); 1934 1935 Assert(pPatchList->PatchOffset == 0); 1935 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1936 Assert(pAllocationList->SegmentId); 1937 pPrivateData->SrcAllocInfo.segmentIdAlloc = pAllocationList->SegmentId; 1938 pPrivateData->SrcAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1939 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 1940 if (!pPrivateData->fFlags.bShadow2PrimaryUpdate) 1941 #endif 1942 { 1943 pPatchList = &pPatch->pPatchLocationList[1]; 1944 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_DESTINATION_INDEX); 1945 Assert(pPatchList->PatchOffset == 4); 1946 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1947 Assert(pAllocationList->SegmentId); 1948 pPrivateData->DstAllocInfo.segmentIdAlloc = pAllocationList->SegmentId; 1949 pPrivateData->DstAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1950 } 1936 const DXGK_ALLOCATIONLIST *pSrcAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1937 Assert(pSrcAllocationList->SegmentId); 1938 pPrivateData->SrcAllocInfo.segmentIdAlloc = pSrcAllocationList->SegmentId; 1939 pPrivateData->SrcAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pSrcAllocationList->PhysicalAddress.QuadPart; 1940 1941 pPatchList = &pPatch->pPatchLocationList[1]; 1942 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_DESTINATION_INDEX); 1943 Assert(pPatchList->PatchOffset == 4); 1944 const DXGK_ALLOCATIONLIST *pDstAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1945 Assert(pDstAllocationList->SegmentId); 1946 pPrivateData->DstAllocInfo.segmentIdAlloc = pDstAllocationList->SegmentId; 1947 pPrivateData->DstAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pDstAllocationList->PhysicalAddress.QuadPart; 1951 1948 break; 1952 1949 } … … 2021 2018 #endif 2022 2019 2020 static void vboxWddmSubmitBltCmd(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_CONTEXT pContext, PVBOXWDDM_DMA_PRESENT_BLT pBlt) 2021 { 2022 PVBOXVDMAPIPE_CMD_RECTSINFO pRectsCmd = (PVBOXVDMAPIPE_CMD_RECTSINFO)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_RECTSINFO, ContextsRects.UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2023 Assert(pRectsCmd); 2024 if (pRectsCmd) 2025 { 2026 pRectsCmd->pContext = pContext; 2027 memcpy(&pRectsCmd->ContextsRects, &pBlt->DstRects, RT_OFFSETOF(VBOXVDMAPIPE_RECTS, UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2028 NTSTATUS tmpStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pRectsCmd->Hdr); 2029 Assert(tmpStatus == STATUS_SUCCESS); 2030 if (tmpStatus != STATUS_SUCCESS) 2031 vboxVdmaGgCmdDestroy(&pRectsCmd->Hdr); 2032 } 2033 } 2023 2034 2024 2035 NTSTATUS … … 2079 2090 case VBOXVDMACMD_TYPE_DMA_PRESENT_BLT: 2080 2091 { 2092 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pSubmitCommand->hContext; 2093 Assert(pContext); 2094 Assert(pContext->pDevice); 2095 Assert(pContext->pDevice->pAdapter == pDevExt); 2081 2096 PVBOXWDDM_DMA_PRESENT_BLT pBlt = (PVBOXWDDM_DMA_PRESENT_BLT)pPrivateData; 2097 PVBOXWDDM_ALLOCATION pDstAlloc = pPrivateData->DstAllocInfo.pAlloc; 2098 PVBOXWDDM_ALLOCATION pSrcAlloc = pPrivateData->SrcAllocInfo.pAlloc; 2082 2099 uint32_t cContexts3D = ASMAtomicReadU32(&pDevExt->cContexts3D); 2083 if (cContexts3D)2084 { 2085 if (pPrivateData->fFlags.bShadow2PrimaryUpdate)2100 switch (pDstAlloc->enmType) 2101 { 2102 case VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE: 2086 2103 { 2087 RECT rect; 2088 if (pBlt->DstRects.UpdateRects.cRects) 2104 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->DstAllocInfo.srcId]; 2105 Assert(pSource->pPrimaryAllocation == pDstAlloc); 2106 switch (pSrcAlloc->enmType) 2089 2107 { 2090 rect = pBlt->DstRects.UpdateRects.aRects[0]; 2091 for (UINT i = 1; i < pBlt->DstRects.UpdateRects.cRects; ++i) 2108 case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE: 2092 2109 { 2093 vboxWddmRectUnited(&rect, &rect, &pBlt->DstRects.UpdateRects.aRects[i]); 2110 RECT rect; 2111 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM); 2112 vboxWddmCheckUpdateShadowAddress(pDevExt, pSource, pPrivateData->SrcAllocInfo.segmentIdAlloc, pPrivateData->SrcAllocInfo.offAlloc); 2113 if (pBlt->DstRects.UpdateRects.cRects) 2114 { 2115 rect = pBlt->DstRects.UpdateRects.aRects[0]; 2116 for (UINT i = 1; i < pBlt->DstRects.UpdateRects.cRects; ++i) 2117 { 2118 vboxWddmRectUnited(&rect, &rect, &pBlt->DstRects.UpdateRects.aRects[i]); 2119 } 2120 } 2121 else 2122 rect = pBlt->DstRects.ContextRect; 2123 2124 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 2125 vboxWddmSubmitBltCmd(pDevExt, pContext, pBlt); 2126 break; 2094 2127 } 2128 case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC: 2129 { 2130 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D); 2131 Assert(pSrcAlloc->fRcFlags.RenderTarget); 2132 if (pSrcAlloc->fRcFlags.RenderTarget) 2133 { 2134 vboxWddmSubmitBltCmd(pDevExt, pContext, pBlt); 2135 } 2136 break; 2137 } 2138 default: 2139 AssertBreakpoint(); 2140 break; 2095 2141 } 2096 else 2097 rect = pBlt->DstRects.ContextRect; 2098 2099 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pPrivateData->SrcAllocInfo.srcId]; 2100 VBOXVBVA_OP(ReportDirtyRect, pDevExt, &pSource->Vbva, &rect); 2142 break; 2101 2143 } 2102 2103 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pSubmitCommand->hContext; 2104 Assert(pContext); 2105 Assert(pContext->pDevice); 2106 Assert(pContext->pDevice->pAdapter == pDevExt); 2107 PVBOXVDMAPIPE_CMD_RECTSINFO pRectsCmd = (PVBOXVDMAPIPE_CMD_RECTSINFO)vboxVdmaGgCmdCreate(&pDevExt->u.primary.Vdma.DmaGg, VBOXVDMAPIPE_CMD_TYPE_RECTSINFO, RT_OFFSETOF(VBOXVDMAPIPE_CMD_RECTSINFO, ContextsRects.UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2108 Assert(pRectsCmd); 2109 if (pRectsCmd) 2144 case VBOXWDDM_ALLOC_TYPE_STD_STAGINGSURFACE: 2110 2145 { 2111 pRectsCmd->pContext = pContext; 2112 memcpy(&pRectsCmd->ContextsRects, &pBlt->DstRects, RT_OFFSETOF(VBOXVDMAPIPE_RECTS, UpdateRects.aRects[pBlt->DstRects.UpdateRects.cRects])); 2113 NTSTATUS tmpStatus = vboxVdmaGgCmdSubmit(&pDevExt->u.primary.Vdma.DmaGg, &pRectsCmd->Hdr); 2114 Assert(tmpStatus == STATUS_SUCCESS); 2115 if (tmpStatus != STATUS_SUCCESS) 2116 vboxVdmaGgCmdDestroy(&pRectsCmd->Hdr); 2146 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D); 2147 Assert(pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC); 2148 Assert(pSrcAlloc->fRcFlags.RenderTarget); 2149 Assert(vboxWddmRectIsEqual(&pBlt->SrcRect, &pBlt->DstRects.ContextRect)); 2150 Assert(pBlt->DstRects.UpdateRects.cRects == 1); 2151 Assert(vboxWddmRectIsEqual(&pBlt->SrcRect, pBlt->DstRects.UpdateRects.aRects)); 2152 break; 2117 2153 } 2118 } 2119 else 2120 Assert(!pPrivateData->fFlags.bShadow2PrimaryUpdate); 2154 case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE: 2155 { 2156 Assert(pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE); 2157 break; 2158 } 2159 default: 2160 AssertBreakpoint(); 2161 break; 2162 } 2121 2163 2122 2164 VBOXWDDM_SHADOW_UPDATE_COMPLETION context; … … 2134 2176 default: 2135 2177 { 2178 AssertBreakpoint(); 2136 2179 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate (&pDevExt->u.primary.Vdma, 0); 2137 2180 if (!pDr) … … 3722 3765 3723 3766 /* we do not know the shadow address yet, perform dummy DMA cycle */ 3724 pPrivateData->fFlags.bShadow2PrimaryUpdate = 1;3725 3767 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY; 3726 3768 vboxWddmPopulateDmaAllocInfo(&pPrivateData->SrcAllocInfo, pSrcAlloc, pSrc); … … 3746 3788 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 3747 3789 3748 if (pContext->enmType != VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D) 3749 { 3750 vboxWddmPopulateDmaAllocInfo(&pPrivateData->SrcAllocInfo, pSrcAlloc, pSrc); 3751 3752 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 3753 && pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) 3754 { 3755 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 3756 Assert(cContexts3D); 3757 #endif 3758 pPrivateData->fFlags.bShadow2PrimaryUpdate = 1; 3759 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM); 3760 } 3761 #ifdef VBOXWDDM_RENDER_FROM_SHADOW /* <- no need to fill dst surf info here */ 3762 else 3763 #endif 3764 { 3765 vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 3766 } 3767 } 3768 /* else - no need to fill any surf info since we need this request for visible rects */ 3790 vboxWddmPopulateDmaAllocInfo(&pPrivateData->SrcAllocInfo, pSrcAlloc, pSrc); 3791 vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 3769 3792 3770 3793 PVBOXWDDM_DMA_PRESENT_BLT pBlt = (PVBOXWDDM_DMA_PRESENT_BLT)pPrivateData; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r30515 r30536 54 54 { 55 55 VBOXWDDM_ALLOC_TYPE enmType; 56 //D3DDDI_RESOURCEFLAGS fRcFlags;56 D3DDDI_RESOURCEFLAGS fRcFlags; 57 57 UINT SegmentId; 58 58 VBOXVIDEOOFFSET offVram; … … 149 149 { 150 150 UINT bCmdInDmaBuffer : 1; 151 UINT bShadow2PrimaryUpdate : 1; 152 UINT bSrcAllocValid : 1; 153 UINT bDstAllocValid : 1; 154 UINT bReserved : 28; 151 UINT bReserved : 31; 155 152 }; 156 153 uint32_t Value;
Note:
See TracChangeset
for help on using the changeset viewer.