1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include "util/u_inlines.h"
29 #include "util/u_memory.h"
30 #include "util/u_simple_list.h"
31 #include "util/u_format.h"
33 #include "pipe/p_format.h"
34 #include "pipe/p_screen.h"
37 #include "tr_dump_state.h"
39 #include "tr_screen.h"
40 #include "tr_texture.h"
46 static INLINE struct pipe_resource *
47 trace_resource_unwrap(struct trace_context *tr_ctx,
48 struct pipe_resource *resource)
50 struct trace_resource *tr_tex;
55 tr_tex = trace_resource(resource);
57 assert(tr_tex->resource);
58 return tr_tex->resource;
62 static INLINE struct pipe_surface *
63 trace_surface_unwrap(struct trace_context *tr_ctx,
64 struct pipe_surface *surface)
66 struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
67 struct trace_surface *tr_surf;
72 assert(surface->texture);
76 tr_surf = trace_surface(surface);
78 assert(tr_surf->surface);
79 assert(tr_surf->surface->texture->screen == tr_scr->screen);
81 return tr_surf->surface;
86 trace_context_draw_block(struct trace_context *tr_ctx, int flag)
90 pipe_mutex_lock(tr_ctx->draw_mutex);
92 if (tr_ctx->draw_blocker & flag) {
93 tr_ctx->draw_blocked |= flag;
94 } else if ((tr_ctx->draw_rule.blocker & flag) &&
95 (tr_ctx->draw_blocker & 4)) {
96 boolean block = FALSE;
97 debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__,
98 (void *) tr_ctx->draw_rule.fs, (void *) tr_ctx->curr.fs,
99 (void *) tr_ctx->draw_rule.vs, (void *) tr_ctx->curr.vs,
100 (void *) tr_ctx->draw_rule.surf, 0,
101 (void *) tr_ctx->draw_rule.sampler_view, 0);
102 if (tr_ctx->draw_rule.fs &&
103 tr_ctx->draw_rule.fs == tr_ctx->curr.fs)
105 if (tr_ctx->draw_rule.vs &&
106 tr_ctx->draw_rule.vs == tr_ctx->curr.vs)
108 if (tr_ctx->draw_rule.surf &&
109 tr_ctx->draw_rule.surf == tr_ctx->curr.zsbuf)
111 if (tr_ctx->draw_rule.surf)
112 for (k = 0; k < tr_ctx->curr.nr_cbufs; k++)
113 if (tr_ctx->draw_rule.surf == tr_ctx->curr.cbufs[k])
115 if (tr_ctx->draw_rule.sampler_view) {
116 for (k = 0; k < tr_ctx->curr.num_sampler_views; k++)
117 if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.sampler_views[k])
119 for (k = 0; k < tr_ctx->curr.num_vert_sampler_views; k++) {
120 if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.vert_sampler_views[k]) {
127 tr_ctx->draw_blocked |= (flag | 4);
130 if (tr_ctx->draw_blocked)
131 trace_rbug_notify_draw_blocked(tr_ctx);
133 /* wait for rbug to clear the blocked flag */
134 while (tr_ctx->draw_blocked & flag) {
135 tr_ctx->draw_blocked |= flag;
136 #ifdef PIPE_THREAD_HAVE_CONDVAR
137 pipe_condvar_wait(tr_ctx->draw_cond, tr_ctx->draw_mutex);
139 pipe_mutex_unlock(tr_ctx->draw_mutex);
140 #ifdef PIPE_SUBSYSTEM_WINDOWS_USER
143 pipe_mutex_lock(tr_ctx->draw_mutex);
147 pipe_mutex_unlock(tr_ctx->draw_mutex);
151 trace_context_draw_arrays(struct pipe_context *_pipe,
152 unsigned mode, unsigned start, unsigned count)
154 struct trace_context *tr_ctx = trace_context(_pipe);
155 struct pipe_context *pipe = tr_ctx->pipe;
157 if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
160 trace_context_draw_block(tr_ctx, 1);
162 trace_dump_call_begin("pipe_context", "draw_arrays");
164 trace_dump_arg(ptr, pipe);
165 trace_dump_arg(uint, mode);
166 trace_dump_arg(uint, start);
167 trace_dump_arg(uint, count);
169 pipe->draw_arrays(pipe, mode, start, count);
171 trace_dump_call_end();
173 trace_context_draw_block(tr_ctx, 2);
178 trace_context_draw_elements(struct pipe_context *_pipe,
179 struct pipe_resource *_indexBuffer,
181 unsigned mode, unsigned start, unsigned count)
183 struct trace_context *tr_ctx = trace_context(_pipe);
184 struct trace_resource *tr_buf = trace_resource(_indexBuffer);
185 struct pipe_context *pipe = tr_ctx->pipe;
186 struct pipe_resource *indexBuffer = tr_buf->resource;
188 if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
191 trace_context_draw_block(tr_ctx, 1);
193 trace_dump_call_begin("pipe_context", "draw_elements");
195 trace_dump_arg(ptr, pipe);
196 trace_dump_arg(ptr, indexBuffer);
197 trace_dump_arg(uint, indexSize);
198 trace_dump_arg(uint, mode);
199 trace_dump_arg(uint, start);
200 trace_dump_arg(uint, count);
202 pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);
204 trace_dump_call_end();
206 trace_context_draw_block(tr_ctx, 2);
211 trace_context_draw_range_elements(struct pipe_context *_pipe,
212 struct pipe_resource *_indexBuffer,
220 struct trace_context *tr_ctx = trace_context(_pipe);
221 struct trace_resource *tr_buf = trace_resource(_indexBuffer);
222 struct pipe_context *pipe = tr_ctx->pipe;
223 struct pipe_resource *indexBuffer = tr_buf->resource;
225 if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
228 trace_context_draw_block(tr_ctx, 1);
230 trace_dump_call_begin("pipe_context", "draw_range_elements");
232 trace_dump_arg(ptr, pipe);
233 trace_dump_arg(ptr, indexBuffer);
234 trace_dump_arg(uint, indexSize);
235 trace_dump_arg(uint, minIndex);
236 trace_dump_arg(uint, maxIndex);
237 trace_dump_arg(uint, mode);
238 trace_dump_arg(uint, start);
239 trace_dump_arg(uint, count);
241 pipe->draw_range_elements(pipe,
243 indexSize, minIndex, maxIndex,
246 trace_dump_call_end();
248 trace_context_draw_block(tr_ctx, 2);
252 static INLINE struct pipe_query *
253 trace_context_create_query(struct pipe_context *_pipe,
256 struct trace_context *tr_ctx = trace_context(_pipe);
257 struct pipe_context *pipe = tr_ctx->pipe;
258 struct pipe_query *result;
260 trace_dump_call_begin("pipe_context", "create_query");
262 trace_dump_arg(ptr, pipe);
263 trace_dump_arg(uint, query_type);
265 result = pipe->create_query(pipe, query_type);
267 trace_dump_ret(ptr, result);
269 trace_dump_call_end();
276 trace_context_destroy_query(struct pipe_context *_pipe,
277 struct pipe_query *query)
279 struct trace_context *tr_ctx = trace_context(_pipe);
280 struct pipe_context *pipe = tr_ctx->pipe;
282 trace_dump_call_begin("pipe_context", "destroy_query");
284 trace_dump_arg(ptr, pipe);
285 trace_dump_arg(ptr, query);
287 pipe->destroy_query(pipe, query);
289 trace_dump_call_end();
294 trace_context_begin_query(struct pipe_context *_pipe,
295 struct pipe_query *query)
297 struct trace_context *tr_ctx = trace_context(_pipe);
298 struct pipe_context *pipe = tr_ctx->pipe;
300 trace_dump_call_begin("pipe_context", "begin_query");
302 trace_dump_arg(ptr, pipe);
303 trace_dump_arg(ptr, query);
305 pipe->begin_query(pipe, query);
307 trace_dump_call_end();
312 trace_context_end_query(struct pipe_context *_pipe,
313 struct pipe_query *query)
315 struct trace_context *tr_ctx = trace_context(_pipe);
316 struct pipe_context *pipe = tr_ctx->pipe;
318 trace_dump_call_begin("pipe_context", "end_query");
320 trace_dump_arg(ptr, pipe);
321 trace_dump_arg(ptr, query);
323 pipe->end_query(pipe, query);
325 trace_dump_call_end();
329 static INLINE boolean
330 trace_context_get_query_result(struct pipe_context *_pipe,
331 struct pipe_query *query,
335 struct trace_context *tr_ctx = trace_context(_pipe);
336 struct pipe_context *pipe = tr_ctx->pipe;
340 trace_dump_call_begin("pipe_context", "get_query_result");
342 trace_dump_arg(ptr, pipe);
344 _result = pipe->get_query_result(pipe, query, wait, presult);
347 trace_dump_arg(uint, result);
348 trace_dump_ret(bool, _result);
350 trace_dump_call_end();
357 trace_context_create_blend_state(struct pipe_context *_pipe,
358 const struct pipe_blend_state *state)
360 struct trace_context *tr_ctx = trace_context(_pipe);
361 struct pipe_context *pipe = tr_ctx->pipe;
364 trace_dump_call_begin("pipe_context", "create_blend_state");
366 trace_dump_arg(ptr, pipe);
367 trace_dump_arg(blend_state, state);
369 result = pipe->create_blend_state(pipe, state);
371 trace_dump_ret(ptr, result);
373 trace_dump_call_end();
380 trace_context_bind_blend_state(struct pipe_context *_pipe,
383 struct trace_context *tr_ctx = trace_context(_pipe);
384 struct pipe_context *pipe = tr_ctx->pipe;
386 trace_dump_call_begin("pipe_context", "bind_blend_state");
388 trace_dump_arg(ptr, pipe);
389 trace_dump_arg(ptr, state);
391 pipe->bind_blend_state(pipe, state);
393 trace_dump_call_end();
398 trace_context_delete_blend_state(struct pipe_context *_pipe,
401 struct trace_context *tr_ctx = trace_context(_pipe);
402 struct pipe_context *pipe = tr_ctx->pipe;
404 trace_dump_call_begin("pipe_context", "delete_blend_state");
406 trace_dump_arg(ptr, pipe);
407 trace_dump_arg(ptr, state);
409 pipe->delete_blend_state(pipe, state);
411 trace_dump_call_end();
416 trace_context_create_sampler_state(struct pipe_context *_pipe,
417 const struct pipe_sampler_state *state)
419 struct trace_context *tr_ctx = trace_context(_pipe);
420 struct pipe_context *pipe = tr_ctx->pipe;
423 trace_dump_call_begin("pipe_context", "create_sampler_state");
425 trace_dump_arg(ptr, pipe);
426 trace_dump_arg(sampler_state, state);
428 result = pipe->create_sampler_state(pipe, state);
430 trace_dump_ret(ptr, result);
432 trace_dump_call_end();
439 trace_context_bind_fragment_sampler_states(struct pipe_context *_pipe,
443 struct trace_context *tr_ctx = trace_context(_pipe);
444 struct pipe_context *pipe = tr_ctx->pipe;
446 trace_dump_call_begin("pipe_context", "bind_fragment_sampler_states");
448 trace_dump_arg(ptr, pipe);
449 trace_dump_arg(uint, num_states);
450 trace_dump_arg_array(ptr, states, num_states);
452 pipe->bind_fragment_sampler_states(pipe, num_states, states);
454 trace_dump_call_end();
459 trace_context_bind_vertex_sampler_states(struct pipe_context *_pipe,
463 struct trace_context *tr_ctx = trace_context(_pipe);
464 struct pipe_context *pipe = tr_ctx->pipe;
466 trace_dump_call_begin("pipe_context", "bind_vertex_sampler_states");
468 trace_dump_arg(ptr, pipe);
469 trace_dump_arg(uint, num_states);
470 trace_dump_arg_array(ptr, states, num_states);
472 pipe->bind_vertex_sampler_states(pipe, num_states, states);
474 trace_dump_call_end();
479 trace_context_delete_sampler_state(struct pipe_context *_pipe,
482 struct trace_context *tr_ctx = trace_context(_pipe);
483 struct pipe_context *pipe = tr_ctx->pipe;
485 trace_dump_call_begin("pipe_context", "delete_sampler_state");
487 trace_dump_arg(ptr, pipe);
488 trace_dump_arg(ptr, state);
490 pipe->delete_sampler_state(pipe, state);
492 trace_dump_call_end();
497 trace_context_create_rasterizer_state(struct pipe_context *_pipe,
498 const struct pipe_rasterizer_state *state)
500 struct trace_context *tr_ctx = trace_context(_pipe);
501 struct pipe_context *pipe = tr_ctx->pipe;
504 trace_dump_call_begin("pipe_context", "create_rasterizer_state");
506 trace_dump_arg(ptr, pipe);
507 trace_dump_arg(rasterizer_state, state);
509 result = pipe->create_rasterizer_state(pipe, state);
511 trace_dump_ret(ptr, result);
513 trace_dump_call_end();
520 trace_context_bind_rasterizer_state(struct pipe_context *_pipe,
523 struct trace_context *tr_ctx = trace_context(_pipe);
524 struct pipe_context *pipe = tr_ctx->pipe;
526 trace_dump_call_begin("pipe_context", "bind_rasterizer_state");
528 trace_dump_arg(ptr, pipe);
529 trace_dump_arg(ptr, state);
531 pipe->bind_rasterizer_state(pipe, state);
533 trace_dump_call_end();
538 trace_context_delete_rasterizer_state(struct pipe_context *_pipe,
541 struct trace_context *tr_ctx = trace_context(_pipe);
542 struct pipe_context *pipe = tr_ctx->pipe;
544 trace_dump_call_begin("pipe_context", "delete_rasterizer_state");
546 trace_dump_arg(ptr, pipe);
547 trace_dump_arg(ptr, state);
549 pipe->delete_rasterizer_state(pipe, state);
551 trace_dump_call_end();
556 trace_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
557 const struct pipe_depth_stencil_alpha_state *state)
559 struct trace_context *tr_ctx = trace_context(_pipe);
560 struct pipe_context *pipe = tr_ctx->pipe;
563 trace_dump_call_begin("pipe_context", "create_depth_stencil_alpha_state");
565 result = pipe->create_depth_stencil_alpha_state(pipe, state);
567 trace_dump_arg(ptr, pipe);
568 trace_dump_arg(depth_stencil_alpha_state, state);
570 trace_dump_ret(ptr, result);
572 trace_dump_call_end();
579 trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
582 struct trace_context *tr_ctx = trace_context(_pipe);
583 struct pipe_context *pipe = tr_ctx->pipe;
585 trace_dump_call_begin("pipe_context", "bind_depth_stencil_alpha_state");
587 trace_dump_arg(ptr, pipe);
588 trace_dump_arg(ptr, state);
590 pipe->bind_depth_stencil_alpha_state(pipe, state);
592 trace_dump_call_end();
597 trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe,
600 struct trace_context *tr_ctx = trace_context(_pipe);
601 struct pipe_context *pipe = tr_ctx->pipe;
603 trace_dump_call_begin("pipe_context", "delete_depth_stencil_alpha_state");
605 trace_dump_arg(ptr, pipe);
606 trace_dump_arg(ptr, state);
608 pipe->delete_depth_stencil_alpha_state(pipe, state);
610 trace_dump_call_end();
615 trace_context_create_fs_state(struct pipe_context *_pipe,
616 const struct pipe_shader_state *state)
618 struct trace_context *tr_ctx = trace_context(_pipe);
619 struct pipe_context *pipe = tr_ctx->pipe;
622 trace_dump_call_begin("pipe_context", "create_fs_state");
624 trace_dump_arg(ptr, pipe);
625 trace_dump_arg(shader_state, state);
627 result = pipe->create_fs_state(pipe, state);
629 trace_dump_ret(ptr, result);
631 trace_dump_call_end();
633 result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_FRAGMENT);
640 trace_context_bind_fs_state(struct pipe_context *_pipe,
643 struct trace_context *tr_ctx = trace_context(_pipe);
644 struct trace_shader *tr_shdr = trace_shader(_state);
645 struct pipe_context *pipe = tr_ctx->pipe;
646 void *state = tr_shdr ? tr_shdr->state : NULL;
648 trace_dump_call_begin("pipe_context", "bind_fs_state");
650 trace_dump_arg(ptr, pipe);
651 trace_dump_arg(ptr, state);
653 tr_ctx->curr.fs = tr_shdr;
655 if (tr_shdr && tr_shdr->replaced)
656 state = tr_shdr->replaced;
658 pipe->bind_fs_state(pipe, state);
660 trace_dump_call_end();
665 trace_context_delete_fs_state(struct pipe_context *_pipe,
668 struct trace_context *tr_ctx = trace_context(_pipe);
669 struct trace_shader *tr_shdr = trace_shader(_state);
670 struct pipe_context *pipe = tr_ctx->pipe;
671 void *state = tr_shdr->state;
673 trace_dump_call_begin("pipe_context", "delete_fs_state");
675 trace_dump_arg(ptr, pipe);
676 trace_dump_arg(ptr, state);
678 pipe->delete_fs_state(pipe, state);
680 trace_dump_call_end();
682 trace_shader_destroy(tr_ctx, tr_shdr);
687 trace_context_create_vs_state(struct pipe_context *_pipe,
688 const struct pipe_shader_state *state)
690 struct trace_context *tr_ctx = trace_context(_pipe);
691 struct pipe_context *pipe = tr_ctx->pipe;
694 trace_dump_call_begin("pipe_context", "create_vs_state");
696 trace_dump_arg(ptr, pipe);
697 trace_dump_arg(shader_state, state);
699 result = pipe->create_vs_state(pipe, state);
701 trace_dump_ret(ptr, result);
703 trace_dump_call_end();
705 result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_VERTEX);
712 trace_context_bind_vs_state(struct pipe_context *_pipe,
715 struct trace_context *tr_ctx = trace_context(_pipe);
716 struct trace_shader *tr_shdr = trace_shader(_state);
717 struct pipe_context *pipe = tr_ctx->pipe;
718 void *state = tr_shdr ? tr_shdr->state : NULL;
720 trace_dump_call_begin("pipe_context", "bind_vs_state");
722 trace_dump_arg(ptr, pipe);
723 trace_dump_arg(ptr, state);
725 tr_ctx->curr.vs = tr_shdr;
727 if (tr_shdr && tr_shdr->replaced)
728 state = tr_shdr->replaced;
730 pipe->bind_vs_state(pipe, state);
732 trace_dump_call_end();
737 trace_context_delete_vs_state(struct pipe_context *_pipe,
740 struct trace_context *tr_ctx = trace_context(_pipe);
741 struct trace_shader *tr_shdr = trace_shader(_state);
742 struct pipe_context *pipe = tr_ctx->pipe;
743 void *state = tr_shdr->state;
745 trace_dump_call_begin("pipe_context", "delete_vs_state");
747 trace_dump_arg(ptr, pipe);
748 trace_dump_arg(ptr, state);
750 pipe->delete_vs_state(pipe, state);
752 trace_dump_call_end();
754 trace_shader_destroy(tr_ctx, tr_shdr);
759 trace_context_create_vertex_elements_state(struct pipe_context *_pipe,
760 unsigned num_elements,
761 const struct pipe_vertex_element *elements)
763 struct trace_context *tr_ctx = trace_context(_pipe);
764 struct pipe_context *pipe = tr_ctx->pipe;
767 trace_dump_call_begin("pipe_context", "create_vertex_elements_state");
769 trace_dump_arg(ptr, pipe);
770 trace_dump_arg(uint, num_elements);
772 trace_dump_arg_begin("elements");
773 trace_dump_struct_array(vertex_element, elements, num_elements);
774 trace_dump_arg_end();
776 result = pipe->create_vertex_elements_state(pipe, num_elements, elements);
778 trace_dump_ret(ptr, result);
780 trace_dump_call_end();
787 trace_context_bind_vertex_elements_state(struct pipe_context *_pipe,
790 struct trace_context *tr_ctx = trace_context(_pipe);
791 struct pipe_context *pipe = tr_ctx->pipe;
793 trace_dump_call_begin("pipe_context", "bind_vertex_elements_state");
795 trace_dump_arg(ptr, pipe);
796 trace_dump_arg(ptr, state);
798 pipe->bind_vertex_elements_state(pipe, state);
800 trace_dump_call_end();
805 trace_context_delete_vertex_elements_state(struct pipe_context *_pipe,
808 struct trace_context *tr_ctx = trace_context(_pipe);
809 struct pipe_context *pipe = tr_ctx->pipe;
811 trace_dump_call_begin("pipe_context", "delete_verte_elements_state");
813 trace_dump_arg(ptr, pipe);
814 trace_dump_arg(ptr, state);
816 pipe->delete_vertex_elements_state(pipe, state);
818 trace_dump_call_end();
823 trace_context_set_blend_color(struct pipe_context *_pipe,
824 const struct pipe_blend_color *state)
826 struct trace_context *tr_ctx = trace_context(_pipe);
827 struct pipe_context *pipe = tr_ctx->pipe;
829 trace_dump_call_begin("pipe_context", "set_blend_color");
831 trace_dump_arg(ptr, pipe);
832 trace_dump_arg(blend_color, state);
834 pipe->set_blend_color(pipe, state);
836 trace_dump_call_end();
841 trace_context_set_stencil_ref(struct pipe_context *_pipe,
842 const struct pipe_stencil_ref *state)
844 struct trace_context *tr_ctx = trace_context(_pipe);
845 struct pipe_context *pipe = tr_ctx->pipe;
847 trace_dump_call_begin("pipe_context", "set_stencil_ref");
849 trace_dump_arg(ptr, pipe);
850 trace_dump_arg(stencil_ref, state);
852 pipe->set_stencil_ref(pipe, state);
854 trace_dump_call_end();
859 trace_context_set_clip_state(struct pipe_context *_pipe,
860 const struct pipe_clip_state *state)
862 struct trace_context *tr_ctx = trace_context(_pipe);
863 struct pipe_context *pipe = tr_ctx->pipe;
865 trace_dump_call_begin("pipe_context", "set_clip_state");
867 trace_dump_arg(ptr, pipe);
868 trace_dump_arg(clip_state, state);
870 pipe->set_clip_state(pipe, state);
872 trace_dump_call_end();
877 trace_context_set_constant_buffer(struct pipe_context *_pipe,
878 uint shader, uint index,
879 struct pipe_resource *buffer)
881 struct trace_context *tr_ctx = trace_context(_pipe);
882 struct pipe_context *pipe = tr_ctx->pipe;
885 buffer = trace_resource_unwrap(tr_ctx, buffer);
888 trace_dump_call_begin("pipe_context", "set_constant_buffer");
890 trace_dump_arg(ptr, pipe);
891 trace_dump_arg(uint, shader);
892 trace_dump_arg(uint, index);
893 trace_dump_arg(ptr, buffer);
895 pipe->set_constant_buffer(pipe, shader, index, buffer);
897 trace_dump_call_end();
902 trace_context_set_framebuffer_state(struct pipe_context *_pipe,
903 const struct pipe_framebuffer_state *state)
905 struct trace_context *tr_ctx = trace_context(_pipe);
906 struct pipe_context *pipe = tr_ctx->pipe;
907 struct pipe_framebuffer_state unwrapped_state;
911 tr_ctx->curr.nr_cbufs = state->nr_cbufs;
912 for (i = 0; i < state->nr_cbufs; i++)
914 tr_ctx->curr.cbufs[i] = trace_resource(state->cbufs[i]->texture);
916 tr_ctx->curr.cbufs[i] = NULL;
918 tr_ctx->curr.zsbuf = trace_resource(state->zsbuf->texture);
920 tr_ctx->curr.zsbuf = NULL;
923 /* Unwrap the input state */
924 memcpy(&unwrapped_state, state, sizeof(unwrapped_state));
925 for(i = 0; i < state->nr_cbufs; ++i)
926 unwrapped_state.cbufs[i] = trace_surface_unwrap(tr_ctx, state->cbufs[i]);
927 for(i = state->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; ++i)
928 unwrapped_state.cbufs[i] = NULL;
929 unwrapped_state.zsbuf = trace_surface_unwrap(tr_ctx, state->zsbuf);
930 state = &unwrapped_state;
932 trace_dump_call_begin("pipe_context", "set_framebuffer_state");
934 trace_dump_arg(ptr, pipe);
935 trace_dump_arg(framebuffer_state, state);
937 pipe->set_framebuffer_state(pipe, state);
939 trace_dump_call_end();
944 trace_context_set_polygon_stipple(struct pipe_context *_pipe,
945 const struct pipe_poly_stipple *state)
947 struct trace_context *tr_ctx = trace_context(_pipe);
948 struct pipe_context *pipe = tr_ctx->pipe;
950 trace_dump_call_begin("pipe_context", "set_polygon_stipple");
952 trace_dump_arg(ptr, pipe);
953 trace_dump_arg(poly_stipple, state);
955 pipe->set_polygon_stipple(pipe, state);
957 trace_dump_call_end();
962 trace_context_set_scissor_state(struct pipe_context *_pipe,
963 const struct pipe_scissor_state *state)
965 struct trace_context *tr_ctx = trace_context(_pipe);
966 struct pipe_context *pipe = tr_ctx->pipe;
968 trace_dump_call_begin("pipe_context", "set_scissor_state");
970 trace_dump_arg(ptr, pipe);
971 trace_dump_arg(scissor_state, state);
973 pipe->set_scissor_state(pipe, state);
975 trace_dump_call_end();
980 trace_context_set_viewport_state(struct pipe_context *_pipe,
981 const struct pipe_viewport_state *state)
983 struct trace_context *tr_ctx = trace_context(_pipe);
984 struct pipe_context *pipe = tr_ctx->pipe;
986 trace_dump_call_begin("pipe_context", "set_viewport_state");
988 trace_dump_arg(ptr, pipe);
989 trace_dump_arg(viewport_state, state);
991 pipe->set_viewport_state(pipe, state);
993 trace_dump_call_end();
997 static struct pipe_sampler_view *
998 trace_create_sampler_view(struct pipe_context *_pipe,
999 struct pipe_resource *_resource,
1000 const struct pipe_sampler_view *templ)
1002 struct trace_context *tr_ctx = trace_context(_pipe);
1003 struct trace_resource *tr_tex = trace_resource(_resource);
1004 struct pipe_context *pipe = tr_ctx->pipe;
1005 struct pipe_resource *texture = tr_tex->resource;
1006 struct trace_sampler_view *result = CALLOC_STRUCT(trace_sampler_view);
1008 trace_dump_call_begin("pipe_context", "create_sampler_view");
1010 trace_dump_arg(ptr, pipe);
1011 trace_dump_arg(ptr, texture);
1012 trace_dump_arg(ptr, templ);
1014 result->sampler_view = pipe->create_sampler_view(pipe, texture, templ);
1016 result->base = *templ;
1017 result->base.reference.count = 1;
1018 result->base.texture = NULL;
1019 pipe_resource_reference(&result->base.texture, _resource);
1020 result->base.context = _pipe;
1022 trace_dump_ret(ptr, result);
1024 trace_dump_call_end();
1026 return &result->base;
1031 trace_sampler_view_destroy(struct pipe_context *_pipe,
1032 struct pipe_sampler_view *_view)
1034 struct trace_context *tr_ctx = trace_context(_pipe);
1035 struct trace_sampler_view *tr_view = trace_sampler_view(_view);
1036 struct pipe_context *pipe = tr_ctx->pipe;
1037 struct pipe_sampler_view *view = tr_view->sampler_view;
1039 trace_dump_call_begin("pipe_context", "sampler_view_destroy");
1041 trace_dump_arg(ptr, pipe);
1042 trace_dump_arg(ptr, view);
1044 pipe->sampler_view_destroy(pipe, view);
1046 trace_dump_call_end();
1048 pipe_resource_reference(&_view->texture, NULL);
1054 trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
1056 struct pipe_sampler_view **views)
1058 struct trace_context *tr_ctx = trace_context(_pipe);
1059 struct trace_sampler_view *tr_view;
1060 struct pipe_context *pipe = tr_ctx->pipe;
1061 struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
1064 tr_ctx->curr.num_sampler_views = num;
1065 for(i = 0; i < num; ++i) {
1066 tr_view = trace_sampler_view(views[i]);
1067 tr_ctx->curr.sampler_views[i] = tr_view;
1068 unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
1070 views = unwrapped_views;
1072 trace_dump_call_begin("pipe_context", "set_fragment_sampler_views");
1074 trace_dump_arg(ptr, pipe);
1075 trace_dump_arg(uint, num);
1076 trace_dump_arg_array(ptr, views, num);
1078 pipe->set_fragment_sampler_views(pipe, num, views);
1080 trace_dump_call_end();
1085 trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
1087 struct pipe_sampler_view **views)
1089 struct trace_context *tr_ctx = trace_context(_pipe);
1090 struct trace_sampler_view *tr_view;
1091 struct pipe_context *pipe = tr_ctx->pipe;
1092 struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
1095 tr_ctx->curr.num_vert_sampler_views = num;
1096 for(i = 0; i < num; ++i) {
1097 tr_view = trace_sampler_view(views[i]);
1098 tr_ctx->curr.vert_sampler_views[i] = tr_view;
1099 unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
1101 views = unwrapped_views;
1103 trace_dump_call_begin("pipe_context", "set_vertex_sampler_views");
1105 trace_dump_arg(ptr, pipe);
1106 trace_dump_arg(uint, num);
1107 trace_dump_arg_array(ptr, views, num);
1109 pipe->set_vertex_sampler_views(pipe, num, views);
1111 trace_dump_call_end();
1116 trace_context_set_vertex_buffers(struct pipe_context *_pipe,
1117 unsigned num_buffers,
1118 const struct pipe_vertex_buffer *buffers)
1120 struct trace_context *tr_ctx = trace_context(_pipe);
1121 struct pipe_context *pipe = tr_ctx->pipe;
1124 trace_dump_call_begin("pipe_context", "set_vertex_buffers");
1126 trace_dump_arg(ptr, pipe);
1127 trace_dump_arg(uint, num_buffers);
1129 trace_dump_arg_begin("buffers");
1130 trace_dump_struct_array(vertex_buffer, buffers, num_buffers);
1131 trace_dump_arg_end();
1134 struct pipe_vertex_buffer *_buffers = malloc(num_buffers * sizeof(*_buffers));
1135 memcpy(_buffers, buffers, num_buffers * sizeof(*_buffers));
1136 for (i = 0; i < num_buffers; i++)
1137 _buffers[i].buffer = trace_resource_unwrap(tr_ctx, buffers[i].buffer);
1138 pipe->set_vertex_buffers(pipe, num_buffers, _buffers);
1141 pipe->set_vertex_buffers(pipe, num_buffers, NULL);
1144 trace_dump_call_end();
1149 trace_context_surface_copy(struct pipe_context *_pipe,
1150 struct pipe_surface *dest,
1151 unsigned destx, unsigned desty,
1152 struct pipe_surface *src,
1153 unsigned srcx, unsigned srcy,
1154 unsigned width, unsigned height)
1156 struct trace_context *tr_ctx = trace_context(_pipe);
1157 struct pipe_context *pipe = tr_ctx->pipe;
1159 dest = trace_surface_unwrap(tr_ctx, dest);
1160 src = trace_surface_unwrap(tr_ctx, src);
1162 trace_dump_call_begin("pipe_context", "surface_copy");
1164 trace_dump_arg(ptr, pipe);
1165 trace_dump_arg(ptr, dest);
1166 trace_dump_arg(uint, destx);
1167 trace_dump_arg(uint, desty);
1168 trace_dump_arg(ptr, src);
1169 trace_dump_arg(uint, srcx);
1170 trace_dump_arg(uint, srcy);
1171 trace_dump_arg(uint, width);
1172 trace_dump_arg(uint, height);
1174 pipe->surface_copy(pipe,
1176 src, srcx, srcy, width, height);
1178 trace_dump_call_end();
1183 trace_context_surface_fill(struct pipe_context *_pipe,
1184 struct pipe_surface *dst,
1185 unsigned dstx, unsigned dsty,
1186 unsigned width, unsigned height,
1189 struct trace_context *tr_ctx = trace_context(_pipe);
1190 struct pipe_context *pipe = tr_ctx->pipe;
1192 dst = trace_surface_unwrap(tr_ctx, dst);
1194 trace_dump_call_begin("pipe_context", "surface_fill");
1196 trace_dump_arg(ptr, pipe);
1197 trace_dump_arg(ptr, dst);
1198 trace_dump_arg(uint, dstx);
1199 trace_dump_arg(uint, dsty);
1200 trace_dump_arg(uint, width);
1201 trace_dump_arg(uint, height);
1203 pipe->surface_fill(pipe, dst, dstx, dsty, width, height, value);
1205 trace_dump_call_end();
1210 trace_context_clear(struct pipe_context *_pipe,
1216 struct trace_context *tr_ctx = trace_context(_pipe);
1217 struct pipe_context *pipe = tr_ctx->pipe;
1219 trace_dump_call_begin("pipe_context", "clear");
1221 trace_dump_arg(ptr, pipe);
1222 trace_dump_arg(uint, buffers);
1223 trace_dump_arg_array(float, rgba, 4);
1224 trace_dump_arg(float, depth);
1225 trace_dump_arg(uint, stencil);
1227 pipe->clear(pipe, buffers, rgba, depth, stencil);
1229 trace_dump_call_end();
1234 trace_context_flush(struct pipe_context *_pipe,
1236 struct pipe_fence_handle **fence)
1238 struct trace_context *tr_ctx = trace_context(_pipe);
1239 struct pipe_context *pipe = tr_ctx->pipe;
1241 trace_dump_call_begin("pipe_context", "flush");
1243 trace_dump_arg(ptr, pipe);
1244 trace_dump_arg(uint, flags);
1246 pipe->flush(pipe, flags, fence);
1249 trace_dump_ret(ptr, *fence);
1251 trace_dump_call_end();
1256 trace_context_destroy(struct pipe_context *_pipe)
1258 struct trace_screen *tr_scr = trace_screen(_pipe->screen);
1259 struct trace_context *tr_ctx = trace_context(_pipe);
1260 struct pipe_context *pipe = tr_ctx->pipe;
1262 trace_dump_call_begin("pipe_context", "destroy");
1263 trace_dump_arg(ptr, pipe);
1264 trace_dump_call_end();
1266 trace_screen_remove_from_list(tr_scr, contexts, tr_ctx);
1268 pipe->destroy(pipe);
1274 trace_is_resource_referenced( struct pipe_context *_pipe,
1275 struct pipe_resource *_resource,
1276 unsigned face, unsigned level)
1278 struct trace_context *tr_ctx = trace_context(_pipe);
1279 struct trace_resource *tr_tex = trace_resource(_resource);
1280 struct pipe_context *pipe = tr_ctx->pipe;
1281 struct pipe_resource *texture = tr_tex->resource;
1282 unsigned int referenced;
1284 trace_dump_call_begin("pipe_context", "is_resource_referenced");
1285 trace_dump_arg(ptr, pipe);
1286 trace_dump_arg(ptr, texture);
1287 trace_dump_arg(uint, face);
1288 trace_dump_arg(uint, level);
1290 referenced = pipe->is_resource_referenced(pipe, texture, face, level);
1292 trace_dump_ret(uint, referenced);
1293 trace_dump_call_end();
1299 /********************************************************************
1304 static struct pipe_transfer *
1305 trace_context_get_transfer(struct pipe_context *_context,
1306 struct pipe_resource *_resource,
1307 struct pipe_subresource sr,
1309 const struct pipe_box *box)
1311 struct trace_context *tr_context = trace_context(_context);
1312 struct trace_resource *tr_tex = trace_resource(_resource);
1313 struct pipe_context *context = tr_context->pipe;
1314 struct pipe_resource *texture = tr_tex->resource;
1315 struct pipe_transfer *result = NULL;
1317 assert(texture->screen == context->screen);
1319 trace_dump_call_begin("pipe_context", "get_transfer");
1321 trace_dump_arg(ptr, context);
1322 trace_dump_arg(ptr, texture);
1323 trace_dump_arg(uint, sr.face);
1324 trace_dump_arg(uint, sr.level);
1325 trace_dump_arg(uint, usage);
1326 trace_dump_arg(uint, box->x);
1327 trace_dump_arg(uint, box->y);
1328 trace_dump_arg(uint, box->z);
1329 trace_dump_arg(uint, box->width);
1330 trace_dump_arg(uint, box->height);
1331 trace_dump_arg(uint, box->depth);
1333 result = context->get_transfer(context, texture, sr, usage, box);
1335 trace_dump_ret(ptr, result);
1337 trace_dump_call_end();
1340 result = trace_transfer_create(tr_context, tr_tex, result);
1347 trace_context_transfer_destroy(struct pipe_context *_context,
1348 struct pipe_transfer *_transfer)
1350 struct trace_context *tr_context = trace_context(_context);
1351 struct trace_transfer *tr_trans = trace_transfer(_transfer);
1352 struct pipe_context *context = tr_context->pipe;
1353 struct pipe_transfer *transfer = tr_trans->transfer;
1355 trace_dump_call_begin("pipe_context", "transfer_destroy");
1357 trace_dump_arg(ptr, context);
1358 trace_dump_arg(ptr, transfer);
1360 trace_dump_call_end();
1362 trace_transfer_destroy(tr_context, tr_trans);
1367 trace_context_transfer_map(struct pipe_context *_context,
1368 struct pipe_transfer *_transfer)
1370 struct trace_context *tr_context = trace_context(_context);
1371 struct trace_transfer *tr_trans = trace_transfer(_transfer);
1372 struct pipe_context *context = tr_context->pipe;
1373 struct pipe_transfer *transfer = tr_trans->transfer;
1376 map = context->transfer_map(context, transfer);
1378 if(transfer->usage & PIPE_TRANSFER_WRITE) {
1379 assert(!tr_trans->map);
1380 tr_trans->map = map;
1389 trace_context_transfer_flush_region( struct pipe_context *_context,
1390 struct pipe_transfer *_transfer,
1391 const struct pipe_box *box)
1393 struct trace_context *tr_context = trace_context(_context);
1394 struct trace_transfer *tr_transfer = trace_transfer(_transfer);
1395 struct pipe_context *context = tr_context->pipe;
1396 struct pipe_transfer *transfer = tr_transfer->transfer;
1398 trace_dump_call_begin("pipe_context", "transfer_flush_region");
1400 trace_dump_arg(ptr, context);
1401 trace_dump_arg(ptr, transfer);
1402 trace_dump_arg(uint, box->x);
1403 trace_dump_arg(uint, box->y);
1404 trace_dump_arg(uint, box->z);
1405 trace_dump_arg(uint, box->width);
1406 trace_dump_arg(uint, box->height);
1407 trace_dump_arg(uint, box->depth);
1408 trace_dump_call_end();
1410 context->transfer_flush_region(context,
1416 trace_context_transfer_unmap(struct pipe_context *_context,
1417 struct pipe_transfer *_transfer)
1419 struct trace_context *tr_ctx = trace_context(_context);
1420 struct trace_transfer *tr_trans = trace_transfer(_transfer);
1421 struct pipe_context *context = tr_ctx->pipe;
1422 struct pipe_transfer *transfer = tr_trans->transfer;
1425 trace_dump_call_begin("pipe_context", "transfer_write");
1427 trace_dump_arg(ptr, context);
1429 trace_dump_arg(ptr, transfer);
1431 trace_dump_arg_begin("stride");
1432 trace_dump_uint(transfer->stride);
1433 trace_dump_arg_end();
1435 trace_dump_arg_begin("data");
1436 trace_dump_box_bytes(tr_trans->map,
1437 transfer->resource->format,
1440 transfer->slice_stride);
1441 trace_dump_arg_end();
1443 // trace_dump_arg_begin("size");
1444 // trace_dump_uint(size);
1445 // trace_dump_arg_end();
1447 trace_dump_call_end();
1449 tr_trans->map = NULL;
1452 context->transfer_unmap(context, transfer);
1457 trace_context_transfer_inline_write(struct pipe_context *_context,
1458 struct pipe_resource *_resource,
1459 struct pipe_subresource sr,
1461 const struct pipe_box *box,
1464 unsigned slice_stride)
1466 struct trace_context *tr_context = trace_context(_context);
1467 struct trace_resource *tr_tex = trace_resource(_resource);
1468 struct pipe_context *context = tr_context->pipe;
1469 struct pipe_resource *resource = tr_tex->resource;
1471 assert(resource->screen == context->screen);
1473 trace_dump_call_begin("pipe_context", "transfer_inline_write");
1475 trace_dump_arg(ptr, context);
1476 trace_dump_arg(ptr, resource);
1477 trace_dump_arg(uint, sr.face);
1478 trace_dump_arg(uint, sr.level);
1479 trace_dump_arg(uint, usage);
1480 trace_dump_arg(uint, box->x);
1481 trace_dump_arg(uint, box->y);
1482 trace_dump_arg(uint, box->z);
1483 trace_dump_arg(uint, box->width);
1484 trace_dump_arg(uint, box->height);
1485 trace_dump_arg(uint, box->depth);
1486 trace_dump_arg(uint, stride);
1487 trace_dump_arg(uint, slice_stride);
1489 trace_dump_arg_begin("data");
1490 trace_dump_box_bytes(data,
1495 trace_dump_arg_end();
1497 trace_dump_call_end();
1499 context->transfer_inline_write(context, resource,
1500 sr, usage, box, data, stride, slice_stride);
1506 static const struct debug_named_value rbug_blocker_flags[] = {
1512 struct pipe_context *
1513 trace_context_create(struct trace_screen *tr_scr,
1514 struct pipe_context *pipe)
1516 struct trace_context *tr_ctx;
1521 if(!trace_enabled())
1524 tr_ctx = CALLOC_STRUCT(trace_context);
1528 tr_ctx->base.winsys = NULL;
1529 tr_ctx->base.priv = pipe->priv; /* expose wrapped priv data */
1530 tr_ctx->base.screen = &tr_scr->base;
1531 tr_ctx->draw_blocker = debug_get_flags_option("RBUG_BLOCK",
1534 pipe_mutex_init(tr_ctx->draw_mutex);
1535 pipe_condvar_init(tr_ctx->draw_cond);
1536 pipe_mutex_init(tr_ctx->list_mutex);
1537 make_empty_list(&tr_ctx->shaders);
1539 tr_ctx->base.destroy = trace_context_destroy;
1540 tr_ctx->base.draw_arrays = trace_context_draw_arrays;
1541 tr_ctx->base.draw_elements = trace_context_draw_elements;
1542 tr_ctx->base.draw_range_elements = trace_context_draw_range_elements;
1543 tr_ctx->base.create_query = trace_context_create_query;
1544 tr_ctx->base.destroy_query = trace_context_destroy_query;
1545 tr_ctx->base.begin_query = trace_context_begin_query;
1546 tr_ctx->base.end_query = trace_context_end_query;
1547 tr_ctx->base.get_query_result = trace_context_get_query_result;
1548 tr_ctx->base.create_blend_state = trace_context_create_blend_state;
1549 tr_ctx->base.bind_blend_state = trace_context_bind_blend_state;
1550 tr_ctx->base.delete_blend_state = trace_context_delete_blend_state;
1551 tr_ctx->base.create_sampler_state = trace_context_create_sampler_state;
1552 tr_ctx->base.bind_fragment_sampler_states = trace_context_bind_fragment_sampler_states;
1553 tr_ctx->base.bind_vertex_sampler_states = trace_context_bind_vertex_sampler_states;
1554 tr_ctx->base.delete_sampler_state = trace_context_delete_sampler_state;
1555 tr_ctx->base.create_rasterizer_state = trace_context_create_rasterizer_state;
1556 tr_ctx->base.bind_rasterizer_state = trace_context_bind_rasterizer_state;
1557 tr_ctx->base.delete_rasterizer_state = trace_context_delete_rasterizer_state;
1558 tr_ctx->base.create_depth_stencil_alpha_state = trace_context_create_depth_stencil_alpha_state;
1559 tr_ctx->base.bind_depth_stencil_alpha_state = trace_context_bind_depth_stencil_alpha_state;
1560 tr_ctx->base.delete_depth_stencil_alpha_state = trace_context_delete_depth_stencil_alpha_state;
1561 tr_ctx->base.create_fs_state = trace_context_create_fs_state;
1562 tr_ctx->base.bind_fs_state = trace_context_bind_fs_state;
1563 tr_ctx->base.delete_fs_state = trace_context_delete_fs_state;
1564 tr_ctx->base.create_vs_state = trace_context_create_vs_state;
1565 tr_ctx->base.bind_vs_state = trace_context_bind_vs_state;
1566 tr_ctx->base.delete_vs_state = trace_context_delete_vs_state;
1567 tr_ctx->base.create_vertex_elements_state = trace_context_create_vertex_elements_state;
1568 tr_ctx->base.bind_vertex_elements_state = trace_context_bind_vertex_elements_state;
1569 tr_ctx->base.delete_vertex_elements_state = trace_context_delete_vertex_elements_state;
1570 tr_ctx->base.set_blend_color = trace_context_set_blend_color;
1571 tr_ctx->base.set_stencil_ref = trace_context_set_stencil_ref;
1572 tr_ctx->base.set_clip_state = trace_context_set_clip_state;
1573 tr_ctx->base.set_constant_buffer = trace_context_set_constant_buffer;
1574 tr_ctx->base.set_framebuffer_state = trace_context_set_framebuffer_state;
1575 tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple;
1576 tr_ctx->base.set_scissor_state = trace_context_set_scissor_state;
1577 tr_ctx->base.set_viewport_state = trace_context_set_viewport_state;
1578 tr_ctx->base.set_fragment_sampler_views = trace_context_set_fragment_sampler_views;
1579 tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views;
1580 tr_ctx->base.create_sampler_view = trace_create_sampler_view;
1581 tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
1582 tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
1583 if (pipe->surface_copy)
1584 tr_ctx->base.surface_copy = trace_context_surface_copy;
1585 if (pipe->surface_fill)
1586 tr_ctx->base.surface_fill = trace_context_surface_fill;
1587 tr_ctx->base.clear = trace_context_clear;
1588 tr_ctx->base.flush = trace_context_flush;
1589 tr_ctx->base.is_resource_referenced = trace_is_resource_referenced;
1591 tr_ctx->base.get_transfer = trace_context_get_transfer;
1592 tr_ctx->base.transfer_destroy = trace_context_transfer_destroy;
1593 tr_ctx->base.transfer_map = trace_context_transfer_map;
1594 tr_ctx->base.transfer_unmap = trace_context_transfer_unmap;
1595 tr_ctx->base.transfer_flush_region = trace_context_transfer_flush_region;
1596 tr_ctx->base.transfer_inline_write = trace_context_transfer_inline_write;
1598 tr_ctx->pipe = pipe;
1600 trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
1602 return &tr_ctx->base;