VirtualBox

source: vbox/trunk/include/VBox/Graphics/HGSMIDefs.h@ 67955

Last change on this file since 67955 was 66544, checked in by vboxsync, 8 years ago

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
Change header of files which are expected to end up in the Linux kernel to the MIT licence to simplify life for people wanting to port vboxvideo to other kernels and to simplify synchronising changes back to VirtualBox. Update author information in files which have it, but do not add it to files which do not.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/** @file
2 *
3 * VBox Host Guest Shared Memory Interface (HGSMI).
4 * Host/Guest shared part: types and defines.
5 */
6
7/*
8 * Copyright (C) 2006-2017 Oracle Corporation
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29
30#ifndef ___VBox_Graphics_HGSMIDefs_h
31#define ___VBox_Graphics_HGSMIDefs_h
32
33#include <VBoxVideoIPRT.h>
34
35/* HGSMI uses 32 bit offsets and sizes. */
36typedef uint32_t HGSMISIZE;
37typedef uint32_t HGSMIOFFSET;
38
39#define HGSMIOFFSET_VOID ((HGSMIOFFSET)~0)
40
41/* Describes a shared memory area buffer.
42 * Used for calculations with offsets and for buffers verification.
43 */
44typedef struct HGSMIAREA
45{
46 uint8_t *pu8Base; /* The starting address of the area. Corresponds to offset 'offBase'. */
47 HGSMIOFFSET offBase; /* The starting offset of the area. */
48 HGSMIOFFSET offLast; /* The last valid offset:
49 * offBase + cbArea - 1 - (sizeof(header) + sizeof(tail)).
50 */
51 HGSMISIZE cbArea; /* Size of the area. */
52} HGSMIAREA;
53
54
55/* The buffer description flags. */
56#define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03 /* Buffer sequence type mask. */
57#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00 /* Single buffer, not a part of a sequence. */
58#define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01 /* The first buffer in a sequence. */
59#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 /* A middle buffer in a sequence. */
60#define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03 /* The last buffer in a sequence. */
61
62
63#pragma pack(1)
64/* 16 bytes buffer header. */
65typedef struct HGSMIBUFFERHEADER
66{
67 uint32_t u32DataSize; /* Size of data that follows the header. */
68
69 uint8_t u8Flags; /* The buffer description: HGSMI_BUFFER_HEADER_F_* */
70
71 uint8_t u8Channel; /* The channel the data must be routed to. */
72 uint16_t u16ChannelInfo; /* Opaque to the HGSMI, used by the channel. */
73
74 union {
75 uint8_t au8Union[8]; /* Opaque placeholder to make the union 8 bytes. */
76
77 struct
78 { /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
79 uint32_t u32Reserved1; /* A reserved field, initialize to 0. */
80 uint32_t u32Reserved2; /* A reserved field, initialize to 0. */
81 } Buffer;
82
83 struct
84 { /* HGSMI_BUFFER_HEADER_F_SEQ_START */
85 uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
86 uint32_t u32SequenceSize; /* The total size of the sequence. */
87 } SequenceStart;
88
89 struct
90 { /* HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and HGSMI_BUFFER_HEADER_F_SEQ_END */
91 uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
92 uint32_t u32SequenceOffset; /* Data offset in the entire sequence. */
93 } SequenceContinue;
94 } u;
95} HGSMIBUFFERHEADER;
96
97/* 8 bytes buffer tail. */
98typedef struct HGSMIBUFFERTAIL
99{
100 uint32_t u32Reserved; /* Reserved, must be initialized to 0. */
101 uint32_t u32Checksum; /* Verifyer for the buffer header and offset and for first 4 bytes of the tail. */
102} HGSMIBUFFERTAIL;
103#pragma pack()
104
105AssertCompileSize(HGSMIBUFFERHEADER, 16);
106AssertCompileSize(HGSMIBUFFERTAIL, 8);
107
108/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
109#define HGSMI_NUMBER_OF_CHANNELS 0x100
110
111typedef struct HGSMIENV
112{
113 /* Environment context pointer. */
114 void *pvEnv;
115
116 /* Allocate system memory. */
117 DECLCALLBACKMEMBER(void *, pfnAlloc)(void *pvEnv, HGSMISIZE cb);
118
119 /* Free system memory. */
120 DECLCALLBACKMEMBER(void, pfnFree)(void *pvEnv, void *pv);
121} HGSMIENV;
122
123#endif /* !___VBox_Graphics_HGSMIDefs_h */
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