diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2009-05-15 01:07:05 +0200 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2009-06-01 11:19:39 +0100 |
commit | dfa4ebcbcc9c7e9e7562f73a4ddc367756623e5e (patch) | |
tree | 25627d97f69fd45dc37c19484b99a06f3d0ed018 | |
parent | aee1a6f70413235c0c4c2c2adfca97d5128a155e (diff) |
rbug: Add Gallium Remote Debugger Protocol code
This is the (de)marshalling and connection managment code
-rw-r--r-- | configs/default | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/gallium/SConscript | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/Makefile | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/README | 21 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/SConscript | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug.h | 33 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_connection.c | 167 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_connection.h | 45 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_context.c | 442 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_context.h | 128 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_core.c | 359 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_core.h | 101 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_demarshal.c | 85 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_internal.h | 100 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_proto.h | 90 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_shader.c | 468 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_shader.h | 144 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_texture.c | 631 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_texture.h | 207 |
20 files changed, 3052 insertions, 2 deletions
diff --git a/configs/default b/configs/default index 9c479fccdf9..d2ea3b24876 100644 --- a/configs/default +++ b/configs/default | |||
@@ -90,7 +90,7 @@ EGL_DRIVERS_DIRS = demo | |||
90 | 90 | ||
91 | # Gallium directories and | 91 | # Gallium directories and |
92 | GALLIUM_DIRS = auxiliary drivers state_trackers | 92 | GALLIUM_DIRS = auxiliary drivers state_trackers |
93 | GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices | 93 | GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices |
94 | GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) | 94 | GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) |
95 | GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace | 95 | GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace |
96 | GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) | 96 | GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) |
diff --git a/configure.ac b/configure.ac index 8110e0f8692..24aa13a7cad 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -409,7 +409,7 @@ WINDOW_SYSTEM="" | |||
409 | GALLIUM_DIRS="auxiliary drivers state_trackers" | 409 | GALLIUM_DIRS="auxiliary drivers state_trackers" |
410 | GALLIUM_WINSYS_DIRS="" | 410 | GALLIUM_WINSYS_DIRS="" |
411 | GALLIUM_WINSYS_DRM_DIRS="" | 411 | GALLIUM_WINSYS_DRM_DIRS="" |
412 | GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices" | 412 | GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices" |
413 | GALLIUM_DRIVERS_DIRS="softpipe failover trace" | 413 | GALLIUM_DRIVERS_DIRS="softpipe failover trace" |
414 | GALLIUM_STATE_TRACKERS_DIRS="" | 414 | GALLIUM_STATE_TRACKERS_DIRS="" |
415 | 415 | ||
diff --git a/src/gallium/SConscript b/src/gallium/SConscript index b6ceaf3edf9..32b7c2980ab 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript | |||
@@ -22,6 +22,7 @@ SConscript([ | |||
22 | 'auxiliary/draw/SConscript', | 22 | 'auxiliary/draw/SConscript', |
23 | 'auxiliary/pipebuffer/SConscript', | 23 | 'auxiliary/pipebuffer/SConscript', |
24 | 'auxiliary/indices/SConscript', | 24 | 'auxiliary/indices/SConscript', |
25 | 'auxiliary/rbug/SConscript', | ||
25 | ]) | 26 | ]) |
26 | 27 | ||
27 | for driver in env['drivers']: | 28 | for driver in env['drivers']: |
diff --git a/src/gallium/auxiliary/rbug/Makefile b/src/gallium/auxiliary/rbug/Makefile new file mode 100644 index 00000000000..cd12e8468fc --- /dev/null +++ b/src/gallium/auxiliary/rbug/Makefile | |||
@@ -0,0 +1,14 @@ | |||
1 | TOP = ../../../.. | ||
2 | include $(TOP)/configs/current | ||
3 | |||
4 | LIBNAME = rbug | ||
5 | |||
6 | C_SOURCES = \ | ||
7 | rbug_connection.c \ | ||
8 | rbug_core.c \ | ||
9 | rbug_texture.c \ | ||
10 | rbug_context.c \ | ||
11 | rbug_shader.c \ | ||
12 | rbug_demarshal.c | ||
13 | |||
14 | include ../../Makefile.template | ||
diff --git a/src/gallium/auxiliary/rbug/README b/src/gallium/auxiliary/rbug/README new file mode 100644 index 00000000000..33d76371de4 --- /dev/null +++ b/src/gallium/auxiliary/rbug/README | |||
@@ -0,0 +1,21 @@ | |||
1 | GALLIUM REMOTE DEBUGGING COMMON CODE | ||
2 | |||
3 | = About = | ||
4 | |||
5 | This directory contains the common code for the Gallium 3D remote debugging | ||
6 | driver and clients. The code is two parts the connection managment code and | ||
7 | the (de)marsheller. | ||
8 | |||
9 | The code currently uses tcp and ip4v for connections. | ||
10 | |||
11 | Information about driver integration can be found in: | ||
12 | |||
13 | src/gallium/drivers/trace/README | ||
14 | |||
15 | for information about applications look in: | ||
16 | |||
17 | progs/rbug/README | ||
18 | |||
19 | |||
20 | -- | ||
21 | Jakob Bornecrantz <jakob@vmware.com> | ||
diff --git a/src/gallium/auxiliary/rbug/SConscript b/src/gallium/auxiliary/rbug/SConscript new file mode 100644 index 00000000000..4a9afb45d3c --- /dev/null +++ b/src/gallium/auxiliary/rbug/SConscript | |||
@@ -0,0 +1,14 @@ | |||
1 | Import('*') | ||
2 | |||
3 | rbug = env.ConvenienceLibrary( | ||
4 | target = 'rbug', | ||
5 | source = [ | ||
6 | 'rbug_core.c', | ||
7 | 'rbug_shader.c', | ||
8 | 'rbug_context.c', | ||
9 | 'rbug_texture.c', | ||
10 | 'rbug_demarshal.c', | ||
11 | 'rbug_connection.c', | ||
12 | ]) | ||
13 | |||
14 | auxiliaries.insert(0, rbug) | ||
diff --git a/src/gallium/auxiliary/rbug/rbug.h b/src/gallium/auxiliary/rbug/rbug.h new file mode 100644 index 00000000000..259bfc6c79c --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug.h | |||
@@ -0,0 +1,33 @@ | |||
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 | * Include all for users the remote debugger protocol code. | ||
27 | */ | ||
28 | |||
29 | #include "rbug/rbug_core.h" | ||
30 | #include "rbug/rbug_shader.h" | ||
31 | #include "rbug/rbug_context.h" | ||
32 | #include "rbug/rbug_texture.h" | ||
33 | #include "rbug/rbug_connection.h" | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_connection.c b/src/gallium/auxiliary/rbug/rbug_connection.c new file mode 100644 index 00000000000..52acb700af9 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_connection.c | |||
@@ -0,0 +1,167 @@ | |||
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 | #include "rbug/rbug.h" | ||
26 | #include "rbug/rbug_internal.h" | ||
27 | |||
28 | #include "util/u_network.h" | ||
29 | |||
30 | struct rbug_connection | ||
31 | { | ||
32 | int socket; | ||
33 | uint32_t send_serial; | ||
34 | uint32_t recv_serial; | ||
35 | enum rbug_opcode opcode; | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * Create a rbug connection from a socket created with u_socket. | ||
40 | * | ||
41 | * Result: | ||
42 | * A new allocated connection using socket as communication path | ||
43 | */ | ||
44 | struct rbug_connection * | ||
45 | rbug_from_socket(int socket) | ||
46 | { | ||
47 | struct rbug_connection *c = CALLOC_STRUCT(rbug_connection); | ||
48 | c->socket = socket; | ||
49 | return c; | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * Free a connection, also closes socket. | ||
54 | */ | ||
55 | void | ||
56 | rbug_disconnect(struct rbug_connection *c) | ||
57 | { | ||
58 | u_socket_close(c->socket); | ||
59 | FREE(c); | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Waits for a message to be fully received. | ||
64 | * Also returns the serial for the message, serial is not touched for replys. | ||
65 | * | ||
66 | * Result: | ||
67 | * demarshaled message on success, NULL on connection error | ||
68 | */ | ||
69 | struct rbug_header * | ||
70 | rbug_get_message(struct rbug_connection *c, uint32_t *serial) | ||
71 | { | ||
72 | struct rbug_proto_header header; | ||
73 | struct rbug_header *out; | ||
74 | struct rbug_proto_header *data; | ||
75 | size_t length = 0; | ||
76 | size_t read = 0; | ||
77 | int ret; | ||
78 | |||
79 | |||
80 | ret = u_socket_peek(c->socket, &header, sizeof(header)); | ||
81 | if (ret <= 0) { | ||
82 | return NULL; | ||
83 | } | ||
84 | |||
85 | length = (size_t)header.length * 4; | ||
86 | data = MALLOC(length); | ||
87 | if (!data) { | ||
88 | return NULL; | ||
89 | } | ||
90 | |||
91 | do { | ||
92 | uint8_t *ptr = ((uint8_t*)data) + read; | ||
93 | ret = u_socket_recv(c->socket, ptr, length - read); | ||
94 | |||
95 | if (ret <= 0) { | ||
96 | FREE(data); | ||
97 | return NULL; | ||
98 | } | ||
99 | |||
100 | read += ret; | ||
101 | } while(read < length); | ||
102 | |||
103 | out = rbug_demarshal(data); | ||
104 | if (!out) | ||
105 | FREE(data); | ||
106 | else if (serial) | ||
107 | *serial = c->recv_serial++; | ||
108 | else | ||
109 | c->recv_serial++; | ||
110 | |||
111 | return out; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * Frees a message and associated data. | ||
116 | */ | ||
117 | void | ||
118 | rbug_free_header(struct rbug_header *header) | ||
119 | { | ||
120 | if (!header) | ||
121 | return; | ||
122 | |||
123 | FREE(header->__message); | ||
124 | FREE(header); | ||
125 | } | ||
126 | |||
127 | /** | ||
128 | * Internal function used by rbug_send_* functions. | ||
129 | * | ||
130 | * Start sending a message. | ||
131 | */ | ||
132 | int | ||
133 | rbug_connection_send_start(struct rbug_connection *c, enum rbug_opcode opcode, uint32_t length) | ||
134 | { | ||
135 | c->opcode = opcode; | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * Internal function used by rbug_send_* functions. | ||
141 | * | ||
142 | * Write data to the socket. | ||
143 | */ | ||
144 | int | ||
145 | rbug_connection_write(struct rbug_connection *c, void *to, uint32_t size) | ||
146 | { | ||
147 | int ret = u_socket_send(c->socket, to, size); | ||
148 | return ret; | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * Internal function used by rbug_send_* functions. | ||
153 | * | ||
154 | * Finish writeing data to the socket. | ||
155 | * Ups the send_serial and sets the serial argument if supplied. | ||
156 | */ | ||
157 | int rbug_connection_send_finish(struct rbug_connection *c, uint32_t *serial) | ||
158 | { | ||
159 | if (c->opcode < 0) | ||
160 | return 0; | ||
161 | else if (serial) | ||
162 | *serial = c->send_serial++; | ||
163 | else | ||
164 | c->send_serial++; | ||
165 | |||
166 | return 0; | ||
167 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_connection.h b/src/gallium/auxiliary/rbug/rbug_connection.h new file mode 100644 index 00000000000..1f2c9ff347c --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_connection.h | |||
@@ -0,0 +1,45 @@ | |||
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 contains the function defentions for connection see c file for | ||
27 | * more comments covering function use. | ||
28 | */ | ||
29 | |||
30 | #ifndef _RBUG_CONNECTION_H_ | ||
31 | #define _RBUG_CONNECTION_H_ | ||
32 | |||
33 | #include "rbug/rbug_proto.h" | ||
34 | |||
35 | struct rbug_connection * rbug_from_socket(int socket); | ||
36 | |||
37 | void rbug_disconnect(struct rbug_connection *c); | ||
38 | |||
39 | struct rbug_header * rbug_get_message(struct rbug_connection *c, uint32_t *serial); | ||
40 | |||
41 | void rbug_free_header(struct rbug_header *header); | ||
42 | |||
43 | struct rbug_header * rbug_demarshal(struct rbug_proto_header *header); | ||
44 | |||
45 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c new file mode 100644 index 00000000000..b4fad5300d9 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_context.c | |||
@@ -0,0 +1,442 @@ | |||
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 the function implementation for one of the rbug extensions. | ||
27 | * Prototypes and declerations of functions and structs is in the same folder | ||
28 | * in the header file matching this file's name. | ||
29 | * | ||
30 | * The functions starting rbug_send_* encodes a call to the write format and | ||
31 | * sends that to the supplied connection, while functions starting with | ||
32 | * rbug_demarshal_* demarshal data in the wire protocol. | ||
33 | * | ||
34 | * Functions ending with _reply are replies to requests. | ||
35 | */ | ||
36 | |||
37 | #include "rbug_internal.h" | ||
38 | #include "rbug/rbug_context.h" | ||
39 | |||
40 | int rbug_send_context_list(struct rbug_connection *__con, | ||
41 | uint32_t *__serial) | ||
42 | { | ||
43 | uint32_t __len = 0; | ||
44 | uint32_t __pos = 0; | ||
45 | uint8_t *__data = NULL; | ||
46 | int __ret = 0; | ||
47 | |||
48 | LEN(8); /* header */ | ||
49 | |||
50 | /* align */ | ||
51 | PAD(__len, 8); | ||
52 | |||
53 | __data = (uint8_t*)MALLOC(__len); | ||
54 | if (!__data) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST)); | ||
58 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
59 | |||
60 | /* final pad */ | ||
61 | PAD(__pos, 8); | ||
62 | |||
63 | if (__pos != __len) { | ||
64 | __ret = -EINVAL; | ||
65 | } else { | ||
66 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST, __len); | ||
67 | rbug_connection_write(__con, __data, __len); | ||
68 | __ret = rbug_connection_send_finish(__con, __serial); | ||
69 | } | ||
70 | |||
71 | FREE(__data); | ||
72 | return __ret; | ||
73 | } | ||
74 | |||
75 | int rbug_send_context_info(struct rbug_connection *__con, | ||
76 | rbug_context_t context, | ||
77 | uint32_t *__serial) | ||
78 | { | ||
79 | uint32_t __len = 0; | ||
80 | uint32_t __pos = 0; | ||
81 | uint8_t *__data = NULL; | ||
82 | int __ret = 0; | ||
83 | |||
84 | LEN(8); /* header */ | ||
85 | LEN(8); /* context */ | ||
86 | |||
87 | /* align */ | ||
88 | PAD(__len, 8); | ||
89 | |||
90 | __data = (uint8_t*)MALLOC(__len); | ||
91 | if (!__data) | ||
92 | return -ENOMEM; | ||
93 | |||
94 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO)); | ||
95 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
96 | WRITE(8, rbug_context_t, context); /* context */ | ||
97 | |||
98 | /* final pad */ | ||
99 | PAD(__pos, 8); | ||
100 | |||
101 | if (__pos != __len) { | ||
102 | __ret = -EINVAL; | ||
103 | } else { | ||
104 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO, __len); | ||
105 | rbug_connection_write(__con, __data, __len); | ||
106 | __ret = rbug_connection_send_finish(__con, __serial); | ||
107 | } | ||
108 | |||
109 | FREE(__data); | ||
110 | return __ret; | ||
111 | } | ||
112 | |||
113 | int rbug_send_context_block_draw(struct rbug_connection *__con, | ||
114 | rbug_context_t context, | ||
115 | uint32_t *__serial) | ||
116 | { | ||
117 | uint32_t __len = 0; | ||
118 | uint32_t __pos = 0; | ||
119 | uint8_t *__data = NULL; | ||
120 | int __ret = 0; | ||
121 | |||
122 | LEN(8); /* header */ | ||
123 | LEN(8); /* context */ | ||
124 | |||
125 | /* align */ | ||
126 | PAD(__len, 8); | ||
127 | |||
128 | __data = (uint8_t*)MALLOC(__len); | ||
129 | if (!__data) | ||
130 | return -ENOMEM; | ||
131 | |||
132 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_BLOCK_DRAW)); | ||
133 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
134 | WRITE(8, rbug_context_t, context); /* context */ | ||
135 | |||
136 | /* final pad */ | ||
137 | PAD(__pos, 8); | ||
138 | |||
139 | if (__pos != __len) { | ||
140 | __ret = -EINVAL; | ||
141 | } else { | ||
142 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_BLOCK_DRAW, __len); | ||
143 | rbug_connection_write(__con, __data, __len); | ||
144 | __ret = rbug_connection_send_finish(__con, __serial); | ||
145 | } | ||
146 | |||
147 | FREE(__data); | ||
148 | return __ret; | ||
149 | } | ||
150 | |||
151 | int rbug_send_context_unblock_draw(struct rbug_connection *__con, | ||
152 | rbug_context_t context, | ||
153 | uint32_t *__serial) | ||
154 | { | ||
155 | uint32_t __len = 0; | ||
156 | uint32_t __pos = 0; | ||
157 | uint8_t *__data = NULL; | ||
158 | int __ret = 0; | ||
159 | |||
160 | LEN(8); /* header */ | ||
161 | LEN(8); /* context */ | ||
162 | |||
163 | /* align */ | ||
164 | PAD(__len, 8); | ||
165 | |||
166 | __data = (uint8_t*)MALLOC(__len); | ||
167 | if (!__data) | ||
168 | return -ENOMEM; | ||
169 | |||
170 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW)); | ||
171 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
172 | WRITE(8, rbug_context_t, context); /* context */ | ||
173 | |||
174 | /* final pad */ | ||
175 | PAD(__pos, 8); | ||
176 | |||
177 | if (__pos != __len) { | ||
178 | __ret = -EINVAL; | ||
179 | } else { | ||
180 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_UNBLOCK_DRAW, __len); | ||
181 | rbug_connection_write(__con, __data, __len); | ||
182 | __ret = rbug_connection_send_finish(__con, __serial); | ||
183 | } | ||
184 | |||
185 | FREE(__data); | ||
186 | return __ret; | ||
187 | } | ||
188 | |||
189 | int rbug_send_context_list_reply(struct rbug_connection *__con, | ||
190 | uint32_t serial, | ||
191 | rbug_context_t *contexts, | ||
192 | uint32_t contexts_len, | ||
193 | uint32_t *__serial) | ||
194 | { | ||
195 | uint32_t __len = 0; | ||
196 | uint32_t __pos = 0; | ||
197 | uint8_t *__data = NULL; | ||
198 | int __ret = 0; | ||
199 | |||
200 | LEN(8); /* header */ | ||
201 | LEN(4); /* serial */ | ||
202 | LEN_ARRAY(8, contexts); /* contexts */ | ||
203 | |||
204 | /* align */ | ||
205 | PAD(__len, 8); | ||
206 | |||
207 | __data = (uint8_t*)MALLOC(__len); | ||
208 | if (!__data) | ||
209 | return -ENOMEM; | ||
210 | |||
211 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST_REPLY)); | ||
212 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
213 | WRITE(4, uint32_t, serial); /* serial */ | ||
214 | WRITE_ARRAY(8, rbug_context_t, contexts); /* contexts */ | ||
215 | |||
216 | /* final pad */ | ||
217 | PAD(__pos, 8); | ||
218 | |||
219 | if (__pos != __len) { | ||
220 | __ret = -EINVAL; | ||
221 | } else { | ||
222 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST_REPLY, __len); | ||
223 | rbug_connection_write(__con, __data, __len); | ||
224 | __ret = rbug_connection_send_finish(__con, __serial); | ||
225 | } | ||
226 | |||
227 | FREE(__data); | ||
228 | return __ret; | ||
229 | } | ||
230 | |||
231 | int rbug_send_context_info_reply(struct rbug_connection *__con, | ||
232 | uint32_t serial, | ||
233 | rbug_texture_t *cbufs, | ||
234 | uint32_t cbufs_len, | ||
235 | rbug_texture_t zdbuf, | ||
236 | uint8_t blocked, | ||
237 | uint32_t *__serial) | ||
238 | { | ||
239 | uint32_t __len = 0; | ||
240 | uint32_t __pos = 0; | ||
241 | uint8_t *__data = NULL; | ||
242 | int __ret = 0; | ||
243 | |||
244 | LEN(8); /* header */ | ||
245 | LEN(4); /* serial */ | ||
246 | LEN_ARRAY(8, cbufs); /* cbufs */ | ||
247 | LEN(8); /* zdbuf */ | ||
248 | LEN(1); /* blocked */ | ||
249 | |||
250 | /* align */ | ||
251 | PAD(__len, 8); | ||
252 | |||
253 | __data = (uint8_t*)MALLOC(__len); | ||
254 | if (!__data) | ||
255 | return -ENOMEM; | ||
256 | |||
257 | WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO_REPLY)); | ||
258 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
259 | WRITE(4, uint32_t, serial); /* serial */ | ||
260 | WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ | ||
261 | WRITE(8, rbug_texture_t, zdbuf); /* zdbuf */ | ||
262 | WRITE(1, uint8_t, blocked); /* blocked */ | ||
263 | |||
264 | /* final pad */ | ||
265 | PAD(__pos, 8); | ||
266 | |||
267 | if (__pos != __len) { | ||
268 | __ret = -EINVAL; | ||
269 | } else { | ||
270 | rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO_REPLY, __len); | ||
271 | rbug_connection_write(__con, __data, __len); | ||
272 | __ret = rbug_connection_send_finish(__con, __serial); | ||
273 | } | ||
274 | |||
275 | FREE(__data); | ||
276 | return __ret; | ||
277 | } | ||
278 | |||
279 | struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header) | ||
280 | { | ||
281 | uint32_t len = 0; | ||
282 | uint32_t pos = 0; | ||
283 | uint8_t *data = NULL; | ||
284 | struct rbug_proto_context_list *ret; | ||
285 | |||
286 | if (!header) | ||
287 | return NULL; | ||
288 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST) | ||
289 | return NULL; | ||
290 | |||
291 | pos = 0; | ||
292 | len = header->length * 4; | ||
293 | data = (uint8_t*)&header[1]; | ||
294 | ret = MALLOC(sizeof(*ret)); | ||
295 | if (!ret) | ||
296 | return NULL; | ||
297 | |||
298 | ret->header.__message = header; | ||
299 | ret->header.opcode = header->opcode; | ||
300 | |||
301 | |||
302 | return ret; | ||
303 | } | ||
304 | |||
305 | struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header) | ||
306 | { | ||
307 | uint32_t len = 0; | ||
308 | uint32_t pos = 0; | ||
309 | uint8_t *data = NULL; | ||
310 | struct rbug_proto_context_info *ret; | ||
311 | |||
312 | if (!header) | ||
313 | return NULL; | ||
314 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO) | ||
315 | return NULL; | ||
316 | |||
317 | pos = 0; | ||
318 | len = header->length * 4; | ||
319 | data = (uint8_t*)&header[1]; | ||
320 | ret = MALLOC(sizeof(*ret)); | ||
321 | if (!ret) | ||
322 | return NULL; | ||
323 | |||
324 | ret->header.__message = header; | ||
325 | ret->header.opcode = header->opcode; | ||
326 | |||
327 | READ(8, rbug_context_t, context); /* context */ | ||
328 | |||
329 | return ret; | ||
330 | } | ||
331 | |||
332 | struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header) | ||
333 | { | ||
334 | uint32_t len = 0; | ||
335 | uint32_t pos = 0; | ||
336 | uint8_t *data = NULL; | ||
337 | struct rbug_proto_context_block_draw *ret; | ||
338 | |||
339 | if (!header) | ||
340 | return NULL; | ||
341 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_BLOCK_DRAW) | ||
342 | return NULL; | ||
343 | |||
344 | pos = 0; | ||
345 | len = header->length * 4; | ||
346 | data = (uint8_t*)&header[1]; | ||
347 | ret = MALLOC(sizeof(*ret)); | ||
348 | if (!ret) | ||
349 | return NULL; | ||
350 | |||
351 | ret->header.__message = header; | ||
352 | ret->header.opcode = header->opcode; | ||
353 | |||
354 | READ(8, rbug_context_t, context); /* context */ | ||
355 | |||
356 | return ret; | ||
357 | } | ||
358 | |||
359 | struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header) | ||
360 | { | ||
361 | uint32_t len = 0; | ||
362 | uint32_t pos = 0; | ||
363 | uint8_t *data = NULL; | ||
364 | struct rbug_proto_context_unblock_draw *ret; | ||
365 | |||
366 | if (!header) | ||
367 | return NULL; | ||
368 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW) | ||
369 | return NULL; | ||
370 | |||
371 | pos = 0; | ||
372 | len = header->length * 4; | ||
373 | data = (uint8_t*)&header[1]; | ||
374 | ret = MALLOC(sizeof(*ret)); | ||
375 | if (!ret) | ||
376 | return NULL; | ||
377 | |||
378 | ret->header.__message = header; | ||
379 | ret->header.opcode = header->opcode; | ||
380 | |||
381 | READ(8, rbug_context_t, context); /* context */ | ||
382 | |||
383 | return ret; | ||
384 | } | ||
385 | |||
386 | struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header) | ||
387 | { | ||
388 | uint32_t len = 0; | ||
389 | uint32_t pos = 0; | ||
390 | uint8_t *data = NULL; | ||
391 | struct rbug_proto_context_list_reply *ret; | ||
392 | |||
393 | if (!header) | ||
394 | return NULL; | ||
395 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST_REPLY) | ||
396 | return NULL; | ||
397 | |||
398 | pos = 0; | ||
399 | len = header->length * 4; | ||
400 | data = (uint8_t*)&header[1]; | ||
401 | ret = MALLOC(sizeof(*ret)); | ||
402 | if (!ret) | ||
403 | return NULL; | ||
404 | |||
405 | ret->header.__message = header; | ||
406 | ret->header.opcode = header->opcode; | ||
407 | |||
408 | READ(4, uint32_t, serial); /* serial */ | ||
409 | READ_ARRAY(8, rbug_context_t, contexts); /* contexts */ | ||
410 | |||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header) | ||
415 | { | ||
416 | uint32_t len = 0; | ||
417 | uint32_t pos = 0; | ||
418 | uint8_t *data = NULL; | ||
419 | struct rbug_proto_context_info_reply *ret; | ||
420 | |||
421 | if (!header) | ||
422 | return NULL; | ||
423 | if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO_REPLY) | ||
424 | return NULL; | ||
425 | |||
426 | pos = 0; | ||
427 | len = header->length * 4; | ||
428 | data = (uint8_t*)&header[1]; | ||
429 | ret = MALLOC(sizeof(*ret)); | ||
430 | if (!ret) | ||
431 | return NULL; | ||
432 | |||
433 | ret->header.__message = header; | ||
434 | ret->header.opcode = header->opcode; | ||
435 | |||
436 | READ(4, uint32_t, serial); /* serial */ | ||
437 | READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ | ||
438 | READ(8, rbug_texture_t, zdbuf); /* zdbuf */ | ||
439 | READ(1, uint8_t, blocked); /* blocked */ | ||
440 | |||
441 | return ret; | ||
442 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h new file mode 100644 index 00000000000..bcd2a826a77 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_context.h | |||
@@ -0,0 +1,128 @@ | |||
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/rbug_proto.h" | ||
42 | #include "rbug/rbug_texture.h" | ||
43 | |||
44 | typedef uint64_t rbug_context_t; | ||
45 | |||
46 | struct rbug_proto_context_list | ||
47 | { | ||
48 | struct rbug_header header; | ||
49 | }; | ||
50 | |||
51 | struct rbug_proto_context_info | ||
52 | { | ||
53 | struct rbug_header header; | ||
54 | rbug_context_t context; | ||
55 | }; | ||
56 | |||
57 | struct rbug_proto_context_block_draw | ||
58 | { | ||
59 | struct rbug_header header; | ||
60 | rbug_context_t context; | ||
61 | }; | ||
62 | |||
63 | struct rbug_proto_context_unblock_draw | ||
64 | { | ||
65 | struct rbug_header header; | ||
66 | rbug_context_t context; | ||
67 | }; | ||
68 | |||
69 | struct rbug_proto_context_list_reply | ||
70 | { | ||
71 | struct rbug_header header; | ||
72 | uint32_t serial; | ||
73 | rbug_context_t *contexts; | ||
74 | uint32_t contexts_len; | ||
75 | }; | ||
76 | |||
77 | struct rbug_proto_context_info_reply | ||
78 | { | ||
79 | struct rbug_header header; | ||
80 | uint32_t serial; | ||
81 | rbug_texture_t *cbufs; | ||
82 | uint32_t cbufs_len; | ||
83 | rbug_texture_t zdbuf; | ||
84 | uint8_t blocked; | ||
85 | }; | ||
86 | |||
87 | int rbug_send_context_list(struct rbug_connection *__con, | ||
88 | uint32_t *__serial); | ||
89 | |||
90 | int rbug_send_context_info(struct rbug_connection *__con, | ||
91 | rbug_context_t context, | ||
92 | uint32_t *__serial); | ||
93 | |||
94 | int rbug_send_context_block_draw(struct rbug_connection *__con, | ||
95 | rbug_context_t context, | ||
96 | uint32_t *__serial); | ||
97 | |||
98 | int rbug_send_context_unblock_draw(struct rbug_connection *__con, | ||
99 | rbug_context_t context, | ||
100 | uint32_t *__serial); | ||
101 | |||
102 | int rbug_send_context_list_reply(struct rbug_connection *__con, | ||
103 | uint32_t serial, | ||
104 | rbug_context_t *contexts, | ||
105 | uint32_t contexts_len, | ||
106 | uint32_t *__serial); | ||
107 | |||
108 | int rbug_send_context_info_reply(struct rbug_connection *__con, | ||
109 | uint32_t serial, | ||
110 | rbug_texture_t *cbufs, | ||
111 | uint32_t cbufs_len, | ||
112 | rbug_texture_t zdbuf, | ||
113 | uint8_t blocked, | ||
114 | uint32_t *__serial); | ||
115 | |||
116 | struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header); | ||
117 | |||
118 | struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header); | ||
119 | |||
120 | struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header); | ||
121 | |||
122 | struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header); | ||
123 | |||
124 | struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); | ||
125 | |||
126 | struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); | ||
127 | |||
128 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_core.c b/src/gallium/auxiliary/rbug/rbug_core.c new file mode 100644 index 00000000000..876ae5a0ce6 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_core.c | |||
@@ -0,0 +1,359 @@ | |||
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 the function implementation for one of the rbug extensions. | ||
27 | * Prototypes and declerations of functions and structs is in the same folder | ||
28 | * in the header file matching this file's name. | ||
29 | * | ||
30 | * The functions starting rbug_send_* encodes a call to the write format and | ||
31 | * sends that to the supplied connection, while functions starting with | ||
32 | * rbug_demarshal_* demarshal data in the wire protocol. | ||
33 | * | ||
34 | * Functions ending with _reply are replies to requests. | ||
35 | */ | ||
36 | |||
37 | #include "rbug_internal.h" | ||
38 | #include "rbug/rbug_core.h" | ||
39 | |||
40 | int rbug_send_noop(struct rbug_connection *__con, | ||
41 | uint32_t *__serial) | ||
42 | { | ||
43 | uint32_t __len = 0; | ||
44 | uint32_t __pos = 0; | ||
45 | uint8_t *__data = NULL; | ||
46 | int __ret = 0; | ||
47 | |||
48 | LEN(8); /* header */ | ||
49 | |||
50 | /* align */ | ||
51 | PAD(__len, 8); | ||
52 | |||
53 | __data = (uint8_t*)MALLOC(__len); | ||
54 | if (!__data) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | WRITE(4, int32_t, ((int32_t)RBUG_OP_NOOP)); | ||
58 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
59 | |||
60 | /* final pad */ | ||
61 | PAD(__pos, 8); | ||
62 | |||
63 | if (__pos != __len) { | ||
64 | __ret = -EINVAL; | ||
65 | } else { | ||
66 | rbug_connection_send_start(__con, RBUG_OP_NOOP, __len); | ||
67 | rbug_connection_write(__con, __data, __len); | ||
68 | __ret = rbug_connection_send_finish(__con, __serial); | ||
69 | } | ||
70 | |||
71 | FREE(__data); | ||
72 | return __ret; | ||
73 | } | ||
74 | |||
75 | int rbug_send_ping(struct rbug_connection *__con, | ||
76 | uint32_t *__serial) | ||
77 | { | ||
78 | uint32_t __len = 0; | ||
79 | uint32_t __pos = 0; | ||
80 | uint8_t *__data = NULL; | ||
81 | int __ret = 0; | ||
82 | |||
83 | LEN(8); /* header */ | ||
84 | |||
85 | /* align */ | ||
86 | PAD(__len, 8); | ||
87 | |||
88 | __data = (uint8_t*)MALLOC(__len); | ||
89 | if (!__data) | ||
90 | return -ENOMEM; | ||
91 | |||
92 | WRITE(4, int32_t, ((int32_t)RBUG_OP_PING)); | ||
93 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
94 | |||
95 | /* final pad */ | ||
96 | PAD(__pos, 8); | ||
97 | |||
98 | if (__pos != __len) { | ||
99 | __ret = -EINVAL; | ||
100 | } else { | ||
101 | rbug_connection_send_start(__con, RBUG_OP_PING, __len); | ||
102 | rbug_connection_write(__con, __data, __len); | ||
103 | __ret = rbug_connection_send_finish(__con, __serial); | ||
104 | } | ||
105 | |||
106 | FREE(__data); | ||
107 | return __ret; | ||
108 | } | ||
109 | |||
110 | int rbug_send_error(struct rbug_connection *__con, | ||
111 | uint32_t error, | ||
112 | uint32_t *__serial) | ||
113 | { | ||
114 | uint32_t __len = 0; | ||
115 | uint32_t __pos = 0; | ||
116 | uint8_t *__data = NULL; | ||
117 | int __ret = 0; | ||
118 | |||
119 | LEN(8); /* header */ | ||
120 | LEN(4); /* error */ | ||
121 | |||
122 | /* align */ | ||
123 | PAD(__len, 8); | ||
124 | |||
125 | __data = (uint8_t*)MALLOC(__len); | ||
126 | if (!__data) | ||
127 | return -ENOMEM; | ||
128 | |||
129 | WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR)); | ||
130 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
131 | WRITE(4, uint32_t, error); /* error */ | ||
132 | |||
133 | /* final pad */ | ||
134 | PAD(__pos, 8); | ||
135 | |||
136 | if (__pos != __len) { | ||
137 | __ret = -EINVAL; | ||
138 | } else { | ||
139 | rbug_connection_send_start(__con, RBUG_OP_ERROR, __len); | ||
140 | rbug_connection_write(__con, __data, __len); | ||
141 | __ret = rbug_connection_send_finish(__con, __serial); | ||
142 | } | ||
143 | |||
144 | FREE(__data); | ||
145 | return __ret; | ||
146 | } | ||
147 | |||
148 | int rbug_send_ping_reply(struct rbug_connection *__con, | ||
149 | uint32_t serial, | ||
150 | uint32_t *__serial) | ||
151 | { | ||
152 | uint32_t __len = 0; | ||
153 | uint32_t __pos = 0; | ||
154 | uint8_t *__data = NULL; | ||
155 | int __ret = 0; | ||
156 | |||
157 | LEN(8); /* header */ | ||
158 | LEN(4); /* serial */ | ||
159 | |||
160 | /* align */ | ||
161 | PAD(__len, 8); | ||
162 | |||
163 | __data = (uint8_t*)MALLOC(__len); | ||
164 | if (!__data) | ||
165 | return -ENOMEM; | ||
166 | |||
167 | WRITE(4, int32_t, ((int32_t)RBUG_OP_PING_REPLY)); | ||
168 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
169 | WRITE(4, uint32_t, serial); /* serial */ | ||
170 | |||
171 | /* final pad */ | ||
172 | PAD(__pos, 8); | ||
173 | |||
174 | if (__pos != __len) { | ||
175 | __ret = -EINVAL; | ||
176 | } else { | ||
177 | rbug_connection_send_start(__con, RBUG_OP_PING_REPLY, __len); | ||
178 | rbug_connection_write(__con, __data, __len); | ||
179 | __ret = rbug_connection_send_finish(__con, __serial); | ||
180 | } | ||
181 | |||
182 | FREE(__data); | ||
183 | return __ret; | ||
184 | } | ||
185 | |||
186 | int rbug_send_error_reply(struct rbug_connection *__con, | ||
187 | uint32_t serial, | ||
188 | uint32_t error, | ||
189 | uint32_t *__serial) | ||
190 | { | ||
191 | uint32_t __len = 0; | ||
192 | uint32_t __pos = 0; | ||
193 | uint8_t *__data = NULL; | ||
194 | int __ret = 0; | ||
195 | |||
196 | LEN(8); /* header */ | ||
197 | LEN(4); /* serial */ | ||
198 | LEN(4); /* error */ | ||
199 | |||
200 | /* align */ | ||
201 | PAD(__len, 8); | ||
202 | |||
203 | __data = (uint8_t*)MALLOC(__len); | ||
204 | if (!__data) | ||
205 | return -ENOMEM; | ||
206 | |||
207 | WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR_REPLY)); | ||
208 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
209 | WRITE(4, uint32_t, serial); /* serial */ | ||
210 | WRITE(4, uint32_t, error); /* error */ | ||
211 | |||
212 | /* final pad */ | ||
213 | PAD(__pos, 8); | ||
214 | |||
215 | if (__pos != __len) { | ||
216 | __ret = -EINVAL; | ||
217 | } else { | ||
218 | rbug_connection_send_start(__con, RBUG_OP_ERROR_REPLY, __len); | ||
219 | rbug_connection_write(__con, __data, __len); | ||
220 | __ret = rbug_connection_send_finish(__con, __serial); | ||
221 | } | ||
222 | |||
223 | FREE(__data); | ||
224 | return __ret; | ||
225 | } | ||
226 | |||
227 | struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header) | ||
228 | { | ||
229 | uint32_t len = 0; | ||
230 | uint32_t pos = 0; | ||
231 | uint8_t *data = NULL; | ||
232 | struct rbug_proto_noop *ret; | ||
233 | |||
234 | if (!header) | ||
235 | return NULL; | ||
236 | if (header->opcode != (int16_t)RBUG_OP_NOOP) | ||
237 | return NULL; | ||
238 | |||
239 | pos = 0; | ||
240 | len = header->length * 4; | ||
241 | data = (uint8_t*)&header[1]; | ||
242 | ret = MALLOC(sizeof(*ret)); | ||
243 | if (!ret) | ||
244 | return NULL; | ||
245 | |||
246 | ret->header.__message = header; | ||
247 | ret->header.opcode = header->opcode; | ||
248 | |||
249 | |||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header) | ||
254 | { | ||
255 | uint32_t len = 0; | ||
256 | uint32_t pos = 0; | ||
257 | uint8_t *data = NULL; | ||
258 | struct rbug_proto_ping *ret; | ||
259 | |||
260 | if (!header) | ||
261 | return NULL; | ||
262 | if (header->opcode != (int16_t)RBUG_OP_PING) | ||
263 | return NULL; | ||
264 | |||
265 | pos = 0; | ||
266 | len = header->length * 4; | ||
267 | data = (uint8_t*)&header[1]; | ||
268 | ret = MALLOC(sizeof(*ret)); | ||
269 | if (!ret) | ||
270 | return NULL; | ||
271 | |||
272 | ret->header.__message = header; | ||
273 | ret->header.opcode = header->opcode; | ||
274 | |||
275 | |||
276 | return ret; | ||
277 | } | ||
278 | |||
279 | struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header) | ||
280 | { | ||
281 | uint32_t len = 0; | ||
282 | uint32_t pos = 0; | ||
283 | uint8_t *data = NULL; | ||
284 | struct rbug_proto_error *ret; | ||
285 | |||
286 | if (!header) | ||
287 | return NULL; | ||
288 | if (header->opcode != (int16_t)RBUG_OP_ERROR) | ||
289 | return NULL; | ||
290 | |||
291 | pos = 0; | ||
292 | len = header->length * 4; | ||
293 | data = (uint8_t*)&header[1]; | ||
294 | ret = MALLOC(sizeof(*ret)); | ||
295 | if (!ret) | ||
296 | return NULL; | ||
297 | |||
298 | ret->header.__message = header; | ||
299 | ret->header.opcode = header->opcode; | ||
300 | |||
301 | READ(4, uint32_t, error); /* error */ | ||
302 | |||
303 | return ret; | ||
304 | } | ||
305 | |||
306 | struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header) | ||
307 | { | ||
308 | uint32_t len = 0; | ||
309 | uint32_t pos = 0; | ||
310 | uint8_t *data = NULL; | ||
311 | struct rbug_proto_ping_reply *ret; | ||
312 | |||
313 | if (!header) | ||
314 | return NULL; | ||
315 | if (header->opcode != (int16_t)RBUG_OP_PING_REPLY) | ||
316 | return NULL; | ||
317 | |||
318 | pos = 0; | ||
319 | len = header->length * 4; | ||
320 | data = (uint8_t*)&header[1]; | ||
321 | ret = MALLOC(sizeof(*ret)); | ||
322 | if (!ret) | ||
323 | return NULL; | ||
324 | |||
325 | ret->header.__message = header; | ||
326 | ret->header.opcode = header->opcode; | ||
327 | |||
328 | READ(4, uint32_t, serial); /* serial */ | ||
329 | |||
330 | return ret; | ||
331 | } | ||
332 | |||
333 | struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header) | ||
334 | { | ||
335 | uint32_t len = 0; | ||
336 | uint32_t pos = 0; | ||
337 | uint8_t *data = NULL; | ||
338 | struct rbug_proto_error_reply *ret; | ||
339 | |||
340 | if (!header) | ||
341 | return NULL; | ||
342 | if (header->opcode != (int16_t)RBUG_OP_ERROR_REPLY) | ||
343 | return NULL; | ||
344 | |||
345 | pos = 0; | ||
346 | len = header->length * 4; | ||
347 | data = (uint8_t*)&header[1]; | ||
348 | ret = MALLOC(sizeof(*ret)); | ||
349 | if (!ret) | ||
350 | return NULL; | ||
351 | |||
352 | ret->header.__message = header; | ||
353 | ret->header.opcode = header->opcode; | ||
354 | |||
355 | READ(4, uint32_t, serial); /* serial */ | ||
356 | READ(4, uint32_t, error); /* error */ | ||
357 | |||
358 | return ret; | ||
359 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_core.h b/src/gallium/auxiliary/rbug/rbug_core.h new file mode 100644 index 00000000000..d63a8c80764 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_core.h | |||
@@ -0,0 +1,101 @@ | |||
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_CORE_H_ | ||
39 | #define _RBUG_PROTO_CORE_H_ | ||
40 | |||
41 | #include "rbug/rbug_proto.h" | ||
42 | |||
43 | struct rbug_proto_noop | ||
44 | { | ||
45 | struct rbug_header header; | ||
46 | }; | ||
47 | |||
48 | struct rbug_proto_ping | ||
49 | { | ||
50 | struct rbug_header header; | ||
51 | }; | ||
52 | |||
53 | struct rbug_proto_error | ||
54 | { | ||
55 | struct rbug_header header; | ||
56 | uint32_t error; | ||
57 | }; | ||
58 | |||
59 | struct rbug_proto_ping_reply | ||
60 | { | ||
61 | struct rbug_header header; | ||
62 | uint32_t serial; | ||
63 | }; | ||
64 | |||
65 | struct rbug_proto_error_reply | ||
66 | { | ||
67 | struct rbug_header header; | ||
68 | uint32_t serial; | ||
69 | uint32_t error; | ||
70 | }; | ||
71 | |||
72 | int rbug_send_noop(struct rbug_connection *__con, | ||
73 | uint32_t *__serial); | ||
74 | |||
75 | int rbug_send_ping(struct rbug_connection *__con, | ||
76 | uint32_t *__serial); | ||
77 | |||
78 | int rbug_send_error(struct rbug_connection *__con, | ||
79 | uint32_t error, | ||
80 | uint32_t *__serial); | ||
81 | |||
82 | int rbug_send_ping_reply(struct rbug_connection *__con, | ||
83 | uint32_t serial, | ||
84 | uint32_t *__serial); | ||
85 | |||
86 | int rbug_send_error_reply(struct rbug_connection *__con, | ||
87 | uint32_t serial, | ||
88 | uint32_t error, | ||
89 | uint32_t *__serial); | ||
90 | |||
91 | struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header); | ||
92 | |||
93 | struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header); | ||
94 | |||
95 | struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header); | ||
96 | |||
97 | struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header); | ||
98 | |||
99 | struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header); | ||
100 | |||
101 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c new file mode 100644 index 00000000000..e3c0954f9ec --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c | |||
@@ -0,0 +1,85 @@ | |||
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 | #include "rbug.h" | ||
26 | |||
27 | /** | ||
28 | * Small function that looks at the proto_header and selects the correct | ||
29 | * demarshal functions and return the result. | ||
30 | */ | ||
31 | struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) | ||
32 | { | ||
33 | switch(header->opcode) { | ||
34 | case RBUG_OP_NOOP: | ||
35 | return (struct rbug_header *)rbug_demarshal_noop(header); | ||
36 | case RBUG_OP_PING: | ||
37 | return (struct rbug_header *)rbug_demarshal_ping(header); | ||
38 | case RBUG_OP_ERROR: | ||
39 | return (struct rbug_header *)rbug_demarshal_error(header); | ||
40 | case RBUG_OP_PING_REPLY: | ||
41 | return (struct rbug_header *)rbug_demarshal_ping_reply(header); | ||
42 | case RBUG_OP_ERROR_REPLY: | ||
43 | return (struct rbug_header *)rbug_demarshal_error_reply(header); | ||
44 | case RBUG_OP_TEXTURE_LIST: | ||
45 | return (struct rbug_header *)rbug_demarshal_texture_list(header); | ||
46 | case RBUG_OP_TEXTURE_INFO: | ||
47 | return (struct rbug_header *)rbug_demarshal_texture_info(header); | ||
48 | case RBUG_OP_TEXTURE_WRITE: | ||
49 | return (struct rbug_header *)rbug_demarshal_texture_write(header); | ||
50 | case RBUG_OP_TEXTURE_READ: | ||
51 | return (struct rbug_header *)rbug_demarshal_texture_read(header); | ||
52 | case RBUG_OP_TEXTURE_LIST_REPLY: | ||
53 | return (struct rbug_header *)rbug_demarshal_texture_list_reply(header); | ||
54 | case RBUG_OP_TEXTURE_INFO_REPLY: | ||
55 | return (struct rbug_header *)rbug_demarshal_texture_info_reply(header); | ||
56 | case RBUG_OP_TEXTURE_READ_REPLY: | ||
57 | return (struct rbug_header *)rbug_demarshal_texture_read_reply(header); | ||
58 | case RBUG_OP_CONTEXT_LIST: | ||
59 | return (struct rbug_header *)rbug_demarshal_context_list(header); | ||
60 | case RBUG_OP_CONTEXT_INFO: | ||
61 | return (struct rbug_header *)rbug_demarshal_context_info(header); | ||
62 | case RBUG_OP_CONTEXT_BLOCK_DRAW: | ||
63 | return (struct rbug_header *)rbug_demarshal_context_block_draw(header); | ||
64 | case RBUG_OP_CONTEXT_UNBLOCK_DRAW: | ||
65 | return (struct rbug_header *)rbug_demarshal_context_unblock_draw(header); | ||
66 | case RBUG_OP_CONTEXT_LIST_REPLY: | ||
67 | return (struct rbug_header *)rbug_demarshal_context_list_reply(header); | ||
68 | case RBUG_OP_CONTEXT_INFO_REPLY: | ||
69 | return (struct rbug_header *)rbug_demarshal_context_info_reply(header); | ||
70 | case RBUG_OP_SHADER_LIST: | ||
71 | return (struct rbug_header *)rbug_demarshal_shader_list(header); | ||
72 | case RBUG_OP_SHADER_INFO: | ||
73 | return (struct rbug_header *)rbug_demarshal_shader_info(header); | ||
74 | case RBUG_OP_SHADER_DISABLE: | ||
75 | return (struct rbug_header *)rbug_demarshal_shader_disable(header); | ||
76 | case RBUG_OP_SHADER_REPLACE: | ||
77 | return (struct rbug_header *)rbug_demarshal_shader_replace(header); | ||
78 | case RBUG_OP_SHADER_LIST_REPLY: | ||
79 | return (struct rbug_header *)rbug_demarshal_shader_list_reply(header); | ||
80 | case RBUG_OP_SHADER_INFO_REPLY: | ||
81 | return (struct rbug_header *)rbug_demarshal_shader_info_reply(header); | ||
82 | default: | ||
83 | return NULL; | ||
84 | } | ||
85 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_internal.h b/src/gallium/auxiliary/rbug/rbug_internal.h new file mode 100644 index 00000000000..4aba1a810f6 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_internal.h | |||
@@ -0,0 +1,100 @@ | |||
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 is internal to the rbug protocol code, and contains asorted | ||
27 | * features needed by the code. | ||
28 | */ | ||
29 | |||
30 | #ifndef _RBUG_INTERNAL_H_ | ||
31 | #define _RBUG_INTERNAL_H_ | ||
32 | |||
33 | #include "rbug/rbug_proto.h" | ||
34 | |||
35 | #include "util/u_memory.h" | ||
36 | #include "util/u_debug.h" | ||
37 | #include <errno.h> | ||
38 | |||
39 | int rbug_connection_send_start(struct rbug_connection *con, enum rbug_opcode opcode, uint32_t length); | ||
40 | int rbug_connection_write(struct rbug_connection *con, void *data, uint32_t size); | ||
41 | int rbug_connection_send_finish(struct rbug_connection *con, uint32_t *c); | ||
42 | |||
43 | /** | ||
44 | * Only works with multiples of 2 | ||
45 | */ | ||
46 | #define PAD(from, to) \ | ||
47 | do { \ | ||
48 | from = (from + to - 1) & ~(to - 1); \ | ||
49 | } while(0) | ||
50 | |||
51 | #define LEN(size) \ | ||
52 | do { \ | ||
53 | PAD(__len, size); \ | ||
54 | __len += size; \ | ||
55 | } while(0) | ||
56 | |||
57 | #define LEN_ARRAY(size, name) \ | ||
58 | do { \ | ||
59 | LEN(4); \ | ||
60 | PAD(__len, size); \ | ||
61 | __len += size * name##_len; \ | ||
62 | } while(0) | ||
63 | |||
64 | #define WRITE(size, type, name) \ | ||
65 | do { \ | ||
66 | PAD(__pos, size); \ | ||
67 | *((type *)(&__data[__pos])) = name; \ | ||
68 | __pos += size; \ | ||
69 | } while(0) | ||
70 | |||
71 | #define WRITE_ARRAY(size, type, name) \ | ||
72 | do { \ | ||
73 | WRITE(4, uint32_t, name##_len); \ | ||
74 | PAD(__pos, size); \ | ||
75 | memcpy(&__data[__pos], name, size * name##_len); \ | ||
76 | __pos += size * name##_len; \ | ||
77 | } while(0) | ||
78 | |||
79 | #define READ(size, type, name) \ | ||
80 | do { \ | ||
81 | PAD(pos, size); \ | ||
82 | pos += size; \ | ||
83 | if (pos > len) \ | ||
84 | break; \ | ||
85 | ret->name = *((type *)(&data[pos - size])); \ | ||
86 | } while(0) | ||
87 | |||
88 | #define READ_ARRAY(size, type, name) \ | ||
89 | do { \ | ||
90 | READ(4, uint32_t, name##_len); \ | ||
91 | if (pos > len) \ | ||
92 | break; \ | ||
93 | PAD(pos, size); \ | ||
94 | pos += size * ret->name##_len; \ | ||
95 | if (pos > len) \ | ||
96 | break; \ | ||
97 | ret->name = (type *)&data[pos - size * ret->name##_len]; \ | ||
98 | } while(0) | ||
99 | |||
100 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h new file mode 100644 index 00000000000..8fa18367713 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_proto.h | |||
@@ -0,0 +1,90 @@ | |||
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_BLOCK_DRAW = 514, | ||
56 | RBUG_OP_CONTEXT_UNBLOCK_DRAW = 515, | ||
57 | RBUG_OP_CONTEXT_LIST_REPLY = -512, | ||
58 | RBUG_OP_CONTEXT_INFO_REPLY = -513, | ||
59 | RBUG_OP_SHADER_LIST = 768, | ||
60 | RBUG_OP_SHADER_INFO = 769, | ||
61 | RBUG_OP_SHADER_DISABLE = 770, | ||
62 | RBUG_OP_SHADER_REPLACE = 771, | ||
63 | RBUG_OP_SHADER_LIST_REPLY = -768, | ||
64 | RBUG_OP_SHADER_INFO_REPLY = -769, | ||
65 | }; | ||
66 | |||
67 | /** | ||
68 | * Header for demarshaled message. | ||
69 | */ | ||
70 | struct rbug_header | ||
71 | { | ||
72 | enum rbug_opcode opcode; | ||
73 | void *__message; | ||
74 | }; | ||
75 | |||
76 | /** | ||
77 | * Header for a message in wire format. | ||
78 | */ | ||
79 | struct rbug_proto_header | ||
80 | { | ||
81 | int32_t opcode; | ||
82 | uint32_t length; | ||
83 | }; | ||
84 | |||
85 | /** | ||
86 | * Forward declare connection here, as this file is included by all users. | ||
87 | */ | ||
88 | struct rbug_connection; | ||
89 | |||
90 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_shader.c b/src/gallium/auxiliary/rbug/rbug_shader.c new file mode 100644 index 00000000000..fccd2f55efd --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_shader.c | |||
@@ -0,0 +1,468 @@ | |||
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 the function implementation for one of the rbug extensions. | ||
27 | * Prototypes and declerations of functions and structs is in the same folder | ||
28 | * in the header file matching this file's name. | ||
29 | * | ||
30 | * The functions starting rbug_send_* encodes a call to the write format and | ||
31 | * sends that to the supplied connection, while functions starting with | ||
32 | * rbug_demarshal_* demarshal data in the wire protocol. | ||
33 | * | ||
34 | * Functions ending with _reply are replies to requests. | ||
35 | */ | ||
36 | |||
37 | #include "rbug_internal.h" | ||
38 | #include "rbug/rbug_shader.h" | ||
39 | |||
40 | int rbug_send_shader_list(struct rbug_connection *__con, | ||
41 | rbug_context_t context, | ||
42 | uint32_t *__serial) | ||
43 | { | ||
44 | uint32_t __len = 0; | ||
45 | uint32_t __pos = 0; | ||
46 | uint8_t *__data = NULL; | ||
47 | int __ret = 0; | ||
48 | |||
49 | LEN(8); /* header */ | ||
50 | LEN(8); /* context */ | ||
51 | |||
52 | /* align */ | ||
53 | PAD(__len, 8); | ||
54 | |||
55 | __data = (uint8_t*)MALLOC(__len); | ||
56 | if (!__data) | ||
57 | return -ENOMEM; | ||
58 | |||
59 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST)); | ||
60 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
61 | WRITE(8, rbug_context_t, context); /* context */ | ||
62 | |||
63 | /* final pad */ | ||
64 | PAD(__pos, 8); | ||
65 | |||
66 | if (__pos != __len) { | ||
67 | __ret = -EINVAL; | ||
68 | } else { | ||
69 | rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST, __len); | ||
70 | rbug_connection_write(__con, __data, __len); | ||
71 | __ret = rbug_connection_send_finish(__con, __serial); | ||
72 | } | ||
73 | |||
74 | FREE(__data); | ||
75 | return __ret; | ||
76 | } | ||
77 | |||
78 | int rbug_send_shader_info(struct rbug_connection *__con, | ||
79 | rbug_context_t context, | ||
80 | rbug_shader_t shader, | ||
81 | uint32_t *__serial) | ||
82 | { | ||
83 | uint32_t __len = 0; | ||
84 | uint32_t __pos = 0; | ||
85 | uint8_t *__data = NULL; | ||
86 | int __ret = 0; | ||
87 | |||
88 | LEN(8); /* header */ | ||
89 | LEN(8); /* context */ | ||
90 | LEN(8); /* shader */ | ||
91 | |||
92 | /* align */ | ||
93 | PAD(__len, 8); | ||
94 | |||
95 | __data = (uint8_t*)MALLOC(__len); | ||
96 | if (!__data) | ||
97 | return -ENOMEM; | ||
98 | |||
99 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO)); | ||
100 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
101 | WRITE(8, rbug_context_t, context); /* context */ | ||
102 | WRITE(8, rbug_shader_t, shader); /* shader */ | ||
103 | |||
104 | /* final pad */ | ||
105 | PAD(__pos, 8); | ||
106 | |||
107 | if (__pos != __len) { | ||
108 | __ret = -EINVAL; | ||
109 | } else { | ||
110 | rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO, __len); | ||
111 | rbug_connection_write(__con, __data, __len); | ||
112 | __ret = rbug_connection_send_finish(__con, __serial); | ||
113 | } | ||
114 | |||
115 | FREE(__data); | ||
116 | return __ret; | ||
117 | } | ||
118 | |||
119 | int rbug_send_shader_disable(struct rbug_connection *__con, | ||
120 | rbug_context_t context, | ||
121 | rbug_shader_t shader, | ||
122 | uint8_t disable, | ||
123 | uint32_t *__serial) | ||
124 | { | ||
125 | uint32_t __len = 0; | ||
126 | uint32_t __pos = 0; | ||
127 | uint8_t *__data = NULL; | ||
128 | int __ret = 0; | ||
129 | |||
130 | LEN(8); /* header */ | ||
131 | LEN(8); /* context */ | ||
132 | LEN(8); /* shader */ | ||
133 | LEN(1); /* disable */ | ||
134 | |||
135 | /* align */ | ||
136 | PAD(__len, 8); | ||
137 | |||
138 | __data = (uint8_t*)MALLOC(__len); | ||
139 | if (!__data) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_DISABLE)); | ||
143 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
144 | WRITE(8, rbug_context_t, context); /* context */ | ||
145 | WRITE(8, rbug_shader_t, shader); /* shader */ | ||
146 | WRITE(1, uint8_t, disable); /* disable */ | ||
147 | |||
148 | /* final pad */ | ||
149 | PAD(__pos, 8); | ||
150 | |||
151 | if (__pos != __len) { | ||
152 | __ret = -EINVAL; | ||
153 | } else { | ||
154 | rbug_connection_send_start(__con, RBUG_OP_SHADER_DISABLE, __len); | ||
155 | rbug_connection_write(__con, __data, __len); | ||
156 | __ret = rbug_connection_send_finish(__con, __serial); | ||
157 | } | ||
158 | |||
159 | FREE(__data); | ||
160 | return __ret; | ||
161 | } | ||
162 | |||
163 | int rbug_send_shader_replace(struct rbug_connection *__con, | ||
164 | rbug_context_t context, | ||
165 | rbug_shader_t shader, | ||
166 | uint32_t *tokens, | ||
167 | uint32_t tokens_len, | ||
168 | uint32_t *__serial) | ||
169 | { | ||
170 | uint32_t __len = 0; | ||
171 | uint32_t __pos = 0; | ||
172 | uint8_t *__data = NULL; | ||
173 | int __ret = 0; | ||
174 | |||
175 | LEN(8); /* header */ | ||
176 | LEN(8); /* context */ | ||
177 | LEN(8); /* shader */ | ||
178 | LEN_ARRAY(4, tokens); /* tokens */ | ||
179 | |||
180 | /* align */ | ||
181 | PAD(__len, 8); | ||
182 | |||
183 | __data = (uint8_t*)MALLOC(__len); | ||
184 | if (!__data) | ||
185 | return -ENOMEM; | ||
186 | |||
187 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_REPLACE)); | ||
188 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
189 | WRITE(8, rbug_context_t, context); /* context */ | ||
190 | WRITE(8, rbug_shader_t, shader); /* shader */ | ||
191 | WRITE_ARRAY(4, uint32_t, tokens); /* tokens */ | ||
192 | |||
193 | /* final pad */ | ||
194 | PAD(__pos, 8); | ||
195 | |||
196 | if (__pos != __len) { | ||
197 | __ret = -EINVAL; | ||
198 | } else { | ||
199 | rbug_connection_send_start(__con, RBUG_OP_SHADER_REPLACE, __len); | ||
200 | rbug_connection_write(__con, __data, __len); | ||
201 | __ret = rbug_connection_send_finish(__con, __serial); | ||
202 | } | ||
203 | |||
204 | FREE(__data); | ||
205 | return __ret; | ||
206 | } | ||
207 | |||
208 | int rbug_send_shader_list_reply(struct rbug_connection *__con, | ||
209 | uint32_t serial, | ||
210 | rbug_shader_t *shaders, | ||
211 | uint32_t shaders_len, | ||
212 | uint32_t *__serial) | ||
213 | { | ||
214 | uint32_t __len = 0; | ||
215 | uint32_t __pos = 0; | ||
216 | uint8_t *__data = NULL; | ||
217 | int __ret = 0; | ||
218 | |||
219 | LEN(8); /* header */ | ||
220 | LEN(4); /* serial */ | ||
221 | LEN_ARRAY(8, shaders); /* shaders */ | ||
222 | |||
223 | /* align */ | ||
224 | PAD(__len, 8); | ||
225 | |||
226 | __data = (uint8_t*)MALLOC(__len); | ||
227 | if (!__data) | ||
228 | return -ENOMEM; | ||
229 | |||
230 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST_REPLY)); | ||
231 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
232 | WRITE(4, uint32_t, serial); /* serial */ | ||
233 | WRITE_ARRAY(8, rbug_shader_t, shaders); /* shaders */ | ||
234 | |||
235 | /* final pad */ | ||
236 | PAD(__pos, 8); | ||
237 | |||
238 | if (__pos != __len) { | ||
239 | __ret = -EINVAL; | ||
240 | } else { | ||
241 | rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST_REPLY, __len); | ||
242 | rbug_connection_write(__con, __data, __len); | ||
243 | __ret = rbug_connection_send_finish(__con, __serial); | ||
244 | } | ||
245 | |||
246 | FREE(__data); | ||
247 | return __ret; | ||
248 | } | ||
249 | |||
250 | int rbug_send_shader_info_reply(struct rbug_connection *__con, | ||
251 | uint32_t serial, | ||
252 | uint32_t *original, | ||
253 | uint32_t original_len, | ||
254 | uint32_t *replaced, | ||
255 | uint32_t replaced_len, | ||
256 | uint8_t disabled, | ||
257 | uint32_t *__serial) | ||
258 | { | ||
259 | uint32_t __len = 0; | ||
260 | uint32_t __pos = 0; | ||
261 | uint8_t *__data = NULL; | ||
262 | int __ret = 0; | ||
263 | |||
264 | LEN(8); /* header */ | ||
265 | LEN(4); /* serial */ | ||
266 | LEN_ARRAY(4, original); /* original */ | ||
267 | LEN_ARRAY(4, replaced); /* replaced */ | ||
268 | LEN(1); /* disabled */ | ||
269 | |||
270 | /* align */ | ||
271 | PAD(__len, 8); | ||
272 | |||
273 | __data = (uint8_t*)MALLOC(__len); | ||
274 | if (!__data) | ||
275 | return -ENOMEM; | ||
276 | |||
277 | WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO_REPLY)); | ||
278 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
279 | WRITE(4, uint32_t, serial); /* serial */ | ||
280 | WRITE_ARRAY(4, uint32_t, original); /* original */ | ||
281 | WRITE_ARRAY(4, uint32_t, replaced); /* replaced */ | ||
282 | WRITE(1, uint8_t, disabled); /* disabled */ | ||
283 | |||
284 | /* final pad */ | ||
285 | PAD(__pos, 8); | ||
286 | |||
287 | if (__pos != __len) { | ||
288 | __ret = -EINVAL; | ||
289 | } else { | ||
290 | rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO_REPLY, __len); | ||
291 | rbug_connection_write(__con, __data, __len); | ||
292 | __ret = rbug_connection_send_finish(__con, __serial); | ||
293 | } | ||
294 | |||
295 | FREE(__data); | ||
296 | return __ret; | ||
297 | } | ||
298 | |||
299 | struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header) | ||
300 | { | ||
301 | uint32_t len = 0; | ||
302 | uint32_t pos = 0; | ||
303 | uint8_t *data = NULL; | ||
304 | struct rbug_proto_shader_list *ret; | ||
305 | |||
306 | if (!header) | ||
307 | return NULL; | ||
308 | if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST) | ||
309 | return NULL; | ||
310 | |||
311 | pos = 0; | ||
312 | len = header->length * 4; | ||
313 | data = (uint8_t*)&header[1]; | ||
314 | ret = MALLOC(sizeof(*ret)); | ||
315 | if (!ret) | ||
316 | return NULL; | ||
317 | |||
318 | ret->header.__message = header; | ||
319 | ret->header.opcode = header->opcode; | ||
320 | |||
321 | READ(8, rbug_context_t, context); /* context */ | ||
322 | |||
323 | return ret; | ||
324 | } | ||
325 | |||
326 | struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header) | ||
327 | { | ||
328 | uint32_t len = 0; | ||
329 | uint32_t pos = 0; | ||
330 | uint8_t *data = NULL; | ||
331 | struct rbug_proto_shader_info *ret; | ||
332 | |||
333 | if (!header) | ||
334 | return NULL; | ||
335 | if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO) | ||
336 | return NULL; | ||
337 | |||
338 | pos = 0; | ||
339 | len = header->length * 4; | ||
340 | data = (uint8_t*)&header[1]; | ||
341 | ret = MALLOC(sizeof(*ret)); | ||
342 | if (!ret) | ||
343 | return NULL; | ||
344 | |||
345 | ret->header.__message = header; | ||
346 | ret->header.opcode = header->opcode; | ||
347 | |||
348 | READ(8, rbug_context_t, context); /* context */ | ||
349 | READ(8, rbug_shader_t, shader); /* shader */ | ||
350 | |||
351 | return ret; | ||
352 | } | ||
353 | |||
354 | struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header) | ||
355 | { | ||
356 | uint32_t len = 0; | ||
357 | uint32_t pos = 0; | ||
358 | uint8_t *data = NULL; | ||
359 | struct rbug_proto_shader_disable *ret; | ||
360 | |||
361 | if (!header) | ||
362 | return NULL; | ||
363 | if (header->opcode != (int16_t)RBUG_OP_SHADER_DISABLE) | ||
364 | return NULL; | ||
365 | |||
366 | pos = 0; | ||
367 | len = header->length * 4; | ||
368 | data = (uint8_t*)&header[1]; | ||
369 | ret = MALLOC(sizeof(*ret)); | ||
370 | if (!ret) | ||
371 | return NULL; | ||
372 | |||
373 | ret->header.__message = header; | ||
374 | ret->header.opcode = header->opcode; | ||
375 | |||
376 | READ(8, rbug_context_t, context); /* context */ | ||
377 | READ(8, rbug_shader_t, shader); /* shader */ | ||
378 | READ(1, uint8_t, disable); /* disable */ | ||
379 | |||
380 | return ret; | ||
381 | } | ||
382 | |||
383 | struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header) | ||
384 | { | ||
385 | uint32_t len = 0; | ||
386 | uint32_t pos = 0; | ||
387 | uint8_t *data = NULL; | ||
388 | struct rbug_proto_shader_replace *ret; | ||
389 | |||
390 | if (!header) | ||
391 | return NULL; | ||
392 | if (header->opcode != (int16_t)RBUG_OP_SHADER_REPLACE) | ||
393 | return NULL; | ||
394 | |||
395 | pos = 0; | ||
396 | len = header->length * 4; | ||
397 | data = (uint8_t*)&header[1]; | ||
398 | ret = MALLOC(sizeof(*ret)); | ||
399 | if (!ret) | ||
400 | return NULL; | ||
401 | |||
402 | ret->header.__message = header; | ||
403 | ret->header.opcode = header->opcode; | ||
404 | |||
405 | READ(8, rbug_context_t, context); /* context */ | ||
406 | READ(8, rbug_shader_t, shader); /* shader */ | ||
407 | READ_ARRAY(4, uint32_t, tokens); /* tokens */ | ||
408 | |||
409 | return ret; | ||
410 | } | ||
411 | |||
412 | struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header) | ||
413 | { | ||
414 | uint32_t len = 0; | ||
415 | uint32_t pos = 0; | ||
416 | uint8_t *data = NULL; | ||
417 | struct rbug_proto_shader_list_reply *ret; | ||
418 | |||
419 | if (!header) | ||
420 | return NULL; | ||
421 | if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST_REPLY) | ||
422 | return NULL; | ||
423 | |||
424 | pos = 0; | ||
425 | len = header->length * 4; | ||
426 | data = (uint8_t*)&header[1]; | ||
427 | ret = MALLOC(sizeof(*ret)); | ||
428 | if (!ret) | ||
429 | return NULL; | ||
430 | |||
431 | ret->header.__message = header; | ||
432 | ret->header.opcode = header->opcode; | ||
433 | |||
434 | READ(4, uint32_t, serial); /* serial */ | ||
435 | READ_ARRAY(8, rbug_shader_t, shaders); /* shaders */ | ||
436 | |||
437 | return ret; | ||
438 | } | ||
439 | |||
440 | struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header) | ||
441 | { | ||
442 | uint32_t len = 0; | ||
443 | uint32_t pos = 0; | ||
444 | uint8_t *data = NULL; | ||
445 | struct rbug_proto_shader_info_reply *ret; | ||
446 | |||
447 | if (!header) | ||
448 | return NULL; | ||
449 | if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO_REPLY) | ||
450 | return NULL; | ||
451 | |||
452 | pos = 0; | ||
453 | len = header->length * 4; | ||
454 | data = (uint8_t*)&header[1]; | ||
455 | ret = MALLOC(sizeof(*ret)); | ||
456 | if (!ret) | ||
457 | return NULL; | ||
458 | |||
459 | ret->header.__message = header; | ||
460 | ret->header.opcode = header->opcode; | ||
461 | |||
462 | READ(4, uint32_t, serial); /* serial */ | ||
463 | READ_ARRAY(4, uint32_t, original); /* original */ | ||
464 | READ_ARRAY(4, uint32_t, replaced); /* replaced */ | ||
465 | READ(1, uint8_t, disabled); /* disabled */ | ||
466 | |||
467 | return ret; | ||
468 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_shader.h b/src/gallium/auxiliary/rbug/rbug_shader.h new file mode 100644 index 00000000000..fe1b9ac0f72 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_shader.h | |||
@@ -0,0 +1,144 @@ | |||
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_SHADER_H_ | ||
39 | #define _RBUG_PROTO_SHADER_H_ | ||
40 | |||
41 | #include "rbug/rbug_proto.h" | ||
42 | #include "rbug/rbug_context.h" | ||
43 | |||
44 | typedef uint64_t rbug_shader_t; | ||
45 | |||
46 | struct rbug_proto_shader_list | ||
47 | { | ||
48 | struct rbug_header header; | ||
49 | rbug_context_t context; | ||
50 | }; | ||
51 | |||
52 | struct rbug_proto_shader_info | ||
53 | { | ||
54 | struct rbug_header header; | ||
55 | rbug_context_t context; | ||
56 | rbug_shader_t shader; | ||
57 | }; | ||
58 | |||
59 | struct rbug_proto_shader_disable | ||
60 | { | ||
61 | struct rbug_header header; | ||
62 | rbug_context_t context; | ||
63 | rbug_shader_t shader; | ||
64 | uint8_t disable; | ||
65 | }; | ||
66 | |||
67 | struct rbug_proto_shader_replace | ||
68 | { | ||
69 | struct rbug_header header; | ||
70 | rbug_context_t context; | ||
71 | rbug_shader_t shader; | ||
72 | uint32_t *tokens; | ||
73 | uint32_t tokens_len; | ||
74 | }; | ||
75 | |||
76 | struct rbug_proto_shader_list_reply | ||
77 | { | ||
78 | struct rbug_header header; | ||
79 | uint32_t serial; | ||
80 | rbug_shader_t *shaders; | ||
81 | uint32_t shaders_len; | ||
82 | }; | ||
83 | |||
84 | struct rbug_proto_shader_info_reply | ||
85 | { | ||
86 | struct rbug_header header; | ||
87 | uint32_t serial; | ||
88 | uint32_t *original; | ||
89 | uint32_t original_len; | ||
90 | uint32_t *replaced; | ||
91 | uint32_t replaced_len; | ||
92 | uint8_t disabled; | ||
93 | }; | ||
94 | |||
95 | int rbug_send_shader_list(struct rbug_connection *__con, | ||
96 | rbug_context_t context, | ||
97 | uint32_t *__serial); | ||
98 | |||
99 | int rbug_send_shader_info(struct rbug_connection *__con, | ||
100 | rbug_context_t context, | ||
101 | rbug_shader_t shader, | ||
102 | uint32_t *__serial); | ||
103 | |||
104 | int rbug_send_shader_disable(struct rbug_connection *__con, | ||
105 | rbug_context_t context, | ||
106 | rbug_shader_t shader, | ||
107 | uint8_t disable, | ||
108 | uint32_t *__serial); | ||
109 | |||
110 | int rbug_send_shader_replace(struct rbug_connection *__con, | ||
111 | rbug_context_t context, | ||
112 | rbug_shader_t shader, | ||
113 | uint32_t *tokens, | ||
114 | uint32_t tokens_len, | ||
115 | uint32_t *__serial); | ||
116 | |||
117 | int rbug_send_shader_list_reply(struct rbug_connection *__con, | ||
118 | uint32_t serial, | ||
119 | rbug_shader_t *shaders, | ||
120 | uint32_t shaders_len, | ||
121 | uint32_t *__serial); | ||
122 | |||
123 | int rbug_send_shader_info_reply(struct rbug_connection *__con, | ||
124 | uint32_t serial, | ||
125 | uint32_t *original, | ||
126 | uint32_t original_len, | ||
127 | uint32_t *replaced, | ||
128 | uint32_t replaced_len, | ||
129 | uint8_t disabled, | ||
130 | uint32_t *__serial); | ||
131 | |||
132 | struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header); | ||
133 | |||
134 | struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header); | ||
135 | |||
136 | struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header); | ||
137 | |||
138 | struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header); | ||
139 | |||
140 | struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header); | ||
141 | |||
142 | struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header); | ||
143 | |||
144 | #endif | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c new file mode 100644 index 00000000000..5a918fe6bc0 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_texture.c | |||
@@ -0,0 +1,631 @@ | |||
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 the function implementation for one of the rbug extensions. | ||
27 | * Prototypes and declerations of functions and structs is in the same folder | ||
28 | * in the header file matching this file's name. | ||
29 | * | ||
30 | * The functions starting rbug_send_* encodes a call to the write format and | ||
31 | * sends that to the supplied connection, while functions starting with | ||
32 | * rbug_demarshal_* demarshal data in the wire protocol. | ||
33 | * | ||
34 | * Functions ending with _reply are replies to requests. | ||
35 | */ | ||
36 | |||
37 | #include "rbug_internal.h" | ||
38 | #include "rbug/rbug_texture.h" | ||
39 | |||
40 | int rbug_send_texture_list(struct rbug_connection *__con, | ||
41 | uint32_t *__serial) | ||
42 | { | ||
43 | uint32_t __len = 0; | ||
44 | uint32_t __pos = 0; | ||
45 | uint8_t *__data = NULL; | ||
46 | int __ret = 0; | ||
47 | |||
48 | LEN(8); /* header */ | ||
49 | |||
50 | /* align */ | ||
51 | PAD(__len, 8); | ||
52 | |||
53 | __data = (uint8_t*)MALLOC(__len); | ||
54 | if (!__data) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST)); | ||
58 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
59 | |||
60 | /* final pad */ | ||
61 | PAD(__pos, 8); | ||
62 | |||
63 | if (__pos != __len) { | ||
64 | __ret = -EINVAL; | ||
65 | } else { | ||
66 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST, __len); | ||
67 | rbug_connection_write(__con, __data, __len); | ||
68 | __ret = rbug_connection_send_finish(__con, __serial); | ||
69 | } | ||
70 | |||
71 | FREE(__data); | ||
72 | return __ret; | ||
73 | } | ||
74 | |||
75 | int rbug_send_texture_info(struct rbug_connection *__con, | ||
76 | rbug_texture_t texture, | ||
77 | uint32_t *__serial) | ||
78 | { | ||
79 | uint32_t __len = 0; | ||
80 | uint32_t __pos = 0; | ||
81 | uint8_t *__data = NULL; | ||
82 | int __ret = 0; | ||
83 | |||
84 | LEN(8); /* header */ | ||
85 | LEN(8); /* texture */ | ||
86 | |||
87 | /* align */ | ||
88 | PAD(__len, 8); | ||
89 | |||
90 | __data = (uint8_t*)MALLOC(__len); | ||
91 | if (!__data) | ||
92 | return -ENOMEM; | ||
93 | |||
94 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO)); | ||
95 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
96 | WRITE(8, rbug_texture_t, texture); /* texture */ | ||
97 | |||
98 | /* final pad */ | ||
99 | PAD(__pos, 8); | ||
100 | |||
101 | if (__pos != __len) { | ||
102 | __ret = -EINVAL; | ||
103 | } else { | ||
104 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO, __len); | ||
105 | rbug_connection_write(__con, __data, __len); | ||
106 | __ret = rbug_connection_send_finish(__con, __serial); | ||
107 | } | ||
108 | |||
109 | FREE(__data); | ||
110 | return __ret; | ||
111 | } | ||
112 | |||
113 | int rbug_send_texture_write(struct rbug_connection *__con, | ||
114 | rbug_texture_t texture, | ||
115 | uint32_t face, | ||
116 | uint32_t level, | ||
117 | uint32_t zslice, | ||
118 | uint32_t x, | ||
119 | uint32_t y, | ||
120 | uint32_t w, | ||
121 | uint32_t h, | ||
122 | uint8_t *data, | ||
123 | uint32_t data_len, | ||
124 | uint32_t stride, | ||
125 | uint32_t *__serial) | ||
126 | { | ||
127 | uint32_t __len = 0; | ||
128 | uint32_t __pos = 0; | ||
129 | uint8_t *__data = NULL; | ||
130 | int __ret = 0; | ||
131 | |||
132 | LEN(8); /* header */ | ||
133 | LEN(8); /* texture */ | ||
134 | LEN(4); /* face */ | ||
135 | LEN(4); /* level */ | ||
136 | LEN(4); /* zslice */ | ||
137 | LEN(4); /* x */ | ||
138 | LEN(4); /* y */ | ||
139 | LEN(4); /* w */ | ||
140 | LEN(4); /* h */ | ||
141 | LEN_ARRAY(1, data); /* data */ | ||
142 | LEN(4); /* stride */ | ||
143 | |||
144 | /* align */ | ||
145 | PAD(__len, 8); | ||
146 | |||
147 | __data = (uint8_t*)MALLOC(__len); | ||
148 | if (!__data) | ||
149 | return -ENOMEM; | ||
150 | |||
151 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_WRITE)); | ||
152 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
153 | WRITE(8, rbug_texture_t, texture); /* texture */ | ||
154 | WRITE(4, uint32_t, face); /* face */ | ||
155 | WRITE(4, uint32_t, level); /* level */ | ||
156 | WRITE(4, uint32_t, zslice); /* zslice */ | ||
157 | WRITE(4, uint32_t, x); /* x */ | ||
158 | WRITE(4, uint32_t, y); /* y */ | ||
159 | WRITE(4, uint32_t, w); /* w */ | ||
160 | WRITE(4, uint32_t, h); /* h */ | ||
161 | WRITE_ARRAY(1, uint8_t, data); /* data */ | ||
162 | WRITE(4, uint32_t, stride); /* stride */ | ||
163 | |||
164 | /* final pad */ | ||
165 | PAD(__pos, 8); | ||
166 | |||
167 | if (__pos != __len) { | ||
168 | __ret = -EINVAL; | ||
169 | } else { | ||
170 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_WRITE, __len); | ||
171 | rbug_connection_write(__con, __data, __len); | ||
172 | __ret = rbug_connection_send_finish(__con, __serial); | ||
173 | } | ||
174 | |||
175 | FREE(__data); | ||
176 | return __ret; | ||
177 | } | ||
178 | |||
179 | int rbug_send_texture_read(struct rbug_connection *__con, | ||
180 | rbug_texture_t texture, | ||
181 | uint32_t face, | ||
182 | uint32_t level, | ||
183 | uint32_t zslice, | ||
184 | uint32_t x, | ||
185 | uint32_t y, | ||
186 | uint32_t w, | ||
187 | uint32_t h, | ||
188 | uint32_t *__serial) | ||
189 | { | ||
190 | uint32_t __len = 0; | ||
191 | uint32_t __pos = 0; | ||
192 | uint8_t *__data = NULL; | ||
193 | int __ret = 0; | ||
194 | |||
195 | LEN(8); /* header */ | ||
196 | LEN(8); /* texture */ | ||
197 | LEN(4); /* face */ | ||
198 | LEN(4); /* level */ | ||
199 | LEN(4); /* zslice */ | ||
200 | LEN(4); /* x */ | ||
201 | LEN(4); /* y */ | ||
202 | LEN(4); /* w */ | ||
203 | LEN(4); /* h */ | ||
204 | |||
205 | /* align */ | ||
206 | PAD(__len, 8); | ||
207 | |||
208 | __data = (uint8_t*)MALLOC(__len); | ||
209 | if (!__data) | ||
210 | return -ENOMEM; | ||
211 | |||
212 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ)); | ||
213 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
214 | WRITE(8, rbug_texture_t, texture); /* texture */ | ||
215 | WRITE(4, uint32_t, face); /* face */ | ||
216 | WRITE(4, uint32_t, level); /* level */ | ||
217 | WRITE(4, uint32_t, zslice); /* zslice */ | ||
218 | WRITE(4, uint32_t, x); /* x */ | ||
219 | WRITE(4, uint32_t, y); /* y */ | ||
220 | WRITE(4, uint32_t, w); /* w */ | ||
221 | WRITE(4, uint32_t, h); /* h */ | ||
222 | |||
223 | /* final pad */ | ||
224 | PAD(__pos, 8); | ||
225 | |||
226 | if (__pos != __len) { | ||
227 | __ret = -EINVAL; | ||
228 | } else { | ||
229 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ, __len); | ||
230 | rbug_connection_write(__con, __data, __len); | ||
231 | __ret = rbug_connection_send_finish(__con, __serial); | ||
232 | } | ||
233 | |||
234 | FREE(__data); | ||
235 | return __ret; | ||
236 | } | ||
237 | |||
238 | int rbug_send_texture_list_reply(struct rbug_connection *__con, | ||
239 | uint32_t serial, | ||
240 | rbug_texture_t *textures, | ||
241 | uint32_t textures_len, | ||
242 | uint32_t *__serial) | ||
243 | { | ||
244 | uint32_t __len = 0; | ||
245 | uint32_t __pos = 0; | ||
246 | uint8_t *__data = NULL; | ||
247 | int __ret = 0; | ||
248 | |||
249 | LEN(8); /* header */ | ||
250 | LEN(4); /* serial */ | ||
251 | LEN_ARRAY(8, textures); /* textures */ | ||
252 | |||
253 | /* align */ | ||
254 | PAD(__len, 8); | ||
255 | |||
256 | __data = (uint8_t*)MALLOC(__len); | ||
257 | if (!__data) | ||
258 | return -ENOMEM; | ||
259 | |||
260 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST_REPLY)); | ||
261 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
262 | WRITE(4, uint32_t, serial); /* serial */ | ||
263 | WRITE_ARRAY(8, rbug_texture_t, textures); /* textures */ | ||
264 | |||
265 | /* final pad */ | ||
266 | PAD(__pos, 8); | ||
267 | |||
268 | if (__pos != __len) { | ||
269 | __ret = -EINVAL; | ||
270 | } else { | ||
271 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST_REPLY, __len); | ||
272 | rbug_connection_write(__con, __data, __len); | ||
273 | __ret = rbug_connection_send_finish(__con, __serial); | ||
274 | } | ||
275 | |||
276 | FREE(__data); | ||
277 | return __ret; | ||
278 | } | ||
279 | |||
280 | int rbug_send_texture_info_reply(struct rbug_connection *__con, | ||
281 | uint32_t serial, | ||
282 | uint32_t target, | ||
283 | uint32_t format, | ||
284 | uint32_t *width, | ||
285 | uint32_t width_len, | ||
286 | uint32_t *height, | ||
287 | uint32_t height_len, | ||
288 | uint32_t *depth, | ||
289 | uint32_t depth_len, | ||
290 | uint32_t blockw, | ||
291 | uint32_t blockh, | ||
292 | uint32_t blocksize, | ||
293 | uint32_t last_level, | ||
294 | uint32_t nr_samples, | ||
295 | uint32_t tex_usage, | ||
296 | uint32_t *__serial) | ||
297 | { | ||
298 | uint32_t __len = 0; | ||
299 | uint32_t __pos = 0; | ||
300 | uint8_t *__data = NULL; | ||
301 | int __ret = 0; | ||
302 | |||
303 | LEN(8); /* header */ | ||
304 | LEN(4); /* serial */ | ||
305 | LEN(4); /* target */ | ||
306 | LEN(4); /* format */ | ||
307 | LEN_ARRAY(4, width); /* width */ | ||
308 | LEN_ARRAY(4, height); /* height */ | ||
309 | LEN_ARRAY(4, depth); /* depth */ | ||
310 | LEN(4); /* blockw */ | ||
311 | LEN(4); /* blockh */ | ||
312 | LEN(4); /* blocksize */ | ||
313 | LEN(4); /* last_level */ | ||
314 | LEN(4); /* nr_samples */ | ||
315 | LEN(4); /* tex_usage */ | ||
316 | |||
317 | /* align */ | ||
318 | PAD(__len, 8); | ||
319 | |||
320 | __data = (uint8_t*)MALLOC(__len); | ||
321 | if (!__data) | ||
322 | return -ENOMEM; | ||
323 | |||
324 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO_REPLY)); | ||
325 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
326 | WRITE(4, uint32_t, serial); /* serial */ | ||
327 | WRITE(4, uint32_t, target); /* target */ | ||
328 | WRITE(4, uint32_t, format); /* format */ | ||
329 | WRITE_ARRAY(4, uint32_t, width); /* width */ | ||
330 | WRITE_ARRAY(4, uint32_t, height); /* height */ | ||
331 | WRITE_ARRAY(4, uint32_t, depth); /* depth */ | ||
332 | WRITE(4, uint32_t, blockw); /* blockw */ | ||
333 | WRITE(4, uint32_t, blockh); /* blockh */ | ||
334 | WRITE(4, uint32_t, blocksize); /* blocksize */ | ||
335 | WRITE(4, uint32_t, last_level); /* last_level */ | ||
336 | WRITE(4, uint32_t, nr_samples); /* nr_samples */ | ||
337 | WRITE(4, uint32_t, tex_usage); /* tex_usage */ | ||
338 | |||
339 | /* final pad */ | ||
340 | PAD(__pos, 8); | ||
341 | |||
342 | if (__pos != __len) { | ||
343 | __ret = -EINVAL; | ||
344 | } else { | ||
345 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO_REPLY, __len); | ||
346 | rbug_connection_write(__con, __data, __len); | ||
347 | __ret = rbug_connection_send_finish(__con, __serial); | ||
348 | } | ||
349 | |||
350 | FREE(__data); | ||
351 | return __ret; | ||
352 | } | ||
353 | |||
354 | int rbug_send_texture_read_reply(struct rbug_connection *__con, | ||
355 | uint32_t serial, | ||
356 | uint32_t format, | ||
357 | uint32_t blockw, | ||
358 | uint32_t blockh, | ||
359 | uint32_t blocksize, | ||
360 | uint8_t *data, | ||
361 | uint32_t data_len, | ||
362 | uint32_t stride, | ||
363 | uint32_t *__serial) | ||
364 | { | ||
365 | uint32_t __len = 0; | ||
366 | uint32_t __pos = 0; | ||
367 | uint8_t *__data = NULL; | ||
368 | int __ret = 0; | ||
369 | |||
370 | LEN(8); /* header */ | ||
371 | LEN(4); /* serial */ | ||
372 | LEN(4); /* format */ | ||
373 | LEN(4); /* blockw */ | ||
374 | LEN(4); /* blockh */ | ||
375 | LEN(4); /* blocksize */ | ||
376 | LEN_ARRAY(1, data); /* data */ | ||
377 | LEN(4); /* stride */ | ||
378 | |||
379 | /* align */ | ||
380 | PAD(__len, 8); | ||
381 | |||
382 | __data = (uint8_t*)MALLOC(__len); | ||
383 | if (!__data) | ||
384 | return -ENOMEM; | ||
385 | |||
386 | WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ_REPLY)); | ||
387 | WRITE(4, uint32_t, ((uint32_t)(__len / 4))); | ||
388 | WRITE(4, uint32_t, serial); /* serial */ | ||
389 | WRITE(4, uint32_t, format); /* format */ | ||
390 | WRITE(4, uint32_t, blockw); /* blockw */ | ||
391 | WRITE(4, uint32_t, blockh); /* blockh */ | ||
392 | WRITE(4, uint32_t, blocksize); /* blocksize */ | ||
393 | WRITE_ARRAY(1, uint8_t, data); /* data */ | ||
394 | WRITE(4, uint32_t, stride); /* stride */ | ||
395 | |||
396 | /* final pad */ | ||
397 | PAD(__pos, 8); | ||
398 | |||
399 | if (__pos != __len) { | ||
400 | __ret = -EINVAL; | ||
401 | } else { | ||
402 | rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ_REPLY, __len); | ||
403 | rbug_connection_write(__con, __data, __len); | ||
404 | __ret = rbug_connection_send_finish(__con, __serial); | ||
405 | } | ||
406 | |||
407 | FREE(__data); | ||
408 | return __ret; | ||
409 | } | ||
410 | |||
411 | struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header) | ||
412 | { | ||
413 | uint32_t len = 0; | ||
414 | uint32_t pos = 0; | ||
415 | uint8_t *data = NULL; | ||
416 | struct rbug_proto_texture_list *ret; | ||
417 | |||
418 | if (!header) | ||
419 | return NULL; | ||
420 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST) | ||
421 | return NULL; | ||
422 | |||
423 | pos = 0; | ||
424 | len = header->length * 4; | ||
425 | data = (uint8_t*)&header[1]; | ||
426 | ret = MALLOC(sizeof(*ret)); | ||
427 | if (!ret) | ||
428 | return NULL; | ||
429 | |||
430 | ret->header.__message = header; | ||
431 | ret->header.opcode = header->opcode; | ||
432 | |||
433 | |||
434 | return ret; | ||
435 | } | ||
436 | |||
437 | struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header) | ||
438 | { | ||
439 | uint32_t len = 0; | ||
440 | uint32_t pos = 0; | ||
441 | uint8_t *data = NULL; | ||
442 | struct rbug_proto_texture_info *ret; | ||
443 | |||
444 | if (!header) | ||
445 | return NULL; | ||
446 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO) | ||
447 | return NULL; | ||
448 | |||
449 | pos = 0; | ||
450 | len = header->length * 4; | ||
451 | data = (uint8_t*)&header[1]; | ||
452 | ret = MALLOC(sizeof(*ret)); | ||
453 | if (!ret) | ||
454 | return NULL; | ||
455 | |||
456 | ret->header.__message = header; | ||
457 | ret->header.opcode = header->opcode; | ||
458 | |||
459 | READ(8, rbug_texture_t, texture); /* texture */ | ||
460 | |||
461 | return ret; | ||
462 | } | ||
463 | |||
464 | struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header) | ||
465 | { | ||
466 | uint32_t len = 0; | ||
467 | uint32_t pos = 0; | ||
468 | uint8_t *data = NULL; | ||
469 | struct rbug_proto_texture_write *ret; | ||
470 | |||
471 | if (!header) | ||
472 | return NULL; | ||
473 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_WRITE) | ||
474 | return NULL; | ||
475 | |||
476 | pos = 0; | ||
477 | len = header->length * 4; | ||
478 | data = (uint8_t*)&header[1]; | ||
479 | ret = MALLOC(sizeof(*ret)); | ||
480 | if (!ret) | ||
481 | return NULL; | ||
482 | |||
483 | ret->header.__message = header; | ||
484 | ret->header.opcode = header->opcode; | ||
485 | |||
486 | READ(8, rbug_texture_t, texture); /* texture */ | ||
487 | READ(4, uint32_t, face); /* face */ | ||
488 | READ(4, uint32_t, level); /* level */ | ||
489 | READ(4, uint32_t, zslice); /* zslice */ | ||
490 | READ(4, uint32_t, x); /* x */ | ||
491 | READ(4, uint32_t, y); /* y */ | ||
492 | READ(4, uint32_t, w); /* w */ | ||
493 | READ(4, uint32_t, h); /* h */ | ||
494 | READ_ARRAY(1, uint8_t, data); /* data */ | ||
495 | READ(4, uint32_t, stride); /* stride */ | ||
496 | |||
497 | return ret; | ||
498 | } | ||
499 | |||
500 | struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header) | ||
501 | { | ||
502 | uint32_t len = 0; | ||
503 | uint32_t pos = 0; | ||
504 | uint8_t *data = NULL; | ||
505 | struct rbug_proto_texture_read *ret; | ||
506 | |||
507 | if (!header) | ||
508 | return NULL; | ||
509 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ) | ||
510 | return NULL; | ||
511 | |||
512 | pos = 0; | ||
513 | len = header->length * 4; | ||
514 | data = (uint8_t*)&header[1]; | ||
515 | ret = MALLOC(sizeof(*ret)); | ||
516 | if (!ret) | ||
517 | return NULL; | ||
518 | |||
519 | ret->header.__message = header; | ||
520 | ret->header.opcode = header->opcode; | ||
521 | |||
522 | READ(8, rbug_texture_t, texture); /* texture */ | ||
523 | READ(4, uint32_t, face); /* face */ | ||
524 | READ(4, uint32_t, level); /* level */ | ||
525 | READ(4, uint32_t, zslice); /* zslice */ | ||
526 | READ(4, uint32_t, x); /* x */ | ||
527 | READ(4, uint32_t, y); /* y */ | ||
528 | READ(4, uint32_t, w); /* w */ | ||
529 | READ(4, uint32_t, h); /* h */ | ||
530 | |||
531 | return ret; | ||
532 | } | ||
533 | |||
534 | struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header) | ||
535 | { | ||
536 | uint32_t len = 0; | ||
537 | uint32_t pos = 0; | ||
538 | uint8_t *data = NULL; | ||
539 | struct rbug_proto_texture_list_reply *ret; | ||
540 | |||
541 | if (!header) | ||
542 | return NULL; | ||
543 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST_REPLY) | ||
544 | return NULL; | ||
545 | |||
546 | pos = 0; | ||
547 | len = header->length * 4; | ||
548 | data = (uint8_t*)&header[1]; | ||
549 | ret = MALLOC(sizeof(*ret)); | ||
550 | if (!ret) | ||
551 | return NULL; | ||
552 | |||
553 | ret->header.__message = header; | ||
554 | ret->header.opcode = header->opcode; | ||
555 | |||
556 | READ(4, uint32_t, serial); /* serial */ | ||
557 | READ_ARRAY(8, rbug_texture_t, textures); /* textures */ | ||
558 | |||
559 | return ret; | ||
560 | } | ||
561 | |||
562 | struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header) | ||
563 | { | ||
564 | uint32_t len = 0; | ||
565 | uint32_t pos = 0; | ||
566 | uint8_t *data = NULL; | ||
567 | struct rbug_proto_texture_info_reply *ret; | ||
568 | |||
569 | if (!header) | ||
570 | return NULL; | ||
571 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO_REPLY) | ||
572 | return NULL; | ||
573 | |||
574 | pos = 0; | ||
575 | len = header->length * 4; | ||
576 | data = (uint8_t*)&header[1]; | ||
577 | ret = MALLOC(sizeof(*ret)); | ||
578 | if (!ret) | ||
579 | return NULL; | ||
580 | |||
581 | ret->header.__message = header; | ||
582 | ret->header.opcode = header->opcode; | ||
583 | |||
584 | READ(4, uint32_t, serial); /* serial */ | ||
585 | READ(4, uint32_t, target); /* target */ | ||
586 | READ(4, uint32_t, format); /* format */ | ||
587 | READ_ARRAY(4, uint32_t, width); /* width */ | ||
588 | READ_ARRAY(4, uint32_t, height); /* height */ | ||
589 | READ_ARRAY(4, uint32_t, depth); /* depth */ | ||
590 | READ(4, uint32_t, blockw); /* blockw */ | ||
591 | READ(4, uint32_t, blockh); /* blockh */ | ||
592 | READ(4, uint32_t, blocksize); /* blocksize */ | ||
593 | READ(4, uint32_t, last_level); /* last_level */ | ||
594 | READ(4, uint32_t, nr_samples); /* nr_samples */ | ||
595 | READ(4, uint32_t, tex_usage); /* tex_usage */ | ||
596 | |||
597 | return ret; | ||
598 | } | ||
599 | |||
600 | struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header) | ||
601 | { | ||
602 | uint32_t len = 0; | ||
603 | uint32_t pos = 0; | ||
604 | uint8_t *data = NULL; | ||
605 | struct rbug_proto_texture_read_reply *ret; | ||
606 | |||
607 | if (!header) | ||
608 | return NULL; | ||
609 | if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ_REPLY) | ||
610 | return NULL; | ||
611 | |||
612 | pos = 0; | ||
613 | len = header->length * 4; | ||
614 | data = (uint8_t*)&header[1]; | ||
615 | ret = MALLOC(sizeof(*ret)); | ||
616 | if (!ret) | ||
617 | return NULL; | ||
618 | |||
619 | ret->header.__message = header; | ||
620 | ret->header.opcode = header->opcode; | ||
621 | |||
622 | READ(4, uint32_t, serial); /* serial */ | ||
623 | READ(4, uint32_t, format); /* format */ | ||
624 | READ(4, uint32_t, blockw); /* blockw */ | ||
625 | READ(4, uint32_t, blockh); /* blockh */ | ||
626 | READ(4, uint32_t, blocksize); /* blocksize */ | ||
627 | READ_ARRAY(1, uint8_t, data); /* data */ | ||
628 | READ(4, uint32_t, stride); /* stride */ | ||
629 | |||
630 | return ret; | ||
631 | } | ||
diff --git a/src/gallium/auxiliary/rbug/rbug_texture.h b/src/gallium/auxiliary/rbug/rbug_texture.h new file mode 100644 index 00000000000..2bcc3566f36 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_texture.h | |||
@@ -0,0 +1,207 @@ | |||
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/rbug_proto.h" | ||
42 | |||
43 | typedef uint64_t rbug_texture_t; | ||
44 | |||
45 | struct rbug_proto_texture_list | ||
46 | { | ||
47 | struct rbug_header header; | ||
48 | }; | ||
49 | |||
50 | struct rbug_proto_texture_info | ||
51 | { | ||
52 | struct rbug_header header; | ||
53 | rbug_texture_t texture; | ||
54 | }; | ||
55 | |||
56 | struct rbug_proto_texture_write | ||
57 | { | ||
58 | struct rbug_header header; | ||
59 | rbug_texture_t texture; | ||
60 | uint32_t face; | ||
61 | uint32_t level; | ||
62 | uint32_t zslice; | ||
63 | uint32_t x; | ||
64 | uint32_t y; | ||
65 | uint32_t w; | ||
66 | uint32_t h; | ||
67 | uint8_t *data; | ||
68 | uint32_t data_len; | ||
69 | uint32_t stride; | ||
70 | }; | ||
71 | |||
72 | struct rbug_proto_texture_read | ||
73 | { | ||
74 | struct rbug_header header; | ||
75 | rbug_texture_t texture; | ||
76 | uint32_t face; | ||
77 | uint32_t level; | ||
78 | uint32_t zslice; | ||
79 | uint32_t x; | ||
80 | uint32_t y; | ||
81 | uint32_t w; | ||
82 | uint32_t h; | ||
83 | }; | ||
84 | |||
85 | struct rbug_proto_texture_list_reply | ||
86 | { | ||
87 | struct rbug_header header; | ||
88 | uint32_t serial; | ||
89 | rbug_texture_t *textures; | ||
90 | uint32_t textures_len; | ||
91 | }; | ||
92 | |||
93 | struct rbug_proto_texture_info_reply | ||
94 | { | ||
95 | struct rbug_header header; | ||
96 | uint32_t serial; | ||
97 | uint32_t target; | ||
98 | uint32_t format; | ||
99 | uint32_t *width; | ||
100 | uint32_t width_len; | ||
101 | uint32_t *height; | ||
102 | uint32_t height_len; | ||
103 | uint32_t *depth; | ||
104 | uint32_t depth_len; | ||
105 | uint32_t blockw; | ||
106 | uint32_t blockh; | ||
107 | uint32_t blocksize; | ||
108 | uint32_t last_level; | ||
109 | uint32_t nr_samples; | ||
110 | uint32_t tex_usage; | ||
111 | }; | ||
112 | |||
113 | struct rbug_proto_texture_read_reply | ||
114 | { | ||
115 | struct rbug_header header; | ||
116 | uint32_t serial; | ||
117 | uint32_t format; | ||
118 | uint32_t blockw; | ||
119 | uint32_t blockh; | ||
120 | uint32_t blocksize; | ||
121 | uint8_t *data; | ||
122 | uint32_t data_len; | ||
123 | uint32_t stride; | ||
124 | }; | ||
125 | |||
126 | int rbug_send_texture_list(struct rbug_connection *__con, | ||
127 | uint32_t *__serial); | ||
128 | |||
129 | int rbug_send_texture_info(struct rbug_connection *__con, | ||
130 | rbug_texture_t texture, | ||
131 | uint32_t *__serial); | ||
132 | |||
133 | int rbug_send_texture_write(struct rbug_connection *__con, | ||
134 | rbug_texture_t texture, | ||
135 | uint32_t face, | ||
136 | uint32_t level, | ||
137 | uint32_t zslice, | ||
138 | uint32_t x, | ||
139 | uint32_t y, | ||
140 | uint32_t w, | ||
141 | uint32_t h, | ||
142 | uint8_t *data, | ||
143 | uint32_t data_len, | ||
144 | uint32_t stride, | ||
145 | uint32_t *__serial); | ||
146 | |||
147 | int rbug_send_texture_read(struct rbug_connection *__con, | ||
148 | rbug_texture_t texture, | ||
149 | uint32_t face, | ||
150 | uint32_t level, | ||
151 | uint32_t zslice, | ||
152 | uint32_t x, | ||
153 | uint32_t y, | ||
154 | uint32_t w, | ||
155 | uint32_t h, | ||
156 | uint32_t *__serial); | ||
157 | |||
158 | int rbug_send_texture_list_reply(struct rbug_connection *__con, | ||
159 | uint32_t serial, | ||
160 | rbug_texture_t *textures, | ||
161 | uint32_t textures_len, | ||
162 | uint32_t *__serial); | ||
163 | |||
164 | int rbug_send_texture_info_reply(struct rbug_connection *__con, | ||
165 | uint32_t serial, | ||
166 | uint32_t target, | ||
167 | uint32_t format, | ||
168 | uint32_t *width, | ||
169 | uint32_t width_len, | ||
170 | uint32_t *height, | ||
171 | uint32_t height_len, | ||
172 | uint32_t *depth, | ||
173 | uint32_t depth_len, | ||
174 | uint32_t blockw, | ||
175 | uint32_t blockh, | ||
176 | uint32_t blocksize, | ||
177 | uint32_t last_level, | ||
178 | uint32_t nr_samples, | ||
179 | uint32_t tex_usage, | ||
180 | uint32_t *__serial); | ||
181 | |||
182 | int rbug_send_texture_read_reply(struct rbug_connection *__con, | ||
183 | uint32_t serial, | ||
184 | uint32_t format, | ||
185 | uint32_t blockw, | ||
186 | uint32_t blockh, | ||
187 | uint32_t blocksize, | ||
188 | uint8_t *data, | ||
189 | uint32_t data_len, | ||
190 | uint32_t stride, | ||
191 | uint32_t *__serial); | ||
192 | |||
193 | struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header); | ||
194 | |||
195 | struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header); | ||
196 | |||
197 | struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header); | ||
198 | |||
199 | struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header); | ||
200 | |||
201 | struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header); | ||
202 | |||
203 | struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header); | ||
204 | |||
205 | struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header); | ||
206 | |||
207 | #endif | ||