trace: Simplify trace_buffer function
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 17 Apr 2009 13:52:05 +0000 (15:52 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 17 Apr 2009 14:03:01 +0000 (16:03 +0200)
src/gallium/drivers/trace/tr_buffer.c
src/gallium/drivers/trace/tr_buffer.h
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump.c
src/gallium/drivers/trace/tr_screen.c

index 6ffce1660ec88e081f061157d1356f60b3992f6d..3cdb107dc6b14f33782ca490fbd6f37e0799a5b5 100644 (file)
@@ -64,7 +64,8 @@ void
 trace_buffer_destroy(struct trace_screen *tr_scr,
                      struct pipe_buffer *buffer)
 {
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, buffer);
+   struct trace_buffer *tr_buf = trace_buffer(buffer);
+
    pipe_buffer_reference(&tr_buf->buffer, NULL);
    FREE(tr_buf);
 }
index e9e4d354dad21d357dc6ad0338a97a22590ef6e3..bb8a3b2c3aa44ef85c79b42ded9180a93b7925cd 100644 (file)
@@ -47,13 +47,11 @@ struct trace_buffer
 
 
 static INLINE struct trace_buffer *
-trace_buffer(struct trace_screen *tr_scr,
-             struct pipe_buffer *buffer)
+trace_buffer(struct pipe_buffer *buffer)
 {
    if(!buffer)
       return NULL;
-   assert(tr_scr);
-   assert(buffer->screen == &tr_scr->base);
+   (void)trace_screen(buffer->screen);
    return (struct trace_buffer *)buffer;
 }
 
index 556b5e003ffddf1938f0cb613d76d45bb018599e..179c8fd354d05aa6c8df2fbaa3c998641acec79d 100644 (file)
@@ -46,7 +46,7 @@ trace_buffer_unwrap(struct trace_context *tr_ctx,
    if(!buffer)
       return NULL;
 
-   tr_buf = trace_buffer(tr_scr, buffer);
+   tr_buf = trace_buffer(buffer);
 
    assert(tr_buf->buffer);
    assert(tr_buf->buffer->screen == tr_scr->screen);
@@ -142,9 +142,8 @@ trace_context_draw_elements(struct pipe_context *_pipe,
                           unsigned indexSize,
                           unsigned mode, unsigned start, unsigned count)
 {
-   struct trace_screen *tr_scr = trace_screen(_pipe->screen);
    struct trace_context *tr_ctx = trace_context(_pipe);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
+   struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
    struct pipe_context *pipe = tr_ctx->pipe;
    struct pipe_buffer *indexBuffer = tr_buf->buffer;
    boolean result;
@@ -180,9 +179,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
                                   unsigned start,
                                   unsigned count)
 {
-   struct trace_screen *tr_scr = trace_screen(_pipe->screen);
    struct trace_context *tr_ctx = trace_context(_pipe);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer);
+   struct trace_buffer *tr_buf = trace_buffer(_indexBuffer);
    struct pipe_context *pipe = tr_ctx->pipe;
    struct pipe_buffer *indexBuffer = tr_buf->buffer;
    boolean result;
index 2618883e70d4c8f8991436e060dbeed9eb331332..d2a7664ed9b23a22438a7fcac3767fef3c99dc40 100644 (file)
@@ -425,8 +425,7 @@ void trace_dump_ptr(const void *value)
 void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
 {
    if (_buffer) {
-      struct trace_screen *tr_scr = trace_screen(_buffer->screen);
-      struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+      struct trace_buffer *tr_buf = trace_buffer(_buffer);
       trace_dump_ptr(tr_buf->buffer);
    } else {
       trace_dump_null();
index 28506da4dc0f79937ce054103543fc4281423d61..3e676f01559acaa98584417b84a28657d064f562 100644 (file)
@@ -603,7 +603,7 @@ trace_screen_buffer_map(struct pipe_screen *_screen,
                         unsigned usage)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct trace_buffer *tr_buf = trace_buffer(_buffer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_buffer *buffer = tr_buf->buffer;
    void *map;
@@ -628,7 +628,7 @@ trace_screen_buffer_map_range(struct pipe_screen *_screen,
                               unsigned usage)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct trace_buffer *tr_buf = trace_buffer(_buffer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_buffer *buffer = tr_buf->buffer;
    void *map;
@@ -680,7 +680,7 @@ trace_screen_buffer_flush_mapped_range(struct pipe_screen *_screen,
                                        unsigned length)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct trace_buffer *tr_buf = trace_buffer(_buffer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_buffer *buffer = tr_buf->buffer;
 
@@ -696,7 +696,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen,
                           struct pipe_buffer *_buffer)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct trace_buffer *tr_buf = trace_buffer(_buffer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_buffer *buffer = tr_buf->buffer;
 
@@ -712,7 +712,7 @@ static void
 trace_screen_buffer_destroy(struct pipe_buffer *_buffer)
 {
    struct trace_screen *tr_scr = trace_screen(_buffer->screen);
-   struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer);
+   struct trace_buffer *tr_buf = trace_buffer(_buffer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_buffer *buffer = tr_buf->buffer;