diff options
author | Jakob Bornecrantz <jakob@vmware.com> | 2009-06-09 19:22:40 +0100 |
---|---|---|
committer | Jakob Bornecrantz <jakob@vmware.com> | 2009-06-09 19:22:40 +0100 |
commit | f3cf3d2fc2c0cb09cb1c18c08a135009904166b7 (patch) | |
tree | f54d1b127db45229b52f798aa820cd9eb45627ad | |
parent | b71a254f057269f8eca162a729830dde5981e138 (diff) | |
download | external_mesa3d-f3cf3d2fc2c0cb09cb1c18c08a135009904166b7.zip external_mesa3d-f3cf3d2fc2c0cb09cb1c18c08a135009904166b7.tar.gz external_mesa3d-f3cf3d2fc2c0cb09cb1c18c08a135009904166b7.tar.bz2 |
rbug: Change block protocol around a bit
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_context.c | 188 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_context.h | 60 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_demarshal.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/rbug/rbug_proto.h | 6 |
4 files changed, 45 insertions, 217 deletions
diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index 55e049f..1832425 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.c +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -233,55 +233,14 @@ int rbug_send_context_draw_unblock(struct rbug_connection *__con, return __ret; } -int rbug_send_context_flush(struct rbug_connection *__con, - rbug_context_t context, - int32_t flags, - uint32_t *__serial) -{ - uint32_t __len = 0; - uint32_t __pos = 0; - uint8_t *__data = NULL; - int __ret = 0; - - LEN(8); /* header */ - LEN(8); /* context */ - LEN(4); /* flags */ - - /* align */ - PAD(__len, 8); - - __data = (uint8_t*)MALLOC(__len); - if (!__data) - return -ENOMEM; - - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH)); - WRITE(4, uint32_t, ((uint32_t)(__len / 4))); - WRITE(8, rbug_context_t, context); /* context */ - WRITE(4, int32_t, flags); /* flags */ - - /* final pad */ - PAD(__pos, 8); - - if (__pos != __len) { - __ret = -EINVAL; - } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len); - rbug_connection_write(__con, __data, __len); - __ret = rbug_connection_send_finish(__con, __serial); - } - - FREE(__data); - return __ret; -} - -int rbug_send_context_rule_add(struct rbug_connection *__con, - rbug_context_t context, - rbug_shader_t vertex, - rbug_shader_t fragment, - rbug_texture_t texture, - rbug_texture_t surface, - rbug_block_t block, - uint32_t *__serial) +int rbug_send_context_draw_rule(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial) { uint32_t __len = 0; uint32_t __pos = 0; @@ -303,7 +262,7 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_RULE)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ WRITE(8, rbug_shader_t, vertex); /* vertex */ @@ -318,7 +277,7 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_RULE, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -327,10 +286,10 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, return __ret; } -int rbug_send_context_rule_delete(struct rbug_connection *__con, - rbug_context_t context, - rbug_block_rule_t rule, - uint32_t *__serial) +int rbug_send_context_flush(struct rbug_connection *__con, + rbug_context_t context, + int32_t flags, + uint32_t *__serial) { uint32_t __len = 0; uint32_t __pos = 0; @@ -339,7 +298,7 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, LEN(8); /* header */ LEN(8); /* context */ - LEN(8); /* rule */ + LEN(4); /* flags */ /* align */ PAD(__len, 8); @@ -348,10 +307,10 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_DELETE)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ - WRITE(8, rbug_block_rule_t, rule); /* rule */ + WRITE(4, int32_t, flags); /* flags */ /* final pad */ PAD(__pos, 8); @@ -359,7 +318,7 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_DELETE, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -471,47 +430,6 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, return __ret; } -int rbug_send_context_rule_add_reply(struct rbug_connection *__con, - uint32_t serial, - rbug_block_rule_t rule, - uint32_t *__serial) -{ - uint32_t __len = 0; - uint32_t __pos = 0; - uint8_t *__data = NULL; - int __ret = 0; - - LEN(8); /* header */ - LEN(4); /* serial */ - LEN(8); /* rule */ - - /* align */ - PAD(__len, 8); - - __data = (uint8_t*)MALLOC(__len); - if (!__data) - return -ENOMEM; - - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY)); - WRITE(4, uint32_t, ((uint32_t)(__len / 4))); - WRITE(4, uint32_t, serial); /* serial */ - WRITE(8, rbug_block_rule_t, rule); /* rule */ - - /* final pad */ - PAD(__pos, 8); - - if (__pos != __len) { - __ret = -EINVAL; - } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD_REPLY, __len); - rbug_connection_write(__con, __data, __len); - __ret = rbug_connection_send_finish(__con, __serial); - } - - FREE(__data); - return __ret; -} - int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -690,44 +608,16 @@ struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(str return ret; } -struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header) -{ - uint32_t len = 0; - uint32_t pos = 0; - uint8_t *data = NULL; - struct rbug_proto_context_flush *ret; - - if (!header) - return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) - return NULL; - - pos = 0; - len = header->length * 4; - data = (uint8_t*)&header[1]; - ret = MALLOC(sizeof(*ret)); - if (!ret) - return NULL; - - ret->header.__message = header; - ret->header.opcode = header->opcode; - - READ(8, rbug_context_t, context); /* context */ - READ(4, int32_t, flags); /* flags */ - - return ret; -} - -struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header) +struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_rule_add *ret; + struct rbug_proto_context_draw_rule *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_RULE) return NULL; pos = 0; @@ -750,16 +640,16 @@ struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug return ret; } -struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header) +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_rule_delete *ret; + struct rbug_proto_context_flush *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_DELETE) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) return NULL; pos = 0; @@ -773,7 +663,7 @@ struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struc ret->header.opcode = header->opcode; READ(8, rbug_context_t, context); /* context */ - READ(8, rbug_block_rule_t, rule); /* rule */ + READ(4, int32_t, flags); /* flags */ return ret; } @@ -840,34 +730,6 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct return ret; } -struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header) -{ - uint32_t len = 0; - uint32_t pos = 0; - uint8_t *data = NULL; - struct rbug_proto_context_rule_add_reply *ret; - - if (!header) - return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY) - return NULL; - - pos = 0; - len = header->length * 4; - data = (uint8_t*)&header[1]; - ret = MALLOC(sizeof(*ret)); - if (!ret) - return NULL; - - ret->header.__message = header; - ret->header.opcode = header->opcode; - - READ(4, uint32_t, serial); /* serial */ - READ(8, rbug_block_rule_t, rule); /* rule */ - - return ret; -} - struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header) { uint32_t len = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h index 178a3bc..da61c23 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.h +++ b/src/gallium/auxiliary/rbug/rbug_context.h @@ -41,12 +41,12 @@ #include "rbug/rbug_proto.h" #include "rbug/rbug_core.h" -typedef uint64_t rbug_block_rule_t; - typedef enum { RBUG_BLOCK_BEFORE = 1, RBUG_BLOCK_AFTER = 2, + RBUG_BLOCK_RULE = 4, + RBUG_BLOCK_MASK = 7, } rbug_block_t; struct rbug_proto_context_list @@ -81,14 +81,7 @@ struct rbug_proto_context_draw_unblock rbug_block_t unblock; }; -struct rbug_proto_context_flush -{ - struct rbug_header header; - rbug_context_t context; - int32_t flags; -}; - -struct rbug_proto_context_rule_add +struct rbug_proto_context_draw_rule { struct rbug_header header; rbug_context_t context; @@ -99,11 +92,11 @@ struct rbug_proto_context_rule_add rbug_block_t block; }; -struct rbug_proto_context_rule_delete +struct rbug_proto_context_flush { struct rbug_header header; rbug_context_t context; - rbug_block_rule_t rule; + int32_t flags; }; struct rbug_proto_context_list_reply @@ -129,13 +122,6 @@ struct rbug_proto_context_info_reply rbug_block_t blocked; }; -struct rbug_proto_context_rule_add_reply -{ - struct rbug_header header; - uint32_t serial; - rbug_block_rule_t rule; -}; - struct rbug_proto_context_draw_blocked { struct rbug_header header; @@ -165,25 +151,20 @@ int rbug_send_context_draw_unblock(struct rbug_connection *__con, rbug_block_t unblock, uint32_t *__serial); +int rbug_send_context_draw_rule(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial); + int rbug_send_context_flush(struct rbug_connection *__con, rbug_context_t context, int32_t flags, uint32_t *__serial); -int rbug_send_context_rule_add(struct rbug_connection *__con, - rbug_context_t context, - rbug_shader_t vertex, - rbug_shader_t fragment, - rbug_texture_t texture, - rbug_texture_t surface, - rbug_block_t block, - uint32_t *__serial); - -int rbug_send_context_rule_delete(struct rbug_connection *__con, - rbug_context_t context, - rbug_block_rule_t rule, - uint32_t *__serial); - int rbug_send_context_list_reply(struct rbug_connection *__con, uint32_t serial, rbug_context_t *contexts, @@ -203,11 +184,6 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, rbug_block_t blocked, uint32_t *__serial); -int rbug_send_context_rule_add_reply(struct rbug_connection *__con, - uint32_t serial, - rbug_block_rule_t rule, - uint32_t *__serial); - int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -223,18 +199,14 @@ struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rb struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header); -struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); - -struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header); +struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header); -struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header); +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); -struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header); - struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header); #endif diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index b3929b9..47390fb 100644 --- a/src/gallium/auxiliary/rbug/rbug_demarshal.c +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -65,18 +65,14 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) return (struct rbug_header *)rbug_demarshal_context_draw_step(header); case RBUG_OP_CONTEXT_DRAW_UNBLOCK: return (struct rbug_header *)rbug_demarshal_context_draw_unblock(header); + case RBUG_OP_CONTEXT_DRAW_RULE: + return (struct rbug_header *)rbug_demarshal_context_draw_rule(header); case RBUG_OP_CONTEXT_FLUSH: return (struct rbug_header *)rbug_demarshal_context_flush(header); - case RBUG_OP_CONTEXT_RULE_ADD: - return (struct rbug_header *)rbug_demarshal_context_rule_add(header); - case RBUG_OP_CONTEXT_RULE_DELETE: - return (struct rbug_header *)rbug_demarshal_context_rule_delete(header); case RBUG_OP_CONTEXT_LIST_REPLY: return (struct rbug_header *)rbug_demarshal_context_list_reply(header); case RBUG_OP_CONTEXT_INFO_REPLY: return (struct rbug_header *)rbug_demarshal_context_info_reply(header); - case RBUG_OP_CONTEXT_RULE_ADD_REPLY: - return (struct rbug_header *)rbug_demarshal_context_rule_add_reply(header); case RBUG_OP_CONTEXT_DRAW_BLOCKED: return (struct rbug_header *)rbug_demarshal_context_draw_blocked(header); case RBUG_OP_SHADER_LIST: diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h index 5ef345d..d273be0 100644 --- a/src/gallium/auxiliary/rbug/rbug_proto.h +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -55,12 +55,10 @@ enum rbug_opcode RBUG_OP_CONTEXT_DRAW_BLOCK = 514, RBUG_OP_CONTEXT_DRAW_STEP = 515, RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516, - RBUG_OP_CONTEXT_FLUSH = 518, - RBUG_OP_CONTEXT_RULE_ADD = 521, - RBUG_OP_CONTEXT_RULE_DELETE = 522, + RBUG_OP_CONTEXT_DRAW_RULE = 518, + RBUG_OP_CONTEXT_FLUSH = 519, RBUG_OP_CONTEXT_LIST_REPLY = -512, RBUG_OP_CONTEXT_INFO_REPLY = -513, - RBUG_OP_CONTEXT_RULE_ADD_REPLY = -521, RBUG_OP_CONTEXT_DRAW_BLOCKED = 517, RBUG_OP_SHADER_LIST = 768, RBUG_OP_SHADER_INFO = 769, |