Changeset 27955 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray
- Timestamp:
- Apr 2, 2010 9:12:26 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxTray
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk
r27912 r27955 29 29 endif 30 30 VBoxTray_DEFS = VBOX_WITH_HGCM LOG_TO_BACKDOOR 31 ifdef VBOXWDDM32 VBoxTray_DEFS += VBOXWDDM33 VBoxTray_DEFS += LOG_ENABLED34 endif35 31 VBoxTray_INCS = ../include 36 32 VBoxTray_SOURCES = \ … … 53 49 $(VBOX_LIB_VBGL_R3) 54 50 51 ifdef VBOXWDDM 52 VBoxTray_DEFS += VBOXWDDM 53 VBoxTray_DEFS += LOG_ENABLED 54 # we need only includes for PFND3DKMT stuff as all we link dynamicaly to it 55 VBoxTray_INCS += $(PATH_SDK_WINDDK_INC_API) $(PATH_SDK_WINDDK_INC_DDK) 56 endif 55 57 # VBoxTray.cpp uses VBOX_SVN_REV. 56 58 VBoxTray.cpp_DEFS += VBOX_SVN_REV=$(VBOX_SVN_REV) -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp
r27912 r27955 39 39 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */ 40 40 BOOL (WINAPI * pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags); 41 42 41 } VBOXDISPLAYCONTEXT; 43 42 44 43 static VBOXDISPLAYCONTEXT gCtx = {0}; 44 45 #ifdef VBOXWDDM 46 static bool vboxWddmReinitVideoModes(VBOXDISPLAYCONTEXT *pCtx) 47 { 48 VBOXDISPIFESCAPE escape = {0}; 49 escape.escapeCode = VBOXESC_REINITVIDEOMODES; 50 DWORD err = VBoxDispIfEscape(&pCtx->pEnv->dispIf, &escape, 0); 51 if (err != NO_ERROR) 52 { 53 Log((__FUNCTION__": VBoxDispIfEscape failed with err (%d)\n", err)); 54 return false; 55 } 56 return true; 57 } 58 59 typedef enum 60 { 61 VBOXDISPLAY_DRIVER_TYPE_UNKNOWN = 0, 62 VBOXDISPLAY_DRIVER_TYPE_XPDM = 1, 63 VBOXDISPLAY_DRIVER_TYPE_WDDM = 2 64 } VBOXDISPLAY_DRIVER_TYPE; 65 66 static VBOXDISPLAY_DRIVER_TYPE getVBoxDisplayDriverType (VBOXDISPLAYCONTEXT *pCtx); 67 #endif 45 68 46 69 int VBoxDisplayInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) … … 66 89 *(uintptr_t *)&gCtx.pfnEnumDisplayDevices = (uintptr_t)GetProcAddress(hUser, "EnumDisplayDevicesA"); 67 90 Log(("VBoxTray: pfnEnumDisplayDevices = %p\n", gCtx.pfnEnumDisplayDevices)); 91 92 #ifdef VBOXWDDM 93 if (OSinfo.dwMajorVersion >= 6) 94 { 95 /* this is vista and up, check if we need to switch the display driver if to WDDM mode */ 96 Log(("VBoxTray: this is vista and up\n")); 97 VBOXDISPLAY_DRIVER_TYPE enmType = getVBoxDisplayDriverType (&gCtx); 98 if (enmType == VBOXDISPLAY_DRIVER_TYPE_WDDM) 99 { 100 Log(("VBoxTray: WDDM driver is installed, switching display driver if to WDDM mode\n")); 101 /* this is hacky, but the most easiest way */ 102 DWORD err = VBoxDispIfSwitchMode(const_cast<PVBOXDISPIF>(&pEnv->dispIf), VBOXDISPIF_MODE_WDDM, NULL /* old mode, we don't care about it */); 103 if (err == NO_ERROR) 104 Log(("VBoxTray: DispIf switched to WDDM mode successfully\n")); 105 else 106 Log(("VBoxTray: failed to switch DispIf to WDDM mode, err (%d)\n", err)); 107 } 108 } 109 #endif 68 110 } 69 111 else if (OSinfo.dwMajorVersion <= 4) /* Windows NT 4.0 */ … … 89 131 } 90 132 133 #ifdef VBOXWDDM 134 static VBOXDISPLAY_DRIVER_TYPE getVBoxDisplayDriverType (VBOXDISPLAYCONTEXT *pCtx) 135 #else 91 136 static bool isVBoxDisplayDriverActive (VBOXDISPLAYCONTEXT *pCtx) 137 #endif 92 138 { 139 #ifdef VBOXWDDM 140 VBOXDISPLAY_DRIVER_TYPE enmType = VBOXDISPLAY_DRIVER_TYPE_UNKNOWN; 141 #else 93 142 bool result = false; 143 #endif 94 144 95 145 if( pCtx->pfnEnumDisplayDevices ) … … 120 170 121 171 if (strcmp(&dispDevice.DeviceString[0], "VirtualBox Graphics Adapter") == 0) 172 #ifndef VBOXWDDM 122 173 result = true; 123 #ifdef VBOXWDDM 124 if (strcmp(&dispDevice.DeviceString[0], "VirtualBox Graphics Adapter (Microsoft Corporation - WDDM)") == 0) 125 result = true; 174 #else 175 enmType = VBOXDISPLAY_DRIVER_TYPE_XPDM; 176 else if (strcmp(&dispDevice.DeviceString[0], "VirtualBox Graphics Adapter (Microsoft Corporation - WDDM)") == 0) 177 enmType = VBOXDISPLAY_DRIVER_TYPE_WDDM; 126 178 #endif 127 179 break; … … 146 198 /* Check for the short name, because all long stuff would be truncated */ 147 199 if (strcmp((char*)&tempDevMode.dmDeviceName[0], "VBoxDisp") == 0) 200 #ifndef VBOXWDDM 148 201 result = true; 149 } 150 202 #else 203 enmType = VBOXDISPLAY_DRIVER_TYPE_XPDM; 204 #endif 205 } 206 207 #ifndef VBOXWDDM 151 208 return result; 209 #else 210 return enmType; 211 #endif 152 212 } 153 213 154 214 /* Returns TRUE to try again. */ 155 static BOOL ResizeDisplayDevice(ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel) 215 static BOOL ResizeDisplayDevice( 216 #ifdef VBOXWDDM 217 VBOXDISPLAYCONTEXT *pCtx, VBOXDISPLAY_DRIVER_TYPE enmType, 218 #endif 219 ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel 220 ) 156 221 { 157 222 BOOL fModeReset = (Width == 0 && Height == 0 && BitsPerPixel == 0); … … 334 399 Log(("ResizeDisplayDevice: EnumDisplaySettings last error %d\n", GetLastError ())); 335 400 } 401 402 #ifdef VBOXWDDM 403 if (enmType == VBOXDISPLAY_DRIVER_TYPE_WDDM) 404 vboxWddmReinitVideoModes(pCtx); 405 #endif 336 406 337 407 /* Assign the new rectangles to displays. */ … … 472 542 * Only try to change video mode if the active display driver is VBox additions. 473 543 */ 544 #ifdef VBOXWDDM 545 VBOXDISPLAY_DRIVER_TYPE enmDriverType = getVBoxDisplayDriverType (pCtx); 546 547 if (enmDriverType == VBOXDISPLAY_DRIVER_TYPE_WDDM) 548 Log(("VBoxDisplayThread : Detected WDDM Driver\n")); 549 550 if (enmDriverType != VBOXDISPLAY_DRIVER_TYPE_UNKNOWN) 551 #else 474 552 if (isVBoxDisplayDriverActive (pCtx)) 553 #endif 475 554 { 476 555 Log(("VBoxDisplayThread : Display driver is active!\n")); … … 481 560 482 561 /* W2K or later. */ 483 if (!ResizeDisplayDevice(displayChangeRequest.display, 562 if (!ResizeDisplayDevice( 563 #ifdef VBOXWDDM 564 pCtx, enmDriverType , 565 #endif 566 displayChangeRequest.display, 484 567 displayChangeRequest.xres, 485 568 displayChangeRequest.yres, 486 displayChangeRequest.bpp)) 569 displayChangeRequest.bpp 570 )) 487 571 { 488 572 break; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.h
r8387 r27955 27 27 void VBoxDisplayDestroy (const VBOXSERVICEENV *pEnv, void *pInstance); 28 28 29 #ifndef VBOXWDDM 29 30 static bool isVBoxDisplayDriverActive (void); 31 #else 32 /* @misha: getVBoxDisplayDriverType is used instead. 33 * it seems bad to put static function declaration to header, 34 * so it is moved to VBoxDisplay.cpp */ 35 #endif 30 36 31 37 #endif /* __VBOXSERVICEDISPLAY__H */ -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxRestore.cpp
r26562 r27955 33 33 const VBOXSERVICEENV *pEnv; 34 34 35 BOOLfRDPState;35 DWORD fRDPState; 36 36 } VBOXRESTORECONTEXT; 37 37 … … 45 45 46 46 gCtx.pEnv = pEnv; 47 gCtx.fRDPState = FALSE;47 gCtx.fRDPState = ERROR_NOT_SUPPORTED; 48 48 49 49 VBoxRestoreCheckVRDP(); … … 68 68 void VBoxRestoreCheckVRDP() 69 69 { 70 HDC hdc;71 BOOL ret;72 70 DWORD ret; 71 VBOXDISPIFESCAPE escape = {0}; 72 escape.escapeCode = VBOXESC_ISVRDPACTIVE; 73 73 /* Check VRDP activity */ 74 hdc = GetDC(HWND_DESKTOP);75 74 76 75 /* send to display driver */ 77 ret = ExtEscape(hdc, VBOXESC_ISVRDPACTIVE, 0, NULL, 0, NULL);76 ret = VBoxDispIfEscape(&gCtx.pEnv->dispIf, &escape, 0); 78 77 Log(("VBoxRestoreSession -> VRDP activate state = %d\n", ret)); 79 ReleaseDC(HWND_DESKTOP, hdc);80 78 81 79 if (ret != gCtx.fRDPState) … … 83 81 DWORD cbReturned; 84 82 85 if (!DeviceIoControl (gCtx.pEnv->hDriver, (ret)? VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION : VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION, NULL, 0, NULL, 0, &cbReturned, NULL))83 if (!DeviceIoControl (gCtx.pEnv->hDriver, ret == NO_ERROR ? VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION : VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION, NULL, 0, NULL, 0, &cbReturned, NULL)) 86 84 { 87 85 Log(("VBoxRestoreThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n")); -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxSeamless.cpp
r26562 r27955 38 38 BOOL (* pfnVBoxRemoveHook)(); 39 39 40 LPRGNDATA lpRgnData;40 PVBOXDISPIFESCAPE lpEscapeData; 41 41 } VBOXSEAMLESSCONTEXT; 42 42 … … 144 144 gCtx.pfnVBoxRemoveHook(); 145 145 146 if (gCtx.lp RgnData)147 { 148 free(gCtx.lp RgnData);149 gCtx.lp RgnData = NULL;146 if (gCtx.lpEscapeData) 147 { 148 free(gCtx.lpEscapeData); 149 gCtx.lpEscapeData = NULL; 150 150 } 151 151 } … … 238 238 if (cbSize) 239 239 { 240 LPRGNDATA lpRgnData = (LPRGNDATA)malloc(cbSize); 241 if (lpRgnData) 242 { 240 PVBOXDISPIFESCAPE lpEscapeData = (PVBOXDISPIFESCAPE)malloc(VBOXDISPIFESCAPE_SIZE(cbSize)); 241 if (lpEscapeData) 242 { 243 lpEscapeData->escapeCode = VBOXESC_SETVISIBLEREGION; 244 LPRGNDATA lpRgnData = VBOXDISPIFESCAPE_DATA(lpEscapeData, RGNDATA); 243 245 memset(lpRgnData, 0, cbSize); 244 246 cbSize = GetRegionData(param.hrgn, cbSize, lpRgnData); … … 254 256 } 255 257 #endif 256 if ( !gCtx.lpRgnData 257 || (gCtx.lpRgnData->rdh.dwSize + gCtx.lpRgnData->rdh.nRgnSize != cbSize) 258 || memcmp(gCtx.lpRgnData, lpRgnData, cbSize)) 258 LPRGNDATA lpCtxRgnData = VBOXDISPIFESCAPE_DATA(gCtx.lpEscapeData, RGNDATA); 259 if ( !gCtx.lpEscapeData 260 || (lpCtxRgnData->rdh.dwSize + lpCtxRgnData->rdh.nRgnSize != cbSize) 261 || memcmp(lpCtxRgnData, lpRgnData, cbSize)) 259 262 { 260 263 /* send to display driver */ 261 ExtEscape(param.hdc, VBOXESC_SETVISIBLEREGION, cbSize, (LPCSTR)lpRgnData, 0, NULL);262 263 if (gCtx.lp RgnData)264 free(gCtx.lp RgnData);265 gCtx.lp RgnData = lpRgnData;264 VBoxDispIfEscape(&gCtx.pEnv->dispIf, lpEscapeData, cbSize); 265 266 if (gCtx.lpEscapeData) 267 free(gCtx.lpEscapeData); 268 gCtx.lpEscapeData = lpEscapeData; 266 269 } 267 270 else 268 271 Log(("Visible rectangles haven't changed; ignore\n")); 269 272 } 270 if (lp RgnData != gCtx.lpRgnData)271 free(lp RgnData);273 if (lpEscapeData != gCtx.lpEscapeData) 274 free(lpEscapeData); 272 275 } 273 276 } -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp
r26292 r27955 370 370 svcEnv.hDriver = gVBoxDriver; 371 371 372 /* initializes disp-if to default (XPDM) mode */ 373 status = VBoxDispIfInit(&svcEnv.dispIf); 374 #ifdef VBOXWDDM 375 /* for now the display mode will be adjusted to WDDM mode if needed 376 * on display service initialization when it detects the display driver type */ 377 #endif 378 372 379 if (status == NO_ERROR) 373 380 { … … 610 617 return 0; 611 618 } 619 620 /* display driver interface abstraction for XPDM & WDDM 621 * with WDDM we can not use ExtEscape to communicate with our driver 622 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd 623 * that knows nothing about us */ 624 DWORD VBoxDispIfInit(PVBOXDISPIF pIf) 625 { 626 pIf->enmMode = VBOXDISPIF_MODE_XPDM; 627 return NO_ERROR; 628 } 629 630 DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode) 631 { 632 /* @todo: may need to addd synchronization in case we want to change modes dynamically 633 * i.e. currently the mode is supposed to be initialized once on service initialization */ 634 if (penmOldMode) 635 *penmOldMode = pIf->enmMode; 636 637 if (enmMode == pIf->enmMode) 638 return VINF_ALREADY_INITIALIZED; 639 640 DWORD err = NO_ERROR; 641 switch (enmMode) 642 { 643 case VBOXDISPIF_MODE_XPDM: 644 Log((__FUNCTION__": request to switch to VBOXDISPIF_MODE_XPDM\n")); 645 pIf->enmMode = VBOXDISPIF_MODE_XPDM; 646 break; 647 #ifdef VBOXWDDM 648 case VBOXDISPIF_MODE_WDDM: 649 { 650 Log((__FUNCTION__": request to switch to VBOXDISPIF_MODE_WDDM\n")); 651 OSVERSIONINFO OSinfo; 652 OSinfo.dwOSVersionInfoSize = sizeof (OSinfo); 653 GetVersionEx (&OSinfo); 654 if (OSinfo.dwMajorVersion >= 6) 655 { 656 /* this is vista and up */ 657 Log((__FUNCTION__": this is vista and up\n")); 658 HMODULE hGdi32 = GetModuleHandle("gdi32"); 659 if (hGdi32 != NULL) 660 { 661 bool bSupported = true; 662 pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc = (PFND3DKMT_OPENADAPTERFROMHDC)GetProcAddress(hGdi32, "D3DKMTOpenAdapterFromHdc"); 663 Log((__FUNCTION__"pfnD3DKMTOpenAdapterFromHdc = %p\n", pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc)); 664 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromHdc); 665 666 pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName = (PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME)GetProcAddress(hGdi32, "D3DKMTOpenAdapterFromGdiDisplayName"); 667 Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName = %p\n", pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName)); 668 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName); 669 670 pIf->modeData.wddm.pfnD3DKMTCloseAdapter = (PFND3DKMT_CLOSEADAPTER)GetProcAddress(hGdi32, "D3DKMTCloseAdapter"); 671 Log((__FUNCTION__": pfnD3DKMTCloseAdapter = %p\n", pIf->modeData.wddm.pfnD3DKMTCloseAdapter)); 672 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTCloseAdapter); 673 674 pIf->modeData.wddm.pfnD3DKMTEscape = (PFND3DKMT_ESCAPE)GetProcAddress(hGdi32, "D3DKMTEscape"); 675 Log((__FUNCTION__": pfnD3DKMTEscape = %p\n", pIf->modeData.wddm.pfnD3DKMTEscape)); 676 bSupported &= !!(pIf->modeData.wddm.pfnD3DKMTCloseAdapter); 677 678 if (bSupported) 679 pIf->enmMode = VBOXDISPIF_MODE_WDDM; 680 else 681 { 682 Log((__FUNCTION__": one of pfnD3DKMT function pointers failed to initialize\n")); 683 err = ERROR_NOT_SUPPORTED; 684 } 685 } 686 else 687 { 688 Log((__FUNCTION__": GetModuleHandle(gdi32) failed, err(%d)\n", GetLastError())); 689 err = ERROR_NOT_SUPPORTED; 690 } 691 } 692 else 693 { 694 Log((__FUNCTION__": can not switch to VBOXDISPIF_MODE_WDDM, because os is not Vista or upper\n")); 695 err = ERROR_NOT_SUPPORTED; 696 } 697 break; 698 } 699 #endif 700 default: 701 err = ERROR_INVALID_PARAMETER; 702 break; 703 } 704 return err; 705 } 706 707 DWORD VBoxDispIfTerm(PVBOXDISPIF pIf) 708 { 709 pIf->enmMode = VBOXDISPIF_MODE_UNKNOWN; 710 return NO_ERROR; 711 } 712 713 static DWORD vboxDispIfEscapeXPDM(PCVBOXDISPIF pIf, PVBOXDISPIFESCAPE pEscape, int cbData) 714 { 715 HDC hdc = GetDC(HWND_DESKTOP); 716 VOID *pvData = cbData ? VBOXDISPIFESCAPE_DATA(pEscape, VOID) : NULL; 717 int iRet = ExtEscape(hdc, pEscape->escapeCode, cbData, (LPCSTR)pvData, 0, NULL); 718 ReleaseDC(HWND_DESKTOP, hdc); 719 if (iRet > 0) 720 return VINF_SUCCESS; 721 else if (iRet == 0) 722 return ERROR_NOT_SUPPORTED; 723 /* else */ 724 return ERROR_GEN_FAILURE; 725 } 726 727 #ifdef VBOXWDDM 728 static DWORD vboxDispIfEscapeWDDM(PCVBOXDISPIF pIf, PVBOXDISPIFESCAPE pEscape, int cbData) 729 { 730 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME OpenAdapterData = {0}; 731 wcscpy(OpenAdapterData.DeviceName, L"\\\\.\\DISPLAY1"); 732 733 DWORD err = ERROR_GEN_FAILURE; 734 NTSTATUS Status = pIf->modeData.wddm.pfnD3DKMTOpenAdapterFromGdiDisplayName(&OpenAdapterData); 735 if (!Status) 736 { 737 D3DKMT_ESCAPE EscapeData = {0}; 738 EscapeData.hAdapter = OpenAdapterData.hAdapter; 739 //EscapeData.hDevice = NULL; 740 EscapeData.Type = D3DKMT_ESCAPE_DRIVERPRIVATE; 741 EscapeData.Flags.HardwareAccess = 1; 742 EscapeData.pPrivateDriverData = pEscape; 743 EscapeData.PrivateDriverDataSize = VBOXDISPIFESCAPE_SIZE(cbData); 744 //EscapeData.hContext = NULL; 745 746 Status = pIf->modeData.wddm.pfnD3DKMTEscape(&EscapeData); 747 if (!Status) 748 err = NO_ERROR; 749 else 750 { 751 if (Status == 0xC00000BBL) /* not supported */ 752 err = ERROR_NOT_SUPPORTED; 753 Log((__FUNCTION__": pfnD3DKMTEscape failed, Status (0x%x)\n", Status)); 754 } 755 756 D3DKMT_CLOSEADAPTER ClosaAdapterData = {0}; 757 ClosaAdapterData.hAdapter = OpenAdapterData.hAdapter; 758 Status = pIf->modeData.wddm.pfnD3DKMTCloseAdapter(&ClosaAdapterData); 759 if (Status) 760 Log((__FUNCTION__": pfnD3DKMTCloseAdapter failed, Status (0x%x)\n", Status)); 761 } 762 else 763 Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName failed, Status (0x%x)\n", Status)); 764 765 return err; 766 } 767 #endif 768 769 DWORD VBoxDispIfEscape(PCVBOXDISPIF pIf, PVBOXDISPIFESCAPE pEscape, int cbData) 770 { 771 switch (pIf->enmMode) 772 { 773 case VBOXDISPIF_MODE_XPDM: 774 return vboxDispIfEscapeXPDM(pIf, pEscape, cbData); 775 #ifdef VBOXWDDM 776 case VBOXDISPIF_MODE_WDDM: 777 return vboxDispIfEscapeWDDM(pIf, pEscape, cbData); 778 #endif 779 default: 780 Log((__FUNCTION__": unknown mode (%d)\n", pIf->enmMode)); 781 return ERROR_INVALID_PARAMETER; 782 } 783 } -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.h
r23055 r27955 36 36 #include <VBox/VBoxGuest.h> /** @todo use the VbglR3 interface! */ 37 37 #include <VBox/VBoxGuestLib.h> 38 #include <VBoxDisplay.h> 39 #ifdef VBOXWDDM 40 # include <d3dkmthk.h> 41 #endif 38 42 39 43 #define WM_VBOX_RESTORED WM_APP + 1 … … 44 48 #define ID_TRAYICON 2000 45 49 50 typedef enum 51 { 52 VBOXDISPIF_MODE_UNKNOWN = 0, 53 VBOXDISPIF_MODE_XPDM = 1 54 #ifdef VBOXWDDM 55 , VBOXDISPIF_MODE_WDDM = 2 56 #endif 57 } VBOXDISPIF_MODE; 58 /* display driver interface abstraction for XPDM & WDDM 59 * with WDDM we can not use ExtEscape to communicate with our driver 60 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd 61 * that knows nothing about us 62 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver, 63 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call 64 * It's caller's responsibility to initiate it to work in the correct mode */ 65 typedef struct VBOXDISPIF 66 { 67 VBOXDISPIF_MODE enmMode; 68 #ifdef VBOXWDDM 69 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI, 70 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */ 71 /* open adapter */ 72 union 73 { 74 struct 75 { 76 PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc; 77 PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName; 78 /* close adapter */ 79 PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter; 80 /* escape */ 81 PFND3DKMT_ESCAPE pfnD3DKMTEscape; 82 } wddm; 83 } modeData; 84 #endif 85 } VBOXDISPIF, *PVBOXDISPIF; 86 typedef const struct VBOXDISPIF *PCVBOXDISPIF; 87 88 /* initializes the DispIf 89 * Initially the DispIf is configured to work in XPDM mode 90 * call VBoxDispIfSwitchMode to switch the mode to WDDM */ 91 DWORD VBoxDispIfInit(PVBOXDISPIF pIf); 92 DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode); 93 DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; } 94 DWORD VBoxDispIfTerm(PVBOXDISPIF pIf); 95 DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData); 46 96 47 97 /* The environment information for services. */ … … 51 101 HANDLE hDriver; 52 102 HANDLE hStopEvent; 103 /* display driver interface, XPDM - WDDM abstraction see VBOXDISPIF** definitions above */ 104 VBOXDISPIF dispIf; 53 105 } VBOXSERVICEENV; 54 106
Note:
See TracChangeset
for help on using the changeset viewer.