Changeset 30582 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jul 2, 2010 4:03:52 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30570 r30582 1187 1187 fFlags |= D3DLOCK_DONOTWAIT; 1188 1188 return fFlags; 1189 } 1190 1191 D3DTEXTUREFILTERTYPE vboxDDI2D3DBltFlags(D3DDDI_BLTFLAGS fFlags) 1192 { 1193 if (fFlags.Point) 1194 { 1195 /* no flags other than [Begin|Continue|End]PresentToDwm are set */ 1196 Assert((fFlags.Value & (~(0x00000100 | 0x00000200 | 0x00000400))) == 1); 1197 return D3DTEXF_POINT; 1198 } 1199 if (fFlags.Linear) 1200 { 1201 /* no flags other than [Begin|Continue|End]PresentToDwm are set */ 1202 Assert((fFlags.Value & (~(0x00000100 | 0x00000200 | 0x00000400))) == 2); 1203 return D3DTEXF_LINEAR; 1204 } 1205 /* no flags other than [Begin|Continue|End]PresentToDwm are set */ 1206 Assert((fFlags.Value & (~(0x00000100 | 0x00000200 | 0x00000400))) == 0); 1207 return D3DTEXF_NONE; 1189 1208 } 1190 1209 … … 1618 1637 PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)hTexture; 1619 1638 // Assert(pRc); 1620 IDirect3DTexture9 *pD3DIfTex = pRc ? (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf : NULL; 1639 IDirect3DTexture9 *pD3DIfTex; 1640 if (pRc) 1641 { 1642 Assert(pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE); 1643 pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 1644 } 1645 else 1646 pD3DIfTex = NULL; 1647 1621 1648 // Assert(pD3DIfTex); 1622 1649 HRESULT hr = pDevice->pDevice9If->SetTexture(Stage, pD3DIfTex); … … 2314 2341 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 2315 2342 { 2316 if (pRc-> RcDesc.fFlags.Texture || pRc->RcDesc.fFlags.Value == 0)2343 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 2317 2344 { 2318 2345 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; … … 2420 2447 } 2421 2448 } 2422 else if (pRc-> RcDesc.fFlags.VertexBuffer)2449 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VERTEXBUFFER) 2423 2450 { 2424 2451 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2517 2544 } 2518 2545 } 2519 else if (pRc-> RcDesc.fFlags.IndexBuffer)2546 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_INDEXBUFFER) 2520 2547 { 2521 2548 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2703 2730 if (VBOXDISPMODE_IS_3D(pDevice->pAdapter)) 2704 2731 { 2705 if (pRc-> RcDesc.fFlags.Texture || pRc->RcDesc.fFlags.Value == 0)2732 if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE) 2706 2733 { 2707 2734 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2732 2759 } 2733 2760 } 2734 else if (pRc-> RcDesc.fFlags.VertexBuffer)2761 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VERTEXBUFFER) 2735 2762 { 2736 2763 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2772 2799 } 2773 2800 } 2774 else if (pRc-> RcDesc.fFlags.IndexBuffer)2801 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_INDEXBUFFER) 2775 2802 { 2776 2803 Assert(pData->SubResourceIndex < pRc->cAllocations); … … 2979 3006 { 2980 3007 Assert(pD3D9Surf); 3008 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3009 pAllocation->pD3DIf = pD3D9Surf; 2981 3010 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 2982 3011 { … … 2996 3025 Assert(!pAllocation->pvMem); 2997 3026 } 2998 pAllocation->pD3DIf = pD3D9Surf;2999 3027 } 3000 3028 else … … 3025 3053 { 3026 3054 Assert(pD3D9VBuf); 3055 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_VERTEXBUFFER; 3056 pAllocation->pD3DIf = pD3D9VBuf; 3027 3057 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3028 3058 { … … 3043 3073 Assert(!pAllocation->pvMem); 3044 3074 } 3045 pAllocation->pD3DIf = pD3D9VBuf;3046 3075 } 3047 3076 else … … 3074 3103 { 3075 3104 Assert(pD3D9IBuf); 3105 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_INDEXBUFFER; 3106 pAllocation->pD3DIf = pD3D9IBuf; 3076 3107 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3077 3108 { … … 3092 3123 Assert(!pAllocation->pvMem); 3093 3124 } 3094 pAllocation->pD3DIf = pD3D9IBuf;3095 3125 } 3096 3126 else … … 3121 3151 } 3122 3152 #endif 3153 3154 if (pResource->Flags.RenderTarget) 3155 bIssueCreateResource = true; 3123 3156 3124 3157 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; … … 3138 3171 { 3139 3172 Assert(pD3DIfTex); 3173 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 3174 pAllocation->pD3DIf = pD3DIfTex; 3140 3175 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3141 3176 { … … 3160 3195 } 3161 3196 } 3162 pAllocation->pD3DIf = pD3DIfTex;3163 3197 } 3164 3198 #ifdef DEBUG … … 3192 3226 D3DPRESENT_PARAMETERS params; 3193 3227 memset(¶ms, 0, sizeof (params)); 3194 // params.BackBufferWidth = 0;3195 // params.BackBufferHeight = 0;3228 // params.BackBufferWidth = 0; 3229 // params.BackBufferHeight = 0; 3196 3230 params.BackBufferFormat = vboxDDI2D3DFormat(pResource->Format); 3197 3231 Assert(pResource->SurfCount); … … 3201 3235 params.SwapEffect = D3DSWAPEFFECT_DISCARD; 3202 3236 params.hDeviceWindow = hWnd; 3203 /* @todo: it seems there should be a way to detect this correctly since3204 * our vboxWddmDDevSetDisplayMode will be called in case we are using full-screen */3237 /* @todo: it seems there should be a way to detect this correctly since 3238 * our vboxWddmDDevSetDisplayMode will be called in case we are using full-screen */ 3205 3239 params.Windowed = TRUE; 3206 // params.EnableAutoDepthStencil = FALSE;3207 // params.AutoDepthStencilFormat = D3DFMT_UNKNOWN;3208 // params.Flags;3209 // params.FullScreen_RefreshRateInHz;3210 // params.FullScreen_PresentationInterval;3240 // params.EnableAutoDepthStencil = FALSE; 3241 // params.AutoDepthStencilFormat = D3DFMT_UNKNOWN; 3242 // params.Flags; 3243 // params.FullScreen_RefreshRateInHz; 3244 // params.FullScreen_PresentationInterval; 3211 3245 hr = pAdapter->pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, fFlags, ¶ms, &pDevice9If); 3212 3246 Assert(hr == S_OK); … … 3222 3256 { 3223 3257 Assert(pDevice->hWnd); 3224 3225 3258 } 3226 3259 … … 3235 3268 IDirect3DSurface9* pD3D9Surf; 3236 3269 hr = pDevice->pDevice9If->CreateRenderTarget(pAllocation->SurfDesc.width, 3237 3238 3239 3240 3241 3242 3243 3244 3270 pAllocation->SurfDesc.height, 3271 vboxDDI2D3DFormat(pResource->Format), 3272 vboxDDI2D3DMultiSampleType(pResource->MultisampleType), 3273 pResource->MultisampleQuality, 3274 !pResource->Flags.NotLockable /* BOOL Lockable */, 3275 &pD3D9Surf, 3276 NULL /* HANDLE* pSharedHandle */ 3277 ); 3245 3278 Assert(hr == S_OK); 3246 3279 if (hr == S_OK) 3247 3280 { 3248 3281 Assert(pD3D9Surf); 3282 pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_SURFACE; 3283 pAllocation->pD3DIf = pD3D9Surf; 3249 3284 if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM) 3250 3285 { … … 3264 3299 Assert(!pAllocation->pvMem); 3265 3300 } 3266 pAllocation->pD3DIf = pD3D9Surf;3267 3301 } 3268 3302 else … … 3472 3506 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 3473 3507 Assert(pRc->RcDesc.fFlags.RenderTarget); 3508 Assert(pRc->aAllocations[pData->SubResourceIndex].enmD3DIfType == VBOXDISP_D3DIFTYPE_SURFACE); 3474 3509 Assert(pAlloc->hAllocation); 3475 3510 D3DDDICB_SETDISPLAYMODE DdiDm = {0}; … … 3610 3645 Assert(pDevice->pDevice9If); 3611 3646 IDirect3DVertexDeclaration9 *pDecl = (IDirect3DVertexDeclaration9*)hShaderHandle; 3612 HRESULT hr = pDecl->Release();3613 Assert(hr == S_OK);3647 HRESULT hr = S_OK; 3648 pDecl->Release(); 3614 3649 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 3615 3650 return hr; … … 3653 3688 Assert(pDevice->pDevice9If); 3654 3689 IDirect3DVertexShader9 *pShader = (IDirect3DVertexShader9*)hShaderHandle; 3655 HRESULT hr = pShader->Release();3656 Assert(hr == S_OK);3690 HRESULT hr = S_OK; 3691 pShader->Release(); 3657 3692 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 3658 3693 return hr; … … 3750 3785 return E_FAIL; 3751 3786 } 3752 static HRESULT vboxWddmLockRect(PVBOXWDDMDISP_ ALLOCATION pAlloc, UINT iAlloc, D3DDDI_RESOURCEFLAGS fAllocType,3787 static HRESULT vboxWddmLockRect(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, 3753 3788 D3DLOCKED_RECT * pLockedRect, 3754 3789 CONST RECT *pRect, … … 3756 3791 { 3757 3792 HRESULT hr = E_FAIL; 3758 Assert(!pAlloc->LockInfo.cLocks); 3759 if (fAllocType.Texture || fAllocType.Value == 0) 3760 { 3761 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pAlloc->pD3DIf; 3762 Assert(pD3DIfTex); 3763 hr = pD3DIfTex->LockRect(iAlloc, pLockedRect, pRect, fLockFlags); 3764 Assert(hr == S_OK); 3765 } 3766 else if (fAllocType.RenderTarget) 3767 { 3768 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pAlloc->pD3DIf; 3769 Assert(pD3DIfSurf); 3770 hr = pD3DIfSurf->LockRect(pLockedRect, pRect, fLockFlags); 3771 Assert(hr == S_OK); 3772 } 3773 else 3774 { 3775 AssertBreakpoint(); 3776 } 3777 return hr; 3778 } 3779 static HRESULT vboxWddmUnlockRect(PVBOXWDDMDISP_ALLOCATION pAlloc, UINT iAlloc, D3DDDI_RESOURCEFLAGS fAllocType) 3780 { 3781 HRESULT hr = E_FAIL; 3782 Assert(!pAlloc->LockInfo.cLocks); 3783 if (fAllocType.Texture || fAllocType.Value == 0) 3784 { 3785 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pAlloc->pD3DIf; 3786 Assert(pD3DIfTex); 3787 hr = pD3DIfTex->UnlockRect(iAlloc); 3788 Assert(hr == S_OK); 3789 } 3790 else if (fAllocType.RenderTarget) 3791 { 3792 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pAlloc->pD3DIf; 3793 Assert(pD3DIfSurf); 3794 hr = pD3DIfSurf->UnlockRect(); 3795 Assert(hr == S_OK); 3796 } 3797 else 3798 { 3799 AssertBreakpoint(); 3800 } 3801 return hr; 3802 } 3793 Assert(!pRc->aAllocations[iAlloc].LockInfo.cLocks); 3794 Assert(pRc->cAllocations > iAlloc); 3795 switch (pRc->aAllocations[0].enmD3DIfType) 3796 { 3797 case VBOXDISP_D3DIFTYPE_SURFACE: 3798 { 3799 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pRc->aAllocations[iAlloc].pD3DIf; 3800 Assert(pD3DIfSurf); 3801 hr = pD3DIfSurf->LockRect(pLockedRect, pRect, fLockFlags); 3802 Assert(hr == S_OK); 3803 break; 3804 } 3805 case VBOXDISP_D3DIFTYPE_TEXTURE: 3806 { 3807 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 3808 Assert(pD3DIfTex); 3809 hr = pD3DIfTex->LockRect(iAlloc, pLockedRect, pRect, fLockFlags); 3810 Assert(hr == S_OK); 3811 break; 3812 } 3813 default: 3814 AssertBreakpoint(); 3815 break; 3816 } 3817 return hr; 3818 } 3819 static HRESULT vboxWddmUnlockRect(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc) 3820 { 3821 HRESULT hr = S_OK; 3822 Assert(pRc->cAllocations > iAlloc); 3823 switch (pRc->aAllocations[0].enmD3DIfType) 3824 { 3825 case VBOXDISP_D3DIFTYPE_SURFACE: 3826 { 3827 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pRc->aAllocations[iAlloc].pD3DIf; 3828 Assert(pD3DIfSurf); 3829 hr = pD3DIfSurf->UnlockRect(); 3830 Assert(hr == S_OK); 3831 break; 3832 } 3833 case VBOXDISP_D3DIFTYPE_TEXTURE: 3834 { 3835 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 3836 Assert(pD3DIfTex); 3837 hr = pD3DIfTex->UnlockRect(iAlloc); 3838 Assert(hr == S_OK); 3839 break; 3840 } 3841 default: 3842 AssertBreakpoint(); 3843 hr = E_FAIL; 3844 break; 3845 } 3846 return hr; 3847 } 3848 3849 /* on success increments the surface ref counter, 3850 * i.e. one must call pSurf->Release() once the surface is not needed*/ 3851 static HRESULT vboxWddmSurfGet(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, IDirect3DSurface9 **ppSurf) 3852 { 3853 HRESULT hr = S_OK; 3854 Assert(pRc->cAllocations > iAlloc); 3855 switch (pRc->aAllocations[0].enmD3DIfType) 3856 { 3857 case VBOXDISP_D3DIFTYPE_SURFACE: 3858 { 3859 IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pRc->aAllocations[iAlloc].pD3DIf; 3860 Assert(pD3DIfSurf); 3861 pD3DIfSurf->AddRef(); 3862 *ppSurf = pD3DIfSurf; 3863 break; 3864 } 3865 case VBOXDISP_D3DIFTYPE_TEXTURE: 3866 { 3867 IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf; 3868 IDirect3DSurface9 *pSurfaceLevel; 3869 Assert(pD3DIfTex); 3870 hr = pD3DIfTex->GetSurfaceLevel(iAlloc, &pSurfaceLevel); 3871 Assert(hr == S_OK); 3872 if (hr == S_OK) 3873 { 3874 *ppSurf = pSurfaceLevel; 3875 } 3876 break; 3877 } 3878 default: 3879 AssertBreakpoint(); 3880 hr = E_FAIL; 3881 break; 3882 } 3883 return hr; 3884 } 3885 3803 3886 static HRESULT APIENTRY vboxWddmDDevBlt(HANDLE hDevice, CONST D3DDDIARG_BLT* pData) 3804 3887 { … … 3811 3894 Assert(pDstRc->cAllocations > pData->DstSubResourceIndex); 3812 3895 Assert(pSrcRc->cAllocations > pData->SrcSubResourceIndex); 3813 PVBOXWDDMDISP_ALLOCATION pSrcAlloc = &pSrcRc->aAllocations[pData->SrcSubResourceIndex];3814 PVBOXWDDMDISP_ALLOCATION pDstAlloc = &pDstRc->aAllocations[pData->DstSubResourceIndex];3815 3896 HRESULT hr = S_OK; 3816 if ((pDstRc->RcDesc.fFlags.Texture || pDstRc->RcDesc.fFlags.Value == 0) 3897 /* try StretchRect */ 3898 IDirect3DSurface9 *pSrcSurfIf = NULL; 3899 IDirect3DSurface9 *pDstSurfIf = NULL; 3900 hr = vboxWddmSurfGet(pSrcRc, pData->SrcSubResourceIndex, &pSrcSurfIf); 3901 Assert(hr == S_OK); 3902 if (hr == S_OK) 3903 { 3904 Assert(pSrcSurfIf); 3905 hr = vboxWddmSurfGet(pDstRc, pData->DstSubResourceIndex, &pDstSurfIf); 3906 Assert(hr == S_OK); 3907 if (hr == S_OK) 3908 { 3909 Assert(pDstSurfIf); 3910 /* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */ 3911 Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001 | 0x00000002))) == 0); 3912 hr = pDevice->pDevice9If->StretchRect(pSrcSurfIf, 3913 &pData->SrcRect, 3914 pDstSurfIf, 3915 &pData->DstRect, 3916 vboxDDI2D3DBltFlags(pData->Flags)); 3917 Assert(hr == S_OK); 3918 pDstSurfIf->Release(); 3919 } 3920 pSrcSurfIf->Release(); 3921 } 3922 3923 if (hr != S_OK) 3924 { 3925 /* todo: fallback to memcpy or whatever ? */ 3926 AssertBreakpoint(); 3927 } 3928 3929 3930 #if 0 3931 if ((use pAlloc->enmD3DIfType instead!!! pDstRc->RcDesc.fFlags.Texture || pDstRc->RcDesc.fFlags.Value == 0) 3817 3932 && (pSrcRc->RcDesc.fFlags.Texture || pSrcRc->RcDesc.fFlags.Value == 0)) 3818 3933 { … … 3915 4030 } 3916 4031 } 4032 #endif 3917 4033 3918 4034 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); … … 4050 4166 Assert(pDevice->pDevice9If); 4051 4167 IDirect3DPixelShader9 *pShader = (IDirect3DPixelShader9*)hShaderHandle; 4052 HRESULT hr = pShader->Release();4053 Assert(hr == S_OK);4168 HRESULT hr = S_OK; 4169 pShader->Release(); 4054 4170 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr)); 4055 4171 return hr; … … 4701 4817 HRESULT hr = VBoxDispWorkerDestroy(&pAdapter->WndWorker); 4702 4818 Assert(hr == S_OK); 4703 hr = pAdapter->pD3D9If->Release(); 4704 Assert(hr == S_OK); 4819 pAdapter->pD3D9If->Release(); 4705 4820 VBoxDispD3DClose(&pAdapter->D3D); 4706 4821 } -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r30554 r30582 129 129 } VBOXWDDMDISP_LOCKINFO; 130 130 131 typedef enum 132 { 133 VBOXDISP_D3DIFTYPE_UNDEFINED = 0, 134 VBOXDISP_D3DIFTYPE_SURFACE, 135 VBOXDISP_D3DIFTYPE_TEXTURE, 136 VBOXDISP_D3DIFTYPE_VERTEXBUFFER, 137 VBOXDISP_D3DIFTYPE_INDEXBUFFER 138 } VBOXDISP_D3DIFTYPE; 139 131 140 typedef struct VBOXWDDMDISP_ALLOCATION 132 141 { … … 134 143 VBOXWDDM_ALLOC_TYPE enmType; 135 144 void* pvMem; 136 /* object type depends on resource type*/145 /* object type is defined by enmD3DIfType enum */ 137 146 IUnknown *pD3DIf; 147 VBOXDISP_D3DIFTYPE enmD3DIfType; 138 148 VBOXWDDMDISP_LOCKINFO LockInfo; 139 149 VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r30566 r30582 1931 1931 case VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY: 1932 1932 case VBOXVDMACMD_TYPE_DMA_PRESENT_BLT: 1933 case VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP:1934 {1935 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[ 0];1933 { 1934 Assert(pPatch->PatchLocationListSubmissionLength == 2); 1935 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[pPatch->PatchLocationListSubmissionStart]; 1936 1936 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_SOURCE_INDEX); 1937 1937 Assert(pPatchList->PatchOffset == 0); … … 1941 1941 pPrivateData->SrcAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pSrcAllocationList->PhysicalAddress.QuadPart; 1942 1942 1943 pPatchList = &pPatch->pPatchLocationList[ 1];1943 pPatchList = &pPatch->pPatchLocationList[pPatch->PatchLocationListSubmissionStart + 1]; 1944 1944 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_DESTINATION_INDEX); 1945 1945 Assert(pPatchList->PatchOffset == 4); … … 1949 1949 pPrivateData->DstAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pDstAllocationList->PhysicalAddress.QuadPart; 1950 1950 break; 1951 } 1952 case VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP: 1953 { 1954 Assert(pPatch->PatchLocationListSubmissionLength == 1); 1955 const D3DDDI_PATCHLOCATIONLIST* pPatchList = &pPatch->pPatchLocationList[pPatch->PatchLocationListSubmissionStart]; 1956 Assert(pPatchList->AllocationIndex == DXGK_PRESENT_SOURCE_INDEX); 1957 Assert(pPatchList->PatchOffset == 0); 1958 const DXGK_ALLOCATIONLIST *pSrcAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1959 Assert(pSrcAllocationList->SegmentId); 1960 pPrivateData->SrcAllocInfo.segmentIdAlloc = pSrcAllocationList->SegmentId; 1961 pPrivateData->SrcAllocInfo.offAlloc = (VBOXVIDEOOFFSET)pSrcAllocationList->PhysicalAddress.QuadPart; 1951 1962 } 1952 1963 default: … … 2187 2198 if (pRectsCmd) 2188 2199 { 2189 PVBOXWDDM_ALLOCATION p DstAlloc = pPrivateData->DstAllocInfo.pAlloc;2200 PVBOXWDDM_ALLOCATION pAlloc = pPrivateData->SrcAllocInfo.pAlloc; 2190 2201 pRectsCmd->pContext = pContext; 2191 2202 RECT r; 2192 2203 r.top = 0; 2193 2204 r.left = 0; 2194 r.right = p DstAlloc->SurfDesc.width;2195 r.bottom = p DstAlloc->SurfDesc.height;2205 r.right = pAlloc->SurfDesc.width; 2206 r.bottom = pAlloc->SurfDesc.height; 2196 2207 pRectsCmd->ContextsRects.ContextRect = r; 2197 2208 pRectsCmd->ContextsRects.UpdateRects.cRects = 1; … … 4047 4058 else if (pPresent->Flags.Flip) 4048 4059 { 4049 Assert(pPresent->Flags.Value == 1); /* only Blt is set, we do not support anything else for now */4060 Assert(pPresent->Flags.Value == 4); /* only Blt is set, we do not support anything else for now */ 4050 4061 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 4051 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX];4052 4062 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); 4053 4063 Assert(pSrcAlloc); 4054 4064 if (pSrcAlloc) 4055 4065 { 4056 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 4057 Assert(pDstAlloc); 4058 if (pDstAlloc) 4059 { 4060 Assert(cContexts3D); 4061 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP; 4062 4063 vboxWddmPopulateDmaAllocInfo(&pPrivateData->SrcAllocInfo, pSrcAlloc, pSrc); 4064 vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 4065 4066 UINT cbCmd = sizeof (VBOXVDMACMD_DMA_PRESENT_FLIP); 4067 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbCmd; 4068 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 4069 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 4070 4071 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 4072 pPresent->pPatchLocationListOut->PatchOffset = 0; 4073 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 4074 ++pPresent->pPatchLocationListOut; 4075 pPresent->pPatchLocationListOut->PatchOffset = 4; 4076 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 4077 ++pPresent->pPatchLocationListOut; 4078 } 4079 else 4080 { 4081 /* this should not happen actually */ 4082 drprintf((__FUNCTION__": failed to get Dst Allocation info for hDeviceSpecificAllocation(0x%x)\n",pDst->hDeviceSpecificAllocation)); 4083 Status = STATUS_INVALID_HANDLE; 4084 } 4066 Assert(cContexts3D); 4067 pPrivateData->enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP; 4068 4069 vboxWddmPopulateDmaAllocInfo(&pPrivateData->SrcAllocInfo, pSrcAlloc, pSrc); 4070 4071 UINT cbCmd = sizeof (VBOXVDMACMD_DMA_PRESENT_FLIP); 4072 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbCmd; 4073 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 4074 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 4075 4076 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 4077 pPresent->pPatchLocationListOut->PatchOffset = 0; 4078 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 4079 ++pPresent->pPatchLocationListOut; 4085 4080 } 4086 4081 else 4087 4082 { 4088 4083 /* this should not happen actually */ 4089 drprintf((__FUNCTION__": failed to get Src Allocation info for hDeviceSpecificAllocation(0x%x)\n",pSrc->hDeviceSpecificAllocation));4084 drprintf((__FUNCTION__": failed to get pSrc Allocation info for hDeviceSpecificAllocation(0x%x)\n",pSrc->hDeviceSpecificAllocation)); 4090 4085 Status = STATUS_INVALID_HANDLE; 4091 4086 }
Note:
See TracChangeset
for help on using the changeset viewer.