1848b8605Smrg/*
2848b8605Smrg * Copyright 2009 VMware, Inc.
3848b8605Smrg * All Rights Reserved.
4848b8605Smrg *
5848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6848b8605Smrg * copy of this software and associated documentation files (the "Software"),
7848b8605Smrg * to deal in the Software without restriction, including without limitation
8848b8605Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub
9848b8605Smrg * license, and/or sell copies of the Software, and to permit persons to whom
10848b8605Smrg * the Software is furnished to do so, subject to the following conditions:
11848b8605Smrg *
12848b8605Smrg * The above copyright notice and this permission notice (including the next
13848b8605Smrg * paragraph) shall be included in all copies or substantial portions of the
14848b8605Smrg * Software.
15848b8605Smrg *
16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17848b8605Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19848b8605Smrg * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20848b8605Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21848b8605Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22848b8605Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE.
23848b8605Smrg */
24848b8605Smrg
25848b8605Smrg/*
26848b8605Smrg * This file holds structs decelerations and function prototypes for one of
27848b8605Smrg * the rbug extensions. Implementation of the functions is in the same folder
28848b8605Smrg * in the c file matching this file's name.
29848b8605Smrg *
30848b8605Smrg * The structs what is returned from the demarshal functions. The functions
31848b8605Smrg * starting rbug_send_* encodes a call to the write format and sends that to
32848b8605Smrg * the supplied connection, while functions starting with rbug_demarshal_*
33848b8605Smrg * demarshal data from the wire protocol.
34848b8605Smrg *
35848b8605Smrg * Structs and functions ending with _reply are replies to requests.
36848b8605Smrg */
37848b8605Smrg
38848b8605Smrg#ifndef _RBUG_PROTO_CONTEXT_H_
39848b8605Smrg#define _RBUG_PROTO_CONTEXT_H_
40848b8605Smrg
41848b8605Smrg#include "rbug_proto.h"
42848b8605Smrg#include "rbug_core.h"
43848b8605Smrg
44848b8605Smrgtypedef enum
45848b8605Smrg{
46848b8605Smrg	RBUG_BLOCK_BEFORE = 1,
47848b8605Smrg	RBUG_BLOCK_AFTER = 2,
48848b8605Smrg	RBUG_BLOCK_RULE = 4,
49848b8605Smrg	RBUG_BLOCK_MASK = 7
50848b8605Smrg} rbug_block_t;
51848b8605Smrg
52848b8605Smrgstruct rbug_proto_context_list
53848b8605Smrg{
54848b8605Smrg	struct rbug_header header;
55848b8605Smrg};
56848b8605Smrg
57848b8605Smrgstruct rbug_proto_context_info
58848b8605Smrg{
59848b8605Smrg	struct rbug_header header;
60848b8605Smrg	rbug_context_t context;
61848b8605Smrg};
62848b8605Smrg
63848b8605Smrgstruct rbug_proto_context_draw_block
64848b8605Smrg{
65848b8605Smrg	struct rbug_header header;
66848b8605Smrg	rbug_context_t context;
67848b8605Smrg	rbug_block_t block;
68848b8605Smrg};
69848b8605Smrg
70848b8605Smrgstruct rbug_proto_context_draw_step
71848b8605Smrg{
72848b8605Smrg	struct rbug_header header;
73848b8605Smrg	rbug_context_t context;
74848b8605Smrg	rbug_block_t step;
75848b8605Smrg};
76848b8605Smrg
77848b8605Smrgstruct rbug_proto_context_draw_unblock
78848b8605Smrg{
79848b8605Smrg	struct rbug_header header;
80848b8605Smrg	rbug_context_t context;
81848b8605Smrg	rbug_block_t unblock;
82848b8605Smrg};
83848b8605Smrg
84848b8605Smrgstruct rbug_proto_context_draw_rule
85848b8605Smrg{
86848b8605Smrg	struct rbug_header header;
87848b8605Smrg	rbug_context_t context;
88848b8605Smrg	rbug_shader_t vertex;
89848b8605Smrg	rbug_shader_t fragment;
90848b8605Smrg	rbug_texture_t texture;
91848b8605Smrg	rbug_texture_t surface;
92848b8605Smrg	rbug_block_t block;
93848b8605Smrg};
94848b8605Smrg
95848b8605Smrgstruct rbug_proto_context_flush
96848b8605Smrg{
97848b8605Smrg	struct rbug_header header;
98848b8605Smrg	rbug_context_t context;
99848b8605Smrg};
100848b8605Smrg
101848b8605Smrgstruct rbug_proto_context_list_reply
102848b8605Smrg{
103848b8605Smrg	struct rbug_header header;
104848b8605Smrg	uint32_t serial;
105848b8605Smrg	rbug_context_t *contexts;
106848b8605Smrg	uint32_t contexts_len;
107848b8605Smrg};
108848b8605Smrg
109848b8605Smrgstruct rbug_proto_context_info_reply
110848b8605Smrg{
111848b8605Smrg	struct rbug_header header;
112848b8605Smrg	uint32_t serial;
113848b8605Smrg	rbug_shader_t vertex;
114848b8605Smrg	rbug_shader_t fragment;
115848b8605Smrg	rbug_texture_t *texs;
116848b8605Smrg	uint32_t texs_len;
117848b8605Smrg	rbug_texture_t *cbufs;
118848b8605Smrg	uint32_t cbufs_len;
119848b8605Smrg	rbug_texture_t zsbuf;
120848b8605Smrg	rbug_block_t blocker;
121848b8605Smrg	rbug_block_t blocked;
122848b8605Smrg};
123848b8605Smrg
124848b8605Smrgstruct rbug_proto_context_draw_blocked
125848b8605Smrg{
126848b8605Smrg	struct rbug_header header;
127848b8605Smrg	rbug_context_t context;
128848b8605Smrg	rbug_block_t block;
129848b8605Smrg};
130848b8605Smrg
131848b8605Smrgint rbug_send_context_list(struct rbug_connection *__con,
132848b8605Smrg                           uint32_t *__serial);
133848b8605Smrg
134848b8605Smrgint rbug_send_context_info(struct rbug_connection *__con,
135848b8605Smrg                           rbug_context_t context,
136848b8605Smrg                           uint32_t *__serial);
137848b8605Smrg
138848b8605Smrgint rbug_send_context_draw_block(struct rbug_connection *__con,
139848b8605Smrg                                 rbug_context_t context,
140848b8605Smrg                                 rbug_block_t block,
141848b8605Smrg                                 uint32_t *__serial);
142848b8605Smrg
143848b8605Smrgint rbug_send_context_draw_step(struct rbug_connection *__con,
144848b8605Smrg                                rbug_context_t context,
145848b8605Smrg                                rbug_block_t step,
146848b8605Smrg                                uint32_t *__serial);
147848b8605Smrg
148848b8605Smrgint rbug_send_context_draw_unblock(struct rbug_connection *__con,
149848b8605Smrg                                   rbug_context_t context,
150848b8605Smrg                                   rbug_block_t unblock,
151848b8605Smrg                                   uint32_t *__serial);
152848b8605Smrg
153848b8605Smrgint rbug_send_context_draw_rule(struct rbug_connection *__con,
154848b8605Smrg                                rbug_context_t context,
155848b8605Smrg                                rbug_shader_t vertex,
156848b8605Smrg                                rbug_shader_t fragment,
157848b8605Smrg                                rbug_texture_t texture,
158848b8605Smrg                                rbug_texture_t surface,
159848b8605Smrg                                rbug_block_t block,
160848b8605Smrg                                uint32_t *__serial);
161848b8605Smrg
162848b8605Smrgint rbug_send_context_flush(struct rbug_connection *__con,
163848b8605Smrg                            rbug_context_t context,
164848b8605Smrg                            uint32_t *__serial);
165848b8605Smrg
166848b8605Smrgint rbug_send_context_list_reply(struct rbug_connection *__con,
167848b8605Smrg                                 uint32_t serial,
168848b8605Smrg                                 rbug_context_t *contexts,
169848b8605Smrg                                 uint32_t contexts_len,
170848b8605Smrg                                 uint32_t *__serial);
171848b8605Smrg
172848b8605Smrgint rbug_send_context_info_reply(struct rbug_connection *__con,
173848b8605Smrg                                 uint32_t serial,
174848b8605Smrg                                 rbug_shader_t vertex,
175848b8605Smrg                                 rbug_shader_t fragment,
176848b8605Smrg                                 rbug_texture_t *texs,
177848b8605Smrg                                 uint32_t texs_len,
178848b8605Smrg                                 rbug_texture_t *cbufs,
179848b8605Smrg                                 uint32_t cbufs_len,
180848b8605Smrg                                 rbug_texture_t zsbuf,
181848b8605Smrg                                 rbug_block_t blocker,
182848b8605Smrg                                 rbug_block_t blocked,
183848b8605Smrg                                 uint32_t *__serial);
184848b8605Smrg
185848b8605Smrgint rbug_send_context_draw_blocked(struct rbug_connection *__con,
186848b8605Smrg                                   rbug_context_t context,
187848b8605Smrg                                   rbug_block_t block,
188848b8605Smrg                                   uint32_t *__serial);
189848b8605Smrg
190848b8605Smrgstruct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header);
191848b8605Smrg
192848b8605Smrgstruct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header);
193848b8605Smrg
194848b8605Smrgstruct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header);
195848b8605Smrg
196848b8605Smrgstruct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header);
197848b8605Smrg
198848b8605Smrgstruct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header);
199848b8605Smrg
200848b8605Smrgstruct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header);
201848b8605Smrg
202848b8605Smrgstruct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header);
203848b8605Smrg
204848b8605Smrgstruct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header);
205848b8605Smrg
206848b8605Smrgstruct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header);
207848b8605Smrg
208848b8605Smrgstruct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header);
209848b8605Smrg
210848b8605Smrg#endif
211