[69015] | 1 | /* $Id: VBoxVideoGuest.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
[34346] | 2 | /** @file
|
---|
[68672] | 3 | * VBox Host Guest Shared Memory Interface (HGSMI) - OS-independent guest structures.
|
---|
[34346] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[34346] | 8 | *
|
---|
[69307] | 9 | * Permission is hereby granted, free of charge, to any person
|
---|
| 10 | * obtaining a copy of this software and associated documentation
|
---|
| 11 | * files (the "Software"), to deal in the Software without
|
---|
| 12 | * restriction, including without limitation the rights to use,
|
---|
| 13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
| 14 | * copies of the Software, and to permit persons to whom the
|
---|
| 15 | * Software is furnished to do so, subject to the following
|
---|
| 16 | * conditions:
|
---|
[34346] | 17 | *
|
---|
[69307] | 18 | * The above copyright notice and this permission notice shall be
|
---|
| 19 | * included in all copies or substantial portions of the Software.
|
---|
[34346] | 20 | *
|
---|
[69307] | 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
| 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
| 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
| 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
| 25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
| 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
[66544] | 28 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
[34346] | 29 | */
|
---|
| 30 |
|
---|
[76558] | 31 | #ifndef VBOX_INCLUDED_Graphics_VBoxVideoGuest_h
|
---|
| 32 | #define VBOX_INCLUDED_Graphics_VBoxVideoGuest_h
|
---|
[76507] | 33 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 34 | # pragma once
|
---|
| 35 | #endif
|
---|
[34346] | 36 |
|
---|
[68848] | 37 | #include "VBoxVideoIPRT.h"
|
---|
[68672] | 38 | #include "HGSMIBase.h"
|
---|
| 39 | #include "VBoxVideo.h"
|
---|
[34346] | 40 |
|
---|
[34429] | 41 | RT_C_DECLS_BEGIN
|
---|
| 42 |
|
---|
[34346] | 43 | /**
|
---|
[34438] | 44 | * Structure grouping the context needed for sending graphics acceleration
|
---|
| 45 | * information to the host via VBVA. Each screen has its own VBVA buffer.
|
---|
| 46 | */
|
---|
| 47 | typedef struct VBVABUFFERCONTEXT
|
---|
| 48 | {
|
---|
| 49 | /** Offset of the buffer in the VRAM section for the screen */
|
---|
| 50 | uint32_t offVRAMBuffer;
|
---|
| 51 | /** Length of the buffer in bytes */
|
---|
| 52 | uint32_t cbBuffer;
|
---|
| 53 | /** This flag is set if we wrote to the buffer faster than the host could
|
---|
| 54 | * read it. */
|
---|
| 55 | bool fHwBufferOverflow;
|
---|
| 56 | /** The VBVA record that we are currently preparing for the host, NULL if
|
---|
| 57 | * none. */
|
---|
[34490] | 58 | struct VBVARECORD *pRecord;
|
---|
[34438] | 59 | /** Pointer to the VBVA buffer mapped into the current address space. Will
|
---|
| 60 | * be NULL if VBVA is not enabled. */
|
---|
[34490] | 61 | struct VBVABUFFER *pVBVA;
|
---|
[34438] | 62 | } VBVABUFFERCONTEXT, *PVBVABUFFERCONTEXT;
|
---|
| 63 |
|
---|
[34429] | 64 | /** @name Base HGSMI APIs
|
---|
| 65 | * @{ */
|
---|
| 66 |
|
---|
[63271] | 67 | DECLHIDDEN(bool) VBoxHGSMIIsSupported(void);
|
---|
| 68 | DECLHIDDEN(void) VBoxHGSMIGetBaseMappingInfo(uint32_t cbVRAM,
|
---|
[63273] | 69 | uint32_t *poffVRAMBaseMapping,
|
---|
| 70 | uint32_t *pcbMapping,
|
---|
| 71 | uint32_t *poffGuestHeapMemory,
|
---|
| 72 | uint32_t *pcbGuestHeapMemory,
|
---|
| 73 | uint32_t *poffHostFlags);
|
---|
[63271] | 74 | DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 75 | HGSMIOFFSET offLocation);
|
---|
[63271] | 76 | DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 77 | uint32_t fCaps);
|
---|
[63271] | 78 | DECLHIDDEN(void) VBoxHGSMIGetHostAreaMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 79 | uint32_t cbVRAM,
|
---|
| 80 | uint32_t offVRAMBaseMapping,
|
---|
| 81 | uint32_t *poffVRAMHostArea,
|
---|
| 82 | uint32_t *pcbHostArea);
|
---|
[63271] | 83 | DECLHIDDEN(int) VBoxHGSMISendHostCtxInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 84 | HGSMIOFFSET offVRAMFlagsLocation,
|
---|
| 85 | uint32_t fCaps,
|
---|
| 86 | uint32_t offVRAMHostArea,
|
---|
| 87 | uint32_t cbHostArea);
|
---|
[63271] | 88 | DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[71651] | 89 | uint32_t u32Index, uint32_t *pulValue);
|
---|
[63271] | 90 | DECLHIDDEN(int) VBoxQueryConfHGSMIDef(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 91 | uint32_t u32Index, uint32_t u32DefValue, uint32_t *pulValue);
|
---|
[63271] | 92 | DECLHIDDEN(int) VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 93 | uint32_t fFlags,
|
---|
| 94 | uint32_t cHotX,
|
---|
| 95 | uint32_t cHotY,
|
---|
| 96 | uint32_t cWidth,
|
---|
| 97 | uint32_t cHeight,
|
---|
| 98 | uint8_t *pPixels,
|
---|
| 99 | uint32_t cbLength);
|
---|
[63271] | 100 | DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
|
---|
[63273] | 101 | uint32_t *pxHost, uint32_t *pyHost);
|
---|
[34429] | 102 |
|
---|
| 103 | /** @} */
|
---|
| 104 |
|
---|
[34438] | 105 | /** @name VBVA APIs
|
---|
| 106 | * @{ */
|
---|
[63271] | 107 | DECLHIDDEN(bool) VBoxVBVAEnable(PVBVABUFFERCONTEXT pCtx,
|
---|
[63273] | 108 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
| 109 | struct VBVABUFFER *pVBVA, int32_t cScreen);
|
---|
[63271] | 110 | DECLHIDDEN(void) VBoxVBVADisable(PVBVABUFFERCONTEXT pCtx,
|
---|
[63273] | 111 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
| 112 | int32_t cScreen);
|
---|
[63271] | 113 | DECLHIDDEN(bool) VBoxVBVABufferBeginUpdate(PVBVABUFFERCONTEXT pCtx,
|
---|
[63273] | 114 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx);
|
---|
[63271] | 115 | DECLHIDDEN(void) VBoxVBVABufferEndUpdate(PVBVABUFFERCONTEXT pCtx);
|
---|
| 116 | DECLHIDDEN(bool) VBoxVBVAWrite(PVBVABUFFERCONTEXT pCtx,
|
---|
[63273] | 117 | PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
|
---|
| 118 | const void *pv, uint32_t cb);
|
---|
[63271] | 119 | DECLHIDDEN(bool) VBoxVBVAOrderSupported(PVBVABUFFERCONTEXT pCtx, unsigned code);
|
---|
| 120 | DECLHIDDEN(void) VBoxVBVASetupBufferContext(PVBVABUFFERCONTEXT pCtx,
|
---|
[63273] | 121 | uint32_t offVRAMBuffer,
|
---|
| 122 | uint32_t cbBuffer);
|
---|
[34438] | 123 |
|
---|
| 124 | /** @} */
|
---|
| 125 |
|
---|
[34686] | 126 | /** @name Modesetting APIs
|
---|
| 127 | * @{ */
|
---|
| 128 |
|
---|
[63271] | 129 | DECLHIDDEN(uint32_t) VBoxHGSMIGetMonitorCount(PHGSMIGUESTCOMMANDCONTEXT pCtx);
|
---|
[71146] | 130 | DECLHIDDEN(bool) VBoxVGACfgAvailable(void);
|
---|
[71488] | 131 | DECLHIDDEN(bool) VBoxVGACfgQuery(uint16_t u16Id, uint32_t *pu32Value, uint32_t u32DefValue);
|
---|
[63271] | 132 | DECLHIDDEN(uint32_t) VBoxVideoGetVRAMSize(void);
|
---|
| 133 | DECLHIDDEN(bool) VBoxVideoAnyWidthAllowed(void);
|
---|
| 134 | DECLHIDDEN(uint16_t) VBoxHGSMIGetScreenFlags(PHGSMIGUESTCOMMANDCONTEXT pCtx);
|
---|
[34686] | 135 |
|
---|
| 136 | struct VBVAINFOVIEW;
|
---|
| 137 | /**
|
---|
| 138 | * Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
|
---|
| 139 | * the @a VBVAINFOVIEW structure for each screen.
|
---|
| 140 | *
|
---|
| 141 | * @returns iprt status code
|
---|
| 142 | * @param pvData context data for the callback, passed to @a
|
---|
| 143 | * VBoxHGSMISendViewInfo along with the callback
|
---|
| 144 | * @param pInfo array of @a VBVAINFOVIEW structures to be filled in
|
---|
| 145 | * @todo explicitly pass the array size
|
---|
| 146 | */
|
---|
[85121] | 147 | typedef DECLCALLBACKTYPE(int, FNHGSMIFILLVIEWINFO,(void *pvData, struct VBVAINFOVIEW *pInfo, uint32_t cViews));
|
---|
[34686] | 148 | /** Pointer to a FNHGSMIFILLVIEWINFO callback */
|
---|
| 149 | typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
|
---|
| 150 |
|
---|
[63271] | 151 | DECLHIDDEN(int) VBoxHGSMISendViewInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 152 | uint32_t u32Count,
|
---|
| 153 | PFNHGSMIFILLVIEWINFO pfnFill,
|
---|
| 154 | void *pvData);
|
---|
[63271] | 155 | DECLHIDDEN(void) VBoxVideoSetModeRegisters(uint16_t cWidth, uint16_t cHeight,
|
---|
[63273] | 156 | uint16_t cVirtWidth, uint16_t cBPP,
|
---|
| 157 | uint16_t fFlags,
|
---|
| 158 | uint16_t cx, uint16_t cy);
|
---|
[63271] | 159 | DECLHIDDEN(bool) VBoxVideoGetModeRegisters(uint16_t *pcWidth,
|
---|
[63273] | 160 | uint16_t *pcHeight,
|
---|
| 161 | uint16_t *pcVirtWidth,
|
---|
| 162 | uint16_t *pcBPP,
|
---|
| 163 | uint16_t *pfFlags);
|
---|
[63271] | 164 | DECLHIDDEN(void) VBoxVideoDisableVBE(void);
|
---|
| 165 | DECLHIDDEN(void) VBoxHGSMIProcessDisplayInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 166 | uint32_t cDisplay,
|
---|
| 167 | int32_t cOriginX,
|
---|
| 168 | int32_t cOriginY,
|
---|
| 169 | uint32_t offStart,
|
---|
| 170 | uint32_t cbPitch,
|
---|
| 171 | uint32_t cWidth,
|
---|
| 172 | uint32_t cHeight,
|
---|
| 173 | uint16_t cBPP,
|
---|
| 174 | uint16_t fFlags);
|
---|
[63271] | 175 | DECLHIDDEN(int) VBoxHGSMIUpdateInputMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, int32_t cOriginX, int32_t cOriginY,
|
---|
[63273] | 176 | uint32_t cWidth, uint32_t cHeight);
|
---|
[63271] | 177 | DECLHIDDEN(int) VBoxHGSMIGetModeHints(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
[63273] | 178 | unsigned cScreens, VBVAMODEHINT *paHints);
|
---|
[34686] | 179 |
|
---|
| 180 | /** @} */
|
---|
| 181 |
|
---|
[34429] | 182 | RT_C_DECLS_END
|
---|
| 183 |
|
---|
[76585] | 184 | #endif /* !VBOX_INCLUDED_Graphics_VBoxVideoGuest_h */
|
---|
[63039] | 185 |
|
---|