VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDispIf.h@ 69360

Last change on this file since 69360 was 68261, checked in by vboxsync, 7 years ago

WDDM: helper libs. No code changes, just moved a couple of shared source files to a separate directory.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: VBoxDispIf.h 68261 2017-08-02 21:45:09Z vboxsync $ */
2/** @file
3 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
4 */
5
6/*
7 * Copyright (C) 2006-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#include <iprt/cdefs.h>
18
19#ifdef VBOX_WITH_WDDM
20# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
21# include <d3dkmthk.h>
22# include <VBoxDispKmt.h>
23#endif
24
25#include <VBoxDisplay.h>
26
27typedef enum
28{
29 VBOXDISPIF_MODE_UNKNOWN = 0,
30 VBOXDISPIF_MODE_XPDM_NT4 = 1,
31 VBOXDISPIF_MODE_XPDM
32#ifdef VBOX_WITH_WDDM
33 , VBOXDISPIF_MODE_WDDM
34 , VBOXDISPIF_MODE_WDDM_W7
35#endif
36} VBOXDISPIF_MODE;
37/* display driver interface abstraction for XPDM & WDDM
38 * with WDDM we can not use ExtEscape to communicate with our driver
39 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
40 * that knows nothing about us
41 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
42 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
43 * It's caller's responsibility to initiate it to work in the correct mode */
44typedef struct VBOXDISPIF
45{
46 VBOXDISPIF_MODE enmMode;
47 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
48 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
49 union
50 {
51 struct
52 {
53 LONG (WINAPI *pfnChangeDisplaySettingsEx)(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
54 } xpdm;
55#ifdef VBOX_WITH_WDDM
56 struct
57 {
58 /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
59 LONG (WINAPI *pfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
60 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
61 BOOL (WINAPI *pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags);
62
63 VBOXDISPKMT_CALLBACKS KmtCallbacks;
64 } wddm;
65#endif
66 } modeData;
67} VBOXDISPIF, *PVBOXDISPIF;
68typedef const struct VBOXDISPIF *PCVBOXDISPIF;
69
70/* initializes the DispIf
71 * Initially the DispIf is configured to work in XPDM mode
72 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
73DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
74DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
75DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
76DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
77DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
78DWORD VBoxDispIfEscapeInOut(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
79DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
80DWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf);
81DWORD VBoxDispIfResizeStarted(PCVBOXDISPIF const pIf);
82
83typedef struct VBOXDISPIF_SEAMLESS
84{
85 PCVBOXDISPIF pIf;
86
87 union
88 {
89#ifdef VBOX_WITH_WDDM
90 struct
91 {
92 VBOXDISPKMT_ADAPTER Adapter;
93# ifdef VBOX_DISPIF_WITH_OPCONTEXT
94 VBOXDISPKMT_DEVICE Device;
95 VBOXDISPKMT_CONTEXT Context;
96# endif
97 } wddm;
98#endif
99 } modeData;
100} VBOXDISPIF_SEAMLESS;
101
102DECLINLINE(bool) VBoxDispIfSeamlesIsValid(VBOXDISPIF_SEAMLESS *pSeamless)
103{
104 return !!pSeamless->pIf;
105}
106
107DWORD VBoxDispIfSeamlessCreate(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent);
108DWORD VBoxDispIfSeamlessTerm(VBOXDISPIF_SEAMLESS *pSeamless);
109DWORD VBoxDispIfSeamlessSubmit(VBOXDISPIF_SEAMLESS *pSeamless, VBOXDISPIFESCAPE *pData, int cbData);
110
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette