VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h@ 34382

Last change on this file since 34382 was 34349, checked in by vboxsync, 15 years ago

Additions/WINNT/Graphics: more refactoring

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/** @file
2 * VirtualBox Video miniport driver
3 *
4 * Copyright (C) 2006-2007 Oracle Corporation
5 *
6 * This file is part of VirtualBox Open Source Edition (OSE), as
7 * available from http://www.virtualbox.org. This file is free software;
8 * you can redistribute it and/or modify it under the terms of the GNU
9 * General Public License (GPL) as published by the Free Software
10 * Foundation, in version 2 as it comes in the "COPYING" file of the
11 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
12 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13 */
14
15#ifndef VBOXVIDEO_H
16#define VBOXVIDEO_H
17
18#include <VBox/cdefs.h>
19#include <VBox/types.h>
20#include <iprt/assert.h>
21
22//#include <iprt/thread.h>
23
24#include <VBox/VBoxVideoGuest.h>
25#include <VBox/VBoxVideo.h>
26#include "VBoxHGSMI.h"
27
28#define VBE_DISPI_IOPORT_INDEX 0x01CE
29#define VBE_DISPI_IOPORT_DATA 0x01CF
30#define VBE_DISPI_INDEX_ID 0x0
31#define VBE_DISPI_INDEX_XRES 0x1
32#define VBE_DISPI_INDEX_YRES 0x2
33#define VBE_DISPI_INDEX_BPP 0x3
34#define VBE_DISPI_INDEX_ENABLE 0x4
35#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
36#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
37#define VBE_DISPI_INDEX_X_OFFSET 0x8
38#define VBE_DISPI_INDEX_Y_OFFSET 0x9
39#define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
40
41#define VBE_DISPI_ID2 0xB0C2
42/* The VBOX interface id. Indicates support for VBE_DISPI_INDEX_VBOX_VIDEO. */
43#define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
44#define VBE_DISPI_ID_HGSMI 0xBE01
45#define VBE_DISPI_ID_ANYX 0xBE02
46#define VBE_DISPI_DISABLED 0x00
47#define VBE_DISPI_ENABLED 0x01
48#define VBE_DISPI_LFB_ENABLED 0x40
49#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
50#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
51#define VBE_DISPI_TOTAL_VIDEO_MEMORY_KB (VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024)
52#define VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES (VBE_DISPI_TOTAL_VIDEO_MEMORY_KB * 1024)
53
54#define VGA_PORT_HGSMI_HOST 0x3b0
55#define VGA_PORT_HGSMI_GUEST 0x3d0
56
57typedef struct VBOXVIDEO_COMMON
58{
59 int cDisplays; /* Number of displays. */
60
61 uint32_t cbVRAM; /* The VRAM size. */
62
63 uint32_t cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
64 * It is at offset:
65 * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
66 */
67 void *pvMiniportHeap; /* The pointer to the miniport heap VRAM.
68 * This is mapped by miniport separately.
69 */
70 void *pvAdapterInformation; /* The pointer to the last 4K of VRAM.
71 * This is mapped by miniport separately.
72 */
73
74 /** Whether HGSMI is enabled. */
75 bool bHGSMI;
76 /** Context information needed to receive commands from the host. */
77 HGSMIHOSTCOMMANDCONTEXT hostCtx;
78 /** Context information needed to submit commands to the host. */
79 HGSMIGUESTCOMMANDCONTEXT guestCtx;
80} VBOXVIDEO_COMMON, *PVBOXVIDEO_COMMON;
81
82extern "C"
83{
84/** Signal an event in a guest-OS-specific way. pvEvent will be re-cast to
85 * something OS-specific. */
86void VBoxVideoCmnSignalEvent(PVBOXVIDEO_COMMON pCommon, uint64_t pvEvent);
87
88/** Allocate memory to be used in normal driver operation (dispatch level in
89 * Windows) but not necessarily in IRQ context. */
90void *VBoxVideoCmnMemAllocDriver(PVBOXVIDEO_COMMON pCommon, size_t cb);
91
92/** Free memory allocated by @a VBoxVideoCmnMemAllocDriver */
93void VBoxVideoCmnMemFreeDriver(PVBOXVIDEO_COMMON pCommon, void *pv);
94
95/** Write an 8-bit value to an I/O port. */
96void VBoxVideoCmnPortWriteUchar(RTIOPORT Port, uint8_t Value);
97
98/** Write a 16-bit value to an I/O port. */
99void VBoxVideoCmnPortWriteUshort(RTIOPORT Port, uint16_t Value);
100
101/** Write a 32-bit value to an I/O port. */
102void VBoxVideoCmnPortWriteUlong(RTIOPORT Port, uint32_t Value);
103
104/** Read an 8-bit value from an I/O port. */
105uint8_t VBoxVideoCmnPortReadUchar(RTIOPORT Port);
106
107/** Read a 16-bit value from an I/O port. */
108uint16_t VBoxVideoCmnPortReadUshort(RTIOPORT Port);
109
110/** Read a 32-bit value from an I/O port. */
111uint32_t VBoxVideoCmnPortReadUlong(RTIOPORT Port);
112
113void* vboxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
114 HGSMISIZE cbData,
115 uint8_t u8Ch,
116 uint16_t u16Op);
117void vboxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer);
118int vboxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void *pvBuffer);
119
120int VBoxMapAdapterMemory (PVBOXVIDEO_COMMON pCommon,
121 void **ppv,
122 uint32_t ulOffset,
123 uint32_t ulSize);
124
125void VBoxUnmapAdapterMemory (PVBOXVIDEO_COMMON pCommon, void **ppv);
126
127typedef bool(*PFNVIDEOIRQSYNC)(void *);
128bool VBoxSyncToVideoIRQ(PVBOXVIDEO_COMMON pCommon, PFNVIDEOIRQSYNC pfnSync,
129 void *pvUser);
130
131bool VBoxHGSMIIsSupported (void);
132
133typedef int FNHGSMIFILLVIEWINFO (void *pvData, VBVAINFOVIEW *pInfo);
134typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
135
136int VBoxHGSMISendViewInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t u32Count, PFNHGSMIFILLVIEWINFO pfnFill, void *pvData);
137
138void VBoxSetupDisplaysHGSMI (PVBOXVIDEO_COMMON pCommon,
139 uint32_t AdapterMemorySize, uint32_t fCaps);
140
141bool vboxUpdatePointerShape (PHGSMIGUESTCOMMANDCONTEXT pCtx,
142 uint32_t fFlags,
143 uint32_t cHotX,
144 uint32_t cHotY,
145 uint32_t cWidth,
146 uint32_t cHeight,
147 uint8_t *pPixels,
148 uint32_t cbLength);
149
150void VBoxFreeDisplaysHGSMI(PVBOXVIDEO_COMMON pCommon);
151#ifndef VBOX_WITH_WDDM
152DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd);
153DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, uint32_t iDisplay, struct _VBVAHOSTCMD ** ppCmd);
154#endif
155
156
157int vboxVBVAChannelDisplayEnable(PVBOXVIDEO_COMMON pCommon,
158 int iDisplay, /* negative would mean this is a miniport handler */
159 uint8_t u8Channel);
160
161void hgsmiProcessHostCommandQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx);
162
163void HGSMIClearIrq(PHGSMIHOSTCOMMANDCONTEXT pCtx);
164
165} /* extern "C" */
166
167#endif /* VBOXVIDEO_H */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette