Changeset 49244 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
- Timestamp:
- Oct 22, 2013 8:08:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.