Commit d0d63094 authored by Keith Whitwell's avatar Keith Whitwell

trace: compiles with pipe_resources

parent a4451ea4
This diff is collapsed.
......@@ -60,8 +60,8 @@ struct trace_context
unsigned num_vert_sampler_views;
unsigned nr_cbufs;
struct trace_texture *cbufs[PIPE_MAX_COLOR_BUFS];
struct trace_texture *zsbuf;
struct trace_resource *cbufs[PIPE_MAX_COLOR_BUFS];
struct trace_resource *zsbuf;
} curr;
struct {
......@@ -69,7 +69,7 @@ struct trace_context
struct trace_shader *vs;
struct trace_sampler_view *sampler_view;
struct trace_texture *surf;
struct trace_resource *surf;
int blocker;
} draw_rule;
......
......@@ -31,7 +31,6 @@
#include "tr_drm.h"
#include "tr_screen.h"
#include "tr_context.h"
#include "tr_buffer.h"
#include "tr_texture.h"
#include "tr_public.h"
......
......@@ -54,7 +54,6 @@
#include "tr_dump.h"
#include "tr_screen.h"
#include "tr_texture.h"
#include "tr_buffer.h"
static struct os_stream *stream = NULL;
......@@ -574,27 +573,15 @@ void trace_dump_ptr(const void *value)
trace_dump_null();
}
void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
{
if (!dumping)
return;
if (_buffer) {
struct trace_buffer *tr_buf = trace_buffer(_buffer);
trace_dump_ptr(tr_buf->buffer);
} else {
trace_dump_null();
}
}
void trace_dump_texture_ptr(struct pipe_texture *_texture)
void trace_dump_resource_ptr(struct pipe_resource *_resource)
{
if (!dumping)
return;
if (_texture) {
struct trace_texture *tr_tex = trace_texture(_texture);
trace_dump_ptr(tr_tex->texture);
if (_resource) {
struct trace_resource *tr_resource = trace_resource(_resource);
trace_dump_ptr(tr_resource->resource);
} else {
trace_dump_null();
}
......
......@@ -105,8 +105,7 @@ 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_buffer_ptr(struct pipe_buffer *_buffer);
void trace_dump_texture_ptr(struct pipe_texture *_texture);
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);
......
......@@ -44,7 +44,7 @@ void trace_dump_format(enum pipe_format format)
}
void trace_dump_template(const struct pipe_texture *templat)
void trace_dump_template(const struct pipe_resource *templat)
{
if (!trace_dumping_enabled_locked())
return;
......@@ -428,16 +428,16 @@ void trace_dump_transfer(const struct pipe_transfer *state)
trace_dump_struct_begin("pipe_transfer");
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
trace_dump_member(uint, state, box.width);
trace_dump_member(uint, state, box.height);
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, usage);
trace_dump_member(ptr, state, texture);
trace_dump_member(uint, state, face);
trace_dump_member(uint, state, level);
trace_dump_member(uint, state, zslice);
trace_dump_member(ptr, state, resource);
trace_dump_member(uint, state, sr.face);
trace_dump_member(uint, state, sr.level);
trace_dump_member(uint, state, box.z);
trace_dump_struct_end();
}
......@@ -458,7 +458,7 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, max_index);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(buffer_ptr, state, buffer);
trace_dump_member(resource_ptr, state, buffer);
trace_dump_struct_end();
}
......
......@@ -35,7 +35,7 @@
void trace_dump_format(enum pipe_format format);
void trace_dump_template(const struct pipe_texture *templat);
void trace_dump_template(const struct pipe_resource *templat);
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
......
......@@ -29,6 +29,7 @@
#include "os/os_thread.h"
#include "util/u_format.h"
#include "util/u_string.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
#include "util/u_network.h"
......@@ -38,7 +39,6 @@
#include "tr_dump.h"
#include "tr_state.h"
#include "tr_buffer.h"
#include "tr_texture.h"
#include "rbug/rbug.h"
......@@ -150,7 +150,7 @@ static int
trace_rbug_texture_list(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct trace_screen *tr_scr = tr_rbug->tr_scr;
struct trace_texture *tr_tex = NULL;
struct trace_resource *tr_tex = NULL;
struct tr_list *ptr;
rbug_texture_t *texs;
int i = 0;
......@@ -158,7 +158,7 @@ trace_rbug_texture_list(struct trace_rbug *tr_rbug, struct rbug_header *header,
pipe_mutex_lock(tr_scr->list_mutex);
texs = MALLOC(tr_scr->num_textures * sizeof(rbug_texture_t));
foreach(ptr, &tr_scr->textures) {
tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list));
tr_tex = (struct trace_resource *)((char*)ptr - offsetof(struct trace_resource, list));
texs[i++] = VOID2U64(tr_tex);
}
pipe_mutex_unlock(tr_scr->list_mutex);
......@@ -173,14 +173,14 @@ static int
trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct trace_screen *tr_scr = tr_rbug->tr_scr;
struct trace_texture *tr_tex = NULL;
struct trace_resource *tr_tex = NULL;
struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header;
struct tr_list *ptr;
struct pipe_texture *t;
struct pipe_resource *t;
pipe_mutex_lock(tr_scr->list_mutex);
foreach(ptr, &tr_scr->textures) {
tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list));
tr_tex = (struct trace_resource *)((char*)ptr - offsetof(struct trace_resource, list));
if (gpti->texture == VOID2U64(tr_tex))
break;
tr_tex = NULL;
......@@ -191,7 +191,7 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
return -ESRCH;
}
t = tr_tex->texture;
t = tr_tex->resource;
rbug_send_texture_info_reply(tr_rbug->con, serial,
t->target, t->format,
&t->width0, 1,
......@@ -216,18 +216,18 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
struct rbug_proto_texture_read *gptr = (struct rbug_proto_texture_read *)header;
struct trace_screen *tr_scr = tr_rbug->tr_scr;
struct trace_texture *tr_tex = NULL;
struct trace_resource *tr_tex = NULL;
struct tr_list *ptr;
struct pipe_context *context = tr_scr->private_context;
struct pipe_texture *tex;
struct pipe_resource *tex;
struct pipe_transfer *t;
void *map;
pipe_mutex_lock(tr_scr->list_mutex);
foreach(ptr, &tr_scr->textures) {
tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list));
tr_tex = (struct trace_resource *)((char*)ptr - offsetof(struct trace_resource, list));
if (gptr->texture == VOID2U64(tr_tex))
break;
tr_tex = NULL;
......@@ -238,7 +238,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
return -ESRCH;
}
tex = tr_tex->texture;
tex = tr_tex->resource;
t = pipe_get_transfer(context, tex,
gptr->face, gptr->level, gptr->zslice,
PIPE_TRANSFER_READ,
......@@ -247,12 +247,13 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
map = context->transfer_map(context, t);
rbug_send_texture_read_reply(tr_rbug->con, serial,
t->texture->format,
util_format_get_blockwidth(t->texture->format),
util_format_get_blockheight(t->texture->format),
util_format_get_blocksize(t->texture->format),
t->resource->format,
util_format_get_blockwidth(t->resource->format),
util_format_get_blockheight(t->resource->format),
util_format_get_blocksize(t->resource->format),
(uint8_t*)map,
t->stride * util_format_get_nblocksy(t->texture->format, t->height),
t->stride * util_format_get_nblocksy(t->resource->format,
t->box.height),
t->stride,
NULL);
......
This diff is collapsed.
......@@ -102,7 +102,7 @@ trace_screen(struct pipe_screen *screen);
void
trace_screen_user_buffer_update(struct pipe_screen *screen,
struct pipe_buffer *buffer);
struct pipe_resource *buffer);
#define trace_screen_add_to_list(tr_scr, name, obj) \
do { \
......
......@@ -35,51 +35,51 @@
#include "tr_texture.h"
struct pipe_texture *
trace_texture_create(struct trace_screen *tr_scr,
struct pipe_texture *texture)
struct pipe_resource *
trace_resource_create(struct trace_screen *tr_scr,
struct pipe_resource *texture)
{
struct trace_texture *tr_tex;
struct trace_resource *tr_tex;
if(!texture)
goto error;
assert(texture->screen == tr_scr->screen);
tr_tex = CALLOC_STRUCT(trace_texture);
tr_tex = CALLOC_STRUCT(trace_resource);
if(!tr_tex)
goto error;
memcpy(&tr_tex->base, texture, sizeof(struct pipe_texture));
memcpy(&tr_tex->base, texture, sizeof(struct pipe_resource));
pipe_reference_init(&tr_tex->base.reference, 1);
tr_tex->base.screen = &tr_scr->base;
tr_tex->texture = texture;
tr_tex->resource = texture;
trace_screen_add_to_list(tr_scr, textures, tr_tex);
return &tr_tex->base;
error:
pipe_texture_reference(&texture, NULL);
pipe_resource_reference(&texture, NULL);
return NULL;
}
void
trace_texture_destroy(struct trace_texture *tr_tex)
trace_resource_destroy(struct trace_resource *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);
pipe_resource_reference(&tr_tex->resource, NULL);
FREE(tr_tex);
}
struct pipe_surface *
trace_surface_create(struct trace_texture *tr_tex,
trace_surface_create(struct trace_resource *tr_tex,
struct pipe_surface *surface)
{
struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
......@@ -88,7 +88,7 @@ trace_surface_create(struct trace_texture *tr_tex,
if(!surface)
goto error;
assert(surface->texture == tr_tex->texture);
assert(surface->texture == tr_tex->resource);
tr_surf = CALLOC_STRUCT(trace_surface);
if(!tr_surf)
......@@ -98,7 +98,7 @@ trace_surface_create(struct trace_texture *tr_tex,
pipe_reference_init(&tr_surf->base.reference, 1);
tr_surf->base.texture = NULL;
pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base);
pipe_resource_reference(&tr_surf->base.texture, &tr_tex->base);
tr_surf->surface = surface;
trace_screen_add_to_list(tr_scr, surfaces, tr_surf);
......@@ -118,7 +118,7 @@ trace_surface_destroy(struct trace_surface *tr_surf)
trace_screen_remove_from_list(tr_scr, surfaces, tr_surf);
pipe_texture_reference(&tr_surf->base.texture, NULL);
pipe_resource_reference(&tr_surf->base.texture, NULL);
pipe_surface_reference(&tr_surf->surface, NULL);
FREE(tr_surf);
}
......@@ -126,7 +126,7 @@ trace_surface_destroy(struct trace_surface *tr_surf)
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
struct trace_texture *tr_tex,
struct trace_resource *tr_tex,
struct pipe_transfer *transfer)
{
struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
......@@ -135,7 +135,7 @@ trace_transfer_create(struct trace_context *tr_ctx,
if(!transfer)
goto error;
assert(transfer->texture == tr_tex->texture);
assert(transfer->resource == tr_tex->resource);
tr_trans = CALLOC_STRUCT(trace_transfer);
if(!tr_trans)
......@@ -143,11 +143,11 @@ trace_transfer_create(struct trace_context *tr_ctx,
memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer));
tr_trans->base.texture = NULL;
tr_trans->base.resource = NULL;
tr_trans->transfer = transfer;
pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base);
assert(tr_trans->base.texture == &tr_tex->base);
pipe_resource_reference(&tr_trans->base.resource, &tr_tex->base);
assert(tr_trans->base.resource == &tr_tex->base);
trace_screen_add_to_list(tr_scr, transfers, tr_trans);
......@@ -169,7 +169,7 @@ trace_transfer_destroy(struct trace_context *tr_context,
trace_screen_remove_from_list(tr_scr, transfers, tr_trans);
pipe_texture_reference(&tr_trans->base.texture, NULL);
pipe_resource_reference(&tr_trans->base.resource, NULL);
context->transfer_destroy(context, transfer);
FREE(tr_trans);
}
......
......@@ -36,11 +36,11 @@
struct trace_context;
struct trace_texture
struct trace_resource
{
struct pipe_texture base;
struct pipe_resource base;
struct pipe_texture *texture;
struct pipe_resource *resource;
struct tr_list list;
};
......@@ -77,13 +77,13 @@ struct trace_transfer
};
static INLINE struct trace_texture *
trace_texture(struct pipe_texture *texture)
static INLINE struct trace_resource *
trace_resource(struct pipe_resource *texture)
{
if(!texture)
return NULL;
(void)trace_screen(texture->screen);
return (struct trace_texture *)texture;
return (struct trace_resource *)texture;
}
......@@ -92,7 +92,7 @@ trace_surface(struct pipe_surface *surface)
{
if(!surface)
return NULL;
(void)trace_texture(surface->texture);
(void)trace_resource(surface->texture);
return (struct trace_surface *)surface;
}
......@@ -111,20 +111,20 @@ trace_transfer(struct pipe_transfer *transfer)
{
if(!transfer)
return NULL;
(void)trace_texture(transfer->texture);
(void)trace_resource(transfer->resource);
return (struct trace_transfer *)transfer;
}
struct pipe_texture *
trace_texture_create(struct trace_screen *tr_scr,
struct pipe_texture *texture);
struct pipe_resource *
trace_resource_create(struct trace_screen *tr_scr,
struct pipe_resource *texture);
void
trace_texture_destroy(struct trace_texture *tr_tex);
trace_resource_destroy(struct trace_resource *tr_tex);
struct pipe_surface *
trace_surface_create(struct trace_texture *tr_tex,
trace_surface_create(struct trace_resource *tr_tex,
struct pipe_surface *surface);
void
......@@ -132,7 +132,7 @@ trace_surface_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
trace_transfer_create(struct trace_context *tr_ctx,
struct trace_texture *tr_tex,
struct trace_resource *tr_tex,
struct pipe_transfer *transfer);
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment