summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/trace/tr_screen.h
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-04-17 15:55:51 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-04-17 16:03:01 +0200
commit44d0e0caf4ad3b01dc08d8432867c449dc3f2a23 (patch)
treea0d8ad22f727c44c3cca74d9cbcd48f949d30891 /src/gallium/drivers/trace/tr_screen.h
parent1e42f68fd612b2a4c877b91393e5ff5bc34dbe0d (diff)
trace: Keep screen objects on lists
Diffstat (limited to 'src/gallium/drivers/trace/tr_screen.h')
-rw-r--r--src/gallium/drivers/trace/tr_screen.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
index 8c65516b50..59f254166d 100644
--- a/src/gallium/drivers/trace/tr_screen.h
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -30,6 +30,7 @@
#include "pipe/p_screen.h"
+#include "pipe/p_thread.h"
#ifdef __cplusplus
@@ -37,6 +38,11 @@ extern "C" {
#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
@@ -50,6 +56,18 @@ struct trace_screen
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;
};
@@ -65,6 +83,21 @@ void
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
}