VirtualBox

source: vbox/trunk/include/VBox/VBoxVideo.h@ 4027

Last change on this file since 4027 was 4027, checked in by vboxsync, 18 years ago

Direct draw heap and miniport heap memory reservation for Windows guest additions.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/** @file
2 * VirtualBox Video interface
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21#ifndef ___VBox_VBoxVideo_h
22#define ___VBox_VBoxVideo_h
23
24#include <iprt/cdefs.h>
25#include <iprt/types.h>
26
27/*
28 * The last 4096 bytes of the guest VRAM contains the generic info for all
29 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
30 *
31 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
32 * etc. This is used exclusively by the corresponding instance of a display driver.
33 *
34 * The VRAM layout:
35 * Last 4096 bytes - Adapter information area.
36 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
37 * Slack - what left after dividing the VRAM.
38 * 4096 bytes aligned framebuffers:
39 * last 4096 bytes of each framebuffer is the display information area.
40 *
41 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
42 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
43 *
44 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
45 * the host starts to process the info. The first element at the start of
46 * the 4096 bytes region should be normally be a LINK that points to
47 * actual information chain. That way the guest driver can have some
48 * fixed layout of the information memory block and just rewrite
49 * the link to point to relevant memory chain.
50 *
51 * The processing stops at the END element.
52 *
53 * The host can access the memory only when the port IO is processed.
54 * All data that will be needed later must be copied from these 4096 bytes.
55 * But other VRAM can be used by host until the mode is disabled.
56 *
57 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
58 * to disable the mode.
59 *
60 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
61 * from the host and issue commands to the host.
62 *
63 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
64 * following operations with the VBE data register can be performed:
65 *
66 * Operation Result
67 * write 16 bit value NOP
68 * read 16 bit value count of monitors
69 * write 32 bit value sets the vbox command value and the command processed by the host
70 * read 32 bit value result of the last vbox command is returned
71 */
72
73#define VBOX_VIDEO_PRIMARY_SCREEN 0
74#define VBOX_VIDEO_NO_SCREEN ~0
75
76#define VBOX_VIDEO_MAX_SCREENS 64
77
78/* The size of the information. */
79#define VBOX_VIDEO_ADAPTER_INFORMATION_SIZE 4096
80#define VBOX_VIDEO_DISPLAY_INFORMATION_SIZE 4096
81
82
83/* The value for port IO to let the adapter to interpret the adapter memory. */
84#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
85
86/* The value for port IO to let the adapter to interpret the adapter memory. */
87#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
88
89/* The value for port IO to let the adapter to interpret the display memory.
90 * The display number is encoded in low 16 bits.
91 */
92#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
93
94/* The value for port IO to read the number of monitors.
95 */
96#define VBOX_VIDEO_QUERY_MONITOR_COUNT 0x00020000
97
98/* The value for port IO to read the offscreen heap size value.
99 */
100#define VBOX_VIDEO_QUERY_OFFSCREEN_HEAP_SIZE 0x00020001
101
102/* The end of the information. */
103#define VBOX_VIDEO_INFO_TYPE_END 0
104/* Instructs the host to fetch the next VBOXVIDEOINFOHDR at the given offset of VRAM. */
105#define VBOX_VIDEO_INFO_TYPE_LINK 1
106/* Information about a display memory position. */
107#define VBOX_VIDEO_INFO_TYPE_DISPLAY 2
108/* Information about a screen. */
109#define VBOX_VIDEO_INFO_TYPE_SCREEN 3
110/* Information about host notifications for the driver. */
111#define VBOX_VIDEO_INFO_TYPE_HOST_EVENTS 4
112/* Information about non-volatile guest VRAM heap. */
113#define VBOX_VIDEO_INFO_TYPE_NV_HEAP 5
114
115
116#pragma pack(1)
117typedef struct _VBOXVIDEOINFOHDR
118{
119 uint8_t u8Type;
120 uint8_t u8Reserved;
121 uint16_t u16Length;
122} VBOXVIDEOINFOHDR;
123
124
125typedef struct _VBOXVIDEOINFOLINK
126{
127 /* Relative offset in VRAM */
128 int32_t i32Offset;
129} VBOXVIDEOINFOLINK;
130
131
132/* Resides in adapter info memory. Describes a display VRAM chunk. */
133typedef struct _VBOXVIDEOINFODISPLAY
134{
135 /* Index of the framebuffer assigned by guest. */
136 uint32_t u32Index;
137
138 /* Absolute offset in VRAM of the framebuffer to be displayed on the monitor. */
139 uint32_t u32Offset;
140
141 /* The size of the memory that can be used for the screen. */
142 uint32_t u32FramebufferSize;
143
144 /* The size of the memory that is used for the Display information.
145 * The information is at u32Offset + u32FramebufferSize
146 */
147 uint32_t u32InformationSize;
148
149} VBOXVIDEOINFODISPLAY;
150
151
152/* Resides in display info area, describes the current video mode. */
153#define VBOX_VIDEO_INFO_SCREEN_F_NONE 0x00
154#define VBOX_VIDEO_INFO_SCREEN_F_ACTIVE 0x01
155
156typedef struct _VBOXVIDEOINFOSCREEN
157{
158 /* Physical X origin relative to the primary screen. */
159 int32_t xOrigin;
160
161 /* Physical Y origin relative to the primary screen. */
162 int32_t yOrigin;
163
164 /* The scan line size in bytes. */
165 uint32_t u32LineSize;
166
167 /* Width of the screen. */
168 uint16_t u16Width;
169
170 /* Height of the screen. */
171 uint16_t u16Height;
172
173 /* Color depth. */
174 uint8_t bitsPerPixel;
175
176 /* VBOX_VIDEO_INFO_SCREEN_F_* */
177 uint8_t u8Flags;
178} VBOXVIDEOINFOSCREEN;
179
180/* The guest initializes the structure to 0. The positions of the structure in the
181 * display info area must not be changed, host will update the structure. Guest checks
182 * the events and modifies the structure as a response to host.
183 */
184#define VBOX_VIDEO_INFO_HOST_EVENTS_F_NONE 0x00000000
185#define VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET 0x00000080
186
187typedef struct _VBOXVIDEOINFOHOSTEVENTS
188{
189 /* Host events. */
190 uint32_t fu32Events;
191} VBOXVIDEOINFOHOSTEVENTS;
192
193/* Resides in adapter info memory. Describes the non-volatile VRAM heap. */
194typedef struct _VBOXVIDEOINFONVHEAP
195{
196 /* Absolute offset in VRAM of the start of the heap. */
197 uint32_t u32HeapOffset;
198
199 /* The size of the heap. */
200 uint32_t u32HeapSize;
201
202} VBOXVIDEOINFONVHEAP;
203#pragma pack()
204
205#endif
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