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 structs decelerations and function prototypes for one of
27 * the rbug extensions. Implementation of the functions is in the same folder
28 * in the c file matching this file's name.
29 *
30 * The structs what is returned from the demarshal functions. The functions
31 * starting rbug_send_* encodes a call to the write format and sends that to
32 * the supplied connection, while functions starting with rbug_demarshal_*
33 * demarshal data from the wire protocol.
34 *
35 * Structs and functions ending with _reply are replies to requests.
36 */
37
38#ifndef _RBUG_PROTO_CONTEXT_H_
39#define _RBUG_PROTO_CONTEXT_H_
40
41#include "rbug_proto.h"
42#include "rbug_core.h"
43
44typedef enum
45{
46	RBUG_BLOCK_BEFORE = 1,
47	RBUG_BLOCK_AFTER = 2,
48	RBUG_BLOCK_RULE = 4,
49	RBUG_BLOCK_MASK = 7
50} rbug_block_t;
51
52struct rbug_proto_context_list
53{
54	struct rbug_header header;
55};
56
57struct rbug_proto_context_info
58{
59	struct rbug_header header;
60	rbug_context_t context;
61};
62
63struct rbug_proto_context_draw_block
64{
65	struct rbug_header header;
66	rbug_context_t context;
67	rbug_block_t block;
68};
69
70struct rbug_proto_context_draw_step
71{
72	struct rbug_header header;
73	rbug_context_t context;
74	rbug_block_t step;
75};
76
77struct rbug_proto_context_draw_unblock
78{
79	struct rbug_header header;
80	rbug_context_t context;
81	rbug_block_t unblock;
82};
83
84struct rbug_proto_context_draw_rule
85{
86	struct rbug_header header;
87	rbug_context_t context;
88	rbug_shader_t vertex;
89	rbug_shader_t fragment;
90	rbug_texture_t texture;
91	rbug_texture_t surface;
92	rbug_block_t block;
93};
94
95struct rbug_proto_context_flush
96{
97	struct rbug_header header;
98	rbug_context_t context;
99};
100
101struct rbug_proto_context_list_reply
102{
103	struct rbug_header header;
104	uint32_t serial;
105	rbug_context_t *contexts;
106	uint32_t contexts_len;
107};
108
109struct rbug_proto_context_info_reply
110{
111	struct rbug_header header;
112	uint32_t serial;
113	rbug_shader_t vertex;
114	rbug_shader_t fragment;
115	rbug_texture_t *texs;
116	uint32_t texs_len;
117	rbug_texture_t *cbufs;
118	uint32_t cbufs_len;
119	rbug_texture_t zsbuf;
120	rbug_block_t blocker;
121	rbug_block_t blocked;
122};
123
124struct rbug_proto_context_draw_blocked
125{
126	struct rbug_header header;
127	rbug_context_t context;
128	rbug_block_t block;
129};
130
131int rbug_send_context_list(struct rbug_connection *__con,
132                           uint32_t *__serial);
133
134int rbug_send_context_info(struct rbug_connection *__con,
135                           rbug_context_t context,
136                           uint32_t *__serial);
137
138int rbug_send_context_draw_block(struct rbug_connection *__con,
139                                 rbug_context_t context,
140                                 rbug_block_t block,
141                                 uint32_t *__serial);
142
143int rbug_send_context_draw_step(struct rbug_connection *__con,
144                                rbug_context_t context,
145                                rbug_block_t step,
146                                uint32_t *__serial);
147
148int rbug_send_context_draw_unblock(struct rbug_connection *__con,
149                                   rbug_context_t context,
150                                   rbug_block_t unblock,
151                                   uint32_t *__serial);
152
153int rbug_send_context_draw_rule(struct rbug_connection *__con,
154                                rbug_context_t context,
155                                rbug_shader_t vertex,
156                                rbug_shader_t fragment,
157                                rbug_texture_t texture,
158                                rbug_texture_t surface,
159                                rbug_block_t block,
160                                uint32_t *__serial);
161
162int rbug_send_context_flush(struct rbug_connection *__con,
163                            rbug_context_t context,
164                            uint32_t *__serial);
165
166int rbug_send_context_list_reply(struct rbug_connection *__con,
167                                 uint32_t serial,
168                                 rbug_context_t *contexts,
169                                 uint32_t contexts_len,
170                                 uint32_t *__serial);
171
172int rbug_send_context_info_reply(struct rbug_connection *__con,
173                                 uint32_t serial,
174                                 rbug_shader_t vertex,
175                                 rbug_shader_t fragment,
176                                 rbug_texture_t *texs,
177                                 uint32_t texs_len,
178                                 rbug_texture_t *cbufs,
179                                 uint32_t cbufs_len,
180                                 rbug_texture_t zsbuf,
181                                 rbug_block_t blocker,
182                                 rbug_block_t blocked,
183                                 uint32_t *__serial);
184
185int rbug_send_context_draw_blocked(struct rbug_connection *__con,
186                                   rbug_context_t context,
187                                   rbug_block_t block,
188                                   uint32_t *__serial);
189
190struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header);
191
192struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header);
193
194struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header);
195
196struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header);
197
198struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header);
199
200struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header);
201
202struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header);
203
204struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header);
205
206struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header);
207
208struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header);
209
210#endif
211