VBoxDispIf.h revision 5e08da9a4148bb4cce3c079351a25cd5924c1d93
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync/** @file
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * VBoxTray - Display Settings Interface abstraction for XPDM & WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync/*
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * Copyright (C) 2006-2012 Oracle Corporation
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync *
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * available from http://www.virtualbox.org. This file is free software;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * you can redistribute it and/or modify it under the terms of the GNU
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * General Public License (GPL) as published by the Free Software
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#include <iprt/cdefs.h>
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#ifdef VBOX_WITH_WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync# define D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync# include <d3dkmthk.h>
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#endif
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#include <VBoxDisplay.h>
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsynctypedef enum
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync{
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync VBOXDISPIF_MODE_UNKNOWN = 0,
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync VBOXDISPIF_MODE_XPDM_NT4 = 1,
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync VBOXDISPIF_MODE_XPDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#ifdef VBOX_WITH_WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync , VBOXDISPIF_MODE_WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#endif
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync} VBOXDISPIF_MODE;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync/* display driver interface abstraction for XPDM & WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * with WDDM we can not use ExtEscape to communicate with our driver
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * because we do not have XPDM display driver any more, i.e. escape requests are handled by cdd
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * that knows nothing about us
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * NOTE: DispIf makes no checks whether the display driver is actually a VBox driver,
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * it just switches between using different backend OS API based on the VBoxDispIfSwitchMode call
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * It's caller's responsibility to initiate it to work in the correct mode */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsynctypedef struct VBOXDISPIF
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync{
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync VBOXDISPIF_MODE enmMode;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* with WDDM the approach is to call into WDDM miniport driver via PFND3DKMT API provided by the GDI,
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * The PFND3DKMT is supposed to be used by the OpenGL ICD according to MSDN, so this approach is a bit hacky */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync union
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync {
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync struct
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync {
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync } xpdm;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#ifdef VBOX_WITH_WDDM
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync struct
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync {
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* ChangeDisplaySettingsEx does not exist in NT. ResizeDisplayDevice uses the function. */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync LONG (WINAPI * pfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* EnumDisplayDevices does not exist in NT. isVBoxDisplayDriverActive et al. are using these functions. */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync BOOL (WINAPI * pfnEnumDisplayDevices)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* open adapter */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* close adapter */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* escape */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_ESCAPE pfnD3DKMTEscape;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync /* auto resize support */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_INVALIDATEACTIVEVIDPN pfnD3DKMTInvalidateActiveVidPn;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync PFND3DKMT_POLLDISPLAYCHILDREN pfnD3DKMTPollDisplayChildren;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync } wddm;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync#endif
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync } modeData;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync} VBOXDISPIF, *PVBOXDISPIF;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsynctypedef const struct VBOXDISPIF *PCVBOXDISPIF;
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync/* initializes the DispIf
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * Initially the DispIf is configured to work in XPDM mode
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync * call VBoxDispIfSwitchMode to switch the mode to WDDM */
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfInit(PVBOXDISPIF pIf);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfSwitchMode(PVBOXDISPIF pIf, VBOXDISPIF_MODE enmMode, VBOXDISPIF_MODE *penmOldMode);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDECLINLINE(VBOXDISPIF_MODE) VBoxDispGetMode(PVBOXDISPIF pIf) { return pIf->enmMode; }
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfTerm(PVBOXDISPIF pIf);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfEscape(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfEscapeInOut(PCVBOXDISPIF const pIf, PVBOXDISPIFESCAPE pEscape, int cbData);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfResize(PCVBOXDISPIF const pIf, ULONG Id, DWORD Width, DWORD Height, DWORD BitsPerPixel);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfResizeModes(PCVBOXDISPIF const pIf, UINT iChangedMode, DISPLAY_DEVICE *paDisplayDevices, DEVMODE *paDeviceModes, UINT cDevModes);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD VBoxDispIfCancelPendingResize(PCVBOXDISPIF const pIf);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD vboxDispIfWddmEnableDisplay(PCVBOXDISPIF const pIf, UINT Id, bool fEnabled);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsyncDWORD vboxDispIfWddmResizeDisplay(PCVBOXDISPIF const pIf, UINT Id, DISPLAY_DEVICE * paDisplayDevices, DEVMODE *paDeviceMode, UINT devModes);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync//DWORD VBoxDispIfReninitModes(PCVBOXDISPIF const pIf, uint8_t *pScreenIdMask, BOOL fReconnectDisplaysOnChange);
beb1b4125f65953ac9ed0ba843cf6248e333d860vboxsync