cr_protocol.h revision 9a12c5b3449d176bbe9757d301a4c22fac6e1e2c
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#ifndef CR_PROTOCOL_H
#define CR_PROTOCOL_H
#ifdef DEBUG_misha
#include "cr_error.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define CR_CMDVBVA_VERSION 1
#pragma pack(1)
typedef struct CR_CAPS_INFO
{
} CR_CAPS_INFO;
#pragma pack()
/*For now guest is allowed to connect host opengl service if protocol version matches exactly*/
/*Note: that after any change to this file, or glapi_parser\apispec.txt version should be changed*/
#define CR_PROTOCOL_VERSION_MAJOR 9
#define CR_PROTOCOL_VERSION_MINOR 1
/* new TexPresent mechanism is available */
#define CR_VBOX_CAP_TEX_PRESENT 0x00000001
/* vbva command submission mechanism supported */
#define CR_VBOX_CAP_CMDVBVA 0x00000002
/* host supports Command Blocks, i.e. CR_CMDBLOCKBEGIN_OPCODE and CR_CMDBLOCKEND_OPCODE opcodes.
* Command Block can be used by guest to prevent clients from blocking each other.
* The Command Block allows multiple command buffers to be processed with one run.
* Command Block commands have to obey to the following rules:
* CR_CMDBLOCKBEGIN_OPCODE - must be the first command in the command buffer, specifying the command block start
* CR_CMDBLOCKEND_OPCODE - must be the last command in the command buffer, specifying the command block end
* If not placed accordingly, CR_CMDBLOCK** commands are ignored.
* Server copies the command block buffer commands to its internal storage
* and processes them with one run when the command block end is signalled
*/
#define CR_VBOX_CAP_CMDBLOCKS 0x00000004
/* GetAttribsLocations support */
#define CR_VBOX_CAP_GETATTRIBSLOCATIONS 0x00000008
/* flush command blocks for execution */
#define CR_VBOX_CAP_CMDBLOCKS_FLUSH 0x00000010
/* Notify guest if host reports minimal OpenGL capabilities. */
#define CR_VBOX_CAP_HOST_CAPS_NOT_SUFFICIENT 0x00000020
#define CR_VBOX_CAPS_ALL 0x0000003f
#define CR_PRESENT_SCREEN_MASK 0xffff
#define CR_PRESENT_FLAGS_OFFSET 16
#define CR_PRESENT_FLAGS_MASK 0xffff0000
typedef enum {
/* first message types is 'wGL\001', so we can immediately
recognize bad message types */
CR_MESSAGE_OPCODES = 0x77474c01,
typedef union {
/* pointers are usually 4 bytes, but on 64-bit machines (Alpha,
* SGI-n64, etc.) they are 8 bytes. Pass network pointers around
* as an opaque array of bytes, since the interpretation & size of
* the pointer only matter to the machine which emitted the
* pointer (and will eventually receive the pointer back again) */
unsigned int ptrAlign[2];
unsigned char ptrSize[8];
/* hack to make this packet big */
/* unsigned int junk[512]; */
#if 0 //def DEBUG_misha
#define CRDBGPTR_CHECKZ(_p) do { \
CRNetworkPointer _ptr = {0}; \
} while (0)
#define CRDBGPTR_CHECKNZ(_p) do { \
CRNetworkPointer _ptr = {0}; \
} while (0)
# if 0
} while (0)
# else
# endif
#else
#define CRDBGPTR_SETZ(_p) do { } while (0)
#define CRDBGPTR_CHECKZ(_p) do { } while (0)
#define CRDBGPTR_CHECKNZ(_p) do { } while (0)
#endif
#ifdef VBOX_WITH_CRHGSMI
typedef struct CRVBOXHGSMI_CMDDATA {
union
{
struct VBOXVDMACMD_CHROMIUM_CMD *pHgsmiCmd;
struct VBOXCMDVBVA_CRCMD_CMD *pVbvaCmd;
const void *pvCmd;
};
int *pCmdRc;
char *pWriteback;
unsigned int *pcbWriteback;
unsigned int cbWriteback;
bool fHgsmiCmd;
#ifdef DEBUG
# define CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData) do { \
if ((_pData)->pWriteback) \
{ \
} \
} while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData) do { \
} while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData) do { \
} while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSETWB(_pData) do { \
} while (0)
#else
# define CRVBOXHGSMI_CMDDATA_ASSERT_CONSISTENT(_pData) do { } while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(_pData) do { } while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSET(_pData) do { } while (0)
# define CRVBOXHGSMI_CMDDATA_ASSERT_ISSETWB(_pData) do { } while (0)
#endif
#define CRVBOXHGSMI_CMDDATA_CLEANUP(_pData) do { \
} while (0)
} while (0)
} while (0)
} while (0)
#endif
typedef struct {
unsigned int conn_id;
typedef struct CRMessageOpcodes {
unsigned int numOpcodes;
typedef struct CRMessageRedirPtr {
#ifdef VBOX_WITH_CRHGSMI
#endif
typedef struct CRMessageWriteback {
typedef struct CRMessageReadback {
typedef struct CRMessageMulti {
typedef struct CRMessageFlowControl {
unsigned int credits;
typedef struct CRMessageReadPixels {
unsigned int bytes_per_row;
unsigned int stride;
int alignment;
int skipRows;
int skipPixels;
int rowLength;
int format;
int type;
typedef struct CRMessageNewClient {
typedef struct CRMessageGather {
unsigned long offset;
unsigned long len;
typedef union {
} CRMessage;
#ifdef __cplusplus
}
#endif
#endif /* CR_PROTOCOL_H */