1 /*
2  * Copyright 2009 VMware, Inc.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * on the rights to use, copy, modify, merge, publish, distribute, sub
9  * license, and/or sell copies of the Software, and to permit persons to whom
10  * the Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19  * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22  * USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /*
26  * This file holds common definitions of the gallium remote debugging protocol.
27  */
28 
29 #ifndef _RBUG_PROTO_H_
30 #define _RBUG_PROTO_H_
31 
32 #include "pipe/p_compiler.h"
33 
34 /**
35  * Uniqe indentifier for each command.
36  *
37  * Replys are designated by negative.
38  */
39 enum rbug_opcode
40 {
41 	RBUG_OP_NOOP = 0,
42 	RBUG_OP_PING = 1,
43 	RBUG_OP_ERROR = 2,
44 	RBUG_OP_PING_REPLY = -1,
45 	RBUG_OP_ERROR_REPLY = -2,
46 	RBUG_OP_TEXTURE_LIST = 256,
47 	RBUG_OP_TEXTURE_INFO = 257,
48 	RBUG_OP_TEXTURE_WRITE = 258,
49 	RBUG_OP_TEXTURE_READ = 259,
50 	RBUG_OP_TEXTURE_LIST_REPLY = -256,
51 	RBUG_OP_TEXTURE_INFO_REPLY = -257,
52 	RBUG_OP_TEXTURE_READ_REPLY = -259,
53 	RBUG_OP_CONTEXT_LIST = 512,
54 	RBUG_OP_CONTEXT_INFO = 513,
55 	RBUG_OP_CONTEXT_DRAW_BLOCK = 514,
56 	RBUG_OP_CONTEXT_DRAW_STEP = 515,
57 	RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516,
58 	RBUG_OP_CONTEXT_DRAW_RULE = 518,
59 	RBUG_OP_CONTEXT_FLUSH = 519,
60 	RBUG_OP_CONTEXT_LIST_REPLY = -512,
61 	RBUG_OP_CONTEXT_INFO_REPLY = -513,
62 	RBUG_OP_CONTEXT_DRAW_BLOCKED = 517,
63 	RBUG_OP_SHADER_LIST = 768,
64 	RBUG_OP_SHADER_INFO = 769,
65 	RBUG_OP_SHADER_DISABLE = 770,
66 	RBUG_OP_SHADER_REPLACE = 771,
67 	RBUG_OP_SHADER_LIST_REPLY = -768,
68 	RBUG_OP_SHADER_INFO_REPLY = -769
69 };
70 
71 /**
72  * Header for demarshaled message.
73  */
74 struct rbug_header
75 {
76 	enum rbug_opcode opcode;
77 	void *__message;
78 };
79 
80 /**
81  * Header for a message in wire format.
82  */
83 struct rbug_proto_header
84 {
85 	int32_t opcode;
86 	uint32_t length;
87 };
88 
89 /**
90  * Forward declare connection here, as this file is included by all users.
91  */
92 struct rbug_connection;
93 
94 /**
95  * Get printable string for opcode.
96  */
97 const char* rbug_proto_get_name(enum rbug_opcode opcode);
98 
99 #endif
100