- Timestamp:
- Mar 15, 2012 2:20:20 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxCrHgsmi.h
r36536 r40483 57 57 VBOXCRHGSMI_DECL(HVBOXCRHGSMI_CLIENT) VBoxCrHgsmiQueryClient(); 58 58 #else 59 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit( void);59 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit(uint32_t crVersionMajor, uint32_t crVersionMinor); 60 60 VBOXCRHGSMI_DECL(PVBOXUHGSMI) VBoxCrHgsmiCreate(void); 61 61 VBOXCRHGSMI_DECL(void) VBoxCrHgsmiDestroy(PVBOXUHGSMI pHgsmi); … … 65 65 VBOXCRHGSMI_DECL(void) VBoxCrHgsmiLog(char * szString); 66 66 67 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiTerm(void); 68 69 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConGetClientID(PVBOXUHGSMI pHgsmi, uint32_t *pu32ClientID); 70 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConCall(PVBOXUHGSMI pHgsmi, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo); 71 67 72 RT_C_DECLS_END 68 73 -
trunk/include/VBox/VBoxGuestLib.h
r40211 r40483 311 311 */ 312 312 DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData); 313 314 /** 315 * Call to a service with user-mode data received by the calling driver from the User-Mode process. 316 * The call must be done in the context of a calling process. 317 * 318 * @param handle Handle of the connection. 319 * @param pData Call request information structure, including function parameters. 320 * @param cbData Length in bytes of data. 321 * 322 * @return VBox status code. 323 */ 324 DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData); 313 325 314 326 /** -
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
r39981 r40483 32 32 #include "../VBoxVideoTools.h" 33 33 #include <VBox/VBoxUhgsmi.h> 34 #include <VBox/VBoxGuest2.h> 34 35 35 36 /* One would increase this whenever definitions in this file are changed */ 36 #define VBOXVIDEOIF_VERSION 1 137 #define VBOXVIDEOIF_VERSION 12 37 38 38 39 #define VBOXWDDM_NODE_ID_SYSTEM 0 … … 252 253 /* true if d3d false if ddraw */ 253 254 VBOXWDDM_CONTEXT_TYPE enmType; 255 uint32_t crVersionMajor; 256 uint32_t crVersionMinor; 254 257 /* we use uint64_t instead of HANDLE to ensure structure def is the same for both 32-bit and 64-bit 255 258 * since x64 kernel driver can be called by 32-bit UMD */ … … 462 465 uint64_t hAlloc; 463 466 } VBOXDISPIFESCAPE_SHRC_REF, *PVBOXDISPIFESCAPE_SHRC_REF; 467 468 typedef struct VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL 469 { 470 VBOXDISPIFESCAPE EscapeHdr; 471 VBoxGuestHGCMCallInfo CallInfo; 472 } VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, *PVBOXDISPIFESCAPE_CRHGSMICTLCON_CALL; 464 473 465 474 /* query info func */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/Makefile.kmk
r39316 r40483 84 84 DLLS += VBoxDispD3D 85 85 VBoxDispD3D_TEMPLATE = VBOXGUESTR3DLL 86 VBoxDispD3D_DEFS = UNICODE _UNICODE VBOX_WITH_WDDM VBOXWDDMDISP LOG_TO_BACKDOOR LOG_TO_BACKDOOR_DRV 86 VBoxDispD3D_DEFS = UNICODE _UNICODE VBOX_WITH_WDDM VBOXWDDMDISP LOG_TO_BACKDOOR LOG_TO_BACKDOOR_DRV VBOX_WITH_HGCM 87 87 ifdef DEBUG_misha 88 88 VBoxDispD3D_DEFS += LOG_ENABLED … … 140 140 LIBRARIES += VBoxCrHgsmi 141 141 VBoxCrHgsmi_TEMPLATE = VBOXGUESTR3LIB 142 VBoxCrHgsmi_DEFS = UNICODE _UNICODE VBOX_WITH_CRHGSMI IN_VBOXCRHGSMI VBOX_WITH_WDDM VBOX_WITH_VDMA 142 VBoxCrHgsmi_DEFS = UNICODE _UNICODE VBOX_WITH_CRHGSMI IN_VBOXCRHGSMI VBOX_WITH_WDDM VBOX_WITH_VDMA VBOX_WITH_HGCM 143 143 VBoxCrHgsmi_INCS = ../../../include .. 144 144 VBoxCrHgsmi_SOURCES = \ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxCrHgsmi.cpp
r36867 r40483 24 24 static VBOXDISPKMT_CALLBACKS g_VBoxCrHgsmiKmtCallbacks; 25 25 static int g_bVBoxKmtCallbacksInited = 0; 26 static uint32_t g_VBoxCrVersionMajor; 27 static uint32_t g_VBoxCrVersionMinor; 26 28 27 29 #ifdef VBOX_CRHGSMI_WITH_D3DDEV … … 181 183 } 182 184 183 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit( )185 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiInit(uint32_t crVersionMajor, uint32_t crVersionMinor) 184 186 { 185 187 if (!g_bVBoxKmtCallbacksInited) … … 187 189 g_bVBoxKmtCallbacksInited = vboxCrHgsmiInitPerform(&g_VBoxCrHgsmiKmtCallbacks); 188 190 Assert(g_bVBoxKmtCallbacksInited); 191 if (g_bVBoxKmtCallbacksInited) 192 { 193 g_VBoxCrVersionMajor = crVersionMajor; 194 g_VBoxCrVersionMinor = crVersionMinor; 195 } 189 196 } 190 197 … … 198 205 { 199 206 #if 0 200 HRESULT hr = vboxUhgsmiKmtCreate(pHgsmiGL, TRUE /* bD3D tmp for injection thread*/);207 HRESULT hr = vboxUhgsmiKmtCreate(pHgsmiGL, g_VBoxCrVersionMajor, g_VBoxCrVersionMinor, TRUE /* bD3D tmp for injection thread*/); 201 208 #else 202 HRESULT hr = vboxUhgsmiKmtEscCreate(pHgsmiGL, TRUE /* bD3D tmp for injection thread*/);209 HRESULT hr = vboxUhgsmiKmtEscCreate(pHgsmiGL, g_VBoxCrVersionMajor, g_VBoxCrVersionMinor, TRUE /* bD3D tmp for injection thread*/); 203 210 #endif 204 211 Log(("CrHgsmi: faled to create KmtEsc UHGSMI instance, hr (0x%x)\n", hr)); … … 250 257 vboxVDbgPrint(("%s", szString)); 251 258 } 259 260 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConGetClientID(PVBOXUHGSMI pHgsmi, uint32_t *pu32ClientID) 261 { 262 PVBOXUHGSMI_PRIVATE_BASE pHgsmiPrivate = (PVBOXUHGSMI_PRIVATE_BASE)pHgsmi; 263 int rc = VBoxCrHgsmiPrivateCtlConGetClientID(pHgsmiPrivate, pu32ClientID); 264 if (!RT_SUCCESS(rc)) 265 { 266 WARN(("VBoxCrHgsmiPrivateCtlConCall failed with rc (%d)", rc)); 267 } 268 return rc; 269 } 270 271 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConCall(PVBOXUHGSMI pHgsmi, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo) 272 { 273 PVBOXUHGSMI_PRIVATE_BASE pHgsmiPrivate = (PVBOXUHGSMI_PRIVATE_BASE)pHgsmi; 274 int rc = VBoxCrHgsmiPrivateCtlConCall(pHgsmiPrivate, pCallInfo, cbCallInfo); 275 if (!RT_SUCCESS(rc)) 276 { 277 WARN(("VBoxCrHgsmiPrivateCtlConCall failed with rc (%d)", rc)); 278 } 279 return rc; 280 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispCm.cpp
r39515 r40483 114 114 HRESULT vboxDispCmCtxCreate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_CONTEXT pContext) 115 115 { 116 VBOXWDDM_CREATECONTEXT_INFO Info ;116 VBOXWDDM_CREATECONTEXT_INFO Info = {0}; 117 117 Info.u32IfVersion = pDevice->u32IfVersion; 118 118 Info.enmType = VBOXDISPMODE_IS_3D(pDevice->pAdapter) ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispKmt.cpp
r39161 r40483 250 250 251 251 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext, 252 VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo) 252 VBOXWDDM_CONTEXT_TYPE enmType, 253 uint32_t crVersionMajor, uint32_t crVersionMinor, 254 HANDLE hEvent, uint64_t u64UmInfo) 253 255 { 254 256 VBOXWDDM_CREATECONTEXT_INFO Info = {0}; 255 257 Info.u32IfVersion = 9; 256 258 Info.enmType = enmType; 259 Info.crVersionMajor = crVersionMajor; 260 Info.crVersionMinor = crVersionMinor; 257 261 Info.hUmEvent = (uint64_t)hEvent; 258 262 Info.u64UmInfo = u64UmInfo; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispKmt.h
r36867 r40483 86 86 HRESULT vboxDispKmtDestroyDevice(PVBOXDISPKMT_DEVICE pDevice); 87 87 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext, 88 VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo); 88 VBOXWDDM_CONTEXT_TYPE enmType, 89 uint32_t crVersionMajor, uint32_t crVersionMinor, 90 HANDLE hEvent, uint64_t u64UmInfo); 89 91 HRESULT vboxDispKmtDestroyContext(PVBOXDISPKMT_CONTEXT pContext); 90 92 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiBase.h
r36867 r40483 33 33 #endif 34 34 35 typedef DECLCALLBACK(int) FNVBOXCRHGSMI_CTLCON_CALL(struct VBOXUHGSMI_PRIVATE_BASE *pHgsmi, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo); 36 typedef FNVBOXCRHGSMI_CTLCON_CALL *PFNVBOXCRHGSMI_CTLCON_CALL; 37 38 #define VBoxCrHgsmiPrivateCtlConCall(_pHgsmi, _pCallInfo, _cbCallInfo) (_pHgsmi->pfnCtlConCall((_pHgsmi), (_pCallInfo), (_cbCallInfo))) 39 40 41 typedef DECLCALLBACK(int) FNVBOXCRHGSMI_CTLCON_GETCLIENTID(struct VBOXUHGSMI_PRIVATE_BASE *pHgsmi, uint32_t *pu32ClientID); 42 typedef FNVBOXCRHGSMI_CTLCON_GETCLIENTID *PFNVBOXCRHGSMI_CTLCON_GETCLIENTID; 43 44 #define VBoxCrHgsmiPrivateCtlConGetClientID(_pHgsmi, _pu32ClientID) (_pHgsmi->pfnCtlConGetClientID((_pHgsmi), (_pu32ClientID))) 45 46 35 47 typedef struct VBOXUHGSMI_PRIVATE_BASE 36 48 { 37 49 VBOXUHGSMI Base; 50 PFNVBOXCRHGSMI_CTLCON_CALL pfnCtlConCall; 51 PFNVBOXCRHGSMI_CTLCON_GETCLIENTID pfnCtlConGetClientID; 38 52 #ifdef VBOX_CRHGSMI_WITH_D3DDEV 39 53 HVBOXCRHGSMI_CLIENT hClient; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.cpp
r39215 r40483 22 22 #include <iprt/err.h> 23 23 24 #ifndef NT_SUCCESS 25 # define NT_SUCCESS(_Status) (((NTSTATUS)(_Status)) >= 0) 26 #endif 27 24 28 typedef struct VBOXUHGSMI_BUFFER_PRIVATE_KMT 25 29 { … … 50 54 DdiDealloc.AllocationCount = 1; 51 55 NTSTATUS Status = pBuffer->pHgsmi->Callbacks.pfnD3DKMTDestroyAllocation(&DdiDealloc); 52 Assert(!Status); 53 if (!Status) 56 if (NT_SUCCESS(Status)) 54 57 { 55 58 if (pBuffer->BasePrivate.Base.bSynchCreated) … … 59 62 RTMemFree(pBuffer); 60 63 return VINF_SUCCESS; 64 } 65 else 66 { 67 WARN(("pfnD3DKMTDestroyAllocation failed, Status (0x%x)", Status)); 61 68 } 62 69 return VERR_GENERAL_FAILURE; … … 85 92 86 93 NTSTATUS Status = pBuffer->pHgsmi->Callbacks.pfnD3DKMTLock(&DdiLock); 87 Assert(!Status);88 94 LeaveCriticalSection(&pBuffer->CritSect); 89 if ( !Status)95 if (NT_SUCCESS(Status)) 90 96 { 91 97 *pvLock = (void*)(((uint8_t*)DdiLock.pData) + (offLock & 0xfff)); 92 98 return VINF_SUCCESS; 93 99 } 100 else 101 { 102 WARN(("pfnD3DKMTLock failed, Status (0x%x)", Status)); 103 } 104 94 105 return VERR_GENERAL_FAILURE; 95 106 } … … 104 115 DdiUnlock.phAllocations = &pBuffer->BasePrivate.hAllocation; 105 116 NTSTATUS Status = pBuffer->pHgsmi->Callbacks.pfnD3DKMTUnlock(&DdiUnlock); 106 Assert(!Status); 107 if (!Status) 117 if (NT_SUCCESS(Status)) 108 118 return VINF_SUCCESS; 119 else 120 WARN(("pfnD3DKMTUnlock failed, Status (0x%x)", Status)); 121 109 122 return VERR_GENERAL_FAILURE; 110 123 } … … 150 163 Buf.AllocInfo.enmSynchType = enmSynchType; 151 164 152 HRESULT hr = pPrivate->Callbacks.pfnD3DKMTCreateAllocation(&Buf.DdiAlloc); 153 Assert(hr == S_OK); 154 if (hr == S_OK) 165 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTCreateAllocation(&Buf.DdiAlloc); 166 if (NT_SUCCESS(Status)) 155 167 { 156 168 InitializeCriticalSection(&pBuf->CritSect); … … 176 188 else 177 189 { 190 WARN(("pfnD3DKMTCreateAllocation failes, Status(0x%x)", Status)); 178 191 rc = VERR_OUT_OF_RESOURCES; 179 192 } … … 209 222 Assert(DdiRender.CommandLength < UINT32_MAX/2); 210 223 211 HRESULT hr = pHg->Callbacks.pfnD3DKMTRender(&DdiRender); 212 Assert(hr == S_OK); 213 if (hr == S_OK) 224 NTSTATUS Status = pHg->Callbacks.pfnD3DKMTRender(&DdiRender); 225 if (NT_SUCCESS(Status)) 214 226 { 215 227 pHg->Context.CommandBufferSize = DdiRender.NewCommandBufferSize; … … 221 233 222 234 return VINF_SUCCESS; 235 } 236 else 237 { 238 WARN(("pfnD3DKMTRender failed, Status (0x%x)", Status)); 223 239 } 224 240 … … 256 272 DeallocInfo.hAlloc = pBuffer->Alloc.hAlloc; 257 273 258 HRESULT hr = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 259 Assert(hr == S_OK); 260 if (hr == S_OK) 274 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 275 if (NT_SUCCESS(Status)) 261 276 { 262 277 if (pBuffer->Base.bSynchCreated) … … 266 281 RTMemFree(pBuffer); 267 282 return VINF_SUCCESS; 283 } 284 else 285 { 286 WARN(("pfnD3DKMTEscape failed, Status (0x%x)", Status)); 268 287 } 269 288 … … 313 332 Buf.AllocInfo.Alloc.enmSynchType = enmSynchType; 314 333 315 HRESULT hr = pPrivate->Callbacks.pfnD3DKMTEscape(&Buf.DdiEscape); 316 Assert(hr == S_OK); 317 if (hr == S_OK) 334 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTEscape(&Buf.DdiEscape); 335 if (NT_SUCCESS(Status)) 318 336 { 319 337 pBuf->Alloc = Buf.AllocInfo.Alloc; … … 336 354 else 337 355 { 356 WARN(("pfnD3DKMTEscape failed, Status (0x%x)", Status)); 338 357 rc = VERR_OUT_OF_RESOURCES; 339 358 } … … 399 418 } 400 419 401 HRESULT hr = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 402 Assert(hr == S_OK); 403 if (hr == S_OK) 420 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 421 if (NT_SUCCESS(Status)) 404 422 { 405 423 return VINF_SUCCESS; 406 424 } 425 else 426 { 427 WARN(("pfnD3DKMTEscape failed, Status (0x%x)", Status)); 428 } 407 429 408 430 return VERR_GENERAL_FAILURE; 409 431 } 410 432 411 static HRESULT vboxUhgsmiKmtEngineCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D) 433 static HRESULT vboxUhgsmiKmtEngineCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, 434 uint32_t crVersionMajor, uint32_t crVersionMinor, BOOL bD3D) 412 435 { 413 436 HRESULT hr = vboxDispKmtCallbacksInit(&pHgsmi->Callbacks); … … 422 445 hr = vboxDispKmtCreateContext(&pHgsmi->Device, &pHgsmi->Context, 423 446 bD3D ? VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D : VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL, 447 crVersionMajor, crVersionMinor, 424 448 NULL, 0); 425 449 if (hr == S_OK) … … 441 465 else 442 466 { 443 WARN(("vboxDispKmtOpenAdapter failed, hr(0x%x)", hr));467 // WARN(("vboxDispKmtOpenAdapter failed, hr(0x%x)", hr)); 444 468 } 445 469 … … 452 476 return hr; 453 477 } 454 HRESULT vboxUhgsmiKmtCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D) 478 479 /* Cr calls have <= 3args, we try to allocate it on stack first */ 480 typedef struct VBOXCRHGSMI_CALLDATA 481 { 482 VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL CallHdr; 483 HGCMFunctionParameter aArgs[3]; 484 } VBOXCRHGSMI_CALLDATA, *PVBOXCRHGSMI_CALLDATA; 485 486 static DECLCALLBACK(int) vboxCrHhgsmiKmtEscCtlConCall(struct VBOXUHGSMI_PRIVATE_BASE *pHgsmi, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo) 487 { 488 VBOXCRHGSMI_CALLDATA Buf; 489 PVBOXCRHGSMI_CALLDATA pBuf; 490 int cbBuffer = cbCallInfo + RT_OFFSETOF(VBOXCRHGSMI_CALLDATA, CallHdr.CallInfo); 491 492 if (cbBuffer <= sizeof (Buf)) 493 pBuf = &Buf; 494 else 495 { 496 pBuf = (PVBOXCRHGSMI_CALLDATA)RTMemAlloc(cbBuffer); 497 if (!pBuf) 498 { 499 WARN(("RTMemAlloc failed!")); 500 return VERR_NO_MEMORY; 501 } 502 } 503 504 PVBOXUHGSMI_PRIVATE_KMT pPrivate = VBOXUHGSMIKMT_GET(pHgsmi); 505 D3DKMT_ESCAPE DdiEscape = {0}; 506 507 DdiEscape.hAdapter = pPrivate->Adapter.hAdapter; 508 DdiEscape.hDevice = pPrivate->Device.hDevice; 509 DdiEscape.Type = D3DKMT_ESCAPE_DRIVERPRIVATE; 510 //Buf.DdiEscape.Flags.HardwareAccess = 1; 511 DdiEscape.pPrivateDriverData = pBuf; 512 DdiEscape.PrivateDriverDataSize = cbBuffer; 513 DdiEscape.hContext = pPrivate->Context.hContext; 514 515 pBuf->CallHdr.EscapeHdr.escapeCode = VBOXESC_CRHGSMICTLCON_CALL; 516 pBuf->CallHdr.EscapeHdr.u32CmdSpecific = 0; 517 memcpy(&pBuf->CallHdr.CallInfo, pCallInfo, cbCallInfo); 518 519 int rc; 520 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 521 if (NT_SUCCESS(Status)) 522 { 523 memcpy(pCallInfo, &pBuf->CallHdr.CallInfo, cbCallInfo); 524 rc = VINF_SUCCESS; 525 } 526 else 527 { 528 WARN(("pfnD3DKMTEscape failed, Status (0x%x)", Status)); 529 rc = VERR_GENERAL_FAILURE; 530 } 531 /* cleanup */ 532 if (pBuf != &Buf) 533 RTMemFree(pBuf); 534 535 return rc; 536 } 537 538 static DECLCALLBACK(int) vboxCrHhgsmiKmtEscCtlConGetClientID(struct VBOXUHGSMI_PRIVATE_BASE *pHgsmi, uint32_t *pu32ClientID) 539 { 540 VBOXDISPIFESCAPE GetId = {0}; 541 PVBOXUHGSMI_PRIVATE_KMT pPrivate = VBOXUHGSMIKMT_GET(pHgsmi); 542 D3DKMT_ESCAPE DdiEscape = {0}; 543 544 DdiEscape.hAdapter = pPrivate->Adapter.hAdapter; 545 DdiEscape.hDevice = pPrivate->Device.hDevice; 546 DdiEscape.Type = D3DKMT_ESCAPE_DRIVERPRIVATE; 547 //Buf.DdiEscape.Flags.HardwareAccess = 1; 548 DdiEscape.pPrivateDriverData = &GetId; 549 DdiEscape.PrivateDriverDataSize = sizeof (GetId); 550 DdiEscape.hContext = pPrivate->Context.hContext; 551 552 GetId.escapeCode = VBOXESC_CRHGSMICTLCON_GETCLIENTID; 553 554 NTSTATUS Status = pPrivate->Callbacks.pfnD3DKMTEscape(&DdiEscape); 555 if (NT_SUCCESS(Status)) 556 { 557 Assert(GetId.u32CmdSpecific); 558 *pu32ClientID = GetId.u32CmdSpecific; 559 return VINF_SUCCESS; 560 } 561 else 562 { 563 *pu32ClientID = 0; 564 WARN(("pfnD3DKMTEscape failed, Status (0x%x)", Status)); 565 } 566 return VERR_GENERAL_FAILURE; 567 } 568 569 HRESULT vboxUhgsmiKmtCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t crVersionMajor, uint32_t crVersionMinor, BOOL bD3D) 455 570 { 456 571 pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiKmtBufferCreate; 457 572 pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiKmtBufferSubmitAsynch; 573 pHgsmi->BasePrivate.pfnCtlConCall = vboxCrHhgsmiKmtEscCtlConCall; 574 pHgsmi->BasePrivate.pfnCtlConGetClientID = vboxCrHhgsmiKmtEscCtlConGetClientID; 458 575 #ifdef VBOX_CRHGSMI_WITH_D3DDEV 459 576 pHgsmi->BasePrivate.hClient = NULL; 460 577 #endif 461 return vboxUhgsmiKmtEngineCreate(pHgsmi, bD3D);462 } 463 464 HRESULT vboxUhgsmiKmtEscCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D)578 return vboxUhgsmiKmtEngineCreate(pHgsmi, crVersionMajor, crVersionMinor, bD3D); 579 } 580 581 HRESULT vboxUhgsmiKmtEscCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t crVersionMajor, uint32_t crVersionMinor, BOOL bD3D) 465 582 { 466 583 pHgsmi->BasePrivate.Base.pfnBufferCreate = vboxUhgsmiKmtEscBufferCreate; 467 584 pHgsmi->BasePrivate.Base.pfnBufferSubmitAsynch = vboxUhgsmiKmtEscBufferSubmitAsynch; 585 pHgsmi->BasePrivate.pfnCtlConCall = vboxCrHhgsmiKmtEscCtlConCall; 586 pHgsmi->BasePrivate.pfnCtlConGetClientID = vboxCrHhgsmiKmtEscCtlConGetClientID; 468 587 #ifdef VBOX_CRHGSMI_WITH_D3DDEV 469 588 pHgsmi->BasePrivate.hClient = NULL; 470 589 #endif 471 return vboxUhgsmiKmtEngineCreate(pHgsmi, bD3D);590 return vboxUhgsmiKmtEngineCreate(pHgsmi, crVersionMajor, crVersionMinor, bD3D); 472 591 } 473 592 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.h
r36867 r40483 36 36 #define VBOXUHGSMIKMT_GET(_p) VBOXUHGSMIKMT_GET_PRIVATE(_p, VBOXUHGSMI_PRIVATE_KMT) 37 37 38 HRESULT vboxUhgsmiKmtCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D);38 HRESULT vboxUhgsmiKmtCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t crVersionMajor, uint32_t crVersionMinor, BOOL bD3D); 39 39 HRESULT vboxUhgsmiKmtDestroy(PVBOXUHGSMI_PRIVATE_KMT pHgsmi); 40 40 41 HRESULT vboxUhgsmiKmtEscCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D);41 HRESULT vboxUhgsmiKmtEscCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t crVersionMajor, uint32_t crVersionMinor, BOOL bD3D); 42 42 43 43 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk
r39252 r40483 66 66 VBoxVideoWddm_TEMPLATE = VBOXGUESTR0 67 67 VBoxVideoWddm_DEFS += VBOX_WITH_8BPP_MODES 68 VBoxVideoWddm_DEFS += VBOX_WDDM_MINIPORT VBOX_WITH_WDDM 68 VBoxVideoWddm_DEFS += VBOX_WDDM_MINIPORT VBOX_WITH_WDDM VBOX_WITH_HGCM 69 69 ifdef VBOX_WITH_VIDEOHWACCEL 70 70 VBoxVideoWddm_DEFS += VBOX_WITH_VIDEOHWACCEL … … 87 87 endif 88 88 VBoxVideoWddm_DEFS += LOG_TO_BACKDOOR 89 VBoxVideoWddm_INCS += ../../../include .. . 89 VBoxVideoWddm_INCS += ../../../include .. . ../../../../common/VBoxGuestLib 90 90 VBoxVideoWddm_LDFLAGS.x86 += /Entry:DriverEntry@8 91 91 VBoxVideoWddm_LDFLAGS.amd64 += /Entry:DriverEntry … … 97 97 wddm/VBoxMPShgsmi.cpp \ 98 98 wddm/VBoxMPCm.cpp \ 99 wddm/VBoxMPCr.cpp \ 99 100 wddm/VBoxMPMisc.cpp \ 100 101 wddm/VBoxMPWddm.rc \ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
r40387 r40483 97 97 volatile uint32_t cUnlockedVBVADisabled; 98 98 99 HVBOXCRCTL hCrCtl; 100 uint32_t cCrCtlRefs; 101 99 102 VBOXWDDM_GLOBAL_POINTER_INFO PointerInfo; 100 103 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r39981 r40483 31 31 #include "VBoxMPShgsmi.h" 32 32 #include "VBoxMPVbva.h" 33 #include "VBoxMPCr.h" 33 34 34 35 #if 0 … … 220 221 UINT NodeOrdinal; 221 222 UINT EngineAffinity; 223 uint32_t u32CrConClientID; 222 224 VBOXWDDM_HTABLE Swapchains; 223 225 VBOXVIDEOCM_CTX CmContext; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r40387 r40483 3645 3645 break; 3646 3646 } 3647 3647 3648 case VBOXESC_UHGSMI_DEALLOCATE: 3648 3649 { … … 3661 3662 break; 3662 3663 } 3664 3663 3665 case VBOXESC_GETVBOXVIDEOCMCMD: 3664 3666 { … … 3677 3679 break; 3678 3680 } 3681 3682 case VBOXESC_CRHGSMICTLCON_CALL: 3683 { 3684 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3685 PVBOXDISPIFESCAPE_CRHGSMICTLCON_CALL pCall = (PVBOXDISPIFESCAPE_CRHGSMICTLCON_CALL)pEscapeHdr; 3686 if (pEscape->PrivateDriverDataSize >= sizeof (*pCall)) 3687 { 3688 /* this is true due to the above condition */ 3689 Assert(pEscape->PrivateDriverDataSize > RT_OFFSETOF(VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, CallInfo)); 3690 int rc = VBoxMpCrCtlConCallUserData(pDevExt, &pCall->CallInfo, pEscape->PrivateDriverDataSize - RT_OFFSETOF(VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, CallInfo)); 3691 if (RT_SUCCESS(rc)) 3692 Status = STATUS_SUCCESS; 3693 else 3694 { 3695 WARN(("VBoxMpCrUmCtlConCall failed, rc(%d)", rc)); 3696 Status = STATUS_UNSUCCESSFUL; 3697 } 3698 } 3699 else 3700 { 3701 WARN(("buffer too small!")); 3702 Status = STATUS_BUFFER_TOO_SMALL; 3703 } 3704 3705 break; 3706 } 3707 3708 case VBOXESC_CRHGSMICTLCON_GETCLIENTID: 3709 { 3710 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)pEscape->hContext; 3711 if (pEscape->PrivateDriverDataSize == sizeof (*pEscapeHdr)) 3712 { 3713 pEscapeHdr->u32CmdSpecific = pContext->u32CrConClientID; 3714 Status = STATUS_SUCCESS; 3715 } 3716 else 3717 { 3718 WARN(("unexpected buffer size!")); 3719 Status = STATUS_INVALID_PARAMETER; 3720 } 3721 3722 break; 3723 } 3724 3679 3725 case VBOXESC_SETVISIBLEREGION: 3680 3726 { … … 5615 5661 if (Status == STATUS_SUCCESS) 5616 5662 { 5617 // Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 5618 // ExAcquireFastMutex(&pDevExt->ContextMutex); 5619 ASMAtomicIncU32(&pDevExt->cContexts3D); 5620 // ExReleaseFastMutex(&pDevExt->ContextMutex); 5621 break; 5663 int rc = VINF_SUCCESS; 5664 if (pInfo->crVersionMajor || pInfo->crVersionMinor) 5665 { 5666 rc = VBoxMpCrCtlConConnect(pDevExt, 5667 pInfo->crVersionMajor, pInfo->crVersionMinor, 5668 &pContext->u32CrConClientID); 5669 if (!RT_SUCCESS(rc)) 5670 { 5671 WARN(("VBoxMpCrCtlConConnect failed rc (%d)", rc)); 5672 Status = STATUS_UNSUCCESSFUL; 5673 } 5674 } 5675 5676 if (RT_SUCCESS(rc)) 5677 { 5678 // Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 5679 // ExAcquireFastMutex(&pDevExt->ContextMutex); 5680 ASMAtomicIncU32(&pDevExt->cContexts3D); 5681 // ExReleaseFastMutex(&pDevExt->ContextMutex); 5682 break; 5683 } 5622 5684 } 5623 5685 5624 5686 vboxWddmSwapchainCtxTerm(pDevExt, pContext); 5625 5687 } 5688 vboxVideoAMgrCtxDestroy(&pContext->AllocContext); 5626 5689 } 5627 5690 break; … … 5630 5693 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL: 5631 5694 { 5695 pContext->enmType = pInfo->enmType; 5632 5696 Status = vboxVideoAMgrCtxCreate(&pDevExt->AllocMgr, &pContext->AllocContext); 5633 5697 Assert(Status == STATUS_SUCCESS); 5634 if (Status != STATUS_SUCCESS) 5635 break; 5636 /* do not break to go to the _2D branch and do the rest stuff */ 5698 if (Status == STATUS_SUCCESS) 5699 { 5700 int rc = VINF_SUCCESS; 5701 if (pInfo->crVersionMajor || pInfo->crVersionMinor) 5702 { 5703 rc = VBoxMpCrCtlConConnect(pDevExt, 5704 pInfo->crVersionMajor, pInfo->crVersionMinor, 5705 &pContext->u32CrConClientID); 5706 if (!RT_SUCCESS(rc)) 5707 { 5708 WARN(("VBoxMpCrCtlConConnect failed rc (%d)", rc)); 5709 Status = STATUS_UNSUCCESSFUL; 5710 } 5711 } 5712 5713 if (RT_SUCCESS(rc)) 5714 { 5715 break; 5716 } 5717 vboxVideoAMgrCtxDestroy(&pContext->AllocContext); 5718 } 5719 break; 5637 5720 } 5638 5721 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D: … … 5684 5767 PVBOXWDDM_CONTEXT pContext = (PVBOXWDDM_CONTEXT)hContext; 5685 5768 PVBOXMP_DEVEXT pDevExt = pContext->pDevice->pAdapter; 5686 if (pContext->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D) 5687 { 5688 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 5689 // ExAcquireFastMutex(&pDevExt->ContextMutex); 5690 // RemoveEntryList(&pContext->ListEntry); 5691 uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContexts3D); 5692 // ExReleaseFastMutex(&pDevExt->ContextMutex); 5693 Assert(cContexts < UINT32_MAX/2); 5769 switch(pContext->enmType) 5770 { 5771 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D: 5772 { 5773 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 5774 // ExAcquireFastMutex(&pDevExt->ContextMutex); 5775 // RemoveEntryList(&pContext->ListEntry); 5776 uint32_t cContexts = ASMAtomicDecU32(&pDevExt->cContexts3D); 5777 // ExReleaseFastMutex(&pDevExt->ContextMutex); 5778 Assert(cContexts < UINT32_MAX/2); 5779 /* don't break! */ 5780 } 5781 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_3D: 5782 case VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL: 5783 if (pContext->u32CrConClientID) 5784 { 5785 VBoxMpCrCtlConDisconnect(pDevExt, pContext->u32CrConClientID); 5786 } 5787 break; 5788 default: 5789 break; 5694 5790 } 5695 5791 -
trunk/src/VBox/Additions/WINNT/include/VBoxDisplay.h
r39160 r40483 33 33 # define VBOXESC_SHRC_RELEASE 0xABCD900C 34 34 # define VBOXESC_DBGDUMPBUF 0xABCD900D 35 # define VBOXESC_CRHGSMICTLCON_CALL 0xABCD900E 36 # define VBOXESC_CRHGSMICTLCON_GETCLIENTID 0xABCD900F 35 37 36 38 typedef struct -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r40198 r40483 1893 1893 PVBOXGUESTSESSION pSession, 1894 1894 VBoxGuestHGCMCallInfo *pInfo, 1895 uint32_t cMillies, bool fInterruptible, bool f32bit, 1895 uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData, 1896 1896 size_t cbExtra, size_t cbData, size_t *pcbDataReturned) 1897 1897 { … … 1949 1949 */ 1950 1950 Log(("VBoxGuestCommonIOCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID)); 1951 fFlags = pSession->R0Process == NIL_RTR0PROCESS ? VBGLR0_HGCMCALL_F_KERNEL : VBGLR0_HGCMCALL_F_USER;1951 fFlags = !fUserData && pSession->R0Process == NIL_RTR0PROCESS ? VBGLR0_HGCMCALL_F_KERNEL : VBGLR0_HGCMCALL_F_USER; 1952 1952 #ifdef RT_ARCH_AMD64 1953 1953 if (f32bit) … … 2449 2449 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 2450 2450 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 2451 fInterruptible, false /*f32bit*/, 2451 fInterruptible, false /*f32bit*/, false /* fUserData */, 2452 2452 0, cbData, pcbDataReturned); 2453 2453 } … … 2458 2458 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout, 2459 2459 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS, 2460 false /*f32bit*/, 2460 false /*f32bit*/, false /* fUserData */, 2461 2461 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned); 2462 } 2463 else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(0))) 2464 { 2465 bool fInterruptible = true; 2466 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 2467 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 2468 fInterruptible, false /*f32bit*/, true /* fUserData */, 2469 0, cbData, pcbDataReturned); 2462 2470 } 2463 2471 # ifdef RT_ARCH_AMD64 … … 2467 2475 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 2468 2476 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 2469 fInterruptible, true /*f32bit*/, 2477 fInterruptible, true /*f32bit*/, false /* fUserData */, 2470 2478 0, cbData, pcbDataReturned); 2471 2479 } … … 2476 2484 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout, 2477 2485 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS, 2478 true /*f32bit*/, 2486 true /*f32bit*/, false /* fUserData */, 2479 2487 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned); 2480 2488 } -
trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
r28800 r40483 198 198 } 199 199 200 DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData) 201 { 202 int rc = VINF_SUCCESS; 203 204 VBGL_HGCM_ASSERTMsg(cbData >= sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (HGCMFunctionParameter), 205 ("cbData = %d, cParms = %d (calculated size %d)\n", cbData, pData->cParms, sizeof (VBoxGuestHGCMCallInfo) + pData->cParms * sizeof (VBoxGuestHGCMCallInfo))); 206 207 rc = vbglDriverIOCtl (&handle->driver, VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(cbData), pData, cbData); 208 209 return rc; 210 } 211 212 200 213 DECLVBGL(int) VbglHGCMCallTimed (VBGLHGCMHANDLE handle, 201 214 VBoxGuestHGCMCallInfoTimed *pData, uint32_t cbData) -
trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
r40211 r40483 64 64 HGCM.cpp \ 65 65 VBoxGuestR0LibSharedFolders.c \ 66 VBoxGuestR0LibCrOgl.cpp \ 66 67 VbglR0CanUsePhysPageList.cpp 67 68 -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r39288 r40483 596 596 */ 597 597 /** @todo use vbglR3DoIOCtl here instead */ 598 static int crVBoxHGCMCall( void *pvData, unsigned cbData)598 static int crVBoxHGCMCall(CRConnection *conn, void *pvData, unsigned cbData) 599 599 { 600 600 #ifdef IN_GUEST 601 601 PCRVBOXHGSMI_CLIENT pClient = _crVBoxHGSMIClientGet(conn); 602 if (pClient) 603 { 604 return VBoxCrHgsmiCtlConCall(pClient->pHgsmi, (struct VBoxGuestHGCMCallInfo *)pvData, cbData); 605 } 606 else 607 { 602 608 # ifdef RT_OS_WINDOWS 603 609 DWORD cbReturned, lerr; … … 683 689 return VERR_NOT_SUPPORTED; 684 690 # endif /*#ifdef RT_OS_WINDOWS*/ 685 691 } 686 692 #else /*#ifdef IN_GUEST*/ 687 693 crError("crVBoxHGCMCall called on host side!"); … … 853 859 parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) buf; 854 860 855 rc = crVBoxHGCMCall( &parms, sizeof(parms));861 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 856 862 callRes = parms.hdr.result; 857 863 } … … 870 876 parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) buf; 871 877 872 rc = crVBoxHGCMCall( &parms, sizeof(parms));878 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 873 879 callRes = parms.hdr.result; 874 880 } … … 911 917 parms.cbBuffer.u.value32 = 0; 912 918 913 rc = crVBoxHGCMCall( &parms, sizeof(parms));919 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 914 920 915 921 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) … … 967 973 parms.cbWriteback.u.value32 = 0; 968 974 969 rc = crVBoxHGCMCall( &parms, sizeof(parms));975 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 970 976 971 977 #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) … … 1003 1009 crDebug("SHCRGL_GUEST_FN_WRITE_BUFFER, offset=%u, size=%u", wbParms.ui32Offset.u.value32, wbParms.pBuffer.u.Pointer.size); 1004 1010 1005 rc = crVBoxHGCMCall( &wbParms, sizeof(wbParms));1011 rc = crVBoxHGCMCall(conn, &wbParms, sizeof(wbParms)); 1006 1012 if (RT_FAILURE(rc) || RT_FAILURE(wbParms.hdr.result)) 1007 1013 { … … 1028 1034 crMemcpy(&wrbParms.cbWriteback, &parms.cbWriteback, sizeof(HGCMFunctionParameter)); 1029 1035 1030 rc = crVBoxHGCMCall( &wrbParms, sizeof(wrbParms));1036 rc = crVBoxHGCMCall(conn, &wrbParms, sizeof(wrbParms)); 1031 1037 1032 1038 /*bit of hack to reuse code below*/ … … 1164 1170 parms.cbBuffer.u.value32 = 0; 1165 1171 1166 rc = crVBoxHGCMCall( &parms, sizeof(parms));1172 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 1167 1173 1168 1174 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) … … 1372 1378 parms.vMinor.u.value32 = CR_PROTOCOL_VERSION_MINOR; 1373 1379 1374 rc = crVBoxHGCMCall( &parms, sizeof(parms));1380 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 1375 1381 1376 1382 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) … … 1400 1406 parms.u64PID.u.value64 = pid; 1401 1407 1402 rc = crVBoxHGCMCall( &parms, sizeof(parms));1408 rc = crVBoxHGCMCall(conn, &parms, sizeof(parms)); 1403 1409 1404 1410 if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result)) … … 1442 1448 { 1443 1449 crDebug("could not open VBox Guest Additions driver! rc = %d\n", GetLastError()); 1450 CRASSERT(0); 1444 1451 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 1445 1452 return FALSE; … … 1533 1540 } 1534 1541 1542 static bool _crVBoxCommonDoDisconnectLocked( CRConnection *conn ) 1543 { 1544 int i; 1545 if (conn->pHostBuffer) 1546 { 1547 crFree(conn->pHostBuffer); 1548 conn->pHostBuffer = NULL; 1549 conn->cbHostBuffer = 0; 1550 conn->cbHostBufferAllocated = 0; 1551 } 1552 1553 conn->pBuffer = NULL; 1554 conn->cbBuffer = 0; 1555 1556 if (conn->type == CR_VBOXHGCM) 1557 { 1558 --g_crvboxhgcm.num_conns; 1559 1560 if (conn->index < g_crvboxhgcm.num_conns) 1561 { 1562 g_crvboxhgcm.conns[conn->index] = g_crvboxhgcm.conns[g_crvboxhgcm.num_conns]; 1563 g_crvboxhgcm.conns[conn->index]->index = conn->index; 1564 } 1565 else g_crvboxhgcm.conns[conn->index] = NULL; 1566 1567 conn->type = CR_NO_CONNECTION; 1568 } 1569 1570 for (i = 0; i < g_crvboxhgcm.num_conns; i++) 1571 if (g_crvboxhgcm.conns[i] && g_crvboxhgcm.conns[i]->type != CR_NO_CONNECTION) 1572 return true; 1573 return false; 1574 } 1575 1535 1576 /*@todo same, replace DeviceIoControl with vbglR3DoIOCtl */ 1536 1577 static void crVBoxHGCMDoDisconnect( CRConnection *conn ) … … 1541 1582 DWORD cbReturned; 1542 1583 # endif 1543 int i; 1544 #endif 1584 #endif 1585 bool fHasActiveCons = false; 1545 1586 1546 1587 if (!g_crvboxhgcm.initialized) return; … … 1552 1593 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1553 1594 1554 if (conn->pHostBuffer) 1555 { 1556 crFree(conn->pHostBuffer); 1557 conn->pHostBuffer = NULL; 1558 conn->cbHostBuffer = 0; 1559 conn->cbHostBufferAllocated = 0; 1560 } 1561 1562 conn->pBuffer = NULL; 1563 conn->cbBuffer = 0; 1564 1565 if (conn->type == CR_VBOXHGCM) 1566 { 1567 --g_crvboxhgcm.num_conns; 1568 1569 if (conn->index < g_crvboxhgcm.num_conns) 1570 { 1571 g_crvboxhgcm.conns[conn->index] = g_crvboxhgcm.conns[g_crvboxhgcm.num_conns]; 1572 g_crvboxhgcm.conns[conn->index]->index = conn->index; 1573 } 1574 else g_crvboxhgcm.conns[conn->index] = NULL; 1575 1576 conn->type = CR_NO_CONNECTION; 1577 } 1595 fHasActiveCons = _crVBoxCommonDoDisconnectLocked(conn); 1578 1596 1579 1597 #ifndef IN_GUEST … … 1613 1631 } 1614 1632 1615 /* see if any connections remain */1616 for (i = 0; i < g_crvboxhgcm.num_conns; i++)1617 if (g_crvboxhgcm.conns[i] && g_crvboxhgcm.conns[i]->type != CR_NO_CONNECTION)1618 break;1619 1620 1633 /* close guest additions driver*/ 1621 if ( i>=g_crvboxhgcm.num_conns)1634 if (!fHasActiveCons) 1622 1635 { 1623 1636 # ifdef RT_OS_WINDOWS … … 1672 1685 int rc; 1673 1686 #ifndef VBOX_CRHGSMI_WITH_D3DDEV 1674 rc = VBoxCrHgsmiInit( );1687 rc = VBoxCrHgsmiInit(CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR); 1675 1688 #else 1676 1689 VBOXCRHGSMI_CALLBACKS Callbacks; … … 2305 2318 static int crVBoxHGSMIDoConnect( CRConnection *conn ) 2306 2319 { 2307 return crVBoxHGCMDoConnect(conn); 2320 PCRVBOXHGSMI_CLIENT pClient; 2321 int rc = VINF_SUCCESS; 2322 2323 #ifdef CHROMIUM_THREADSAFE 2324 crLockMutex(&g_crvboxhgcm.mutex); 2325 #endif 2326 2327 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2328 2329 pClient = _crVBoxHGSMIClientGet(conn); 2330 CRASSERT(pClient); 2331 if (pClient) 2332 { 2333 rc = VBoxCrHgsmiCtlConGetClientID(pClient->pHgsmi, &conn->u32ClientID); 2334 CRASSERT(RT_SUCCESS(rc)); 2335 } 2336 2337 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2338 2339 #ifdef CHROMIUM_THREADSAFE 2340 crUnlockMutex(&g_crvboxhgcm.mutex); 2341 #endif 2342 return RT_SUCCESS(rc); 2308 2343 } 2309 2344 2310 2345 static void crVBoxHGSMIDoDisconnect( CRConnection *conn ) 2311 2346 { 2347 bool fHasActiveCons = false; 2348 2349 if (!g_crvboxhgcm.initialized) return; 2350 2351 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 2352 2312 2353 #ifdef CHROMIUM_THREADSAFE 2313 2354 crLockMutex(&g_crvboxhgcm.mutex); 2314 2355 #endif 2356 2357 fHasActiveCons = _crVBoxCommonDoDisconnectLocked(conn); 2358 2315 2359 #ifndef VBOX_CRHGSMI_WITH_D3DDEV 2316 2360 if (conn->HgsmiClient.pHgsmi) … … 2321 2365 VBoxCrHgsmiDestroy(pHgsmi); 2322 2366 } 2323 #endif 2324 crVBoxHGCMDoDisconnect(conn); 2367 #else 2368 # error "port me!" 2369 #endif 2370 2371 VBOXCRHGSMIPROFILE_FUNC_EPILOGUE(); 2372 2325 2373 #ifdef CHROMIUM_THREADSAFE 2326 2374 crUnlockMutex(&g_crvboxhgcm.mutex);
Note:
See TracChangeset
for help on using the changeset viewer.