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