Changeset 49244 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Timestamp:
- Oct 22, 2013 8:08:34 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.h
r47070 r49244 236 236 237 237 #define VBOXMP_CRCMD_HEADER_SIZE sizeof (CRMessageOpcodes) 238 /* last +4 below is 4-aligned com and opcode size (i.e. ((1 + 3) & ~3)) */238 /* last +4 below is 4-aligned command opcode size (i.e. ((1 + 3) & ~3)) */ 239 239 #define VBOXMP_CRCMD_SIZE_WINDOWPOSITION (20 + 4) 240 240 #define VBOXMP_CRCMD_SIZE_WINDOWVISIBLEREGIONS(_cRects) (16 + (_cRects) * 4 * sizeof (GLint) + 4) … … 243 243 #define VBOXMP_CRCMD_SIZE_WINDOWSIZE (20 + 4) 244 244 #define VBOXMP_CRCMD_SIZE_GETCHROMIUMPARAMETERVCR (36 + 4) 245 #define VBOXMP_CRCMD_SIZE_CHROMIUMPARAMETERICR (16 + 4) 246 #define VBOXMP_CRCMD_SIZE_WINDOWCREATE (256 + 28 + 4) 247 #define VBOXMP_CRCMD_SIZE_WINDOWDESTROY (12 + 4) 248 #define VBOXMP_CRCMD_SIZE_CREATECONTEXT (256 + 32 + 4) 249 #define VBOXMP_CRCMD_SIZE_DESTROYCONTEXT (12 + 4) 245 250 246 251 #endif /* #ifndef ___VBoxMPCr_h__ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r48070 r49244 108 108 VBOXWDDM_ADDR Addr; 109 109 uint32_t hostID; 110 uint32_t cHostIDRefs; 110 111 struct VBOXWDDM_SWAPCHAIN *pSwapchain; 111 112 } VBOXWDDM_ALLOC_DATA, *PVBOXWDDM_ALLOC_DATA; … … 320 321 uint32_t cShRcRefs; 321 322 uint32_t cOpens; 323 uint32_t cHostIDRefs; 322 324 } VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION; 323 325 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r47566 r49244 897 897 } 898 898 899 typedef struct VBOXMP_CRHGSMIMGR 900 { 901 VBOXMP_CRPACKER CrPacker; 902 void *pvCommandBuffer; 903 } VBOXMP_CRHGSMIMGR; 904 905 DECLINLINE(CRPackContext*) vboxVdmaCrHmGetPackContext(VBOXMP_CRHGSMIMGR *pMgr) 906 { 907 return &pMgr->CrPacker.CrPacker; 908 } 909 910 NTSTATUS vboxVdmaCrHmCreate(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRHGSMIMGR *pMgr, uint32_t cbCommandBuffer, uint32_t cCommands) 911 { 912 pMgr->pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer); 913 if (!pMgr->pvCommandBuffer) 914 { 915 WARN(("VBoxMpCrShgsmiTransportBufAlloc failed!")); 916 return VERR_OUT_OF_RESOURCES; 917 } 918 919 VBoxMpCrPackerInit(&pMgr->CrPacker); 920 921 VBoxMpCrPackerTxBufferInit(&pMgr->CrPacker, pMgr->pvCommandBuffer, cbCommandBuffer, cCommands); 922 923 return STATUS_SUCCESS; 924 } 925 926 NTSTATUS vboxVdmaCrHmSubmitWrSync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRHGSMIMGR *pMgr, uint32_t u32CrConClientID) 927 { 928 NTSTATUS Status = vboxVdmaCrRxGenericSync(pDevExt, &pMgr->CrPacker, u32CrConClientID); 929 if (!NT_SUCCESS(Status)) 930 { 931 WARN(("vboxVdmaCrRxGenericSync failed Status 0x%x", Status)); 932 VBoxMpCrShgsmiTransportBufFree(&pDevExt->CrHgsmiTransport, pMgr->pvCommandBuffer); 933 return Status; 934 } 935 936 return STATUS_SUCCESS; 937 } 899 938 #if 0 900 939 NTSTATUS vboxVdmaCrCmdGetChromiumParametervCR(PVBOXMP_DEVEXT pDevExt, uint32_t u32CrConClientID, GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid * values) … … 902 941 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_GETCHROMIUMPARAMETERVCR; 903 942 uint32_t cCommands = 1; 904 void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer); 905 if (!pvCommandBuffer) 906 { 907 WARN(("VBoxMpCrShgsmiTransportBufAlloc failed!")); 908 return VERR_OUT_OF_RESOURCES; 909 } 910 911 VBOXMP_CRPACKER CrPacker; 912 VBoxMpCrPackerInit(&CrPacker); 913 914 VBoxMpCrPackerTxBufferInit(&CrPacker, pvCommandBuffer, cbCommandBuffer, cCommands); 943 944 VBOXMP_CRHGSMIMGR Mgr; 945 NTSTATUS Status = vboxVdmaCrHmCreate(pDevExt, &Mgr, cbCommandBuffer, cCommands); 946 if (!NT_SUCCESS(Status)) 947 { 948 WARN(("vboxVdmaCrHmCreate failed Status 0x%x", Status)); 949 return Status; 950 } 915 951 916 952 int dummy = 1; 917 953 918 crPackGetChromiumParametervCR(&CrPacker.CrPacker, target, index, type, count, values, &dummy); 919 920 921 NTSTATUS Status = vboxVdmaCrRxGenericSync(pDevExt, &CrPacker, u32CrConClientID); 954 crPackGetChromiumParametervCR(vboxVdmaCrHmGetPackContext(&Mgr), target, index, type, count, values, &dummy); 955 956 Status = vboxVdmaCrHmSubmitWrSync(pDevExt, &Mgr, u32CrConClientID); 922 957 if (!NT_SUCCESS(Status)) 923 958 { 924 WARN(("vboxVdmaCrRxGenericSync failed Status 0x%x", Status)); 925 VBoxMpCrShgsmiTransportBufFree(&pDevExt->CrHgsmiTransport, pvCommandBuffer); 959 WARN(("vboxVdmaCrHmSubmitWrSync failed Status 0x%x", Status)); 926 960 return Status; 927 961 } 928 962 929 963 return STATUS_SUCCESS; 964 } 965 966 static NTSTATUS vboxVdmaCrCmdCreateContext(PVBOXMP_DEVEXT pDevExt, int32_t visualBits, int32_t *pi32CtxID) 967 { 968 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_CREATECONTEXT; 969 uint32_t cCommands = 1; 970 971 VBOXMP_CRHGSMIMGR Mgr; 972 NTSTATUS Status = vboxVdmaCrHmCreate(pDevExt, &Mgr, cbCommandBuffer, cCommands); 973 if (!NT_SUCCESS(Status)) 974 { 975 WARN(("vboxVdmaCrHmCreate failed Status 0x%x", Status)); 976 return Status; 977 } 978 979 int dummy = 1; 980 981 crPackCreateContext(&CrPacker.CrPacker, "", visualBits, 0, &pi32CtxID, &dummy); 982 983 Status = vboxVdmaCrHmSubmitWrSync(pDevExt, &Mgr, u32CrConClientID); 984 if (!NT_SUCCESS(Status)) 985 { 986 WARN(("vboxVdmaCrHmSubmitWrSync failed Status 0x%x", Status)); 987 return Status; 988 } 989 990 return STATUS_SUCCESS; 991 } 992 993 static NTSTATUS vboxVdmaCrCmdWindowCreate(PVBOXMP_DEVEXT pDevExt, int32_t visualBits, int32_t *pi32WinID) 994 { 995 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_WINDOWCREATE; 996 uint32_t cCommands = 1; 997 998 VBOXMP_CRHGSMIMGR Mgr; 999 NTSTATUS Status = vboxVdmaCrHmCreate(pDevExt, &Mgr, cbCommandBuffer, cCommands); 1000 if (!NT_SUCCESS(Status)) 1001 { 1002 WARN(("vboxVdmaCrHmCreate failed Status 0x%x", Status)); 1003 return Status; 1004 } 1005 1006 int dummy = 1; 1007 1008 crPackWindowCreate(&CrPacker.CrPacker, "", visualBits, 0, &pi32CtxID, &dummy); 1009 1010 Status = vboxVdmaCrHmSubmitWrSync(pDevExt, &Mgr, u32CrConClientID); 1011 if (!NT_SUCCESS(Status)) 1012 { 1013 WARN(("vboxVdmaCrHmSubmitWrSync failed Status 0x%x", Status)); 1014 return Status; 1015 } 1016 1017 return STATUS_SUCCESS; 1018 } 1019 1020 static NTSTATUS vboxVdmaCrCtlGetDefaultCtxId(PVBOXMP_DEVEXT pDevExt, int32_t *pi32CtxID) 1021 { 1022 if (!pDevExt->i32CrConDefaultCtxID) 1023 { 1024 if (!pDevExt->f3DEnabled) 1025 { 1026 WARN(("3D disabled, should not be here!")); 1027 return STATUS_UNSUCCESSFUL; 1028 } 1029 1030 uint32_t u32ClienID; 1031 NTSTATUS Status = vboxVdmaCrCtlGetDefaultClientId(pDevExt, &u32ClienID); 1032 if (!NT_SUCCESS(Status)) 1033 { 1034 WARN(("vboxVdmaCrCtlGetDefaultClientId failed, Status %#x", Status)); 1035 return Status; 1036 } 1037 1038 Status = vboxVdmaCrCmdWindowCreate(PVBOXMP_DEVEXT pDevExt, int32_t visualBits, int32_t *pi32WinID) 1039 1040 VBOXMP_CRPACKER CrPacker; 1041 VBoxMpCrPackerInit(&CrPacker); 1042 1043 int rc = VBoxMpCrCtlConConnect(&pDevExt->CrCtlCon, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR, &pDevExt->u32CrConDefaultClientID); 1044 if (!RT_SUCCESS(rc)) 1045 { 1046 WARN(("VBoxMpCrCtlConConnect failed, rc %d", rc)); 1047 return STATUS_UNSUCCESSFUL; 1048 } 1049 } 1050 1051 *pi32CtxID = pDevExt->i32CrConDefaultCtxID; 930 1052 return STATUS_SUCCESS; 931 1053 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r49171 r49244 57 57 } 58 58 59 DECLINLINE(void) VBoxWddmOaHostIDReleaseLocked(PVBOXWDDM_OPENALLOCATION pOa) 60 { 61 Assert(pOa->cHostIDRefs); 62 PVBOXWDDM_ALLOCATION pAllocation = pOa->pAllocation; 63 Assert(pAllocation->AllocData.cHostIDRefs >= pOa->cHostIDRefs); 64 Assert(pAllocation->AllocData.hostID); 65 --pOa->cHostIDRefs; 66 --pAllocation->AllocData.cHostIDRefs; 67 if (!pAllocation->AllocData.cHostIDRefs) 68 pAllocation->AllocData.hostID = 0; 69 } 70 71 DECLINLINE(void) VBoxWddmOaHostIDCheckReleaseLocked(PVBOXWDDM_OPENALLOCATION pOa) 72 { 73 if (pOa->cHostIDRefs) 74 VBoxWddmOaHostIDReleaseLocked(pOa); 75 } 76 59 77 DECLINLINE(void) VBoxWddmOaRelease(PVBOXWDDM_OPENALLOCATION pOa) 60 78 { … … 63 81 KeAcquireSpinLock(&pAllocation->OpenLock, &OldIrql); 64 82 Assert(pAllocation->cOpens); 83 VBoxWddmOaHostIDCheckReleaseLocked(pOa); 65 84 --pAllocation->cOpens; 66 85 uint32_t cOpens = --pOa->cOpens; … … 97 116 KeReleaseSpinLock(&pAllocation->OpenLock, OldIrql); 98 117 return pOa; 118 } 119 120 DECLINLINE(int) VBoxWddmOaSetHostID(PVBOXWDDM_DEVICE pDevice, PVBOXWDDM_ALLOCATION pAllocation, uint32_t hostID, uint32_t *pHostID) 121 { 122 PVBOXWDDM_OPENALLOCATION pOa; 123 KIRQL OldIrql; 124 int rc = VINF_SUCCESS; 125 KeAcquireSpinLock(&pAllocation->OpenLock, &OldIrql); 126 pOa = VBoxWddmOaSearchLocked(pDevice, pAllocation); 127 if (!pOa) 128 { 129 KeReleaseSpinLock(&pAllocation->OpenLock, OldIrql);; 130 WARN(("no open allocation!")); 131 return VERR_INVALID_STATE; 132 } 133 134 if (hostID) 135 { 136 if (pAllocation->AllocData.hostID == 0) 137 { 138 pAllocation->AllocData.hostID = hostID; 139 } 140 else if (pAllocation->AllocData.hostID != hostID) 141 { 142 WARN(("hostID differ: alloc(%d), trying to assign(%d)", pAllocation->AllocData.hostID, hostID)); 143 hostID = pAllocation->AllocData.hostID; 144 rc = VERR_NOT_EQUAL; 145 } 146 147 ++pAllocation->AllocData.cHostIDRefs; 148 ++pOa->cHostIDRefs; 149 } 150 else 151 VBoxWddmOaHostIDCheckReleaseLocked(pOa); 152 153 KeReleaseSpinLock(&pAllocation->OpenLock, OldIrql); 154 155 if (pHostID) 156 *pHostID = hostID; 157 158 return rc; 99 159 } 100 160 … … 4041 4101 break; 4042 4102 } 4103 case VBOXESC_SETALLOCHOSTID: 4104 { 4105 PVBOXWDDM_DEVICE pDevice = (PVBOXWDDM_DEVICE)pEscape->hDevice; 4106 if (!pDevice) 4107 { 4108 WARN(("VBOXESC_SETALLOCHOSTID called without no device specified, failing")); 4109 Status = STATUS_INVALID_PARAMETER; 4110 break; 4111 } 4112 4113 if (pEscape->PrivateDriverDataSize != sizeof (VBOXDISPIFESCAPE_SETALLOCHOSTID)) 4114 { 4115 WARN(("invalid buffer size for VBOXDISPIFESCAPE_SHRC_REF, was(%d), but expected (%d)", 4116 pEscape->PrivateDriverDataSize, sizeof (VBOXDISPIFESCAPE_SHRC_REF))); 4117 Status = STATUS_INVALID_PARAMETER; 4118 break; 4119 } 4120 4121 PVBOXDISPIFESCAPE_SETALLOCHOSTID pSetHostID = (PVBOXDISPIFESCAPE_SETALLOCHOSTID)pEscapeHdr; 4122 PVBOXWDDM_ALLOCATION pAlloc = vboxWddmGetAllocationFromHandle(pDevExt, (D3DKMT_HANDLE)pSetHostID->hAlloc); 4123 if (!pAlloc) 4124 { 4125 WARN(("failed to get allocation from handle")); 4126 Status = STATUS_INVALID_PARAMETER; 4127 break; 4128 } 4129 4130 if (pAlloc->enmType != VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE) 4131 { 4132 WARN(("setHostID: invalid allocation type: %d", pAlloc->enmType)); 4133 Status = STATUS_INVALID_PARAMETER; 4134 break; 4135 } 4136 4137 pSetHostID->rc = VBoxWddmOaSetHostID(pDevice, pAlloc, pSetHostID->hostID, &pSetHostID->EscapeHdr.u32CmdSpecific); 4138 Status = STATUS_SUCCESS; 4139 break; 4140 } 4043 4141 case VBOXESC_SHRC_ADDREF: 4044 4142 case VBOXESC_SHRC_RELEASE: 4045 4143 { 4046 4144 PVBOXWDDM_DEVICE pDevice = (PVBOXWDDM_DEVICE)pEscape->hDevice; 4145 if (!pDevice) 4146 { 4147 WARN(("VBOXESC_SHRC_ADDREF|VBOXESC_SHRC_RELEASE called without no device specified, failing")); 4148 Status = STATUS_INVALID_PARAMETER; 4149 break; 4150 } 4151 4047 4152 /* query whether the allocation represanted by the given [wine-generated] shared resource handle still exists */ 4048 4153 if (pEscape->PrivateDriverDataSize != sizeof (VBOXDISPIFESCAPE_SHRC_REF)) … … 5002 5107 if (pOpenAllocation->PrivateDriverSize) 5003 5108 { 5004 Assert(pOpenAllocation->PrivateDriverSize == sizeof (VBOXWDDM_RCINFO));5005 5109 Assert(pOpenAllocation->pPrivateDriverData); 5006 if (pOpenAllocation->PrivateDriverSize >= sizeof (VBOXWDDM_RCINFO))5110 if (pOpenAllocation->PrivateDriverSize == sizeof (VBOXWDDM_RCINFO)) 5007 5111 { 5008 5112 pRcInfo = (PVBOXWDDM_RCINFO)pOpenAllocation->pPrivateDriverData; … … 5010 5114 } 5011 5115 else 5116 { 5117 WARN(("Invalid PrivateDriverSize %d", pOpenAllocation->PrivateDriverSize)); 5012 5118 Status = STATUS_INVALID_PARAMETER; 5119 } 5013 5120 } 5014 5121
Note:
See TracChangeset
for help on using the changeset viewer.