summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/trace/tr_context.c10
-rw-r--r--src/gallium/drivers/trace/tr_screen.c39
-rw-r--r--src/gallium/drivers/trace/tr_texture.c8
-rw-r--r--src/gallium/drivers/trace/tr_texture.h16
-rw-r--r--src/gallium/drivers/trace/tr_winsys.c4
5 files changed, 27 insertions, 50 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index ec8be27077f..bc65af05ca1 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -40,16 +40,14 @@ static INLINE struct pipe_texture *
trace_texture_unwrap(struct trace_context *tr_ctx,
struct pipe_texture *texture)
{
- struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
struct trace_texture *tr_tex;
if(!texture)
return NULL;
- tr_tex = trace_texture(tr_scr, texture);
+ tr_tex = trace_texture(texture);
assert(tr_tex->texture);
- assert(tr_tex->texture->screen == tr_scr->screen);
return tr_tex->texture;
}
@@ -58,8 +56,7 @@ 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_texture *tr_tex;
+ struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
struct trace_surface *tr_surf;
if(!surface)
@@ -69,8 +66,7 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
if(!surface->texture)
return surface;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
+ tr_surf = trace_surface(surface);
assert(tr_surf->surface);
assert(tr_surf->surface->texture->screen == tr_scr->screen);
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 8789f86b1a8..14b25b21a16 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -216,22 +216,18 @@ trace_screen_texture_release(struct pipe_screen *_screen,
struct pipe_texture *texture;
assert(ptexture);
- if(*ptexture) {
- tr_tex = trace_texture(tr_scr, *ptexture);
- texture = tr_tex->texture;
- assert(texture->screen == screen);
- }
- else
- texture = NULL;
-
if (*ptexture) {
if (!--(*ptexture)->refcount) {
+ tr_tex = trace_texture(*ptexture);
+ texture = tr_tex->texture;
+ assert(texture->screen == screen);
+
trace_dump_call_begin("pipe_screen", "texture_destroy");
trace_dump_arg(ptr, screen);
trace_dump_arg(ptr, texture);
- trace_texture_destroy(tr_scr, *ptexture);
+ trace_texture_destroy(tr_tex);
trace_dump_call_end();
}
@@ -254,7 +250,7 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen,
struct pipe_surface *result;
assert(texture);
- tr_tex = trace_texture(tr_scr, texture);
+ tr_tex = trace_texture(texture);
texture = tr_tex->texture;
assert(texture->screen == screen);
@@ -289,23 +285,18 @@ trace_screen_tex_surface_release(struct pipe_screen *_screen,
struct trace_surface *tr_surf;
struct pipe_surface *surface;
- assert(psurface);
- if(*psurface) {
- tr_tex = trace_texture(tr_scr, (*psurface)->texture);
- tr_surf = trace_surface(tr_tex, *psurface);
- surface = tr_surf->surface;
- }
- else
- surface = NULL;
-
if (*psurface) {
if (!--(*psurface)->refcount) {
+ tr_tex = trace_texture((*psurface)->texture);
+ tr_surf = trace_surface(*psurface);
+ surface = tr_surf->surface;
+
trace_dump_call_begin("pipe_screen", "tex_surface_destroy");
trace_dump_arg(ptr, screen);
trace_dump_arg(ptr, surface);
- trace_surface_destroy(tr_tex, *psurface);
+ trace_surface_destroy(tr_surf);
trace_dump_call_end();
}
@@ -326,8 +317,8 @@ trace_screen_surface_map(struct pipe_screen *_screen,
struct trace_surface *tr_surf;
void *map;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
+ tr_tex = trace_texture(surface->texture);
+ tr_surf = trace_surface(surface);
surface = tr_surf->surface;
map = screen->surface_map(screen, surface, flags);
@@ -351,8 +342,8 @@ trace_screen_surface_unmap(struct pipe_screen *_screen,
struct trace_texture *tr_tex;
struct trace_surface *tr_surf;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
+ tr_tex = trace_texture(surface->texture);
+ tr_surf = trace_surface(surface);
surface = tr_surf->surface;
if(tr_surf->map) {
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 1cc4f0bd436..e1e4f59f636 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -61,10 +61,8 @@ error:
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture_destroy(struct trace_texture *tr_tex)
{
- struct trace_texture *tr_tex = trace_texture(tr_scr, texture);
pipe_texture_reference(&tr_tex->texture, NULL);
FREE(tr_tex);
}
@@ -100,10 +98,8 @@ error:
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface_destroy(struct trace_surface *tr_surf)
{
- struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
pipe_texture_reference(&tr_surf->base.texture, NULL);
pipe_surface_reference(&tr_surf->surface, NULL);
FREE(tr_surf);
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index 9e72edb8a3c..a223d6c6953 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -54,23 +54,21 @@ struct trace_surface
static INLINE struct trace_texture *
-trace_texture(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture(struct pipe_texture *texture)
{
if(!texture)
return NULL;
- assert(texture->screen == &tr_scr->base);
+ (void)trace_screen(texture->screen);
return (struct trace_texture *)texture;
}
static INLINE struct trace_surface *
-trace_surface(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface(struct pipe_surface *surface)
{
if(!surface)
return NULL;
- assert(surface->texture == &tr_tex->base);
+ (void)trace_texture(surface->texture);
return (struct trace_surface *)surface;
}
@@ -80,16 +78,14 @@ trace_texture_create(struct trace_screen *tr_scr,
struct pipe_texture *texture);
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture);
+trace_texture_destroy(struct trace_texture *tr_tex);
struct pipe_surface *
trace_surface_create(struct trace_texture *tr_tex,
struct pipe_surface *surface);
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface);
+trace_surface_destroy(struct trace_surface *tr_surf);
#endif /* TR_TEXTURE_H_ */
diff --git a/src/gallium/drivers/trace/tr_winsys.c b/src/gallium/drivers/trace/tr_winsys.c
index c4148fe8104..fe7293befc0 100644
--- a/src/gallium/drivers/trace/tr_winsys.c
+++ b/src/gallium/drivers/trace/tr_winsys.c
@@ -78,9 +78,7 @@ trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys,
assert(surface);
if(surface->texture) {
- struct trace_screen *tr_scr = trace_screen(surface->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
+ struct trace_surface *tr_surf = trace_surface(surface);
surface = tr_surf->surface;
}