1 | /* $Id: VBoxMPCommon.h 42217 2012-07-18 20:41:29Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Miniport common functions used by XPDM/WDDM drivers
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011 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 VBOXMPCOMMON_H
|
---|
19 | #define VBOXMPCOMMON_H
|
---|
20 |
|
---|
21 | #include "VBoxMPDevExt.h"
|
---|
22 |
|
---|
23 | RT_C_DECLS_BEGIN
|
---|
24 |
|
---|
25 | int VBoxMPCmnMapAdapterMemory(PVBOXMP_COMMON pCommon, void **ppv, uint32_t ulOffset, uint32_t ulSize);
|
---|
26 | void VBoxMPCmnUnmapAdapterMemory(PVBOXMP_COMMON pCommon, void **ppv);
|
---|
27 |
|
---|
28 | typedef bool(*PFNVIDEOIRQSYNC)(void *);
|
---|
29 | bool VBoxMPCmnSyncToVideoIRQ(PVBOXMP_COMMON pCommon, PFNVIDEOIRQSYNC pfnSync, void *pvUser);
|
---|
30 |
|
---|
31 | /* Video modes related */
|
---|
32 | #define VBOXMP_MAX_VIDEO_MODES 128
|
---|
33 | void VBoxMPCmnInitCustomVideoModes(PVBOXMP_DEVEXT pExt);
|
---|
34 | VIDEO_MODE_INFORMATION* VBoxMPCmnGetCustomVideoModeInfo(ULONG ulIndex);
|
---|
35 | VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(ULONG ulIndex);
|
---|
36 |
|
---|
37 | #ifdef VBOX_XPDM_MINIPORT
|
---|
38 | VIDEO_MODE_INFORMATION* VBoxMPXpdmCurrentVideoMode(PVBOXMP_DEVEXT pExt);
|
---|
39 | ULONG VBoxMPXpdmGetVideoModesCount();
|
---|
40 | void VBoxMPXpdmBuildVideoModesTable(PVBOXMP_DEVEXT pExt);
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #ifdef VBOX_WDDM_MINIPORT
|
---|
44 | void VBoxWddmInvalidateAllVideoModesInfos(PVBOXMP_DEVEXT pExt);
|
---|
45 | void VBoxWddmInvalidateVideoModesInfo(PVBOXMP_DEVEXT pExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId);
|
---|
46 | PVBOXWDDM_VIDEOMODES_INFO VBoxWddmUpdateVideoModesInfoByMask(PVBOXMP_DEVEXT pExt, uint8_t *pScreenIdMask);
|
---|
47 | PVBOXWDDM_VIDEOMODES_INFO VBoxWddmUpdateAllVideoModesInfos(PVBOXMP_DEVEXT pExt);
|
---|
48 | NTSTATUS VBoxWddmGetModesForResolution(VIDEO_MODE_INFORMATION *pAllModes, uint32_t cAllModes, int iSearchPreferredMode,
|
---|
49 | const D3DKMDT_2DREGION *pResolution, VIDEO_MODE_INFORMATION * pModes,
|
---|
50 | uint32_t cModes, uint32_t *pcModes, int32_t *piPreferrableMode);
|
---|
51 | PVBOXWDDM_VIDEOMODES_INFO VBoxWddmGetAllVideoModesInfos(PVBOXMP_DEVEXT pExt);
|
---|
52 | PVBOXWDDM_VIDEOMODES_INFO VBoxWddmGetVideoModesInfo(PVBOXMP_DEVEXT pExt, D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId);
|
---|
53 | bool VBoxWddmFillMode(VIDEO_MODE_INFORMATION *pInfo, D3DDDIFORMAT enmFormat, ULONG w, ULONG h);
|
---|
54 | bool VBoxWddmFillMode(VIDEO_MODE_INFORMATION *pInfo, D3DDDIFORMAT enmFormat, ULONG w, ULONG h);
|
---|
55 | void VBoxWddmAdjustMode(PVBOXMP_DEVEXT pExt, PVBOXWDDM_ADJUSTVIDEOMODE pMode);
|
---|
56 | void VBoxWddmAdjustModes(PVBOXMP_DEVEXT pExt, uint32_t cModes, PVBOXWDDM_ADJUSTVIDEOMODE aModes);
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | /* Registry access */
|
---|
60 | #ifdef VBOX_XPDM_MINIPORT
|
---|
61 | typedef PVBOXMP_DEVEXT VBOXMPCMNREGISTRY;
|
---|
62 | #else
|
---|
63 | typedef HANDLE VBOXMPCMNREGISTRY;
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | VP_STATUS VBoxMPCmnRegInit(IN PVBOXMP_DEVEXT pExt, OUT VBOXMPCMNREGISTRY *pReg);
|
---|
67 | VP_STATUS VBoxMPCmnRegFini(IN VBOXMPCMNREGISTRY Reg);
|
---|
68 | VP_STATUS VBoxMPCmnRegSetDword(IN VBOXMPCMNREGISTRY Reg, PWSTR pName, uint32_t Val);
|
---|
69 | VP_STATUS VBoxMPCmnRegQueryDword(IN VBOXMPCMNREGISTRY Reg, PWSTR pName, uint32_t *pVal);
|
---|
70 |
|
---|
71 | /* Pointer related */
|
---|
72 | inline bool VBoxMPCmnUpdatePointerShape(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_ATTRIBUTES pAttrs, uint32_t cbLength)
|
---|
73 | {
|
---|
74 | return VBoxHGSMIUpdatePointerShape(&pCommon->guestCtx,
|
---|
75 | pAttrs->Enable & 0x0000FFFF,
|
---|
76 | (pAttrs->Enable >> 16) & 0xFF,
|
---|
77 | (pAttrs->Enable >> 24) & 0xFF,
|
---|
78 | pAttrs->Width, pAttrs->Height, pAttrs->Pixels,
|
---|
79 | cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES));
|
---|
80 | }
|
---|
81 |
|
---|
82 | RT_C_DECLS_END
|
---|
83 |
|
---|
84 | #endif /*VBOXMPCOMMON_H*/
|
---|