VirtualBox

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

Last change on this file since 93668 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: VBoxDispIf.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
4 */
5
6/*
7 * Copyright (C) 2006-2022 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
18#ifndef GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h
19#define GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/cdefs.h>
25
26#ifdef VBOX_WITH_WDDM
27# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
28# include <iprt/win/d3dkmthk.h>
29# include <VBoxDispKmt.h>
30#endif
31
32#include <VBoxDisplay.h>
33
34typedef enum
35{
36 VBOXDISPIF_MODE_UNKNOWN = 0,
37 VBOXDISPIF_MODE_XPDM_NT4 = 1,
38 VBOXDISPIF_MODE_XPDM
39#ifdef VBOX_WITH_WDDM
40 , VBOXDISPIF_MODE_WDDM
41 , VBOXDISPIF_MODE_WDDM_W7
42#endif
43} VBOXDISPIF_MODE;
44/* display driver interface abstraction for XPDM & WDDM
45 * with WDDM we can not use ExtEscape to communicate with our driver
46 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
47 * that knows nothing about us
48 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
49 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
50 * It's caller's responsibility to initiate it to work in the correct mode */
51typedef struct VBOXDISPIF
52{
53 VBOXDISPIF_MODE enmMode;
54 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
55 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
56 union
57 {
58 struct
59 {
60 DECLCALLBACKMEMBER_EX(LONG, WINAPI, pfnChangeDisplaySettingsEx,(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode,
61 HWND hwnd, DWORD dwflags, LPVOID lParam));
62 } xpdm;
63#ifdef VBOX_WITH_WDDM
64 struct
65 {
66 /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
67 DECLCALLBACKMEMBER_EX(LONG, WINAPI, pfnChangeDisplaySettingsEx,(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode,
68 HWND hwnd, DWORD dwflags, LPVOID lParam));
69 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
70 DECLCALLBACKMEMBER_EX(BOOL, WINAPI, pfnEnumDisplayDevices,(IN LPCSTR lpDevice, IN DWORD iDevNum,
71 OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags));
72
73 VBOXDISPKMT_CALLBACKS KmtCallbacks;
74 } wddm;
75#endif
76 } modeData;
77} VBOXDISPIF, *PVBOXDISPIF;
78typedef const struct VBOXDISPIF *PCVBOXDISPIF;
79
80/* initializes the DispIf
81 * Initially the DispIf is configured to work in XPDM mode
82 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
83DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
84DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
85DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
86DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
87DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
88DWORD VBoxDispIfEscapeInOut(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
89DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, UINT iChangedMode, BOOL fEnable, BOOL fExtDispSup, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
90DWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf);
91DWORD VBoxDispIfResizeStarted(PCVBOXDISPIF const pIf);
92
93BOOL VBoxDispIfResizeDisplayWin7(PCVBOXDISPIF const pIf, uint32_t cDispDef, const VMMDevDisplayDef *paDispDef);
94
95typedef struct VBOXDISPIF_SEAMLESS
96{
97 PCVBOXDISPIF pIf;
98
99 union
100 {
101#ifdef VBOX_WITH_WDDM
102 struct
103 {
104 VBOXDISPKMT_ADAPTER Adapter;
105# ifdef VBOX_DISPIF_WITH_OPCONTEXT
106 VBOXDISPKMT_DEVICE Device;
107 VBOXDISPKMT_CONTEXT Context;
108# endif
109 } wddm;
110#endif
111 } modeData;
112} VBOXDISPIF_SEAMLESS;
113
114DECLINLINE(bool) VBoxDispIfSeamlesIsValid(VBOXDISPIF_SEAMLESS *pSeamless)
115{
116 return !!pSeamless->pIf;
117}
118
119DWORD VBoxDispIfSeamlessCreate(PCVBOXDISPIF const pIf, VBOXDISPIF_SEAMLESS *pSeamless, HANDLE hEvent);
120DWORD VBoxDispIfSeamlessTerm(VBOXDISPIF_SEAMLESS *pSeamless);
121DWORD VBoxDispIfSeamlessSubmit(VBOXDISPIF_SEAMLESS *pSeamless, VBOXDISPIFESCAPE *pData, int cbData);
122
123#endif /* !GA_INCLUDED_SRC_WINNT_VBoxTray_VBoxDispIf_h */
124
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