VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/include/cr_protocol.h@ 39289

Last change on this file since 39289 was 39289, checked in by vboxsync, 13 years ago

missing file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.3 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved.
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#ifndef CR_PROTOCOL_H
8#define CR_PROTOCOL_H
9
10#include <iprt/cdefs.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/*For now guest is allowed to connect host opengl service if protocol version matches exactly*/
17/*Note: that after any change to this file, or glapi_parser\apispec.txt version should be changed*/
18#define CR_PROTOCOL_VERSION_MAJOR 9
19#define CR_PROTOCOL_VERSION_MINOR 1
20
21typedef enum {
22 /* first message types is 'wGL\001', so we can immediately
23 recognize bad message types */
24 CR_MESSAGE_OPCODES = 0x77474c01,
25 CR_MESSAGE_WRITEBACK,
26 CR_MESSAGE_READBACK,
27 CR_MESSAGE_READ_PIXELS,
28 CR_MESSAGE_MULTI_BODY,
29 CR_MESSAGE_MULTI_TAIL,
30 CR_MESSAGE_FLOW_CONTROL,
31 CR_MESSAGE_OOB,
32 CR_MESSAGE_NEWCLIENT,
33 CR_MESSAGE_GATHER,
34 CR_MESSAGE_ERROR,
35 CR_MESSAGE_CRUT,
36 CR_MESSAGE_REDIR_PTR
37} CRMessageType;
38
39typedef union {
40 /* pointers are usually 4 bytes, but on 64-bit machines (Alpha,
41 * SGI-n64, etc.) they are 8 bytes. Pass network pointers around
42 * as an opaque array of bytes, since the interpretation & size of
43 * the pointer only matter to the machine which emitted the
44 * pointer (and will eventually receive the pointer back again) */
45 unsigned int ptrAlign[2];
46 unsigned char ptrSize[8];
47 /* hack to make this packet big */
48 /* unsigned int junk[512]; */
49} CRNetworkPointer;
50
51#ifdef DEBUG_misha
52#define CRDBGPTR_SETZ(_p) crMemset((_p), 0, sizeof (CRNetworkPointer))
53#define CRDBGPTR_CHECKZ(_p) do { \
54 CRNetworkPointer _ptr = {0}; \
55 Assert(!crMemcmp((_p), &_ptr, sizeof (CRNetworkPointer))); \
56 } while (0)
57#define CRDBGPTR_CHECKNZ(_p) do { \
58 CRNetworkPointer _ptr = {0}; \
59 Assert(crMemcmp((_p), &_ptr, sizeof (CRNetworkPointer))); \
60 } while (0)
61# if 0
62# define _CRDBGPTR_PRINT(_tStr, _id, _p) do { \
63 crDebug(_tStr "%d:0x%08x%08x", (_id), (_p)->ptrAlign[1], (_p)->ptrAlign[0]); \
64 } while (0)
65# else
66# define _CRDBGPTR_PRINT(_tStr, _id, _p) do { } while (0)
67# endif
68#define CRDBGPTR_PRINTWB(_id, _p) _CRDBGPTR_PRINT("wbptr:", _id, _p)
69#define CRDBGPTR_PRINTRB(_id, _p) _CRDBGPTR_PRINT("rbptr:", _id, _p)
70#else
71#define CRDBGPTR_SETZ(_p) do { } while (0)
72#define CRDBGPTR_CHECKZ(_p) do { } while (0)
73#define CRDBGPTR_CHECKNZ(_p) do { } while (0)
74#define CRDBGPTR_PRINTWB(_id, _p) do { } while (0)
75#define CRDBGPTR_PRINTRB(_id, _p) do { } while (0)
76#endif
77
78#ifdef VBOX_WITH_CRHGSMI
79typedef struct CRVBOXHGSMI_CMDDATA {
80 struct VBOXVDMACMD_CHROMIUM_CMD *pCmd;
81 int *pCmdRc;
82 char *pWriteback;
83 unsigned int *pcbWriteback;
84 unsigned int cbWriteback;
85} CRVBOXHGSMI_CMDDATA, *PCRVBOXHGSMI_CMDDATA;
86
87#ifdef DEBUG
88# define CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData) do { \
89 CRASSERT(!(_pData)->pCmd == !(_pData)->pCmdRc); \
90 CRASSERT(!(_pData)->pWriteback == !(_pData)->pcbWriteback); \
91 CRASSERT(!(_pData)->pWriteback == !(_pData)->cbWriteback); \
92 if ((_pData)->pWriteback) \
93 { \
94 CRASSERT((_pData)->pCmd); \
95 } \
96 } while (0)
97
98# define CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData) do { \
99 CRASSERT(!(_pData)->pCmd); \
100 CRASSERT(!(_pData)->pCmdRc); \
101 CRASSERT(!(_pData)->pWriteback); \
102 CRASSERT(!(_pData)->pcbWriteback); \
103 CRASSERT(!(_pData)->cbWriteback); \
104 } while (0)
105
106# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData) do { \
107 CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData); \
108 CRASSERT(CRVBOXHGSMI_CMDDATA_IS_SET(_pData)); \
109 } while (0)
110
111# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSETWB(_pData) do { \
112 CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData); \
113 CRASSERT(CRVBOXHGSMI_CMDDATA_IS_SETWB(_pData)); \
114 } while (0)
115#else
116# define CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData) do { } while (0)
117# define CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData) do { } while (0)
118# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData) do { } while (0)
119# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSETWB(_pData) do { } while (0)
120#endif
121
122#define CRVBOXHGSMI_CMDDATA_IS_SET(_pData) (!!(_pData)->pCmd)
123#define CRVBOXHGSMI_CMDDATA_IS_SETWB(_pData) (!!(_pData)->pWriteback)
124
125#define CRVBOXHGSMI_CMDDATA_CLEANUP(_pData) do { \
126 crMemset(_pData, 0, sizeof (CRVBOXHGSMI_CMDDATA)); \
127 CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData); \
128 CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData); \
129 } while (0)
130
131#define CRVBOXHGSMI_CMDDATA_SET(_pData, _pCmd, _pHdr) do { \
132 CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData); \
133 (_pData)->pCmd = (_pCmd); \
134 (_pData)->pCmdRc = &(_pHdr)->result; \
135 CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData); \
136 } while (0)
137
138#define CRVBOXHGSMI_CMDDATA_SETWB(_pData, _pCmd, _pHdr, _pWb, _cbWb, _pcbWb) do { \
139 CRVBOXHGSMI_CMDDATA_SET(_pData, _pCmd, _pHdr); \
140 (_pData)->pWriteback = (_pWb); \
141 (_pData)->pcbWriteback = (_pcbWb); \
142 (_pData)->cbWriteback = (_cbWb); \
143 CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData); \
144 } while (0)
145
146#define CRVBOXHGSMI_CMDDATA_RC(_pData, _rc) do { \
147 *(_pData)->pCmdRc = (_rc); \
148 } while (0)
149#endif
150
151typedef struct {
152 CRMessageType type;
153 unsigned int conn_id;
154} CRMessageHeader;
155
156typedef struct CRMessageOpcodes {
157 CRMessageHeader header;
158 unsigned int numOpcodes;
159} CRMessageOpcodes;
160
161typedef struct CRMessageRedirPtr {
162 CRMessageHeader header;
163 CRMessageHeader* pMessage;
164#ifdef VBOX_WITH_CRHGSMI
165 CRVBOXHGSMI_CMDDATA CmdData;
166#endif
167} CRMessageRedirPtr;
168
169typedef struct CRMessageWriteback {
170 CRMessageHeader header;
171 CRNetworkPointer writeback_ptr;
172} CRMessageWriteback;
173
174typedef struct CRMessageReadback {
175 CRMessageHeader header;
176 CRNetworkPointer writeback_ptr;
177 CRNetworkPointer readback_ptr;
178} CRMessageReadback;
179
180typedef struct CRMessageMulti {
181 CRMessageHeader header;
182} CRMessageMulti;
183
184typedef struct CRMessageFlowControl {
185 CRMessageHeader header;
186 unsigned int credits;
187} CRMessageFlowControl;
188
189typedef struct CRMessageReadPixels {
190 CRMessageHeader header;
191 int width, height;
192 unsigned int bytes_per_row;
193 unsigned int stride;
194 int alignment;
195 int skipRows;
196 int skipPixels;
197 int rowLength;
198 int format;
199 int type;
200 CRNetworkPointer pixels;
201} CRMessageReadPixels;
202
203typedef struct CRMessageNewClient {
204 CRMessageHeader header;
205} CRMessageNewClient;
206
207typedef struct CRMessageGather {
208 CRMessageHeader header;
209 unsigned long offset;
210 unsigned long len;
211} CRMessageGather;
212
213typedef union {
214 CRMessageHeader header;
215 CRMessageOpcodes opcodes;
216 CRMessageRedirPtr redirptr;
217 CRMessageWriteback writeback;
218 CRMessageReadback readback;
219 CRMessageReadPixels readPixels;
220 CRMessageMulti multi;
221 CRMessageFlowControl flowControl;
222 CRMessageNewClient newclient;
223 CRMessageGather gather;
224} CRMessage;
225
226DECLEXPORT(void) crNetworkPointerWrite( CRNetworkPointer *dst, void *src );
227
228#ifdef __cplusplus
229}
230#endif
231
232#endif /* CR_PROTOCOL_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