rbug: Extend context info and block ops
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 9 Jun 2009 14:58:14 +0000 (15:58 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 9 Jun 2009 15:00:39 +0000 (16:00 +0100)
src/gallium/auxiliary/rbug/rbug_context.c
src/gallium/auxiliary/rbug/rbug_context.h
src/gallium/auxiliary/rbug/rbug_demarshal.c
src/gallium/auxiliary/rbug/rbug_proto.h

index 787f650f7102709b830d7a81677cbee3addadb76..55e049f3137c840c949dec7a424906007c92c4f4 100644 (file)
@@ -274,6 +274,100 @@ int rbug_send_context_flush(struct rbug_connection *__con,
        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)
+{
+       uint32_t __len = 0;
+       uint32_t __pos = 0;
+       uint8_t *__data = NULL;
+       int __ret = 0;
+
+       LEN(8); /* header */
+       LEN(8); /* context */
+       LEN(8); /* vertex */
+       LEN(8); /* fragment */
+       LEN(8); /* texture */
+       LEN(8); /* surface */
+       LEN(4); /* block */
+
+       /* align */
+       PAD(__len, 8);
+
+       __data = (uint8_t*)MALLOC(__len);
+       if (!__data)
+               return -ENOMEM;
+
+       WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD));
+       WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
+       WRITE(8, rbug_context_t, context); /* context */
+       WRITE(8, rbug_shader_t, vertex); /* vertex */
+       WRITE(8, rbug_shader_t, fragment); /* fragment */
+       WRITE(8, rbug_texture_t, texture); /* texture */
+       WRITE(8, rbug_texture_t, surface); /* surface */
+       WRITE(4, rbug_block_t, block); /* block */
+
+       /* final pad */
+       PAD(__pos, 8);
+
+       if (__pos != __len) {
+               __ret = -EINVAL;
+       } else {
+               rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD, __len);
+               rbug_connection_write(__con, __data, __len);
+               __ret = rbug_connection_send_finish(__con, __serial);
+       }
+
+       FREE(__data);
+       return __ret;
+}
+
+int rbug_send_context_rule_delete(struct rbug_connection *__con,
+                                  rbug_context_t context,
+                                  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(8); /* context */
+       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_DELETE));
+       WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
+       WRITE(8, rbug_context_t, context); /* context */
+       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_DELETE, __len);
+               rbug_connection_write(__con, __data, __len);
+               __ret = rbug_connection_send_finish(__con, __serial);
+       }
+
+       FREE(__data);
+       return __ret;
+}
+
 int rbug_send_context_list_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_context_t *contexts,
@@ -320,6 +414,8 @@ int rbug_send_context_info_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_shader_t vertex,
                                  rbug_shader_t fragment,
+                                 rbug_texture_t *texs,
+                                 uint32_t texs_len,
                                  rbug_texture_t *cbufs,
                                  uint32_t cbufs_len,
                                  rbug_texture_t zsbuf,
@@ -336,6 +432,7 @@ int rbug_send_context_info_reply(struct rbug_connection *__con,
        LEN(4); /* serial */
        LEN(8); /* vertex */
        LEN(8); /* fragment */
+       LEN_ARRAY(8, texs); /* texs */
        LEN_ARRAY(8, cbufs); /* cbufs */
        LEN(8); /* zsbuf */
        LEN(4); /* blocker */
@@ -353,6 +450,7 @@ int rbug_send_context_info_reply(struct rbug_connection *__con,
        WRITE(4, uint32_t, serial); /* serial */
        WRITE(8, rbug_shader_t, vertex); /* vertex */
        WRITE(8, rbug_shader_t, fragment); /* fragment */
+       WRITE_ARRAY(8, rbug_texture_t, texs); /* texs */
        WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */
        WRITE(8, rbug_texture_t, zsbuf); /* zsbuf */
        WRITE(4, rbug_block_t, blocker); /* blocker */
@@ -373,6 +471,47 @@ 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,
@@ -579,6 +718,66 @@ struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto
        return ret;
 }
 
+struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header)
+{
+       uint32_t len = 0;
+       uint32_t pos = 0;
+       uint8_t *data =  NULL;
+       struct rbug_proto_context_rule_add *ret;
+
+       if (!header)
+               return NULL;
+       if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD)
+               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(8, rbug_shader_t, vertex); /* vertex */
+       READ(8, rbug_shader_t, fragment); /* fragment */
+       READ(8, rbug_texture_t, texture); /* texture */
+       READ(8, rbug_texture_t, surface); /* surface */
+       READ(4, rbug_block_t, block); /* block */
+
+       return ret;
+}
+
+struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header)
+{
+       uint32_t len = 0;
+       uint32_t pos = 0;
+       uint8_t *data =  NULL;
+       struct rbug_proto_context_rule_delete *ret;
+
+       if (!header)
+               return NULL;
+       if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_DELETE)
+               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(8, rbug_block_rule_t, rule); /* rule */
+
+       return ret;
+}
+
 struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header)
 {
        uint32_t len = 0;
@@ -632,6 +831,7 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct
        READ(4, uint32_t, serial); /* serial */
        READ(8, rbug_shader_t, vertex); /* vertex */
        READ(8, rbug_shader_t, fragment); /* fragment */
+       READ_ARRAY(8, rbug_texture_t, texs); /* texs */
        READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */
        READ(8, rbug_texture_t, zsbuf); /* zsbuf */
        READ(4, rbug_block_t, blocker); /* blocker */
@@ -640,6 +840,34 @@ 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;
index 9f1726d64d466be61119ea40a422ec59ecc86d90..178a3bce245012c1401141a9de4c6fa19cc4d142 100644 (file)
@@ -41,6 +41,8 @@
 #include "rbug/rbug_proto.h"
 #include "rbug/rbug_core.h"
 
+typedef uint64_t rbug_block_rule_t;
+
 typedef enum
 {
        RBUG_BLOCK_BEFORE = 1,
@@ -86,6 +88,24 @@ struct rbug_proto_context_flush
        int32_t flags;
 };
 
+struct rbug_proto_context_rule_add
+{
+       struct rbug_header header;
+       rbug_context_t context;
+       rbug_shader_t vertex;
+       rbug_shader_t fragment;
+       rbug_texture_t texture;
+       rbug_texture_t surface;
+       rbug_block_t block;
+};
+
+struct rbug_proto_context_rule_delete
+{
+       struct rbug_header header;
+       rbug_context_t context;
+       rbug_block_rule_t rule;
+};
+
 struct rbug_proto_context_list_reply
 {
        struct rbug_header header;
@@ -100,6 +120,8 @@ struct rbug_proto_context_info_reply
        uint32_t serial;
        rbug_shader_t vertex;
        rbug_shader_t fragment;
+       rbug_texture_t *texs;
+       uint32_t texs_len;
        rbug_texture_t *cbufs;
        uint32_t cbufs_len;
        rbug_texture_t zsbuf;
@@ -107,6 +129,13 @@ 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;
@@ -141,6 +170,20 @@ int rbug_send_context_flush(struct rbug_connection *__con,
                             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,
@@ -151,6 +194,8 @@ int rbug_send_context_info_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_shader_t vertex,
                                  rbug_shader_t fragment,
+                                 rbug_texture_t *texs,
+                                 uint32_t texs_len,
                                  rbug_texture_t *cbufs,
                                  uint32_t cbufs_len,
                                  rbug_texture_t zsbuf,
@@ -158,6 +203,11 @@ 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,
@@ -175,10 +225,16 @@ struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(str
 
 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_rule_delete * rbug_demarshal_context_rule_delete(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
index 80894f4a64cae75163423283f4c9443107e13fcf..b3929b9cb43b38621fbd5d9c9e90034b70297ba1 100644 (file)
@@ -67,10 +67,16 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header)
                return (struct rbug_header *)rbug_demarshal_context_draw_unblock(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:
index db9fa685006371b7a2fad49e46a3cec9c2177fa0..5ef345d72ddf4dcfc756f2466f109bb43422fb97 100644 (file)
@@ -56,8 +56,11 @@ enum rbug_opcode
        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_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,