Changeset 30346 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jun 21, 2010 5:03:55 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r30317 r30346 1078 1078 fFlags |= D3DLOCK_DONOTWAIT; 1079 1079 return fFlags; 1080 }1081 1082 static void vboxResourcePopulateRcDesc(VBOXWDDM_RC_DESC *pDesc, D3DDDIARG_CREATERESOURCE* pResource)1083 {1084 pDesc->fFlags = pResource->Flags;1085 pDesc->enmFormat = pResource->Format;1086 pDesc->enmPool = pResource->Pool;1087 pDesc->enmMultisampleType = pResource->MultisampleType;1088 pDesc->MultisampleQuality = pResource->MultisampleQuality;1089 pDesc->MipLevels = pResource->MipLevels;1090 pDesc->Fvf = pResource->Fvf;1091 pDesc->VidPnSourceId = pResource->VidPnSourceId;1092 pDesc->RefreshRate = pResource->RefreshRate;1093 pDesc->enmRotation = pResource->Rotation;1094 1080 } 1095 1081 … … 2565 2551 } 2566 2552 2553 static void vboxWddmRequestAllocFree(D3DDDICB_ALLOCATE* pAlloc) 2554 { 2555 RTMemFree(pAlloc); 2556 } 2557 2567 2558 static D3DDDICB_ALLOCATE* vboxWddmRequestAllocAlloc(D3DDDIARG_CREATERESOURCE* pResource) 2568 2559 { … … 2610 2601 PVBOXWDDMDISP_ADAPTER pAdapter = pDevice->pAdapter; 2611 2602 2612 if (VBOXDISPMODE_IS_3D(pAdapter)) 2613 { 2614 PVBOXWDDMDISP_RESOURCE pRc = vboxResourceAlloc(pResource->SurfCount); 2615 Assert(pRc); 2616 if (pRc) 2617 { 2618 pRc->hResource = pResource->hResource; 2619 pRc->pDevice = pDevice; 2620 pRc->fFlags = VBOXWDDM_RESOURCE_F_TYPE_GENERIC; 2621 vboxResourcePopulateRcDesc(&pRc->RcDesc, pResource); 2622 pRc->cAllocations = pResource->SurfCount; 2623 for (UINT i = 0; i < pResource->SurfCount; ++i) 2624 { 2625 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 2626 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 2627 pAllocation->hAllocation = NULL; 2628 pAllocation->enmType = VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC; 2629 pAllocation->pvMem = (void*)pSurf->pSysMem; 2630 pAllocation->SurfDesc.pitch = pSurf->SysMemPitch; 2631 pAllocation->SurfDesc.slicePitch = pSurf->SysMemSlicePitch; 2632 pAllocation->SurfDesc.depth = pSurf->Depth; 2633 pAllocation->SurfDesc.width = pSurf->Width; 2634 pAllocation->SurfDesc.height = pSurf->Height; 2635 pAllocation->SurfDesc.format = pResource->Format; 2636 } 2637 2603 PVBOXWDDMDISP_RESOURCE pRc = vboxResourceAlloc(pResource->SurfCount); 2604 Assert(pRc); 2605 if (pRc) 2606 { 2607 bool bIssueCreateResource = false; 2608 2609 pRc->hResource = pResource->hResource; 2610 pRc->hKMResource = NULL; 2611 pRc->pDevice = pDevice; 2612 pRc->fFlags = VBOXWDDM_RESOURCE_F_TYPE_GENERIC; 2613 pRc->RcDesc.fFlags = pResource->Flags; 2614 pRc->RcDesc.enmFormat = pResource->Format; 2615 pRc->RcDesc.enmPool = pResource->Pool; 2616 pRc->RcDesc.enmMultisampleType = pResource->MultisampleType; 2617 pRc->RcDesc.MultisampleQuality = pResource->MultisampleQuality; 2618 pRc->RcDesc.MipLevels = pResource->MipLevels; 2619 pRc->RcDesc.Fvf = pResource->Fvf; 2620 pRc->RcDesc.VidPnSourceId = pResource->VidPnSourceId; 2621 pRc->RcDesc.RefreshRate = pResource->RefreshRate; 2622 pRc->RcDesc.enmRotation = pResource->Rotation; 2623 pRc->cAllocations = pResource->SurfCount; 2624 for (UINT i = 0; i < pResource->SurfCount; ++i) 2625 { 2626 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i]; 2627 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[i]; 2628 pAllocation->hAllocation = NULL; 2629 pAllocation->enmType = VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC; 2630 pAllocation->pvMem = (void*)pSurf->pSysMem; 2631 pAllocation->SurfDesc.pitch = pSurf->SysMemPitch; 2632 pAllocation->SurfDesc.slicePitch = pSurf->SysMemSlicePitch; 2633 pAllocation->SurfDesc.depth = pSurf->Depth; 2634 pAllocation->SurfDesc.width = pSurf->Width; 2635 pAllocation->SurfDesc.height = pSurf->Height; 2636 pAllocation->SurfDesc.format = pResource->Format; 2637 } 2638 2639 if (VBOXDISPMODE_IS_3D(pAdapter)) 2640 { 2638 2641 if (pResource->Flags.RenderTarget) 2639 2642 { … … 2642 2645 Assert(!pDevice->pDevice9If); 2643 2646 Assert(!pDevice->hWnd); 2647 bIssueCreateResource = true; 2644 2648 hr = VBoxDispWndCreate(pAdapter, pResource->pSurfList[0].Width, pResource->pSurfList[0].Height, &hWnd); 2645 2649 Assert(hr == S_OK); … … 2948 2952 Assert(0); 2949 2953 } 2950 2951 if (hr == S_OK)2952 pResource->hResource = pRc;2953 else2954 vboxResourceFree(pRc);2955 2954 } 2956 2955 else 2957 { 2958 hr = E_OUTOFMEMORY; 2959 } 2960 2961 } 2962 else 2963 { 2964 PVBOXWDDMDISP_RESOURCE pRc = vboxResourceAlloc(pResource->SurfCount); 2965 Assert(pRc); 2966 if (pRc) 2967 { 2968 pRc->hResource = pResource->hResource; 2969 pRc->hKMResource = NULL; 2970 pRc->pDevice = pDevice; 2971 pRc->fFlags = VBOXWDDM_RESOURCE_F_TYPE_GENERIC; 2972 pRc->RcDesc.fFlags = pResource->Flags; 2973 pRc->RcDesc.enmFormat = pResource->Format; 2974 pRc->RcDesc.enmPool = pResource->Pool; 2975 pRc->RcDesc.enmMultisampleType = pResource->MultisampleType; 2976 pRc->RcDesc.MultisampleQuality = pResource->MultisampleQuality; 2977 pRc->RcDesc.MipLevels = pResource->MipLevels; 2978 pRc->RcDesc.Fvf = pResource->Fvf; 2979 pRc->RcDesc.VidPnSourceId = pResource->VidPnSourceId; 2980 pRc->RcDesc.RefreshRate = pResource->RefreshRate; 2981 pRc->RcDesc.enmRotation = pResource->Rotation; 2982 pRc->cAllocations = pResource->SurfCount; 2983 2956 bIssueCreateResource = true; 2957 2958 2959 if (hr == S_OK && bIssueCreateResource) 2960 { 2984 2961 D3DDDICB_ALLOCATE *pDdiAllocate = vboxWddmRequestAllocAlloc(pResource); 2985 2962 Assert(pDdiAllocate); … … 3005 2982 pDdiAllocI->VidPnSourceId = pResource->VidPnSourceId; 3006 2983 pDdiAllocI->Flags.Value = 0; 3007 if (pResource->Flags.Primary )2984 if (pResource->Flags.Primary && pResource->Flags.RenderTarget) 3008 2985 pDdiAllocI->Flags.Primary = 1; 3009 2986 … … 3041 3018 if (hr == S_OK) 3042 3019 { 3020 pRc->hKMResource = pDdiAllocate->hKMResource; 3021 3043 3022 for (UINT i = 0; i < pResource->SurfCount; ++i) 3044 3023 { … … 3053 3032 } 3054 3033 } 3034 3035 vboxWddmRequestAllocFree(pDdiAllocate); 3055 3036 } 3056 3037 else … … 3064 3045 vboxResourceFree(pRc); 3065 3046 } 3047 3048 if (hr == S_OK) 3049 pResource->hResource = pRc; 3066 3050 else 3067 { 3068 hr = E_OUTOFMEMORY; 3069 } 3070 } 3051 vboxResourceFree(pRc); 3052 } 3053 else 3054 { 3055 hr = E_OUTOFMEMORY; 3056 } 3057 3071 3058 3072 3059 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); … … 3104 3091 } 3105 3092 } 3106 else 3093 3094 Assert(pRc->hResource); 3095 Assert(pRc->hKMResource || VBOXDISPMODE_IS_3D(pAdapter)); 3096 if (pRc->hKMResource) 3107 3097 { 3108 3098 if (!(pRc->fFlags & VBOXWDDM_RESOURCE_F_OPENNED)) … … 3110 3100 D3DDDICB_DEALLOCATE Dealloc; 3111 3101 Dealloc.hResource = pRc->hResource; 3112 Assert(pRc->hResource);3113 3102 /* according to the docs the below two are ignored in case we set the hResource */ 3114 3103 Dealloc.NumAllocations = 0; … … 3157 3146 #endif 3158 3147 } 3148 #if 1 3159 3149 else 3150 #endif 3160 3151 { 3161 3152 D3DDDICB_PRESENT DdiPresent = {0}; … … 3163 3154 { 3164 3155 PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource; 3156 Assert(pRc->hKMResource); 3165 3157 Assert(pRc->cAllocations > pData->SrcSubResourceIndex); 3166 3158 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->SrcSubResourceIndex]; … … 3171 3163 { 3172 3164 PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource; 3165 Assert(pRc->hKMResource); 3173 3166 Assert(pRc->cAllocations > pData->DstSubResourceIndex); 3174 3167 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[pData->DstSubResourceIndex]; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r30317 r30346 1542 1542 Status = STATUS_UNSUCCESSFUL; 1543 1543 } 1544 else 1544 1545 #endif 1546 if (pAllocInfo->fFlags.RenderTarget) 1547 { 1548 pAllocationInfo->Flags.CpuVisible = 1; 1549 Assert(pAllocation->SurfDesc.bpp); 1550 Assert(pAllocation->SurfDesc.pitch); 1551 Assert(pAllocation->SurfDesc.cbSize); 1552 } 1545 1553 } 1546 1554 // else
Note:
See TracChangeset
for help on using the changeset viewer.