Changeset 68848 in vbox
- Timestamp:
- Sep 24, 2017 4:58:46 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 118102
- Location:
- trunk
- Files:
-
- 1 deleted
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/Graphics/HGSMIChSetup.h
r68672 r68848 31 31 32 32 /* HGSMI setup and configuration channel commands and data structures. */ 33 #define HGSMI_CC_HOST_FLAGS_LOCATION 0 /* Tell the host the location of HGSMIHOSTFLAGS structure, 34 * where the host can write information about pending 35 * buffers, etc, and which can be quickly polled by 36 * the guest without a need to port IO. 37 */ 33 /* 34 * Tell the host the location of hgsmi_host_flags structure, where the host 35 * can write information about pending buffers, etc, and which can be quickly 36 * polled by the guest without a need to port IO. 37 */ 38 #define HGSMI_CC_HOST_FLAGS_LOCATION 0 38 39 39 40 typedef struct HGSMIBUFFERLOCATION … … 46 47 /* HGSMI setup and configuration data structures. */ 47 48 /* host->guest commands pending, should be accessed under FIFO lock only */ 48 #define HGSMIHOSTFLAGS_COMMANDS_PENDING UINT32_C(0x 1)49 #define HGSMIHOSTFLAGS_COMMANDS_PENDING UINT32_C(0x01) 49 50 /* IRQ is fired, should be accessed under VGAState::lock only */ 50 #define HGSMIHOSTFLAGS_IRQ UINT32_C(0x 2)51 #define HGSMIHOSTFLAGS_IRQ UINT32_C(0x02) 51 52 #ifdef VBOX_WITH_WDDM 52 53 /* one or more guest commands is completed, should be accessed under FIFO lock only */ 53 # define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED UINT32_C(0x 4)54 # define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED UINT32_C(0x04) 54 55 /* watchdog timer interrupt flag (used for debugging), should be accessed under VGAState::lock only */ 55 # define HGSMIHOSTFLAGS_WATCHDOG UINT32_C(0x 8)56 # define HGSMIHOSTFLAGS_WATCHDOG UINT32_C(0x08) 56 57 #endif 57 58 /* vsync interrupt flag, should be accessed under VGAState::lock only */ … … 59 60 /** monitor hotplug flag, should be accessed under VGAState::lock only */ 60 61 #define HGSMIHOSTFLAGS_HOTPLUG UINT32_C(0x20) 61 /** Cursor capability state change flag, should be accessed under 62 * VGAState::lock only. @see VBVACONF32. */ 62 /** 63 * Cursor capability state change flag, should be accessed under 64 * VGAState::lock only. @see VBVACONF32. 65 */ 63 66 #define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES UINT32_C(0x40) 64 67 65 68 typedef struct HGSMIHOSTFLAGS 66 69 { 67 /* host flags can be accessed and modified in multiple threads concurrently, 68 * e.g. CrOpenGL HGCM and GUI threads when to completing HGSMI 3D and Video Accel respectively, 69 * EMT thread when dealing with HGSMI command processing, etc. 70 * Besides settings/cleaning flags atomically, some each flag has its own special sync restrictions, 71 * see commants for flags definitions above */ 70 /* 71 * Host flags can be accessed and modified in multiple threads 72 * concurrently, e.g. CrOpenGL HGCM and GUI threads when completing 73 * HGSMI 3D and Video Accel respectively, EMT thread when dealing with 74 * HGSMI command processing, etc. 75 * Besides settings/cleaning flags atomically, some flags have their 76 * own special sync restrictions, see comments for flags above. 77 */ 72 78 volatile uint32_t u32HostFlags; 73 79 uint32_t au32Reserved[3]; … … 76 82 77 83 #endif 78 -
trunk/include/VBox/Graphics/HGSMIChannels.h
r66544 r68848 33 33 34 34 35 /* Each channel has an 8 bit identifier. There are a number of predefined 35 /* 36 * Each channel has an 8 bit identifier. There are a number of predefined 36 37 * (hardcoded) channels. 37 38 * … … 39 40 * to a free 16 bit numerical value. values are allocated in range 40 41 * [HGSMI_CH_STRING_FIRST;HGSMI_CH_STRING_LAST]. 41 *42 42 */ 43 43 44 44 45 45 /* Predefined channel identifiers. Used internally by VBOX to simplify the channel setup. */ 46 #define HGSMI_CH_RESERVED (0x00) /* A reserved channel value. */ 47 48 #define HGSMI_CH_HGSMI (0x01) /* HGCMI: setup and configuration channel. */ 49 50 #define HGSMI_CH_VBVA (0x02) /* Graphics: VBVA. */ 51 #define HGSMI_CH_SEAMLESS (0x03) /* Graphics: Seamless with a single guest region. */ 52 #define HGSMI_CH_SEAMLESS2 (0x04) /* Graphics: Seamless with separate host windows. */ 53 #define HGSMI_CH_OPENGL (0x05) /* Graphics: OpenGL HW acceleration. */ 46 /* A reserved channel value */ 47 #define HGSMI_CH_RESERVED 0x00 48 /* HGCMI: setup and configuration */ 49 #define HGSMI_CH_HGSMI 0x01 50 /* Graphics: VBVA */ 51 #define HGSMI_CH_VBVA 0x02 52 /* Graphics: Seamless with a single guest region */ 53 #define HGSMI_CH_SEAMLESS 0x03 54 /* Graphics: Seamless with separate host windows */ 55 #define HGSMI_CH_SEAMLESS2 0x04 56 /* Graphics: OpenGL HW acceleration */ 57 #define HGSMI_CH_OPENGL 0x05 54 58 55 59 56 60 /* Dynamically allocated channel identifiers. */ 57 #define HGSMI_CH_STRING_FIRST (0x20) /* The first channel index to be used for string mappings (inclusive). */ 58 #define HGSMI_CH_STRING_LAST (0xff) /* The last channel index for string mappings (inclusive). */ 61 /* The first channel index to be used for string mappings (inclusive) */ 62 #define HGSMI_CH_STRING_FIRST 0x20 63 /* The last channel index for string mappings (inclusive) */ 64 #define HGSMI_CH_STRING_LAST 0xff 59 65 60 66 61 /* Check whether the channel identifier is allocated for a dynamic channel .*/67 /* Check whether the channel identifier is allocated for a dynamic channel */ 62 68 #define HGSMI_IS_DYNAMIC_CHANNEL(_channel) (((uint8_t)(_channel) & 0xE0) != 0) 63 69 -
trunk/include/VBox/Graphics/VBoxVideoGuest.h
r68672 r68848 29 29 #define ___VBox_Graphics_VBoxVideoGuest_h___ 30 30 31 #include "VBoxVideoIPRT.h" 31 32 #include "HGSMIBase.h" 32 33 #include "VBoxVideo.h" 33 #include "VBoxVideoIPRT.h"34 34 35 35 RT_C_DECLS_BEGIN -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r67145 r68848 26 26 */ 27 27 28 #include <HGSMIBase.h> 29 #include <VBoxVideoIPRT.h> 28 30 #include <VBoxVideoGuest.h> 29 31 #include <VBoxVideoVBE.h> 30 #include <VBoxVideoIPRT.h> 32 #include <HGSMIChannels.h> 33 #include <HGSMIChSetup.h> 31 34 32 35 /** Detect whether HGSMI is supported by the host. */ … … 45 48 46 49 /** 47 * Inform the host of the location of the host flags in VRAM via an HGSMI 48 * command. 50 * Inform the host of the location of the host flags in VRAM via an HGSMI command. 49 51 * @returns IPRT status value. 50 52 * @returns VERR_NOT_IMPLEMENTED if the host does not support the command. 51 53 * @returns VERR_NO_MEMORY if a heap allocation fails. 52 54 * @param pCtx the context of the guest heap to use. 53 * @param offLocation the offset chosen for the flags withing guest 54 * VRAM. 55 */ 56 DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, 57 HGSMIOFFSET offLocation) 55 * @param offLocation the offset chosen for the flags withing guest VRAM. 56 */ 57 DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMIOFFSET offLocation) 58 58 { 59 59 HGSMIBUFFERLOCATION *p; 60 int rc = VINF_SUCCESS; 61 62 /* Allocate the IO buffer. */ 63 p = (HGSMIBUFFERLOCATION *)VBoxHGSMIBufferAlloc(pCtx, 64 sizeof(HGSMIBUFFERLOCATION), 65 HGSMI_CH_HGSMI, 66 HGSMI_CC_HOST_FLAGS_LOCATION); 67 if (p) 68 { 69 /* Prepare data to be sent to the host. */ 70 p->offLocation = offLocation; 71 p->cbLocation = sizeof(HGSMIHOSTFLAGS); 72 rc = VBoxHGSMIBufferSubmit(pCtx, p); 73 /* Free the IO buffer. */ 74 VBoxHGSMIBufferFree(pCtx, p); 75 } 76 else 77 rc = VERR_NO_MEMORY; 78 return rc; 60 61 /* Allocate the IO buffer. */ 62 p = (HGSMIBUFFERLOCATION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI, 63 HGSMI_CC_HOST_FLAGS_LOCATION); 64 if (!p) 65 return VERR_NO_MEMORY; 66 67 /* Prepare data to be sent to the host. */ 68 p->offLocation = offLocation; 69 p->cbLocation = sizeof(HGSMIHOSTFLAGS); 70 /* No need to check that the buffer is valid as we have just allocated it. */ 71 VBoxHGSMIBufferSubmit(pCtx, p); 72 /* Free the IO buffer. */ 73 VBoxHGSMIBufferFree(pCtx, p); 74 75 return VINF_SUCCESS; 79 76 } 80 77 … … 88 85 * @param fCaps the capabilities to report, see VBVACAPS. 89 86 */ 90 DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, 91 uint32_t fCaps) 92 { 93 VBVACAPS *pCaps; 94 int rc = VINF_SUCCESS; 95 96 /* Allocate the IO buffer. */ 97 pCaps = (VBVACAPS *)VBoxHGSMIBufferAlloc(pCtx, 98 sizeof(VBVACAPS), HGSMI_CH_VBVA, 99 VBVA_INFO_CAPS); 100 101 if (pCaps) 102 { 103 /* Prepare data to be sent to the host. */ 104 pCaps->rc = VERR_NOT_IMPLEMENTED; 105 pCaps->fCaps = fCaps; 106 rc = VBoxHGSMIBufferSubmit(pCtx, pCaps); 107 if (RT_SUCCESS(rc)) 108 { 109 AssertRC(pCaps->rc); 110 rc = pCaps->rc; 111 } 112 /* Free the IO buffer. */ 113 VBoxHGSMIBufferFree(pCtx, pCaps); 114 } 115 else 116 rc = VERR_NO_MEMORY; 117 return rc; 87 DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fCaps) 88 { 89 VBVACAPS *p; 90 91 /* Allocate the IO buffer. */ 92 p = (VBVACAPS *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS); 93 94 if (!p) 95 return VERR_NO_MEMORY; 96 97 /* Prepare data to be sent to the host. */ 98 p->rc = VERR_NOT_IMPLEMENTED; 99 p->fCaps = fCaps; 100 /* No need to check that the buffer is valid as we have just allocated it. */ 101 VBoxHGSMIBufferSubmit(pCtx, p); 102 103 AssertRC(p->rc); 104 /* Free the IO buffer. */ 105 VBoxHGSMIBufferFree(pCtx, p); 106 return p->rc; 118 107 } 119 108 … … 160 149 } 161 150 162 163 /** Sanity test on first call. We do not worry about concurrency issues. */164 static int testQueryConf(PHGSMIGUESTCOMMANDCONTEXT pCtx)165 {166 static bool cOnce = false;167 uint32_t ulValue = 0;168 int rc;169 170 if (cOnce)171 return VINF_SUCCESS;172 cOnce = true;173 rc = VBoxQueryConfHGSMI(pCtx, UINT32_MAX, &ulValue);174 if (RT_SUCCESS(rc) && ulValue == UINT32_MAX)175 return VINF_SUCCESS;176 cOnce = false;177 if (RT_FAILURE(rc))178 return rc;179 return VERR_INTERNAL_ERROR;180 }181 182 183 151 /** 184 152 * Query the host for an HGSMI configuration parameter via an HGSMI command. … … 187 155 * @param u32Index the index of the parameter to query, 188 156 * @see VBVACONF32::u32Index 189 * @param u32DefValue defaut value190 157 * @param pulValue where to store the value of the parameter on success 191 158 */ 192 DECLHIDDEN(int) VBoxQueryConfHGSMIDef(PHGSMIGUESTCOMMANDCONTEXT pCtx, 193 uint32_t u32Index, uint32_t u32DefValue, uint32_t *pulValue) 194 { 195 int rc = VINF_SUCCESS; 159 DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t u32Index, uint32_t *pulValue) 160 { 196 161 VBVACONF32 *p; 197 // LogFunc(("u32Index = %d\n", u32Index)); 198 199 rc = testQueryConf(pCtx); 200 if (RT_FAILURE(rc)) 201 return rc; 202 /* Allocate the IO buffer. */ 203 p = (VBVACONF32 *)VBoxHGSMIBufferAlloc(pCtx, 204 sizeof(VBVACONF32), HGSMI_CH_VBVA, 205 VBVA_QUERY_CONF32); 206 if (p) 207 { 208 /* Prepare data to be sent to the host. */ 209 p->u32Index = u32Index; 210 p->u32Value = u32DefValue; 211 rc = VBoxHGSMIBufferSubmit(pCtx, p); 212 if (RT_SUCCESS(rc)) 213 { 214 *pulValue = p->u32Value; 215 // LogFunc(("u32Value = %d\n", p->u32Value)); 216 } 217 /* Free the IO buffer. */ 218 VBoxHGSMIBufferFree(pCtx, p); 219 } 220 else 221 rc = VERR_NO_MEMORY; 222 // LogFunc(("rc = %d\n", rc)); 223 return rc; 224 } 225 226 DECLHIDDEN(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx, 227 uint32_t u32Index, uint32_t *pulValue) 228 { 229 return VBoxQueryConfHGSMIDef(pCtx, u32Index, UINT32_MAX, pulValue); 162 163 /* Allocate the IO buffer. */ 164 p = (VBVACONF32 *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, 165 VBVA_QUERY_CONF32); 166 if (!p) 167 return VERR_NO_MEMORY; 168 169 /* Prepare data to be sent to the host. */ 170 p->u32Index = u32Index; 171 p->u32Value = UINT32_MAX; 172 /* No need to check that the buffer is valid as we have just allocated it. */ 173 VBoxHGSMIBufferSubmit(pCtx, p); 174 *pulValue = p->u32Value; 175 /* Free the IO buffer. */ 176 VBoxHGSMIBufferFree(pCtx, p); 177 return VINF_SUCCESS; 230 178 } 231 179 … … 243 191 * @param cbLength size in bytes of the pixel data 244 192 */ 245 DECLHIDDEN(int) VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx, 246 uint32_t fFlags, 247 uint32_t cHotX, 248 uint32_t cHotY, 249 uint32_t cWidth, 250 uint32_t cHeight, 251 uint8_t *pPixels, 252 uint32_t cbLength) 193 DECLHIDDEN(int) VBoxHGSMIUpdatePointerShape(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fFlags, 194 uint32_t cHotX, uint32_t cHotY, uint32_t cWidth, uint32_t cHeight, 195 uint8_t *pPixels, uint32_t cbLength) 253 196 { 254 197 VBVAMOUSEPOINTERSHAPE *p; 255 uint32_t cb Data= 0;256 int rc = VINF_SUCCESS;198 uint32_t cbPixels = 0; 199 int rc; 257 200 258 201 if (fFlags & VBOX_MOUSE_POINTER_SHAPE) 259 202 { 260 /* Size of the pointer data: sizeof (AND mask) + sizeof (XOR_MASK) */ 261 cbData = ((((cWidth + 7) / 8) * cHeight + 3) & ~3) 203 /* 204 * Size of the pointer data: 205 * sizeof (AND mask) + sizeof (XOR_MASK) 206 */ 207 cbPixels = ((((cWidth + 7) / 8) * cHeight + 3) & ~3) 262 208 + cWidth * 4 * cHeight; 263 /* If shape is supplied, then always create the pointer visible. 209 if (cbPixels > cbLength) 210 return VERR_INVALID_PARAMETER; 211 /* 212 * If shape is supplied, then always create the pointer visible. 264 213 * See comments in 'vboxUpdatePointerShape' 265 214 */ 266 215 fFlags |= VBOX_MOUSE_POINTER_VISIBLE; 267 216 } 268 // LogFlowFunc(("cbData %d, %dx%d\n", cbData, cWidth, cHeight)); 269 if (cbData > cbLength) 270 { 271 // LogFunc(("calculated pointer data size is too big (%d bytes, limit %d)\n", 272 // cbData, cbLength)); 273 return VERR_INVALID_PARAMETER; 274 } 275 /* Allocate the IO buffer. */ 276 p = (VBVAMOUSEPOINTERSHAPE *)VBoxHGSMIBufferAlloc(pCtx, 277 sizeof(VBVAMOUSEPOINTERSHAPE) 278 + cbData, 279 HGSMI_CH_VBVA, 280 VBVA_MOUSE_POINTER_SHAPE); 281 if (p) 282 { 283 /* Prepare data to be sent to the host. */ 284 /* Will be updated by the host. */ 285 p->i32Result = VINF_SUCCESS; 286 /* We have our custom flags in the field */ 287 p->fu32Flags = fFlags; 288 p->u32HotX = cHotX; 289 p->u32HotY = cHotY; 290 p->u32Width = cWidth; 291 p->u32Height = cHeight; 292 if (p->fu32Flags & VBOX_MOUSE_POINTER_SHAPE) 293 /* Copy the actual pointer data. */ 294 memcpy (p->au8Data, pPixels, cbData); 295 rc = VBoxHGSMIBufferSubmit(pCtx, p); 296 if (RT_SUCCESS(rc)) 297 rc = p->i32Result; 298 /* Free the IO buffer. */ 299 VBoxHGSMIBufferFree(pCtx, p); 300 } 301 else 302 rc = VERR_NO_MEMORY; 303 // LogFlowFunc(("rc %d\n", rc)); 217 /* Allocate the IO buffer. */ 218 p = (VBVAMOUSEPOINTERSHAPE *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p) + cbPixels, HGSMI_CH_VBVA, 219 VBVA_MOUSE_POINTER_SHAPE); 220 if (!p) 221 return VERR_NO_MEMORY; 222 /* Prepare data to be sent to the host. */ 223 /* Will be updated by the host. */ 224 p->i32Result = VINF_SUCCESS; 225 /* We have our custom flags in the field */ 226 p->fu32Flags = fFlags; 227 p->u32HotX = cHotX; 228 p->u32HotY = cHotY; 229 p->u32Width = cWidth; 230 p->u32Height = cHeight; 231 if (cbPixels) 232 /* Copy the actual pointer data. */ 233 memcpy (p->au8Data, pPixels, cbPixels); 234 /* No need to check that the buffer is valid as we have just allocated it. */ 235 VBoxHGSMIBufferSubmit(pCtx, p); 236 rc = p->i32Result; 237 /* Free the IO buffer. */ 238 VBoxHGSMIBufferFree(pCtx, p); 304 239 return rc; 305 240 } … … 319 254 * @returns VERR_NO_MEMORY HGSMI heap allocation failed. 320 255 */ 321 DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y, 322 uint32_t *pxHost, uint32_t *pyHost) 323 { 324 int rc = VINF_SUCCESS; 256 DECLHIDDEN(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, 257 uint32_t x, uint32_t y, uint32_t *pxHost, uint32_t *pyHost) 258 { 325 259 VBVACURSORPOSITION *p; 326 // Log(("%s: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned)x, (unsigned)y)); 327 328 /* Allocate the IO buffer. */ 329 p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVACURSORPOSITION), HGSMI_CH_VBVA, VBVA_CURSOR_POSITION); 330 if (p) 331 { 332 /* Prepare data to be sent to the host. */ 333 p->fReportPosition = fReportPosition ? 1 : 0; 334 p->x = x; 335 p->y = y; 336 rc = VBoxHGSMIBufferSubmit(pCtx, p); 337 if (RT_SUCCESS(rc)) 338 { 339 if (pxHost) 340 *pxHost = p->x; 341 if (pyHost) 342 *pyHost = p->y; 343 // Log(("%s: return: x=%u, y=%u\n", __PRETTY_FUNCTION__, (unsigned)p->x, (unsigned)p->y)); 344 } 345 /* Free the IO buffer. */ 346 VBoxHGSMIBufferFree(pCtx, p); 347 } 348 else 349 rc = VERR_NO_MEMORY; 350 // LogFunc(("rc = %d\n", rc)); 351 return rc; 352 } 353 354 355 /** @todo Mouse pointer position to be read from VMMDev memory, address of the memory region 356 * can be queried from VMMDev via an IOCTL. This VMMDev memory region will contain 357 * host information which is needed by the guest. 260 261 /* Allocate the IO buffer. */ 262 p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, 263 VBVA_CURSOR_POSITION); 264 if (!p) 265 return VERR_NO_MEMORY; 266 /* Prepare data to be sent to the host. */ 267 p->fReportPosition = fReportPosition; 268 p->x = x; 269 p->y = y; 270 /* No need to check that the buffer is valid as we have just allocated it. */ 271 VBoxHGSMIBufferSubmit(pCtx, p); 272 if (pxHost) 273 *pxHost = p->x; 274 if (pyHost) 275 *pyHost = p->y; 276 /* Free the IO buffer. */ 277 VBoxHGSMIBufferFree(pCtx, p); 278 return VINF_SUCCESS; 279 } 280 281 282 /** 283 * @todo Mouse pointer position to be read from VMMDev memory, address of the 284 * memory region can be queried from VMMDev via an IOCTL. This VMMDev memory 285 * region will contain host information which is needed by the guest. 358 286 * 359 287 * Reading will not cause a switch to the host. … … 366 294 * the page readonly for the guest. 367 295 * * the information should be available only for additions drivers. 368 * * VMMDev additions driver will inform the host which version of the info it expects, 369 * host must support all versions. 370 * 371 */ 296 * * VMMDev additions driver will inform the host which version of the info 297 * it expects, host must support all versions. 298 */ -
trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
r67268 r68848 29 29 #include <VBoxVideoGuest.h> 30 30 #include <VBoxVideoVBE.h> 31 #include <HGSMIChannels.h> 31 32 32 33 #ifndef VBOX_GUESTR3XF86MOD … … 384 385 { 385 386 uint32_t u32Flags = 0; 386 int rc = VBoxQueryConfHGSMI Def(pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, 0, &u32Flags);387 int rc = VBoxQueryConfHGSMI(pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, &u32Flags); 387 388 // LogFunc(("u32Flags = 0x%x rc %Rrc\n", u32Flags, rc)); 388 if (RT_FAILURE(rc) )389 if (RT_FAILURE(rc) || u32Flags > UINT16_MAX) 389 390 u32Flags = 0; 390 391 return (uint16_t)u32Flags; -
trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp
r66544 r68848 29 29 #include <VBoxVideoGuest.h> 30 30 #include <VBoxVideoIPRT.h> 31 #include <HGSMIChannels.h> 31 32 32 33 /* -
trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv
r68769 r68848 31 31 ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>modesetting.c \ 32 32 ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>vbva_base.c \ 33 ${PATH_ROOT}/src/VBox/Additions/linux/drm/HGSMIBase.h=>hgsmi_base.h \34 ${PATH_ROOT}/src/VBox/Additions/linux/drm/VBoxVideoIPRT.h=>vboxvideo_iprt.h \35 33 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \ 36 34 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \ 35 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_err.h=>vbox_err.h \ 37 36 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_fb.c=>vbox_fb.c \ 38 37 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_irq.c=>vbox_irq.c \ -
trunk/src/VBox/Additions/linux/drm/indent.sed
r68769 r68848 23 23 24 24 # Replace up to six leading groups of four spaces with tabs. 25 s/^ /\t\t\t\t\t\t/g25 s/^ */\t\t\t\t\t\t/g 26 26 s/^ /\t\t\t\t\t/g 27 27 s/^ /\t\t\t\t/g … … 29 29 s/^ /\t\t/g 30 30 s/^ /\t/g 31 # Remove any spaces left after the tabs. This also limits maximum indentation.32 s/^\(\t\t*\) */\1/g33 31 34 32 # Change various symbols and file names to fit kernel conventions. 35 33 34 # Miscellaneous: 35 # Remove @file headers. 36 \|/\*\* @file| { 37 :start 38 N 39 s|\*/|\*/|g 40 T start 41 N 42 d 43 } 44 /^\/\* \$Id:.*\*\/$/d 45 /^typedef .* HGSMIOFFSET;$/d 46 s/^#\( *\)include <\([^/]*\)>$/#\1include "\2"/g 47 36 48 # File names: 37 s/\bHGSMIBase\.h\b/ hgsmi_base.h/g49 s/\bHGSMIBase\.h\b/vbox_drv.h/g 38 50 s/\bHGSMIChannels\.h\b/hgsmi_channels.h/g 39 51 s/\bHGSMIChSetup\.h\b/hgsmi_ch_setup.h/g … … 42 54 s/\bVBoxVideoGuest\.h\b/vboxvideo_guest.h/g 43 55 s/\bVBoxVideo\.h\b/vboxvideo.h/g 44 s/\bVBoxVideoIPRT\.h\b/vbox video_iprt.h/g56 s/\bVBoxVideoIPRT\.h\b/vbox_err.h/g 45 57 s/\bVBoxVideoVBE\.h\b/vboxvideo_vbe.h/g 46 58 … … 69 81 s/\bvboxVBVAInformHost\b/vbva_inform_host/g 70 82 s/\bvboxVBVASetupBufferContext\b/vbva_setup_buffer_context/g 83 s/\bVBVO_PORT_READ_U8\b/inb/g 84 s/\bVBVO_PORT_READ_U16\b/inw/g 85 s/\bVBVO_PORT_READ_U32\b/inl/g 86 s/\bVBVO_PORT_WRITE_U8\b/outb/g 87 s/\bVBVO_PORT_WRITE_U16\b/outw/g 88 s/\bVBVO_PORT_WRITE_U32\b/outl/g 71 89 72 90 # Macros: 91 s/\b_1K\b/1024/g 92 s/\b_4M\b/4*1024*1024/g 93 s/\bAssert\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g 94 s/\bAssertCompile\b/assert_compile/g 95 s/\bAssertCompileSize\b/assert_compile_size/g 96 s/\bAssertPtr\b\([^;]*\);$/WARN_ON_ONCE(!(\1));/g 97 /AssertPtrNullReturnVoid/d 98 s/\bAssertRC\b\([^;]*\);$/WARN_ON_ONCE(RT_FAILURE\1);/g 99 s/\bDECLCALLBACK\b(\([^)]*\))/\1/g 100 s/\bDECLCALLBACKMEMBER\b(\([^,)]*\), *\([^,)]*\))/\1 (*\2)/g 101 s/^\bDECLHIDDEN\b(\([^)]*\))/\1/g 102 s/\bDECLINLINE\b(\([^)]*\))/static inline \1/g 103 s/\bRT_BIT\b/BIT/g 104 s/\bRT_BOOL\b(\([^)]*\))/(!!(\1))/g 105 /RT_C_DECLS/d 106 s/\bUINT16_MAX\b/U16_MAX/g 107 s/\bUINT32_MAX\b/U32_MAX/g 108 s/\bUINT32_C\b(\(.*\))/\1u/g 73 109 s/!VALID_PTR(/WARN_ON(!/g 74 110 75 111 # Type names: 76 112 s/\bint32_t\b/s32/g 113 s/\buint8_t\b/u8/g 77 114 s/\buint16_t\b/u16/g 78 115 s/\buint32_t\b/u32/g 116 s/(HGSMIBUFFERLOCATION \*)//g # Remove C++ casts from void. 117 s/typedef struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g 79 118 s/struct HGSMIBUFFERLOCATION/struct hgsmi_buffer_location/g 80 s/} HGSMIBUFFERLOCATION/} hgsmi_buffer_location/g119 s/} HGSMIBUFFERLOCATION/}/g 81 120 s/\bHGSMIBUFFERLOCATION\b/struct hgsmi_buffer_location/g 121 s/\([^*] *\)\bPHGSMIGUESTCOMMANDCONTEXT\b/\1struct gen_pool */g 122 s/(HGSMIHOSTFLAGS \*)//g # Remove C++ casts from void. 123 s/typedef struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g 124 s/struct HGSMIHOSTFLAGS/struct hgsmi_host_flags/g 125 s/} HGSMIHOSTFLAGS/}/g 126 s/\bHGSMIHOSTFLAGS\b/struct hgsmi_host_flags/g 127 s/\bHGSMIOFFSET\b/u32/g 128 s/\bHGSMISIZE\b/u32/g 129 s/\bRTRECT\b/void/g 130 s/(VBVABUFFERCONTEXT \*)//g # Remove C++ casts from void. 82 131 s/struct VBVABUFFERCONTEXT/struct vbva_buf_context/g 83 132 s/} VBVABUFFERCONTEXT/} vbva_buf_context/g 84 133 s/\bVBVABUFFERCONTEXT\b/struct vbva_buf_context/g 85 134 s/\([^*] *\)\bPVBVABUFFERCONTEXT\b/\1struct vbva_buf_context */g 135 s/(VBVACAPS \*)//g # Remove C++ casts from void. 136 s/struct VBVACAPS/struct vbva_caps/g 137 s/} VBVACAPS/} vbva_caps/g 138 s/\bVBVACAPS\b/struct vbva_caps/g 139 s/(VBVACONF32 \*)//g # Remove C++ casts from void. 86 140 s/struct VBVACONF32/struct vbva_conf32/g 87 141 s/} VBVACONF32/} vbva_conf32/g 88 142 s/\bVBVACONF32\b/struct vbva_conf32/g 143 s/(VBVACURSORPOSITION \*)//g # Remove C++ casts from void. 89 144 s/struct VBVACURSORPOSITION/struct vbva_cursor_position/g 90 145 s/} VBVACURSORPOSITION/} vbva_cursor_position/g 91 146 s/\bVBVACURSORPOSITION\b/struct vbva_cursor_position/g 147 s/(VBVAENABLE_EX \*)//g # Remove C++ casts from void. 92 148 s/struct VBVAENABLE_EX/struct vbva_enable_ex/g 93 149 s/} VBVAENABLE_EX/} vbva_enable_ex/g 94 150 s/\bVBVAENABLE_EX\b/struct vbva_enable_ex/g 151 s/(VBVAMOUSEPOINTERSHAPE \*)//g # Remove C++ casts from void. 95 152 s/struct VBVAMOUSEPOINTERSHAPE/struct vbva_mouse_pointer_shape/g 96 153 s/} VBVAMOUSEPOINTERSHAPE/} vbva_mouse_pointer_shape/g 97 154 s/\bVBVAMOUSEPOINTERSHAPE\b/struct vbva_mouse_pointer_shape/g 155 s/(VBVAMODEHINT \*)//g # Remove C++ casts from void. 98 156 s/struct VBVAMODEHINT/struct vbva_modehint/g 99 157 s/} VBVAMODEHINT/} vbva_modehint/g 100 158 s/\bVBVAMODEHINT\b/struct vbva_modehint/g 159 s/(VBVAQUERYMODEHINTS \*)//g # Remove C++ casts from void. 101 160 s/struct VBVAQUERYMODEHINTS/struct vbva_query_mode_hints/g 102 161 s/} VBVAQUERYMODEHINTS/} vbva_query_mode_hints/g 103 162 s/\bVBVAQUERYMODEHINTS\b/struct vbva_query_mode_hints/g 163 s/(VBVAREPORTINPUTMAPPING \*)//g # Remove C++ casts from void. 104 164 s/struct VBVAREPORTINPUTMAPPING/struct vbva_report_input_mapping/g 105 165 s/} VBVAREPORTINPUTMAPPING/} vbva_report_input_mapping/g … … 109 169 s/\baRecords\b/records/g 110 170 s/\bau8Data\b/data/g 171 s/\bau32Reserved\b/reserved/g 111 172 s/\bBase\b/base/g 112 173 s/\bbEnable\b/enable/g … … 119 180 s/\bcbHwBufferAvail\b/available/g 120 181 s/\bcbLength\b/len/g 182 s/\bcbLocation\b/buf_len/g 121 183 s/\bcbPartialWriteThreshold\b/partial_write_tresh/g ## @todo fix this? 122 184 s/\bcbPitch\b/pitch/g 185 s/\bcbPixels\b/pixel_len/g 123 186 s/\bcBPP\b/bpp/g 124 187 s/\bcbRecord\b/len_and_flags/g ## @todo fix this? … … 165 228 s/\bu32Height\b/height/g 166 229 s/\bu32HostEvents\b/host_events/g 230 s/\bu32HostFlags\b/host_flags/g 167 231 s/\bu32HotX\b/hot_x/g 168 232 s/\bu32HotY\b/hot_y/g … … 179 243 s/\bulValue\b/value/g 180 244 245 # Header file guard: 246 s/__HGSMIChannels_h__/__HGSMI_CHANNELS_H__/g 247 s/___VBox_Graphics_HGSMIChSetup_h/__HGSMI_CH_SETUP_H__/g 248 181 249 # And move braces. This must be the last expression as it jumps to the next 182 250 # line. … … 190 258 :try_brace 191 259 s/^\([\t ].*\)\n[\t ][\t ]*{/\1 {/g 260 s/^\([^#()]*\)\n[\t ]*{/\1 {/g 192 261 t done_brace 193 262 P -
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r68337 r68848 38 38 #define LOG_GROUP LOG_GROUP_DEV_VGA 39 39 40 #include < VBoxVideoGuest.h>41 42 #i nclude <drm/drmP.h>43 # include <drm/drm_fb_helper.h>44 45 # include <drm/ttm/ttm_bo_api.h>46 #include <drm/ttm/ttm_bo_driver.h> 47 #include < drm/ttm/ttm_placement.h>48 #include < drm/ttm/ttm_memory.h>49 #include < drm/ttm/ttm_module.h>40 #include <linux/version.h> 41 42 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) 43 # include <linux/types.h> 44 # include <linux/spinlock_types.h> 45 #endif 46 47 #include <linux/genalloc.h> 48 #include <linux/io.h> 49 #include <linux/string.h> 50 50 51 51 #if defined(RHEL_MAJOR) && defined(RHEL_MINOR) … … 58 58 #endif 59 59 60 #include <drm/drmP.h> 60 61 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(RHEL_73) 61 62 #include <drm/drm_gem.h> 62 63 #endif 64 #include <drm/drm_fb_helper.h> 63 65 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) 64 66 #include <drm/drm_encoder.h> 65 67 #endif 68 69 #include <drm/ttm/ttm_bo_api.h> 70 #include <drm/ttm/ttm_bo_driver.h> 71 #include <drm/ttm/ttm_placement.h> 72 #include <drm/ttm/ttm_memory.h> 73 #include <drm/ttm/ttm_module.h> 74 75 #include "vboxvideo_guest.h" 76 #include "vboxvideo_vbe.h" 77 #include "hgsmi_ch_setup.h" 66 78 67 79 #include "product-generated.h" … … 341 353 irqreturn_t vbox_irq_handler(int irq, void *arg); 342 354 343 #endif 355 /* vbox_hgsmi.c */ 356 void *hgsmi_buffer_alloc(struct gen_pool *guest_pool, size_t size, 357 u8 channel, u16 channel_info); 358 void hgsmi_buffer_free(struct gen_pool *guest_pool, void *buf); 359 int hgsmi_buffer_submit(struct gen_pool *guest_pool, void *buf); 360 361 static inline void vbox_write_ioport(u16 index, u16 data) 362 { 363 outw(index, VBE_DISPI_IOPORT_INDEX); 364 outw(data, VBE_DISPI_IOPORT_DATA); 365 } 366 367 #endif -
trunk/src/VBox/Additions/linux/drm/vbox_err.h
r68847 r68848 26 26 */ 27 27 28 #ifndef ___VBox_Graphic_VBoxVideoIPRT_h 29 #define ___VBox_Graphic_VBoxVideoIPRT_h 30 31 #include <asm/io.h> 32 #include <linux/string.h> 33 #include <linux/version.h> 28 #ifndef __VBOX_ERR_H__ 29 #define __VBOX_ERR_H__ 34 30 35 31 /** @name VirtualBox error macros … … 55 51 /** @} */ 56 52 57 /** @name VirtualBox helper functions53 /** @name VirtualBox assertions 58 54 * @{ */ 59 55 60 #define ASMCompilerBarrier() mb() 56 /* Unlike BUILD_BUG_ON(), these can be used outside of functions. */ 57 extern int vbox_assert_var[1]; 58 #define assert_compile(expr) \ 59 extern int vbox_assert_var[1] __attribute__((__unused__)), \ 60 vbox_assert_var[(expr) ? 1 : 0] __attribute__((__unused__)) 61 #define assert_compile_size(type, size) \ 62 assert_compile(sizeof(type) == (size)) 61 63 62 64 /** @} */ 63 65 64 /** @name VirtualBox assertions 65 * @{ */ 66 67 #define Assert(a) WARN_ON_ONCE(!(a)) 68 #define AssertPtr(a) WARN_ON_ONCE(!(a)) 69 #define AssertReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0) 70 #define AssertRC(a) WARN_ON_ONCE(RT_FAILURE(a)) 71 #define AssertPtrNullReturnVoid(a) do {} while(0) 72 #define AssertPtrReturnVoid(a) do { if (WARN_ON_ONCE(!(a))) return; } while(0) 73 74 extern int RTASSERTVAR[1]; 75 #define AssertCompile(expr) \ 76 extern int RTASSERTVAR[1] __attribute__((__unused__)), \ 77 RTASSERTVAR[(expr) ? 1 : 0] __attribute__((__unused__)) 78 #define AssertCompileSize(type, size) \ 79 AssertCompile(sizeof(type) == (size)) 80 81 #define VALID_PTR(p) ((p) != NULL) 82 83 /** @} */ 84 85 /** @name Port I/O helpers 86 * @{ */ 87 /** Write an 8-bit value to an I/O port. */ 88 #define VBVO_PORT_WRITE_U8(Port, Value) \ 89 outb(Value, Port) 90 /** Write a 16-bit value to an I/O port. */ 91 #define VBVO_PORT_WRITE_U16(Port, Value) \ 92 outw(Value, Port) 93 /** Write a 32-bit value to an I/O port. */ 94 #define VBVO_PORT_WRITE_U32(Port, Value) \ 95 outl(Value, Port) 96 /** Read an 8-bit value from an I/O port. */ 97 #define VBVO_PORT_READ_U8(Port) \ 98 inb(Port) 99 /** Read a 16-bit value from an I/O port. */ 100 #define VBVO_PORT_READ_U16(Port) \ 101 inw(Port) 102 /** Read a 32-bit value from an I/O port. */ 103 #define VBVO_PORT_READ_U32(Port) \ 104 inl(Port) 105 106 /** @} */ 107 108 /** @name types for VirtualBox OS-independent code 109 * @{ */ 110 111 typedef void RTRECT; 112 113 #define UINT32_C(val) (val ## U) 114 #define UINT32_MAX UINT32_C(0xffffffff) 115 116 /** @} */ 117 118 /** @name iprt/desc.h replacement macros 119 * @{ */ 120 121 #define RT_C_DECLS_BEGIN 122 #define RT_C_DECLS_END 123 #define DECLCALLBACK(type) type 124 #define DECLCALLBACKMEMBER(type, name) type (*name) 125 #define DECLHIDDEN(type) __attribute__((visibility("hidden"))) type 126 #define DECLINLINE(type) static __inline__ type 127 #define RT_BOOL(val) (!!(val)) 128 #define RT_BIT BIT 129 #define _1K 0x00000400 130 131 /** @} */ 132 133 #endif /* !___VBox_Graphic_VBoxVideoIPRT_h */ 134 66 #endif -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r68334 r68848 38 38 */ 39 39 #include "vbox_drv.h" 40 41 #include <VBoxVideo.h>42 43 40 #include <linux/export.h> 44 41 #include <drm/drm_crtc_helper.h> … … 46 43 #include <drm/drm_plane_helper.h> 47 44 #endif 45 46 #include "VBoxVideo.h" 47 #include "hgsmi_channels.h" 48 48 49 49 static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
Note:
See TracChangeset
for help on using the changeset viewer.