summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-22 23:40:53 +0100
committerMarek Olšák <[email protected]>2017-02-25 00:03:09 +0100
commitd17b8d08a3e51df7ff218adf54600b34fa015a4f (patch)
tree6c5af2d90f06ede498c6982ad5ec4dacadd03667 /src/gallium
parent4a883966c1f74f43afc145d2c3d27af7b8c5e01a (diff)
trace: remove pipe_resource wrapping
Not needed. ddebug does the same thing. The limitation is that drivers can only use pipe_resource::screen through pipe_resource_reference. This unbreaks trace, because pipe_context uploaders aren't wrapped, so trace doesn't understand buffers returned by them. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/trace/tr_context.c156
-rw-r--r--src/gallium/drivers/trace/tr_dump.c14
-rw-r--r--src/gallium/drivers/trace/tr_dump.h1
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c12
-rw-r--r--src/gallium/drivers/trace/tr_screen.c30
-rw-r--r--src/gallium/drivers/trace/tr_texture.c52
-rw-r--r--src/gallium/drivers/trace/tr_texture.h35
7 files changed, 40 insertions, 260 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index f5939b1126c..4024dddde89 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -67,27 +67,10 @@ trace_query_unwrap(struct pipe_query *query)
}
-static inline struct pipe_resource *
-trace_resource_unwrap(struct trace_context *tr_ctx,
- struct pipe_resource *resource)
-{
- struct trace_resource *tr_res;
-
- if (!resource)
- return NULL;
-
- tr_res = trace_resource(resource);
-
- assert(tr_res->resource);
- return tr_res->resource;
-}
-
-
static inline struct pipe_surface *
trace_surface_unwrap(struct trace_context *tr_ctx,
struct pipe_surface *surface)
{
- struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
struct trace_surface *tr_surf;
if (!surface)
@@ -100,8 +83,6 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
tr_surf = trace_surface(surface);
assert(tr_surf->surface);
- assert(tr_surf->surface->texture->screen == tr_scr->screen);
- (void) tr_scr;
return tr_surf->surface;
}
@@ -120,17 +101,7 @@ trace_context_draw_vbo(struct pipe_context *_pipe,
trace_dump_trace_flush();
- if (info->indirect) {
- struct pipe_draw_info _info;
-
- memcpy(&_info, info, sizeof(_info));
- _info.indirect = trace_resource_unwrap(tr_ctx, _info.indirect);
- _info.indirect_params = trace_resource_unwrap(tr_ctx,
- _info.indirect_params);
- pipe->draw_vbo(pipe, &_info);
- } else {
- pipe->draw_vbo(pipe, info);
- }
+ pipe->draw_vbo(pipe, info);
trace_dump_call_end();
}
@@ -776,13 +747,6 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_constant_buffer cb;
-
- if (constant_buffer) {
- cb = *constant_buffer;
- cb.buffer = trace_resource_unwrap(tr_ctx, constant_buffer->buffer);
- constant_buffer = &cb;
- }
trace_dump_call_begin("pipe_context", "set_constant_buffer");
@@ -891,13 +855,11 @@ trace_context_set_viewport_states(struct pipe_context *_pipe,
static struct pipe_sampler_view *
trace_context_create_sampler_view(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
const struct pipe_sampler_view *templ)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_resource *resource = tr_res->resource;
struct pipe_sampler_view *result;
struct trace_sampler_view *tr_view;
@@ -923,7 +885,7 @@ trace_context_create_sampler_view(struct pipe_context *_pipe,
tr_view->base = *templ;
tr_view->base.reference.count = 1;
tr_view->base.texture = NULL;
- pipe_resource_reference(&tr_view->base.texture, _resource);
+ pipe_resource_reference(&tr_view->base.texture, resource);
tr_view->base.context = _pipe;
tr_view->sampler_view = result;
result = &tr_view->base;
@@ -963,13 +925,11 @@ trace_context_sampler_view_destroy(struct pipe_context *_pipe,
static struct pipe_surface *
trace_context_create_surface(struct pipe_context *_pipe,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
const struct pipe_surface *surf_tmpl)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_resource *resource = tr_res->resource;
struct pipe_surface *result = NULL;
trace_dump_call_begin("pipe_context", "create_surface");
@@ -988,7 +948,7 @@ trace_context_create_surface(struct pipe_context *_pipe,
trace_dump_call_end();
- result = trace_surf_create(tr_ctx, tr_res, result);
+ result = trace_surf_create(tr_ctx, resource, result);
return result;
}
@@ -1057,7 +1017,6 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- unsigned i;
trace_dump_call_begin("pipe_context", "set_vertex_buffers");
@@ -1069,16 +1028,7 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
trace_dump_struct_array(vertex_buffer, buffers, num_buffers);
trace_dump_arg_end();
- if (buffers) {
- struct pipe_vertex_buffer *_buffers = MALLOC(num_buffers * sizeof(*_buffers));
- memcpy(_buffers, buffers, num_buffers * sizeof(*_buffers));
- for (i = 0; i < num_buffers; i++)
- _buffers[i].buffer = trace_resource_unwrap(tr_ctx, buffers[i].buffer);
- pipe->set_vertex_buffers(pipe, start_slot, num_buffers, _buffers);
- FREE(_buffers);
- } else {
- pipe->set_vertex_buffers(pipe, start_slot, num_buffers, NULL);
- }
+ pipe->set_vertex_buffers(pipe, start_slot, num_buffers, buffers);
trace_dump_call_end();
}
@@ -1096,14 +1046,7 @@ trace_context_set_index_buffer(struct pipe_context *_pipe,
trace_dump_arg(ptr, pipe);
trace_dump_arg(index_buffer, ib);
- if (ib) {
- struct pipe_index_buffer _ib;
- _ib = *ib;
- _ib.buffer = trace_resource_unwrap(tr_ctx, ib->buffer);
- pipe->set_index_buffer(pipe, &_ib);
- } else {
- pipe->set_index_buffer(pipe, NULL);
- }
+ pipe->set_index_buffer(pipe, ib);
trace_dump_call_end();
}
@@ -1119,8 +1062,6 @@ trace_context_create_stream_output_target(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_stream_output_target *result;
- res = trace_resource_unwrap(tr_ctx, res);
-
trace_dump_call_begin("pipe_context", "create_stream_output_target");
trace_dump_arg(ptr, pipe);
@@ -1192,9 +1133,6 @@ trace_context_resource_copy_region(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- dst = trace_resource_unwrap(tr_ctx, dst);
- src = trace_resource_unwrap(tr_ctx, src);
-
trace_dump_call_begin("pipe_context", "resource_copy_region");
trace_dump_arg(ptr, pipe);
@@ -1223,9 +1161,6 @@ trace_context_blit(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_blit_info info = *_info;
- info.dst.resource = trace_resource_unwrap(tr_ctx, info.dst.resource);
- info.src.resource = trace_resource_unwrap(tr_ctx, info.src.resource);
-
trace_dump_call_begin("pipe_context", "blit");
trace_dump_arg(ptr, pipe);
@@ -1244,8 +1179,6 @@ trace_context_flush_resource(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- resource = trace_resource_unwrap(tr_ctx, resource);
-
trace_dump_call_begin("pipe_context", "flush_resource");
trace_dump_arg(ptr, pipe);
@@ -1361,7 +1294,6 @@ trace_context_clear_texture(struct pipe_context *_pipe,
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- res = trace_resource_unwrap(tr_ctx, res);
trace_dump_call_begin("pipe_context", "clear_texture");
@@ -1413,8 +1345,6 @@ trace_context_generate_mipmap(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
boolean ret;
- res = trace_resource_unwrap(tr_ctx, res);
-
trace_dump_call_begin("pipe_context", "generate_mipmap");
trace_dump_arg(ptr, pipe);
@@ -1459,31 +1389,27 @@ trace_context_destroy(struct pipe_context *_pipe)
static void *
trace_context_transfer_map(struct pipe_context *_context,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
unsigned level,
unsigned usage,
const struct pipe_box *box,
struct pipe_transfer **transfer)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *texture = tr_res->resource;
struct pipe_transfer *result = NULL;
void *map;
- assert(texture->screen == context->screen);
-
/*
* Map and transfers can't be serialized so we convert all write transfers
* to texture/buffer_subdata and ignore read transfers.
*/
- map = context->transfer_map(context, texture, level, usage, box, &result);
+ map = context->transfer_map(context, resource, level, usage, box, &result);
if (!map)
return NULL;
- *transfer = trace_transfer_create(tr_context, tr_res, result);
+ *transfer = trace_transfer_create(tr_context, resource, result);
if (map) {
if (usage & PIPE_TRANSFER_WRITE) {
@@ -1562,14 +1488,12 @@ trace_context_transfer_unmap(struct pipe_context *_context,
static void
trace_context_buffer_subdata(struct pipe_context *_context,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
unsigned usage, unsigned offset,
unsigned size, const void *data)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *resource = tr_res->resource;
struct pipe_box box;
assert(resource->screen == context->screen);
@@ -1595,7 +1519,7 @@ trace_context_buffer_subdata(struct pipe_context *_context,
static void
trace_context_texture_subdata(struct pipe_context *_context,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
unsigned level,
unsigned usage,
const struct pipe_box *box,
@@ -1604,9 +1528,7 @@ trace_context_texture_subdata(struct pipe_context *_context,
unsigned layer_stride)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *resource = tr_res->resource;
assert(resource->screen == context->screen);
@@ -1637,12 +1559,10 @@ trace_context_texture_subdata(struct pipe_context *_context,
static void
trace_context_invalidate_resource(struct pipe_context *_context,
- struct pipe_resource *_resource)
+ struct pipe_resource *resource)
{
struct trace_context *tr_context = trace_context(_context);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
- struct pipe_resource *resource = tr_res->resource;
assert(resource->screen == context->screen);
@@ -1738,7 +1658,6 @@ static void trace_context_set_shader_buffers(struct pipe_context *_context,
{
struct trace_context *tr_context = trace_context(_context);
struct pipe_context *context = tr_context->pipe;
- struct pipe_shader_buffer *_buffers = NULL;
trace_dump_call_begin("pipe_context", "set_shader_buffers");
trace_dump_arg(ptr, context);
@@ -1749,24 +1668,7 @@ static void trace_context_set_shader_buffers(struct pipe_context *_context,
trace_dump_arg_end();
trace_dump_call_end();
- if (buffers) {
- int i;
-
- _buffers = MALLOC(nr * sizeof(struct pipe_shader_buffer));
- if (!_buffers)
- return;
-
- for (i = 0; i < nr; i++) {
- _buffers[i] = buffers[i];
- _buffers[i].buffer = trace_resource_unwrap(
- tr_context, _buffers[i].buffer);
- }
- }
-
- context->set_shader_buffers(context, shader, start, nr, _buffers);
-
- if (_buffers)
- FREE(_buffers);
+ context->set_shader_buffers(context, shader, start, nr, buffers);
}
static void trace_context_set_shader_images(struct pipe_context *_context,
@@ -1776,7 +1678,6 @@ static void trace_context_set_shader_images(struct pipe_context *_context,
{
struct trace_context *tr_context = trace_context(_context);
struct pipe_context *context = tr_context->pipe;
- struct pipe_image_view *_images = NULL;
trace_dump_call_begin("pipe_context", "set_shader_images");
trace_dump_arg(ptr, context);
@@ -1787,24 +1688,7 @@ static void trace_context_set_shader_images(struct pipe_context *_context,
trace_dump_arg_end();
trace_dump_call_end();
- if (images) {
- int i;
-
- _images = MALLOC(nr * sizeof(struct pipe_image_view));
- if (!_images)
- return;
-
- for (i = 0; i < nr; i++) {
- _images[i] = images[i];
- _images[i].resource = trace_resource_unwrap(tr_context,
- _images[i].resource);
- }
- }
-
- context->set_shader_images(context, shader, start, nr, _images);
-
- if (_images)
- FREE(_images);
+ context->set_shader_images(context, shader, start, nr, images);
}
static void trace_context_launch_grid(struct pipe_context *_pipe,
@@ -1820,15 +1704,7 @@ static void trace_context_launch_grid(struct pipe_context *_pipe,
trace_dump_trace_flush();
- if (info->indirect) {
- struct pipe_grid_info _info;
-
- memcpy(&_info, info, sizeof(_info));
- _info.indirect = trace_resource_unwrap(tr_ctx, _info.indirect);
- pipe->launch_grid(pipe, &_info);
- } else {
- pipe->launch_grid(pipe, info);
- }
+ pipe->launch_grid(pipe, info);
trace_dump_call_end();
}
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index b173b8abf89..112a69e29c1 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -625,20 +625,6 @@ void trace_dump_ptr(const void *value)
trace_dump_null();
}
-
-void trace_dump_resource_ptr(struct pipe_resource *_resource)
-{
- if (!dumping)
- return;
-
- if (_resource) {
- struct trace_resource *tr_resource = trace_resource(_resource);
- trace_dump_ptr(tr_resource->resource);
- } else {
- trace_dump_null();
- }
-}
-
void trace_dump_surface_ptr(struct pipe_surface *_surface)
{
if (!dumping)
diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h
index c03660a3446..7a268e31c46 100644
--- a/src/gallium/drivers/trace/tr_dump.h
+++ b/src/gallium/drivers/trace/tr_dump.h
@@ -105,7 +105,6 @@ void trace_dump_member_end(void);
void trace_dump_null(void);
void trace_dump_ptr(const void *value);
/* will turn a wrapped object into the real one and dump ptr */
-void trace_dump_resource_ptr(struct pipe_resource *_texture);
void trace_dump_surface_ptr(struct pipe_surface *_surface);
void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index c5740d080d2..4c6f6d60e0c 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -654,7 +654,7 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, buffer_offset);
- trace_dump_member(resource_ptr, state, buffer);
+ trace_dump_member(ptr, state, buffer);
trace_dump_member(ptr, state, user_buffer);
trace_dump_struct_end();
@@ -675,7 +675,7 @@ void trace_dump_index_buffer(const struct pipe_index_buffer *state)
trace_dump_member(uint, state, index_size);
trace_dump_member(uint, state, offset);
- trace_dump_member(resource_ptr, state, buffer);
+ trace_dump_member(ptr, state, buffer);
trace_dump_member(ptr, state, user_buffer);
trace_dump_struct_end();
@@ -733,7 +733,7 @@ void trace_dump_shader_buffer(const struct pipe_shader_buffer *state)
}
trace_dump_struct_begin("pipe_shader_buffer");
- trace_dump_member(resource_ptr, state, buffer);
+ trace_dump_member(ptr, state, buffer);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(uint, state, buffer_size);
trace_dump_struct_end();
@@ -751,7 +751,7 @@ void trace_dump_image_view(const struct pipe_image_view *state)
}
trace_dump_struct_begin("pipe_image_view");
- trace_dump_member(resource_ptr, state, resource);
+ trace_dump_member(ptr, state, resource);
trace_dump_member(uint, state, format);
trace_dump_member(uint, state, access);
@@ -834,7 +834,7 @@ void trace_dump_blit_info(const struct pipe_blit_info *info)
trace_dump_member_begin("dst");
trace_dump_struct_begin("dst");
- trace_dump_member(resource_ptr, &info->dst, resource);
+ trace_dump_member(ptr, &info->dst, resource);
trace_dump_member(uint, &info->dst, level);
trace_dump_member(format, &info->dst, format);
trace_dump_member_begin("box");
@@ -845,7 +845,7 @@ void trace_dump_blit_info(const struct pipe_blit_info *info)
trace_dump_member_begin("src");
trace_dump_struct_begin("src");
- trace_dump_member(resource_ptr, &info->src, resource);
+ trace_dump_member(ptr, &info->src, resource);
trace_dump_member(uint, &info->src, level);
trace_dump_member(format, &info->src, format);
trace_dump_member_begin("box");
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 13505af7a0a..a4440688575 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -277,15 +277,13 @@ trace_screen_context_create(struct pipe_screen *_screen, void *priv,
static void
trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
unsigned level, unsigned layer,
void *context_private,
struct pipe_box *sub_box)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_resource *resource = tr_res->resource;
trace_dump_call_begin("pipe_screen", "flush_frontbuffer");
@@ -327,8 +325,8 @@ trace_screen_resource_create(struct pipe_screen *_screen,
trace_dump_call_end();
- result = trace_resource_create(tr_scr, result);
-
+ if (result)
+ result->screen = _screen;
return result;
}
@@ -346,23 +344,21 @@ trace_screen_resource_from_handle(struct pipe_screen *_screen,
result = screen->resource_from_handle(screen, templ, handle, usage);
- result = trace_resource_create(trace_screen(_screen), result);
-
+ if (result)
+ result->screen = _screen;
return result;
}
static boolean
trace_screen_resource_get_handle(struct pipe_screen *_screen,
struct pipe_context *_pipe,
- struct pipe_resource *_resource,
+ struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage)
{
struct trace_screen *tr_screen = trace_screen(_screen);
struct trace_context *tr_pipe = _pipe ? trace_context(_pipe) : NULL;
- struct trace_resource *tr_resource = trace_resource(_resource);
struct pipe_screen *screen = tr_screen->screen;
- struct pipe_resource *resource = tr_resource->resource;
/* TODO trace call */
@@ -372,14 +368,10 @@ trace_screen_resource_get_handle(struct pipe_screen *_screen,
static void
trace_screen_resource_changed(struct pipe_screen *_screen,
- struct pipe_resource *_resource)
+ struct pipe_resource *resource)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_resource *resource = tr_res->resource;
-
- assert(resource->screen == screen);
trace_dump_call_begin("pipe_screen", "resource_changed");
@@ -393,14 +385,10 @@ trace_screen_resource_changed(struct pipe_screen *_screen,
static void
trace_screen_resource_destroy(struct pipe_screen *_screen,
- struct pipe_resource *_resource)
+ struct pipe_resource *resource)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_resource *tr_res = trace_resource(_resource);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_resource *resource = tr_res->resource;
-
- assert(resource->screen == screen);
trace_dump_call_begin("pipe_screen", "resource_destroy");
@@ -409,7 +397,7 @@ trace_screen_resource_destroy(struct pipe_screen *_screen,
trace_dump_call_end();
- trace_resource_destroy(tr_scr, tr_res);
+ screen->resource_destroy(screen, resource);
}
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 47845a35a64..fe0c7b52c9b 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -35,47 +35,9 @@
#include "tr_texture.h"
-struct pipe_resource *
-trace_resource_create(struct trace_screen *tr_scr,
- struct pipe_resource *texture)
-{
- struct trace_resource *tr_res;
-
- if (!texture)
- goto error;
-
- assert(texture->screen == tr_scr->screen);
-
- tr_res = CALLOC_STRUCT(trace_resource);
- if (!tr_res)
- goto error;
-
- memcpy(&tr_res->base, texture, sizeof(struct pipe_resource));
-
- pipe_reference_init(&tr_res->base.reference, 1);
- tr_res->base.screen = &tr_scr->base;
- tr_res->resource = texture;
-
- return &tr_res->base;
-
-error:
- pipe_resource_reference(&texture, NULL);
- return NULL;
-}
-
-
-void
-trace_resource_destroy(struct trace_screen *tr_scr,
- struct trace_resource *tr_res)
-{
- pipe_resource_reference(&tr_res->resource, NULL);
- FREE(tr_res);
-}
-
-
struct pipe_surface *
trace_surf_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_res,
+ struct pipe_resource *res,
struct pipe_surface *surface)
{
struct trace_surface *tr_surf;
@@ -83,7 +45,7 @@ trace_surf_create(struct trace_context *tr_ctx,
if (!surface)
goto error;
- assert(surface->texture == tr_res->resource);
+ assert(surface->texture == res);
tr_surf = CALLOC_STRUCT(trace_surface);
if (!tr_surf)
@@ -94,7 +56,7 @@ trace_surf_create(struct trace_context *tr_ctx,
pipe_reference_init(&tr_surf->base.reference, 1);
tr_surf->base.texture = NULL;
- pipe_resource_reference(&tr_surf->base.texture, &tr_res->base);
+ pipe_resource_reference(&tr_surf->base.texture, res);
tr_surf->surface = surface;
return &tr_surf->base;
@@ -117,7 +79,7 @@ trace_surf_destroy(struct trace_surface *tr_surf)
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_res,
+ struct pipe_resource *res,
struct pipe_transfer *transfer)
{
struct trace_transfer *tr_trans;
@@ -125,7 +87,7 @@ trace_transfer_create(struct trace_context *tr_ctx,
if (!transfer)
goto error;
- assert(transfer->resource == tr_res->resource);
+ assert(transfer->resource == res);
tr_trans = CALLOC_STRUCT(trace_transfer);
if (!tr_trans)
@@ -136,8 +98,8 @@ trace_transfer_create(struct trace_context *tr_ctx,
tr_trans->base.resource = NULL;
tr_trans->transfer = transfer;
- pipe_resource_reference(&tr_trans->base.resource, &tr_res->base);
- assert(tr_trans->base.resource == &tr_res->base);
+ pipe_resource_reference(&tr_trans->base.resource, res);
+ assert(tr_trans->base.resource == res);
return &tr_trans->base;
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index af508511567..e5dfc53fdb0 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -43,17 +43,6 @@ struct tr_list
struct tr_list *prev;
};
-
-struct trace_resource
-{
- struct pipe_resource base;
-
- struct pipe_resource *resource;
-
- struct tr_list list;
-};
-
-
struct trace_surface
{
struct pipe_surface base;
@@ -85,22 +74,11 @@ struct trace_transfer
};
-static inline struct trace_resource *
-trace_resource(struct pipe_resource *texture)
-{
- if (!texture)
- return NULL;
- (void)trace_screen(texture->screen);
- return (struct trace_resource *)texture;
-}
-
-
static inline struct trace_surface *
trace_surface(struct pipe_surface *surface)
{
if (!surface)
return NULL;
- (void)trace_resource(surface->texture);
return (struct trace_surface *)surface;
}
@@ -119,22 +97,13 @@ trace_transfer(struct pipe_transfer *transfer)
{
if (!transfer)
return NULL;
- (void)trace_resource(transfer->resource);
return (struct trace_transfer *)transfer;
}
-struct pipe_resource *
-trace_resource_create(struct trace_screen *tr_scr,
- struct pipe_resource *texture);
-
-void
-trace_resource_destroy(struct trace_screen *tr_scr,
- struct trace_resource *tr_res);
-
struct pipe_surface *
trace_surf_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_res,
+ struct pipe_resource *tr_res,
struct pipe_surface *surface);
void
@@ -142,7 +111,7 @@ trace_surf_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
- struct trace_resource *tr_res,
+ struct pipe_resource *tr_res,
struct pipe_transfer *transfer);
void