2 * Copyright (C) 2006-2017 Oracle Corporation
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
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
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.
27 #ifndef ___VBox_Graphics_VBoxVideoGuest_h___
28 #define ___VBox_Graphics_VBoxVideoGuest_h___
32 #include "vboxvideo.h"
36 * Structure grouping the context needed for sending graphics acceleration
37 * information to the host via VBVA. Each screen has its own VBVA buffer.
39 typedef struct vbva_buf_context
{
40 /** Offset of the buffer in the VRAM section for the screen */
42 /** Length of the buffer in bytes */
44 /** This flag is set if we wrote to the buffer faster than the host could
47 /** The VBVA record that we are currently preparing for the host, NULL if
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
;
55 /** @name base HGSMI APIs
58 bool VBoxHGSMIIsSupported(void);
59 void VBoxHGSMIGetBaseMappingInfo(u32 cbVRAM
,
60 u32
*poffVRAMBaseMapping
,
62 u32
*poffGuestHeapMemory
,
63 u32
*pcbGuestHeapMemory
,
65 int hgsmi_report_flags_location(struct gen_pool
* ctx
,
67 int hgsmi_send_caps_info(struct gen_pool
* ctx
,
69 void VBoxHGSMIGetHostAreaMapping(struct gen_pool
* ctx
,
71 u32 offVRAMBaseMapping
,
72 u32
*poffVRAMHostArea
,
74 int VBoxHGSMISendHostCtxInfo(struct gen_pool
* ctx
,
75 u32 offVRAMFlagsLocation
,
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
,
91 int hgsmi_cursor_position(struct gen_pool
* ctx
, bool report_position
, u32 x
, u32 y
,
92 u32
*x_host
, u32
*y_host
);
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
,
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
,
117 /** @name Modesetting APIs
120 u32
VBoxHGSMIGetMonitorCount(struct gen_pool
* ctx
);
121 u32
VBoxVideoGetVRAMSize(void);
122 bool VBoxVideoAnyWidthAllowed(void);
123 u16
VBoxHGSMIGetScreenFlags(struct gen_pool
* ctx
);
127 * Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
128 * the @a VBVAINFOVIEW structure for each screen.
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
136 typedef int FNHGSMIFILLVIEWINFO(void *pvData
,
137 struct VBVAINFOVIEW
*pInfo
,
139 /** Pointer to a FNHGSMIFILLVIEWINFO callback */
140 typedef FNHGSMIFILLVIEWINFO
*PFNHGSMIFILLVIEWINFO
;
142 int VBoxHGSMISendViewInfo(struct gen_pool
* ctx
,
144 PFNHGSMIFILLVIEWINFO pfnFill
,
146 void VBoxVideoSetModeRegisters(u16 width
, u16 height
,
147 u16 cVirtWidth
, u16 bpp
,
150 bool VBoxVideoGetModeRegisters(u16
*pcWidth
,
155 void VBoxVideoDisableVBE(void);
156 void hgsmi_process_display_info(struct gen_pool
* ctx
,
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
);