]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - ubuntu/vbox/vboxvideo/vboxvideo_guest.h
UBUNTU: ubuntu: vbox -- update to 5.2.2-dfsg-2
[mirror_ubuntu-bionic-kernel.git] / ubuntu / vbox / vboxvideo / vboxvideo_guest.h
1 /*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 #ifndef ___VBox_Graphics_VBoxVideoGuest_h___
28 #define ___VBox_Graphics_VBoxVideoGuest_h___
29
30 #include "vbox_err.h"
31 #include "vbox_drv.h"
32 #include "vboxvideo.h"
33
34
35 /**
36 * Structure grouping the context needed for sending graphics acceleration
37 * information to the host via VBVA. Each screen has its own VBVA buffer.
38 */
39 typedef struct vbva_buf_context {
40 /** Offset of the buffer in the VRAM section for the screen */
41 u32 buffer_offset;
42 /** Length of the buffer in bytes */
43 u32 buffer_length;
44 /** This flag is set if we wrote to the buffer faster than the host could
45 * read it. */
46 bool buffer_overflow;
47 /** The VBVA record that we are currently preparing for the host, NULL if
48 * none. */
49 struct VBVARECORD *record;
50 /** Pointer to the VBVA buffer mapped into the current address space. Will
51 * be NULL if VBVA is not enabled. */
52 struct VBVABUFFER *vbva;
53 } vbva_buf_context, *PVBVABUFFERCONTEXT;
54
55 /** @name base HGSMI APIs
56 * @{ */
57
58 bool VBoxHGSMIIsSupported(void);
59 void VBoxHGSMIGetBaseMappingInfo(u32 cbVRAM,
60 u32 *poffVRAMBaseMapping,
61 u32 *pcbMapping,
62 u32 *poffGuestHeapMemory,
63 u32 *pcbGuestHeapMemory,
64 u32 *poffHostFlags);
65 int hgsmi_report_flags_location(struct gen_pool * ctx,
66 u32 location);
67 int hgsmi_send_caps_info(struct gen_pool * ctx,
68 u32 caps);
69 void VBoxHGSMIGetHostAreaMapping(struct gen_pool * ctx,
70 u32 cbVRAM,
71 u32 offVRAMBaseMapping,
72 u32 *poffVRAMHostArea,
73 u32 *pcbHostArea);
74 int VBoxHGSMISendHostCtxInfo(struct gen_pool * ctx,
75 u32 offVRAMFlagsLocation,
76 u32 caps,
77 u32 offVRAMHostArea,
78 u32 cbHostArea);
79 int hgsmi_query_conf(struct gen_pool * ctx,
80 u32 index, u32 *value_ret);
81 int VBoxQueryConfHGSMIDef(struct gen_pool * ctx,
82 u32 index, u32 u32DefValue, u32 *value_ret);
83 int hgsmi_update_pointer_shape(struct gen_pool * ctx,
84 u32 flags,
85 u32 hot_x,
86 u32 hot_y,
87 u32 width,
88 u32 height,
89 u8 *pixels,
90 u32 len);
91 int hgsmi_cursor_position(struct gen_pool * ctx, bool report_position, u32 x, u32 y,
92 u32 *x_host, u32 *y_host);
93
94 /** @} */
95
96 /** @name VBVA APIs
97 * @{ */
98 bool vbva_enable(struct vbva_buf_context * ctx,
99 struct gen_pool * pHGSMICtx,
100 struct VBVABUFFER *vbva, s32 screen);
101 void vbva_disable(struct vbva_buf_context * ctx,
102 struct gen_pool * pHGSMICtx,
103 s32 screen);
104 bool vbva_buffer_begin_update(struct vbva_buf_context * ctx,
105 struct gen_pool * pHGSMICtx);
106 void vbva_buffer_end_update(struct vbva_buf_context * ctx);
107 bool VBoxVBVAWrite(struct vbva_buf_context * ctx,
108 struct gen_pool * pHGSMICtx,
109 const void *pv, u32 len);
110 bool VBoxVBVAOrderSupported(struct vbva_buf_context * ctx, unsigned code);
111 void VBoxVBVASetupBufferContext(struct vbva_buf_context * ctx,
112 u32 buffer_offset,
113 u32 buffer_length);
114
115 /** @} */
116
117 /** @name Modesetting APIs
118 * @{ */
119
120 u32 VBoxHGSMIGetMonitorCount(struct gen_pool * ctx);
121 u32 VBoxVideoGetVRAMSize(void);
122 bool VBoxVideoAnyWidthAllowed(void);
123 u16 VBoxHGSMIGetScreenFlags(struct gen_pool * ctx);
124
125 struct VBVAINFOVIEW;
126 /**
127 * Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
128 * the @a VBVAINFOVIEW structure for each screen.
129 *
130 * @returns iprt status code
131 * @param pvData context data for the callback, passed to @a
132 * VBoxHGSMISendViewInfo along with the callback
133 * @param pInfo array of @a VBVAINFOVIEW structures to be filled in
134 * @todo explicitly pass the array size
135 */
136 typedef int FNHGSMIFILLVIEWINFO(void *pvData,
137 struct VBVAINFOVIEW *pInfo,
138 u32 cViews);
139 /** Pointer to a FNHGSMIFILLVIEWINFO callback */
140 typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
141
142 int VBoxHGSMISendViewInfo(struct gen_pool * ctx,
143 u32 u32Count,
144 PFNHGSMIFILLVIEWINFO pfnFill,
145 void *pvData);
146 void VBoxVideoSetModeRegisters(u16 width, u16 height,
147 u16 cVirtWidth, u16 bpp,
148 u16 flags,
149 u16 cx, u16 cy);
150 bool VBoxVideoGetModeRegisters(u16 *pcWidth,
151 u16 *pcHeight,
152 u16 *pcVirtWidth,
153 u16 *pcBPP,
154 u16 *pfFlags);
155 void VBoxVideoDisableVBE(void);
156 void hgsmi_process_display_info(struct gen_pool * ctx,
157 u32 display,
158 s32 origin_x,
159 s32 origin_y,
160 u32 start_offset,
161 u32 pitch,
162 u32 width,
163 u32 height,
164 u16 bpp,
165 u16 flags);
166 int hgsmi_update_input_mapping(struct gen_pool * ctx, s32 origin_x, s32 origin_y,
167 u32 width, u32 height);
168 int hgsmi_get_mode_hints(struct gen_pool * ctx,
169 unsigned screens, struct vbva_modehint *hints);
170
171 /** @} */
172
173
174 #endif
175