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_TEXTURE_H_
39#define _RBUG_PROTO_TEXTURE_H_
40
41#include "rbug_proto.h"
42#include "rbug_core.h"
43
44struct rbug_proto_texture_list
45{
46	struct rbug_header header;
47};
48
49struct rbug_proto_texture_info
50{
51	struct rbug_header header;
52	rbug_texture_t texture;
53};
54
55struct rbug_proto_texture_write
56{
57	struct rbug_header header;
58	rbug_texture_t texture;
59	uint32_t face;
60	uint32_t level;
61	uint32_t zslice;
62	uint32_t x;
63	uint32_t y;
64	uint32_t w;
65	uint32_t h;
66	uint8_t *data;
67	uint32_t data_len;
68	uint32_t stride;
69};
70
71struct rbug_proto_texture_read
72{
73	struct rbug_header header;
74	rbug_texture_t texture;
75	uint32_t face;
76	uint32_t level;
77	uint32_t zslice;
78	uint32_t x;
79	uint32_t y;
80	uint32_t w;
81	uint32_t h;
82};
83
84struct rbug_proto_texture_list_reply
85{
86	struct rbug_header header;
87	uint32_t serial;
88	rbug_texture_t *textures;
89	uint32_t textures_len;
90};
91
92struct rbug_proto_texture_info_reply
93{
94	struct rbug_header header;
95	uint32_t serial;
96	uint32_t target;
97	uint32_t format;
98	uint32_t *width;
99	uint32_t width_len;
100	uint32_t *height;
101	uint32_t height_len;
102	uint32_t *depth;
103	uint32_t depth_len;
104	uint32_t blockw;
105	uint32_t blockh;
106	uint32_t blocksize;
107	uint32_t last_level;
108	uint32_t nr_samples;
109	uint32_t tex_usage;
110};
111
112struct rbug_proto_texture_read_reply
113{
114	struct rbug_header header;
115	uint32_t serial;
116	uint32_t format;
117	uint32_t blockw;
118	uint32_t blockh;
119	uint32_t blocksize;
120	uint8_t *data;
121	uint32_t data_len;
122	uint32_t stride;
123};
124
125int rbug_send_texture_list(struct rbug_connection *__con,
126                           uint32_t *__serial);
127
128int rbug_send_texture_info(struct rbug_connection *__con,
129                           rbug_texture_t texture,
130                           uint32_t *__serial);
131
132int rbug_send_texture_write(struct rbug_connection *__con,
133                            rbug_texture_t texture,
134                            uint32_t face,
135                            uint32_t level,
136                            uint32_t zslice,
137                            uint32_t x,
138                            uint32_t y,
139                            uint32_t w,
140                            uint32_t h,
141                            uint8_t *data,
142                            uint32_t data_len,
143                            uint32_t stride,
144                            uint32_t *__serial);
145
146int rbug_send_texture_read(struct rbug_connection *__con,
147                           rbug_texture_t texture,
148                           uint32_t face,
149                           uint32_t level,
150                           uint32_t zslice,
151                           uint32_t x,
152                           uint32_t y,
153                           uint32_t w,
154                           uint32_t h,
155                           uint32_t *__serial);
156
157int rbug_send_texture_list_reply(struct rbug_connection *__con,
158                                 uint32_t serial,
159                                 rbug_texture_t *textures,
160                                 uint32_t textures_len,
161                                 uint32_t *__serial);
162
163int rbug_send_texture_info_reply(struct rbug_connection *__con,
164                                 uint32_t serial,
165                                 uint32_t target,
166                                 uint32_t format,
167                                 uint32_t *width,
168                                 uint32_t width_len,
169                                 uint32_t *height,
170                                 uint32_t height_len,
171                                 uint32_t *depth,
172                                 uint32_t depth_len,
173                                 uint32_t blockw,
174                                 uint32_t blockh,
175                                 uint32_t blocksize,
176                                 uint32_t last_level,
177                                 uint32_t nr_samples,
178                                 uint32_t tex_usage,
179                                 uint32_t *__serial);
180
181int rbug_send_texture_read_reply(struct rbug_connection *__con,
182                                 uint32_t serial,
183                                 uint32_t format,
184                                 uint32_t blockw,
185                                 uint32_t blockh,
186                                 uint32_t blocksize,
187                                 uint8_t *data,
188                                 uint32_t data_len,
189                                 uint32_t stride,
190                                 uint32_t *__serial);
191
192struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header);
193
194struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header);
195
196struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header);
197
198struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header);
199
200struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header);
201
202struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header);
203
204struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header);
205
206#endif
207