VirtualBox

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

Last change on this file since 69055 was 69015, checked in by vboxsync, 7 years ago

Fix up header files for graphics hardware.
bugref:9017: Additions/x11: put vboxvideo into upstream X.Org

Make sure that all graphics hardware header files have svn Id tags to be
able to match X.Org files with VirtualBox revisions.

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