trace: fix incorrect trace_surface::base.context pointer
authorBrian Paul <brianp@vmware.com>
Fri, 15 Feb 2013 17:36:32 +0000 (10:36 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 15 Feb 2013 18:11:34 +0000 (11:11 -0700)
When a trace_surface object is created in trace_surf_create() we
weren't correctly setting the surface's context pointer.  Instead of
it being the trace context, it was the wrapped driver's context.
This caused things to blow up sometimes during surface deallocation.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_texture.c
src/gallium/drivers/trace/tr_texture.h

index 9668aace6e1c3212651660a59d16b6852d9bdd08..b88f37999e9a7834077cfd7283993150e4797556 100644 (file)
@@ -897,7 +897,7 @@ trace_context_create_surface(struct pipe_context *_pipe,
 
    trace_dump_call_end();
 
-   result = trace_surf_create(tr_res, result);
+   result = trace_surf_create(tr_ctx, tr_res, result);
 
    return result;
 }
index 81ebc9ee770032a7a56ba749d3b0d942ace1a73e..aae13383865c3aa4ad4fb76e02e254c003c165e6 100644 (file)
@@ -74,7 +74,8 @@ trace_resource_destroy(struct trace_screen *tr_scr,
 
 
 struct pipe_surface *
-trace_surf_create(struct trace_resource *tr_res,
+trace_surf_create(struct trace_context *tr_ctx,
+                  struct trace_resource *tr_res,
                   struct pipe_surface *surface)
 {
    struct trace_surface *tr_surf;
@@ -89,6 +90,7 @@ trace_surf_create(struct trace_resource *tr_res,
       goto error;
 
    memcpy(&tr_surf->base, surface, sizeof(struct pipe_surface));
+   tr_surf->base.context = &tr_ctx->base;
 
    pipe_reference_init(&tr_surf->base.reference, 1);
    tr_surf->base.texture = NULL;
index 596978a1ffd3b29445d968709aa2dc2642a0ea05..2b4732b4f3a18d2b5f9dff5ca7a907fb41421933 100644 (file)
@@ -133,8 +133,9 @@ trace_resource_destroy(struct trace_screen *tr_scr,
                       struct trace_resource *tr_res);
 
 struct pipe_surface *
-trace_surf_create(struct trace_resource *tr_res,
-                     struct pipe_surface *surface);
+trace_surf_create(struct trace_context *tr_ctx,
+                  struct trace_resource *tr_res,
+                  struct pipe_surface *surface);
 
 void
 trace_surf_destroy(struct trace_surface *tr_surf);