Changeset 29798 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- May 25, 2010 5:26:57 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r29772 r29798 1768 1768 { 1769 1769 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 1770 AssertBreakpoint(); 1770 1771 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 1772 if (pDevice->DefaultContext.ContextInfo.hContext) 1773 { 1774 D3DDDICB_DESTROYCONTEXT DestroyContext; 1775 DestroyContext.hContext = pDevice->DefaultContext.ContextInfo.hContext; 1776 HRESULT tmpHr = pDevice->RtCallbacks.pfnDestroyContextCb(pDevice->hDevice, &DestroyContext); 1777 Assert(tmpHr == S_OK); 1778 } 1771 1779 RTMemFree(hDevice); 1772 1780 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); … … 1974 1982 do 1975 1983 { 1984 Assert(!pCreateData->AllocationListSize 1985 && !pCreateData->PatchLocationListSize); 1976 1986 if (!pCreateData->AllocationListSize 1977 1987 && !pCreateData->PatchLocationListSize) 1978 1988 { 1979 /* check whether this is a D3D or DDraw, use wine lib only in the former (D3D) case */ 1980 /* TODO: is this a correct way to check this ? */ 1981 if (pDevice->RtCallbacks.pfnCreateOverlayCb) 1989 pDevice->DefaultContext.ContextInfo.NodeOrdinal = 0; 1990 pDevice->DefaultContext.ContextInfo.EngineAffinity = 0; 1991 pDevice->DefaultContext.ContextInfo.Flags.Value = 0; 1992 pDevice->DefaultContext.ContextInfo.pPrivateDriverData = NULL; 1993 pDevice->DefaultContext.ContextInfo.PrivateDriverDataSize = 0; 1994 pDevice->DefaultContext.ContextInfo.hContext = 0; 1995 pDevice->DefaultContext.ContextInfo.pCommandBuffer = NULL; 1996 pDevice->DefaultContext.ContextInfo.CommandBufferSize = 0; 1997 pDevice->DefaultContext.ContextInfo.pAllocationList = NULL; 1998 pDevice->DefaultContext.ContextInfo.AllocationListSize = 0; 1999 pDevice->DefaultContext.ContextInfo.pPatchLocationList = NULL; 2000 pDevice->DefaultContext.ContextInfo.PatchLocationListSize = 0; 2001 2002 hr = pDevice->RtCallbacks.pfnCreateContextCb(pDevice->hDevice, &pDevice->DefaultContext.ContextInfo); 2003 Assert(hr == S_OK); 2004 if (hr == S_OK) 1982 2005 { 1983 /* DDraw */ 1984 vboxVDbgPrint((__FUNCTION__": DirectDraw Device Created\n")); 1985 break; 1986 } 1987 else 1988 { 1989 /* D3D */ 1990 if (pAdapter->pD3D9If) 2006 if (pDevice->u32IfVersion > 7) 1991 2007 { 1992 /* */ 1993 vboxVDbgPrint((__FUNCTION__": TODO: Implement D3D Device Creation\n")); 1994 break; 2008 /* D3D */ 2009 if (pAdapter->pD3D9If) 2010 { 2011 /* */ 2012 vboxVDbgPrint((__FUNCTION__": TODO: Implement D3D Device Creation\n")); 2013 break; 2014 } 2015 else 2016 { 2017 /* ballback */ 2018 vboxVDbgPrint((__FUNCTION__": D3D Device Being Created, but D3D is unavailable\n")); 2019 break; 2020 } 1995 2021 } 1996 2022 else 1997 2023 { 1998 /* ballback*/1999 vboxVDbgPrint((__FUNCTION__": D 3D Device Being Created, but D3D is unavailable\n"));2024 /* DDraw */ 2025 vboxVDbgPrint((__FUNCTION__": DirectDraw Device Created\n")); 2000 2026 break; 2001 2027 } 2028 2029 D3DDDICB_DESTROYCONTEXT DestroyContext; 2030 DestroyContext.hContext = pDevice->DefaultContext.ContextInfo.hContext; 2031 2032 HRESULT tmpHr = pDevice->RtCallbacks.pfnDestroyContextCb(pDevice->hDevice, &DestroyContext); 2033 Assert(tmpHr == S_OK); 2002 2034 } 2035 else 2036 vboxVDbgPrintR((__FUNCTION__": pfnCreateContextCb failed, hr(%d)\n", hr)); 2003 2037 } 2004 2038 else -
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
r29772 r29798 55 55 } VBOXWDDMDISP_ADAPTER, *PVBOXWDDMDISP_ADAPTER; 56 56 57 typedef struct VBOXWDDMDISP_CONTEXT 58 { 59 struct VBOXWDDMDISP_DEVICE *pDevice; 60 D3DDDICB_CREATECONTEXT ContextInfo; 61 } VBOXWDDMDISP_CONTEXT, *PVBOXWDDMDISP_CONTEXT; 62 57 63 typedef struct VBOXWDDMDISP_DEVICE 58 64 { … … 65 71 UINT cbCmdBuffer; 66 72 D3DDDI_CREATEDEVICEFLAGS fFlags; 73 VBOXWDDMDISP_CONTEXT DefaultContext; 67 74 } VBOXWDDMDISP_DEVICE, *PVBOXWDDMDISP_DEVICE; 68 75 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r29742 r29798 861 861 PVIDEO_POINTER_ATTRIBUTES pointerAttr, 862 862 uint32_t cbLength); 863 #ifndef VBOXWDDM 863 864 #ifdef VBOXWDDM 865 int VBoxFreeDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension); 866 #else 864 867 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd); 865 868 DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r29742 r29798 1045 1045 } 1046 1046 1047 #ifdef VBOXWDDM 1048 int VBoxFreeDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension) 1049 { 1050 int rc; 1051 for (int i = PrimaryExtension->cSources-1; i >= 0; --i) 1052 { 1053 rc = vboxVbvaDisable(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva); 1054 AssertRC(rc); 1055 if (RT_SUCCESS(rc)) 1056 { 1057 rc = vboxVbvaDestroy(PrimaryExtension, &PrimaryExtension->aSources[i].Vbva); 1058 AssertRC(rc); 1059 if (RT_SUCCESS(rc)) 1060 { 1061 rc = vboxVdmaDisable(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 1062 AssertRC(rc); 1063 if (RT_SUCCESS(rc)) 1064 { 1065 rc = vboxVdmaDestroy(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 1066 AssertRC(rc); 1067 if (RT_SUCCESS(rc)) 1068 { 1069 /*rc = */VBoxUnmapAdapterMemory(PrimaryExtension, &PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap); 1070 /* 1071 AssertRC(rc); 1072 if (RT_SUCCESS(rc)) 1073 */ 1074 { 1075 HGSMIHeapDestroy(&PrimaryExtension->u.primary.hgsmiAdapterHeap); 1076 1077 /* Map the adapter information. It will be needed for HGSMI IO. */ 1078 /*rc = */VBoxUnmapAdapterMemory(PrimaryExtension, &PrimaryExtension->u.primary.pvAdapterInformation, VBVA_ADAPTER_INFORMATION_SIZE); 1079 /* 1080 AssertRC(rc); 1081 if (RT_FAILURE(rc)) 1082 drprintf((__FUNCTION__"VBoxUnmapAdapterMemory PrimaryExtension->u.primary.pvAdapterInformation failed, rc(%d)\n", rc)); 1083 */ 1084 1085 } 1086 } 1087 } 1088 } 1089 } 1090 } 1091 1092 return rc; 1093 } 1094 #endif 1047 1095 1048 1096 /* -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.cpp
r29432 r29798 39 39 VBVAENABLE *pEnable = &pEnableEx->Base; 40 40 pEnable->u32Flags = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 41 pEnable->u32Flags |= VBVA_F_EXTENDED ;41 pEnable->u32Flags |= VBVA_F_EXTENDED | VBVA_F_ABSOFFSET; 42 42 pEnable->u32Offset = (uint32_t)pVbva->offVBVA; 43 43 pEnable->i32Result = VERR_NOT_SUPPORTED; … … 119 119 } 120 120 121 int vboxVbvaDestroy(PDEVICE_EXTENSION pDevExt, VBOXVBVAINFO *pVbva) 122 { 123 int rc = VINF_SUCCESS; 124 /*rc = */VBoxUnmapAdapterMemory(pDevExt, (void**)&pVbva->pVBVA, pVbva->cbVBVA); 125 /* 126 AssertRC(rc); 127 if (RT_SUCCESS(rc)) 128 */ 129 memset(pVbva, 0, sizeof(VBOXVBVAINFO)); 130 /* 131 else 132 drprintf((__FUNCTION__": VBoxUnmapAdapterMemory failed, rc (%d)\n", rc)); 133 */ 134 return rc; 135 } 136 121 137 /* 122 138 * Private operations. -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVbva.h
r28800 r29798 25 25 int vboxVbvaEnable (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva); 26 26 int vboxVbvaDisable (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva); 27 int vboxVbvaDestroy(PDEVICE_EXTENSION pDevExt, VBOXVBVAINFO *pVbva); 27 28 int vboxVbvaCreate(struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva, ULONG offBuffer, ULONG cbBuffer, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId); 28 29 int vboxVbvaReportCmdOffset (struct _DEVICE_EXTENSION* pDevExt, VBOXVBVAINFO *pVbva, uint32_t offCmd); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp
r29745 r29798 403 403 } 404 404 } 405 406 void vboxVHWAFree(PDEVICE_EXTENSION pDevExt) 407 { 408 /* we do not allocate/map anything, just issue a Disable command 409 * to ensure all pending commands are flushed */ 410 for (uint32_t i = 0; i < pDevExt->cSources; ++i) 411 { 412 vboxVHWADisable(pDevExt, i); 413 } 414 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.h
r29742 r29798 52 52 int vboxVHWADisable(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId); 53 53 void vboxVHWAInit(PDEVICE_EXTENSION pDevExt); 54 void vboxVHWAFree(PDEVICE_EXTENSION pDevExt); 54 55 55 56 #endif /* #ifndef ___VBoxVideoVhwa_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r29742 r29798 595 595 } 596 596 597 static void vboxWddmDevExtZeroinit(PDEVICE_EXTENSION pDevExt, CONST PDEVICE_OBJECT pPDO) 598 { 599 memset(pDevExt, 0, sizeof (DEVICE_EXTENSION)); 600 pDevExt->pPDO = pPDO; 601 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 602 for (int i = 0; i < RT_ELEMENTS(pDevExt->aSources); ++i) 603 { 604 pDevExt->aSources[i].offVram = VBOXVIDEOOFFSET_VOID; 605 } 606 #endif 607 } 608 597 609 /* driver callbacks */ 598 610 NTSTATUS DxgkDdiAddDevice( … … 613 625 if (pContext) 614 626 { 615 pContext->pPDO = PhysicalDeviceObject;627 vboxWddmDevExtZeroinit(pContext, PhysicalDeviceObject); 616 628 *MiniportDeviceContext = pContext; 617 #ifdef VBOXWDDM_RENDER_FROM_SHADOW618 for (int i = 0; i < RT_ELEMENTS(pContext->aSources); ++i)619 {620 pContext->aSources[i].offVram = VBOXVIDEOOFFSET_VOID;621 }622 #endif623 629 } 624 630 else … … 694 700 { 695 701 drprintf(("VBoxVideoWddm: HGSMI failed to initialize, returning err\n")); 702 703 VbglTerminate(); 696 704 /* @todo: report a better status */ 697 705 Status = STATUS_UNSUCCESSFUL; … … 729 737 dfprintf(("==> "__FUNCTION__ ", context(0x%p)\n", MiniportDeviceContext)); 730 738 731 AssertBreakpoint(); 732 /* @todo: fixme: implement */ 733 734 dfprintf(("<== "__FUNCTION__ ", context(0x%p)\n", MiniportDeviceContext)); 735 736 return STATUS_SUCCESS; 739 vboxVDbgBreakF(); 740 741 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext; 742 NTSTATUS Status = STATUS_SUCCESS; 743 744 /* do everything we did on DxgkDdiStartDevice in the reverse order */ 745 #ifdef VBOX_WITH_VIDEOHWACCEL 746 vboxVHWAFree(pDevExt); 747 #endif 748 749 int rc = VBoxFreeDisplaysHGSMI(pDevExt); 750 AssertRC(rc); 751 if (RT_SUCCESS(rc)) 752 { 753 VbglTerminate(); 754 755 /* revert back to the state we were right after the DxgkDdiAddDevice */ 756 vboxWddmDevExtZeroinit(pDevExt, pDevExt->pPDO); 757 } 758 else 759 Status = STATUS_UNSUCCESSFUL; 760 761 return Status; 737 762 } 738 763
Note:
See TracChangeset
for help on using the changeset viewer.