#include "util/u_memory.h"
+#include "util/u_simple_list.h"
#include "tr_buffer.h"
-
struct pipe_buffer *
trace_buffer_create(struct trace_screen *tr_scr,
struct pipe_buffer *buffer)
tr_buf->base.screen = &tr_scr->base;
tr_buf->buffer = buffer;
+ trace_screen_add_to_list(tr_scr, buffers, tr_buf);
+
return &tr_buf->base;
error:
{
struct trace_buffer *tr_buf = trace_buffer(buffer);
+ trace_screen_remove_from_list(tr_scr, buffers, tr_buf);
+
pipe_buffer_reference(&tr_buf->buffer, NULL);
FREE(tr_buf);
}
struct pipe_buffer *buffer;
+ struct tr_list list;
+
void *map;
boolean range_flushed;
};
**************************************************************************/
#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+
#include "pipe/p_screen.h"
#include "tr_dump.h"
static INLINE void
trace_context_destroy(struct pipe_context *_pipe)
{
+ struct trace_screen *tr_scr = trace_screen(_pipe->screen);
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
trace_dump_call_begin("pipe_context", "destroy");
-
trace_dump_arg(ptr, pipe);
+ trace_dump_call_end();
- pipe->destroy(pipe);
+ trace_screen_remove_from_list(tr_scr, contexts, tr_ctx);
- trace_dump_call_end();
+ pipe->destroy(pipe);
FREE(tr_ctx);
}
trace_dump_ret(ptr, pipe);
trace_dump_call_end();
+ trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
+
return &tr_ctx->base;
error1:
struct pipe_context base;
struct pipe_context *pipe;
+
+ struct tr_list list;
};
**************************************************************************/
#include "util/u_memory.h"
+#include "util/u_simple_list.h"
#include "tr_buffer.h"
#include "tr_dump.h"
#else
winsys = screen->winsys;
#endif
+ pipe_mutex_init(tr_scr->list_mutex);
+ make_empty_list(&tr_scr->buffers);
+ make_empty_list(&tr_scr->contexts);
+ make_empty_list(&tr_scr->textures);
+ make_empty_list(&tr_scr->surfaces);
+ make_empty_list(&tr_scr->transfers);
tr_scr->base.winsys = winsys;
tr_scr->base.destroy = trace_screen_destroy;
#include "pipe/p_screen.h"
+#include "pipe/p_thread.h"
#ifdef __cplusplus
#endif
+struct tr_list {
+ struct tr_list *next;
+ struct tr_list *prev;
+};
+
/**
* It often happens that new data is written directly to the user buffers
* without mapping/unmapping. This flag marks user buffers, so that their
struct pipe_screen base;
struct pipe_screen *screen;
+
+ pipe_mutex list_mutex;
+ int num_buffers;
+ int num_contexts;
+ int num_textures;
+ int num_surfaces;
+ int num_transfers;
+ struct tr_list buffers;
+ struct tr_list contexts;
+ struct tr_list textures;
+ struct tr_list surfaces;
+ struct tr_list transfers;
};
trace_screen_user_buffer_update(struct pipe_screen *screen,
struct pipe_buffer *buffer);
+#define trace_screen_add_to_list(tr_scr, name, obj) \
+ do { \
+ pipe_mutex_lock(tr_scr->list_mutex); \
+ insert_at_head(&tr_scr->name, &obj->list); \
+ tr_scr->num_##name++; \
+ pipe_mutex_unlock(tr_scr->list_mutex); \
+ } while (0)
+
+#define trace_screen_remove_from_list(tr_scr, name, obj) \
+ do { \
+ pipe_mutex_lock(tr_scr->list_mutex); \
+ remove_from_list(&obj->list); \
+ tr_scr->num_##name--; \
+ pipe_mutex_unlock(tr_scr->list_mutex); \
+ } while (0)
#ifdef __cplusplus
}
#include "util/u_hash_table.h"
#include "util/u_memory.h"
+#include "util/u_simple_list.h"
#include "tr_screen.h"
#include "tr_texture.h"
tr_tex->base.screen = &tr_scr->base;
tr_tex->texture = texture;
+ trace_screen_add_to_list(tr_scr, textures, tr_tex);
+
return &tr_tex->base;
error:
void
trace_texture_destroy(struct trace_texture *tr_tex)
{
+ struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
+
+ trace_screen_remove_from_list(tr_scr, textures, tr_tex);
+
pipe_texture_reference(&tr_tex->texture, NULL);
FREE(tr_tex);
}
trace_surface_create(struct trace_texture *tr_tex,
struct pipe_surface *surface)
{
+ struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
struct trace_surface *tr_surf;
if(!surface)
pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base);
tr_surf->surface = surface;
+ trace_screen_add_to_list(tr_scr, surfaces, tr_surf);
+
return &tr_surf->base;
error:
void
trace_surface_destroy(struct trace_surface *tr_surf)
{
+ struct trace_screen *tr_scr = trace_screen(tr_surf->base.texture->screen);
+
+ trace_screen_remove_from_list(tr_scr, surfaces, tr_surf);
+
pipe_texture_reference(&tr_surf->base.texture, NULL);
pipe_surface_reference(&tr_surf->surface, NULL);
FREE(tr_surf);
trace_transfer_create(struct trace_texture *tr_tex,
struct pipe_transfer *transfer)
{
+ struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
struct trace_transfer *tr_trans;
if(!transfer)
tr_trans->transfer = transfer;
assert(tr_trans->base.texture == &tr_tex->base);
+ trace_screen_add_to_list(tr_scr, transfers, tr_trans);
+
return &tr_trans->base;
error:
void
trace_transfer_destroy(struct trace_transfer *tr_trans)
{
+ struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen);
struct pipe_screen *screen = tr_trans->transfer->texture->screen;
+
+ trace_screen_remove_from_list(tr_scr, transfers, tr_trans);
+
pipe_texture_reference(&tr_trans->base.texture, NULL);
screen->tex_transfer_destroy(tr_trans->transfer);
FREE(tr_trans);
struct pipe_texture base;
struct pipe_texture *texture;
+
+ struct tr_list list;
};
struct pipe_surface base;
struct pipe_surface *surface;
+
+ struct tr_list list;
};
struct pipe_transfer *transfer;
+ struct tr_list list;
+
void *map;
};