VirtualBox

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

Last change on this file since 34575 was 34130, checked in by vboxsync, 14 years ago

wddm: autoresize fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
3 */
4
5/*
6 * Copyright (C) 2006-2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16#include <iprt/cdefs.h>
17
18#include <windows.h>
19#ifdef VBOX_WITH_WDDM
20# include <d3dkmthk.h>
21#endif
22
23#include <VBoxDisplay.h>
24
25typedef enum
26{
27 VBOXDISPIF_MODE_UNKNOWN = 0,
28 VBOXDISPIF_MODE_XPDM_NT4 = 1,
29 VBOXDISPIF_MODE_XPDM
30#ifdef VBOX_WITH_WDDM
31 , VBOXDISPIF_MODE_WDDM
32#endif
33} VBOXDISPIF_MODE;
34/* display driver interface abstraction for XPDM & WDDM
35 * with WDDM we can not use ExtEscape to communicate with our driver
36 * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
37 * that knows nothing about us
38 * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
39 * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
40 * It's caller's responsibility to initiate it to work in the correct mode */
41typedef struct VBOXDISPIF
42{
43 VBOXDISPIF_MODE enmMode;
44 /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
45 * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
46 union
47 {
48 struct
49 {
50 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
51 } xpdm;
52#ifdef VBOX_WITH_WDDM
53 struct
54 {
55 /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
56 LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
57
58 /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
59 BOOL (WINAPI * pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags);
60
61 /* open adapter */
62 PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
63 PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName;
64 /* close adapter */
65 PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
66 /* escape */
67 PFND3DKMT_ESCAPE pfnD3DKMTEscape;
68 /* auto resize support */
69 PFND3DKMT_INVALIDATEACTIVEVIDPN pfnD3DKMTInvalidateActiveVidPn;
70 } wddm;
71#endif
72 } modeData;
73} VBOXDISPIF, *PVBOXDISPIF;
74typedef const struct VBOXDISPIF *PCVBOXDISPIF;
75
76/* initializes the DispIf
77 * Initially the DispIf is configured to work in XPDM mode
78 * call VBoxDispIfSwitchMode to switch the mode to WDDM */
79DWORD VBoxDispIfInit(PVBOXDISPIF pIf);
80DWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
81DECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
82DWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
83DWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
84DWORD VBoxDispIfResize(PCVBOXDISPIF const pIf, ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel);
85DWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
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