summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/trace
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/trace')
-rw-r--r--src/gallium/drivers/trace/tr_buffer.c1
-rw-r--r--src/gallium/drivers/trace/tr_context.c28
-rw-r--r--src/gallium/drivers/trace/tr_context.h5
-rw-r--r--src/gallium/drivers/trace/tr_drm.c20
-rw-r--r--src/gallium/drivers/trace/tr_dump.c14
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c39
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.h2
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c13
-rw-r--r--src/gallium/drivers/trace/tr_screen.c28
-rw-r--r--src/gallium/drivers/trace/tr_screen.h2
-rw-r--r--src/gallium/drivers/trace/tr_texture.c1
11 files changed, 79 insertions, 74 deletions
diff --git a/src/gallium/drivers/trace/tr_buffer.c b/src/gallium/drivers/trace/tr_buffer.c
index 4f0eff6a5a..fa2ac068eb 100644
--- a/src/gallium/drivers/trace/tr_buffer.c
+++ b/src/gallium/drivers/trace/tr_buffer.c
@@ -26,6 +26,7 @@
**************************************************************************/
+#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index 075e4f9a0b..34ceaa41c1 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -812,13 +812,13 @@ trace_context_set_clip_state(struct pipe_context *_pipe,
static INLINE void
trace_context_set_constant_buffer(struct pipe_context *_pipe,
uint shader, uint index,
- const struct pipe_constant_buffer *buffer)
+ struct pipe_buffer *buffer)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
if (buffer)
- trace_screen_user_buffer_update(_pipe->screen, buffer->buffer);
+ trace_screen_user_buffer_update(_pipe->screen, buffer);
trace_dump_call_begin("pipe_context", "set_constant_buffer");
@@ -827,10 +827,11 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
trace_dump_arg(uint, index);
trace_dump_arg(constant_buffer, buffer);
+ /* XXX hmm? */
if (buffer) {
- struct pipe_constant_buffer _buffer;
- _buffer.buffer = trace_buffer_unwrap(tr_ctx, buffer->buffer);
- pipe->set_constant_buffer(pipe, shader, index, &_buffer);
+ struct pipe_buffer *_buffer;
+ _buffer = trace_buffer_unwrap(tr_ctx, buffer);
+ pipe->set_constant_buffer(pipe, shader, index, _buffer);
} else {
pipe->set_constant_buffer(pipe, shader, index, buffer);
}
@@ -1235,12 +1236,10 @@ static const struct debug_named_value rbug_blocker_flags[] = {
};
struct pipe_context *
-trace_context_create(struct pipe_screen *_screen,
+trace_context_create(struct trace_screen *tr_scr,
struct pipe_context *pipe)
{
- struct trace_screen *tr_scr;
struct trace_context *tr_ctx;
- struct pipe_screen *screen;
if(!pipe)
goto error1;
@@ -1248,13 +1247,13 @@ trace_context_create(struct pipe_screen *_screen,
if(!trace_enabled())
goto error1;
- tr_scr = trace_screen(_screen);
- screen = tr_scr->screen;
-
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;
+ tr_ctx->base.winsys = NULL;
+ tr_ctx->base.priv = pipe->priv; /* expose wrapped priv data */
+ tr_ctx->base.screen = &tr_scr->base;
tr_ctx->draw_blocker = debug_get_flags_option("RBUG_BLOCK",
rbug_blocker_flags,
0);
@@ -1263,8 +1262,6 @@ trace_context_create(struct pipe_screen *_screen,
pipe_mutex_init(tr_ctx->list_mutex);
make_empty_list(&tr_ctx->shaders);
- tr_ctx->base.winsys = _screen->winsys;
- tr_ctx->base.screen = _screen;
tr_ctx->base.destroy = trace_context_destroy;
tr_ctx->base.draw_arrays = trace_context_draw_arrays;
tr_ctx->base.draw_elements = trace_context_draw_elements;
@@ -1315,11 +1312,6 @@ trace_context_create(struct pipe_screen *_screen,
tr_ctx->pipe = pipe;
- trace_dump_call_begin("", "pipe_context_create");
- trace_dump_arg(ptr, screen);
- trace_dump_ret(ptr, pipe);
- trace_dump_call_end();
-
trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
return &tr_ctx->base;
diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h
index 852b480765..1428423248 100644
--- a/src/gallium/drivers/trace/tr_context.h
+++ b/src/gallium/drivers/trace/tr_context.h
@@ -40,6 +40,8 @@ extern "C" {
#endif
+struct trace_screen;
+
struct trace_context
{
struct pipe_context base;
@@ -95,9 +97,8 @@ trace_context(struct pipe_context *pipe)
}
-
struct pipe_context *
-trace_context_create(struct pipe_screen *screen,
+trace_context_create(struct trace_screen *tr_scr,
struct pipe_context *pipe);
void
diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c
index 48d1c4051c..919dc1b309 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -65,24 +65,6 @@ trace_drm_create_screen(struct drm_api *_api, int fd,
return trace_screen_create(screen);
}
-static struct pipe_context *
-trace_drm_create_context(struct drm_api *_api,
- struct pipe_screen *_screen)
-{
- struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_drm_api *tr_api = trace_drm_api(_api);
- struct pipe_screen *screen = tr_screen->screen;
- struct drm_api *api = tr_api->api;
- struct pipe_context *pipe;
-
- /* TODO trace call */
-
- pipe = api->create_context(api, screen);
-
- pipe = trace_context_create(_screen, pipe);
-
- return pipe;
-}
static struct pipe_texture *
trace_drm_texture_from_shared_handle(struct drm_api *_api,
@@ -173,8 +155,8 @@ trace_drm_create(struct drm_api *api)
if (!tr_api)
goto error;
+ tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
- tr_api->base.create_context = trace_drm_create_context;
tr_api->base.texture_from_shared_handle = trace_drm_texture_from_shared_handle;
tr_api->base.shared_handle_from_texture = trace_drm_shared_handle_from_texture;
tr_api->base.local_handle_from_texture = trace_drm_local_handle_from_texture;
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 0f45e211a3..8de451c22c 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -45,11 +45,11 @@
#endif
#include "pipe/p_compiler.h"
-#include "pipe/p_thread.h"
+#include "os/os_thread.h"
+#include "os/os_stream.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_string.h"
-#include "util/u_stream.h"
#include "tr_dump.h"
#include "tr_screen.h"
@@ -57,7 +57,7 @@
#include "tr_buffer.h"
-static struct util_stream *stream = NULL;
+static struct os_stream *stream = NULL;
static unsigned refcount = 0;
static pipe_mutex call_mutex;
static long unsigned call_no = 0;
@@ -69,7 +69,7 @@ static INLINE void
trace_dump_write(const char *buf, size_t size)
{
if(stream)
- util_stream_write(stream, buf, size);
+ os_stream_write(stream, buf, size);
}
@@ -220,7 +220,7 @@ trace_dump_trace_close(void)
{
if(stream) {
trace_dump_writes("</trace>\n");
- util_stream_close(stream);
+ os_stream_close(stream);
stream = NULL;
refcount = 0;
call_no = 0;
@@ -250,7 +250,7 @@ boolean trace_dump_trace_begin()
if(!stream) {
- stream = util_stream_create(filename, 0);
+ stream = os_stream_create(filename, 0);
if(!stream)
return FALSE;
@@ -367,7 +367,7 @@ void trace_dump_call_end_locked(void)
trace_dump_indent(1);
trace_dump_tag_end("call");
trace_dump_newline();
- util_stream_flush(stream);
+ os_stream_flush(stream);
}
void trace_dump_call_begin(const char *klass, const char *method)
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 720b6cd1ff..6648539a0f 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -49,7 +49,7 @@ static void trace_dump_reference(const struct pipe_reference *reference)
return;
trace_dump_struct_begin("pipe_reference");
- trace_dump_member(int, &reference->count, count);
+ trace_dump_member(int, reference, count);
trace_dump_struct_end();
}
@@ -227,7 +227,7 @@ void trace_dump_clip_state(const struct pipe_clip_state *state)
}
-void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
+void trace_dump_constant_buffer(const struct pipe_buffer *state)
{
if (!trace_dumping_enabled_locked())
return;
@@ -239,7 +239,7 @@ void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
trace_dump_struct_begin("pipe_constant_buffer");
- trace_dump_member(buffer_ptr, state, buffer);
+ trace_dump_reference(&state->reference);
trace_dump_struct_end();
}
@@ -321,9 +321,23 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
trace_dump_struct_end();
}
+static void trace_dump_rt_blend_state(const struct pipe_rt_blend_state *state)
+{
+ trace_dump_member(uint, state, rgb_func);
+ trace_dump_member(uint, state, rgb_src_factor);
+ trace_dump_member(uint, state, rgb_dst_factor);
+
+ trace_dump_member(uint, state, alpha_func);
+ trace_dump_member(uint, state, alpha_src_factor);
+ trace_dump_member(uint, state, alpha_dst_factor);
+
+ trace_dump_member(uint, state, colormask);
+
+}
void trace_dump_blend_state(const struct pipe_blend_state *state)
{
+ unsigned valid_entries = 1;
if (!trace_dumping_enabled_locked())
return;
@@ -334,21 +348,17 @@ void trace_dump_blend_state(const struct pipe_blend_state *state)
trace_dump_struct_begin("pipe_blend_state");
- trace_dump_member(bool, state, blend_enable);
-
- trace_dump_member(uint, state, rgb_func);
- trace_dump_member(uint, state, rgb_src_factor);
- trace_dump_member(uint, state, rgb_dst_factor);
-
- trace_dump_member(uint, state, alpha_func);
- trace_dump_member(uint, state, alpha_src_factor);
- trace_dump_member(uint, state, alpha_dst_factor);
+ trace_dump_member(bool, state, dither);
trace_dump_member(bool, state, logicop_enable);
trace_dump_member(uint, state, logicop_func);
- trace_dump_member(uint, state, colormask);
- trace_dump_member(bool, state, dither);
+ trace_dump_member(bool, state, independent_blend_enable);
+
+ if (state->independent_blend_enable)
+ valid_entries = PIPE_MAX_COLOR_BUFS;
+
+ trace_dump_struct_array(rt_blend_state, state->rt, valid_entries);
trace_dump_struct_end();
}
@@ -410,7 +420,6 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state)
trace_dump_member(uint, state, compare_mode);
trace_dump_member(uint, state, compare_func);
trace_dump_member(bool, state, normalized_coords);
- trace_dump_member(uint, state, prefilter);
trace_dump_member(float, state, lod_bias);
trace_dump_member(float, state, min_lod);
trace_dump_member(float, state, max_lod);
diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h
index 07ad6fbb20..c7860fd6e1 100644
--- a/src/gallium/drivers/trace/tr_dump_state.h
+++ b/src/gallium/drivers/trace/tr_dump_state.h
@@ -47,7 +47,7 @@ void trace_dump_scissor_state(const struct pipe_scissor_state *state);
void trace_dump_clip_state(const struct pipe_clip_state *state);
-void trace_dump_constant_buffer(const struct pipe_constant_buffer *state);
+void trace_dump_constant_buffer(const struct pipe_buffer *state);
void trace_dump_token(const struct tgsi_token *token);
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index 0546aad9b5..691b83c63f 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -26,11 +26,13 @@
**************************************************************************/
+#include "os/os_thread.h"
#include "util/u_format.h"
#include "util/u_string.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "util/u_network.h"
+#include "util/u_time.h"
#include "tgsi/tgsi_parse.h"
@@ -43,15 +45,6 @@
#include <errno.h>
-#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-# define sleep Sleep
-#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_APPLE)
-void usleep(int);
-# define sleep usleep
-#else
-# warning "No socket implementation"
-#endif
-
#define U642VOID(x) ((void *)(unsigned long)(x))
#define VOID2U64(x) ((uint64_t)(unsigned long)(x))
@@ -805,7 +798,7 @@ PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug)
debug_printf("trace_rbug - remote debugging listening on port %u\n", --port);
while(tr_rbug->running) {
- sleep(1);
+ util_time_sleep(1);
c = u_socket_accept(s);
if (c < 0)
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 117503aaff..388d83eb5c 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -33,9 +33,10 @@
#include "tr_dump.h"
#include "tr_dump_state.h"
#include "tr_texture.h"
+#include "tr_context.h"
#include "tr_screen.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
#include "pipe/p_format.h"
@@ -159,6 +160,29 @@ trace_screen_is_format_supported(struct pipe_screen *_screen,
}
+static struct pipe_context *
+trace_screen_context_create(struct pipe_screen *_screen, void *priv)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_context *result;
+
+ trace_dump_call_begin("pipe_screen", "context_create");
+
+ trace_dump_arg(ptr, screen);
+
+ result = screen->context_create(screen, priv);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ result = trace_context_create(tr_scr, result);
+
+ return result;
+}
+
+
static void
trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
struct pipe_surface *_surface,
@@ -904,6 +928,8 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.get_param = trace_screen_get_param;
tr_scr->base.get_paramf = trace_screen_get_paramf;
tr_scr->base.is_format_supported = trace_screen_is_format_supported;
+ assert(screen->context_create);
+ tr_scr->base.context_create = trace_screen_context_create;
tr_scr->base.texture_create = trace_screen_texture_create;
tr_scr->base.texture_blanket = trace_screen_texture_blanket;
tr_scr->base.texture_destroy = trace_screen_texture_destroy;
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
index dba8cd7c65..fe5a0fa190 100644
--- a/src/gallium/drivers/trace/tr_screen.h
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -30,7 +30,7 @@
#include "pipe/p_screen.h"
-#include "pipe/p_thread.h"
+#include "os/os_thread.h"
#ifdef __cplusplus
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 1f25fe38d4..5321d68ec0 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -25,6 +25,7 @@
*
**************************************************************************/
+#include "util/u_inlines.h"
#include "util/u_hash_table.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"