VirtualBox

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

Last change on this file since 103615 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: VBoxDispIf.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h
29#define GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <iprt/cdefs.h>
35
36#ifdef VBOX_WITH_WDDM
37# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
38# include <iprt/win/d3dkmthk.h>
39# include <VBoxDispKmt.h>
40#endif
41
42#include <VBoxDisplay.h>
43
44typedef enum
45{
46 VBOXDISPIF_MODE_UNKNOWN = 0,
47 VBOXDISPIF_MODE_XPDM_NT4 = 1,
48 VBOXDISPIF_MODE_XPDM
49#ifdef VBOX_WITH_WDDM
50 , VBOXDISPIF_MODE_WDDM
51 , VBOXDISPIF_MODE_WDDM_W7
52#endif
53} VBOXDISPIF_MODE;
54/* display driver interface abstraction for XPDM & WDDM
55 * with WDDM we can not use ExtEscape to communicate with our driver
56 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
57 * that knows nothing about us
58 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
59 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
60 * It's caller's responsibility to initiate it to work in the correct mode */
61typedef struct VBOXDISPIF
62{
63 VBOXDISPIF_MODE enmMode;
64 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
65 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
66 union
67 {
68 struct
69 {
70 DECLCALLBACKMEMBER_EX(LONG, WINAPI, pfnChangeDisplaySettingsEx,(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode,
71 HWND hwnd, DWORD dwflags, LPVOID lParam));
72 } xpdm;
73#ifdef VBOX_WITH_WDDM
74 struct
75 {
76 /** ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
77 DECLCALLBACKMEMBER_EX(LONG, WINAPI, pfnChangeDisplaySettingsEx,(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode,
78 HWND hwnd, DWORD dwflags, LPVOID lParam));
79 /** EnumDisplayDevices does not exist in NT.*/
80 DECLCALLBACKMEMBER_EX(BOOL, WINAPI, pfnEnumDisplayDevices,(IN LPCSTR lpDevice, IN DWORD iDevNum,
81 OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags));
82
83 VBOXDISPKMT_CALLBACKS KmtCallbacks;
84 } wddm;
85#endif
86 } modeData;
87} VBOXDISPIF, *PVBOXDISPIF;
88typedef const struct VBOXDISPIF *PCVBOXDISPIF;
89
90/* initializes the DispIf
91 * Initially the DispIf is configured to work in XPDM mode
92 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
93DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
94DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
95DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
96DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
97DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
98DWORD VBoxDispIfEscapeInOut(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
99DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
100DWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf);
101DWORD VBoxDispIfResizeStarted(PCVBOXDISPIF const pIf);
102
103BOOL VBoxDispIfResizeDisplayWin7(PCVBOXDISPIF const pIf, uint32_t cDispDef, const VMMDevDisplayDef *paDispDef);
104
105typedef struct VBOXDISPIF_SEAMLESS
106{
107 PCVBOXDISPIF pIf;
108
109 union
110 {
111#ifdef VBOX_WITH_WDDM
112 struct
113 {
114 VBOXDISPKMT_ADAPTER Adapter;
115# ifdef VBOX_DISPIF_WITH_OPCONTEXT
116 VBOXDISPKMT_DEVICE Device;
117 VBOXDISPKMT_CONTEXT Context;
118# endif
119 } wddm;
120#endif
121 } modeData;
122} VBOXDISPIF_SEAMLESS;
123
124DECLINLINE(bool) VBoxDispIfSeamlesIsValid(VBOXDISPIF_SEAMLESS *pSeamless)
125{
126 return !!pSeamless->pIf;
127}
128
129DWORD VBoxDispIfSeamlessCreate(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent);
130DWORD VBoxDispIfSeamlessTerm(VBOXDISPIF_SEAMLESS *pSeamless);
131DWORD VBoxDispIfSeamlessSubmit(VBOXDISPIF_SEAMLESS *pSeamless, VBOXDISPIFESCAPE *pData, int cbData);
132
133#endif /* !GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h */
134
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