diff options
author | Thierry Reding <treding@nvidia.com> | 2014-11-17 16:48:23 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2019-08-23 18:07:24 +0200 |
commit | f1e6a48458578900399194d686f9525b86f74325 (patch) | |
tree | 1409db63e690e866fe0c751ee59100fee77d2036 | |
parent | efa99c063203585974cd4b3582884b4c80ab5d20 (diff) |
HACK: tegra: Add debugging output
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | src/gallium/drivers/tegra/tegra_context.c | 624 | ||||
-rw-r--r-- | src/gallium/drivers/tegra/tegra_screen.c | 305 | ||||
-rw-r--r-- | src/gallium/winsys/tegra/drm/tegra_drm_winsys.c | 10 |
3 files changed, 874 insertions, 65 deletions
diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c index e91baf0be343..171a4bd07014 100644 --- a/src/gallium/drivers/tegra/tegra_context.c +++ b/src/gallium/drivers/tegra/tegra_context.c @@ -37,11 +37,15 @@ tegra_destroy(struct pipe_context *pcontext) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p)\n", __func__, pcontext); + if (context->base.stream_uploader) u_upload_destroy(context->base.stream_uploader); context->gpu->destroy(context->gpu); free(context); + + debug_printf("< %s()\n", __func__); } static void @@ -52,22 +56,37 @@ tegra_draw_vbo(struct pipe_context *pcontext, struct pipe_draw_indirect_info indirect; struct pipe_draw_info info; + debug_printf("> %s(pcontext=%p, pinfo=%p)\n", __func__, pcontext, pinfo); + debug_printf(" pinfo:\n"); + debug_printf(" index_size: %u\n", pinfo->index_size); + debug_printf(" mode: %x\n", pinfo->mode); + debug_printf(" start: %u\n", pinfo->start); + debug_printf(" count: %u\n", pinfo->count); + if (pinfo && (pinfo->indirect || pinfo->index_size)) { + debug_printf(" unwrapping pipe_draw_info\n"); + memcpy(&info, pinfo, sizeof(info)); if (pinfo->indirect) { + debug_printf(" unwrapping pipe_draw_indirect_info\n"); + memcpy(&indirect, pinfo->indirect, sizeof(indirect)); indirect.buffer = tegra_resource_unwrap(info.indirect->buffer); info.indirect = &indirect; } - if (pinfo->index_size && !pinfo->has_user_indices) + if (pinfo->index_size && !pinfo->has_user_indices) { + debug_printf(" unwrapping index buffer\n"); info.index.resource = tegra_resource_unwrap(info.index.resource); + } pinfo = &info; } context->gpu->draw_vbo(context->gpu, pinfo); + + debug_printf("< %s()\n", __func__); } static void @@ -78,7 +97,12 @@ tegra_render_condition(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, query=%p, condition=%d, mode=%u)\n", + __func__, pcontext, query, condition, mode); + context->gpu->render_condition(context->gpu, query, condition, mode); + + debug_printf("< %s()\n", __func__); } static struct pipe_query * @@ -86,8 +110,15 @@ tegra_create_query(struct pipe_context *pcontext, unsigned int query_type, unsigned int index) { struct tegra_context *context = to_tegra_context(pcontext); + struct pipe_query *query; + + debug_printf("> %s(pcontext=%p, query_type=%u, index=%u)\n", __func__, + pcontext, query_type, index); + + query = context->gpu->create_query(context->gpu, query_type, index); - return context->gpu->create_query(context->gpu, query_type, index); + debug_printf("< %s() = %p\n", __func__, query); + return query; } static struct pipe_query * @@ -96,9 +127,16 @@ tegra_create_batch_query(struct pipe_context *pcontext, unsigned int *queries) { struct tegra_context *context = to_tegra_context(pcontext); + struct pipe_query *query; - return context->gpu->create_batch_query(context->gpu, num_queries, - queries); + debug_printf("> %s(pcontext=%p, num_queries=%u, queries=%p)\n", __func__, + pcontext, num_queries, queries); + + query = context->gpu->create_batch_query(context->gpu, num_queries, + queries); + + debug_printf("< %s() = %p\n", __func__, query); + return query; } static void @@ -106,23 +144,39 @@ tegra_destroy_query(struct pipe_context *pcontext, struct pipe_query *query) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, query=%p)\n", __func__, pcontext, query); + context->gpu->destroy_query(context->gpu, query); + + debug_printf("< %s()\n", __func__); } static bool tegra_begin_query(struct pipe_context *pcontext, struct pipe_query *query) { struct tegra_context *context = to_tegra_context(pcontext); + boolean ret; + + debug_printf("> %s(pcontext=%p, query=%p)\n", __func__, pcontext, query); - return context->gpu->begin_query(context->gpu, query); + ret = context->gpu->begin_query(context->gpu, query); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static bool tegra_end_query(struct pipe_context *pcontext, struct pipe_query *query) { struct tegra_context *context = to_tegra_context(pcontext); + bool ret; + + debug_printf("> %s(pcontext=%p, query=%p)\n", __func__, pcontext, query); - return context->gpu->end_query(context->gpu, query); + ret = context->gpu->end_query(context->gpu, query); + + debug_printf("< %s()\n", __func__); + return ret; } static bool @@ -132,9 +186,15 @@ tegra_get_query_result(struct pipe_context *pcontext, union pipe_query_result *result) { struct tegra_context *context = to_tegra_context(pcontext); + boolean ret; + + debug_printf("> %s(pcontext=%p, query=%p, wait=%d, result=%p)\n", __func__, + pcontext, query, wait, result); + + ret = context->gpu->get_query_result(context->gpu, query, wait, result); - return context->gpu->get_query_result(context->gpu, query, wait, - result); + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static void @@ -148,9 +208,15 @@ tegra_get_query_result_resource(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, query=%p, wait=%d, result_type=%d, index=%d, resource=%p, offset=%u)\n", + __func__, pcontext, query, wait, result_type, index, resource, + offset); + context->gpu->get_query_result_resource(context->gpu, query, wait, result_type, index, resource, offset); + + debug_printf("< %s()\n", __func__); } static void @@ -158,7 +224,11 @@ tegra_set_active_query_state(struct pipe_context *pcontext, bool enable) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, enable=%d)\n", __func__, pcontext, enable); + context->gpu->set_active_query_state(context->gpu, enable); + + debug_printf("< %s()\n", __func__); } static void * @@ -166,8 +236,14 @@ tegra_create_blend_state(struct pipe_context *pcontext, const struct pipe_blend_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_blend_state(context->gpu, cso); - return context->gpu->create_blend_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -175,7 +251,11 @@ tegra_bind_blend_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_blend_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -183,7 +263,11 @@ tegra_delete_blend_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_blend_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -191,8 +275,14 @@ tegra_create_sampler_state(struct pipe_context *pcontext, const struct pipe_sampler_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; - return context->gpu->create_sampler_state(context->gpu, cso); + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_sampler_state(context->gpu, cso); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -202,8 +292,14 @@ tegra_bind_sampler_states(struct pipe_context *pcontext, unsigned shader, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, shader=%u, start_slot=%u, num_samplers=%u, samplers=%p)\n", + __func__, pcontext, shader, start_slot, num_samplers, + samplers); + context->gpu->bind_sampler_states(context->gpu, shader, start_slot, num_samplers, samplers); + + debug_printf("< %s()\n", __func__); } static void @@ -211,7 +307,11 @@ tegra_delete_sampler_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_sampler_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -219,8 +319,14 @@ tegra_create_rasterizer_state(struct pipe_context *pcontext, const struct pipe_rasterizer_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); - return context->gpu->create_rasterizer_state(context->gpu, cso); + so = context->gpu->create_rasterizer_state(context->gpu, cso); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -228,7 +334,11 @@ tegra_bind_rasterizer_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_rasterizer_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -236,7 +346,11 @@ tegra_delete_rasterizer_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_rasterizer_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -244,8 +358,14 @@ tegra_create_depth_stencil_alpha_state(struct pipe_context *pcontext, const struct pipe_depth_stencil_alpha_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_depth_stencil_alpha_state(context->gpu, cso); - return context->gpu->create_depth_stencil_alpha_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -253,7 +373,11 @@ tegra_bind_depth_stencil_alpha_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_depth_stencil_alpha_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -261,7 +385,11 @@ tegra_delete_depth_stencil_alpha_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_depth_stencil_alpha_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -269,8 +397,14 @@ tegra_create_fs_state(struct pipe_context *pcontext, const struct pipe_shader_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_fs_state(context->gpu, cso); - return context->gpu->create_fs_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -278,7 +412,11 @@ tegra_bind_fs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_fs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -286,7 +424,11 @@ tegra_delete_fs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_fs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -294,8 +436,14 @@ tegra_create_vs_state(struct pipe_context *pcontext, const struct pipe_shader_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); - return context->gpu->create_vs_state(context->gpu, cso); + so = context->gpu->create_vs_state(context->gpu, cso); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -303,7 +451,11 @@ tegra_bind_vs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_vs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -311,7 +463,11 @@ tegra_delete_vs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_vs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -319,8 +475,14 @@ tegra_create_gs_state(struct pipe_context *pcontext, const struct pipe_shader_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; - return context->gpu->create_gs_state(context->gpu, cso); + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_gs_state(context->gpu, cso); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -328,7 +490,11 @@ tegra_bind_gs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_gs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -336,7 +502,11 @@ tegra_delete_gs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_gs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -344,8 +514,14 @@ tegra_create_tcs_state(struct pipe_context *pcontext, const struct pipe_shader_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); - return context->gpu->create_tcs_state(context->gpu, cso); + so = context->gpu->create_tcs_state(context->gpu, cso); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -353,7 +529,11 @@ tegra_bind_tcs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_tcs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -361,7 +541,11 @@ tegra_delete_tcs_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_tcs_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -369,8 +553,14 @@ tegra_create_tes_state(struct pipe_context *pcontext, const struct pipe_shader_state *cso) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_tes_state(context->gpu, cso); - return context->gpu->create_tes_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -378,7 +568,11 @@ tegra_bind_tes_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_tes_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -386,7 +580,11 @@ tegra_delete_tes_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_tes_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void * @@ -395,10 +593,16 @@ tegra_create_vertex_elements_state(struct pipe_context *pcontext, const struct pipe_vertex_element *elements) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, num_elements=%u, elements=%p)\n", + __func__, pcontext, num_elements, elements); + + so = context->gpu->create_vertex_elements_state(context->gpu, num_elements, + elements); - return context->gpu->create_vertex_elements_state(context->gpu, - num_elements, - elements); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -406,7 +610,11 @@ tegra_bind_vertex_elements_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_vertex_elements_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -414,7 +622,11 @@ tegra_delete_vertex_elements_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_vertex_elements_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -423,7 +635,11 @@ tegra_set_blend_color(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, color=%p)\n", __func__, pcontext, color); + context->gpu->set_blend_color(context->gpu, color); + + debug_printf("< %s()\n", __func__); } static void @@ -432,7 +648,11 @@ tegra_set_stencil_ref(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, ref=%p)\n", __func__, pcontext, ref); + context->gpu->set_stencil_ref(context->gpu, ref); + + debug_printf("< %s()\n", __func__); } static void @@ -440,7 +660,11 @@ tegra_set_sample_mask(struct pipe_context *pcontext, unsigned int mask) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, mask=%x)\n", __func__, pcontext, mask); + context->gpu->set_sample_mask(context->gpu, mask); + + debug_printf("< %s()\n", __func__); } static void @@ -448,7 +672,12 @@ tegra_set_min_samples(struct pipe_context *pcontext, unsigned int samples) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, samples=%x)\n", __func__, pcontext, + samples); + context->gpu->set_min_samples(context->gpu, samples); + + debug_printf("< %s()\n", __func__); } static void @@ -457,7 +686,11 @@ tegra_set_clip_state(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, state=%p)\n", __func__, pcontext, state); + context->gpu->set_clip_state(context->gpu, state); + + debug_printf("< %s()\n", __func__); } static void @@ -468,13 +701,20 @@ tegra_set_constant_buffer(struct pipe_context *pcontext, unsigned int shader, struct tegra_context *context = to_tegra_context(pcontext); struct pipe_constant_buffer buffer; + debug_printf("> %s(pcontext=%p, shader=%u, index=%u, buf=%p)\n", __func__, + pcontext, shader, index, buf); + if (buf && buf->buffer) { memcpy(&buffer, buf, sizeof(buffer)); + debug_printf(" buffer: %p -> %p\n", buffer.buffer, + tegra_resource_unwrap(buffer.buffer)); buffer.buffer = tegra_resource_unwrap(buffer.buffer); buf = &buffer; } context->gpu->set_constant_buffer(context->gpu, shader, index, buf); + + debug_printf("< %s()\n", __func__); } static void @@ -485,21 +725,28 @@ tegra_set_framebuffer_state(struct pipe_context *pcontext, struct pipe_framebuffer_state state; unsigned i; + debug_printf("> %s(pcontext=%p, fb=%p)\n", __func__, pcontext, fb); + if (fb) { memcpy(&state, fb, sizeof(state)); - for (i = 0; i < fb->nr_cbufs; i++) + for (i = 0; i < fb->nr_cbufs; i++) { state.cbufs[i] = tegra_surface_unwrap(fb->cbufs[i]); + debug_printf(" %u: %p -> %p\n", i, fb->cbufs[i], state.cbufs[i]); + } while (i < PIPE_MAX_COLOR_BUFS) state.cbufs[i++] = NULL; state.zsbuf = tegra_surface_unwrap(fb->zsbuf); + debug_printf(" zsbuf: %p -> %p\n", fb->zsbuf, state.zsbuf); fb = &state; } context->gpu->set_framebuffer_state(context->gpu, fb); + + debug_printf("< %s()\n", __func__); } static void @@ -508,7 +755,12 @@ tegra_set_polygon_stipple(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, stipple=%p)\n", __func__, pcontext, + stipple); + context->gpu->set_polygon_stipple(context->gpu, stipple); + + debug_printf("< %s()\n", __func__); } static void @@ -518,8 +770,13 @@ tegra_set_scissor_states(struct pipe_context *pcontext, unsigned start_slot, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, start_slot=%u, num_scissors=%u, scissors=%p)\n", + __func__, pcontext, start_slot, num_scissors, scissors); + context->gpu->set_scissor_states(context->gpu, start_slot, num_scissors, scissors); + + debug_printf("< %s()\n", __func__); } static void @@ -529,8 +786,13 @@ tegra_set_window_rectangles(struct pipe_context *pcontext, bool include, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, include=%d, num_rectangles=%u, rectangles=%p)\n", + __func__, pcontext, include, num_rectangles, rectangles); + context->gpu->set_window_rectangles(context->gpu, include, num_rectangles, rectangles); + + debug_printf("< %s()\n", __func__); } static void @@ -540,8 +802,13 @@ tegra_set_viewport_states(struct pipe_context *pcontext, unsigned start_slot, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, start_slot=%u, num_viewports=%u, viewports=%p)\n", + __func__, pcontext, start_slot, num_viewports, viewports); + context->gpu->set_viewport_states(context->gpu, start_slot, num_viewports, viewports); + + debug_printf("< %s()\n", __func__); } static void @@ -553,11 +820,16 @@ tegra_set_sampler_views(struct pipe_context *pcontext, unsigned shader, struct tegra_context *context = to_tegra_context(pcontext); unsigned i; + debug_printf("> %s(pcontext=%p, shader=%u, start_slot=%u, num_views=%u, pviews=%p)\n", + __func__, pcontext, shader, start_slot, num_views, pviews); + for (i = 0; i < num_views; i++) views[i] = tegra_sampler_view_unwrap(pviews[i]); context->gpu->set_sampler_views(context->gpu, shader, start_slot, num_views, views); + + debug_printf("< %s()\n", __func__); } static void @@ -567,8 +839,13 @@ tegra_set_tess_state(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, default_outer_level=%p, default_inner_level=%p)\n", + __func__, pcontext, default_outer_level, default_inner_level); + context->gpu->set_tess_state(context->gpu, default_outer_level, default_inner_level); + + debug_printf("< %s()\n", __func__); } static void @@ -577,7 +854,12 @@ tegra_set_debug_callback(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, callback=%p)\n", __func__, pcontext, + callback); + context->gpu->set_debug_callback(context->gpu, callback); + + debug_printf("< %s()\n", __func__); } static void @@ -588,8 +870,13 @@ tegra_set_shader_buffers(struct pipe_context *pcontext, unsigned int shader, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, shader=%u, start=%u, count=%u, buffers=%p, writable_bitmask=%x)\n", + __func__, pcontext, shader, start, count, buffers, writable_bitmask); + context->gpu->set_shader_buffers(context->gpu, shader, start, count, buffers, writable_bitmask); + + debug_printf("< %s()\n", __func__); } static void @@ -599,8 +886,13 @@ tegra_set_shader_images(struct pipe_context *pcontext, unsigned int shader, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, shader=%u, start=%u, count=%u, images=%p)\n", + __func__, pcontext, shader, start, count, images); + context->gpu->set_shader_images(context->gpu, shader, start, count, images); + + debug_printf("< %s()\n", __func__); } static void @@ -612,10 +904,24 @@ tegra_set_vertex_buffers(struct pipe_context *pcontext, unsigned start_slot, struct pipe_vertex_buffer buf[PIPE_MAX_SHADER_INPUTS]; unsigned i; + debug_printf("> %s(pcontext=%p, start_slot=%u, num_buffers=%u, buffers=%p)\n", + __func__, pcontext, start_slot, num_buffers, buffers); + if (num_buffers && buffers) { + for (i = 0; i < num_buffers; i++) { + debug_printf(" %u:\n", i); + debug_printf(" stride: %u\n", buffers[i].stride); + debug_printf(" is_user_buffer: %d\n", buffers[i].is_user_buffer); + debug_printf(" offset: %u\n", buffers[i].buffer_offset); + debug_printf(" buffer: %p\n", buffers[i].buffer.resource); + debug_printf(" user: %p\n", buffers[i].buffer.user); + } + memcpy(buf, buffers, num_buffers * sizeof(struct pipe_vertex_buffer)); for (i = 0; i < num_buffers; i++) { + debug_printf(" %u: %p -> %p\n", i, buf[i].buffer.resource, + tegra_resource_unwrap(buf[i].buffer.resource)); if (!buf[i].is_user_buffer) buf[i].buffer.resource = tegra_resource_unwrap(buf[i].buffer.resource); } @@ -625,6 +931,8 @@ tegra_set_vertex_buffers(struct pipe_context *pcontext, unsigned start_slot, context->gpu->set_vertex_buffers(context->gpu, start_slot, num_buffers, buffers); + + debug_printf("< %s()\n", __func__); } static struct pipe_stream_output_target * @@ -635,11 +943,18 @@ tegra_create_stream_output_target(struct pipe_context *pcontext, { struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + struct pipe_stream_output_target *target; + + debug_printf("> %s(pcontext=%p, presource=%p, buffer_offset=%u, buffer_size=%u)\n", + __func__, pcontext, presource, buffer_offset, buffer_size); + + target = context->gpu->create_stream_output_target(context->gpu, + resource->gpu, + buffer_offset, + buffer_size); - return context->gpu->create_stream_output_target(context->gpu, - resource->gpu, - buffer_offset, - buffer_size); + debug_printf("< %s() = %p\n", __func__, target); + return target; } static void @@ -648,7 +963,12 @@ tegra_stream_output_target_destroy(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, target=%p)\n", __func__, pcontext, + target); + context->gpu->stream_output_target_destroy(context->gpu, target); + + debug_printf("< %s()\n", __func__); } static void @@ -659,8 +979,13 @@ tegra_set_stream_output_targets(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, num_targets=%u, targets=%p, offsets=%p)\n", + __func__, pcontext, num_targets, targets, offsets); + context->gpu->set_stream_output_targets(context->gpu, num_targets, targets, offsets); + + debug_printf("< %s()\n", __func__); } static void @@ -678,9 +1003,15 @@ tegra_resource_copy_region(struct pipe_context *pcontext, struct tegra_resource *dst = to_tegra_resource(pdst); struct tegra_resource *src = to_tegra_resource(psrc); + debug_printf("> %s(pcontext=%p, pdst=%p, dst_level=%u, dstx=%x, dsty=%x, dstz=%u, src=%p, src_level=%u, src_box=%p)\n", + __func__, pcontext, pdst, dst_level, dstx, dsty, dstz, src, + src_level, src_box); + context->gpu->resource_copy_region(context->gpu, dst->gpu, dst_level, dstx, dsty, dstz, src->gpu, src_level, src_box); + + debug_printf("< %s()\n", __func__); } static void @@ -689,6 +1020,8 @@ tegra_blit(struct pipe_context *pcontext, const struct pipe_blit_info *pinfo) struct tegra_context *context = to_tegra_context(pcontext); struct pipe_blit_info info; + debug_printf("> %s(pcontext=%p, pinfo=%p)\n", __func__, pcontext, pinfo); + if (pinfo) { memcpy(&info, pinfo, sizeof(info)); info.dst.resource = tegra_resource_unwrap(info.dst.resource); @@ -697,6 +1030,8 @@ tegra_blit(struct pipe_context *pcontext, const struct pipe_blit_info *pinfo) } context->gpu->blit(context->gpu, pinfo); + + debug_printf("< %s()\n", __func__); } static void @@ -706,7 +1041,12 @@ tegra_clear(struct pipe_context *pcontext, unsigned buffers, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, buffers=%x, color=%p, depth=%f, stencil=%u)\n", + __func__, pcontext, buffers, color, depth, stencil); + context->gpu->clear(context->gpu, buffers, color, depth, stencil); + + debug_printf("< %s()\n", __func__); } static void @@ -722,8 +1062,13 @@ tegra_clear_render_target(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct tegra_surface *dst = to_tegra_surface(pdst); + debug_printf("> %s(pcontext=%p, dst=%p, color=%p, dstx=%u, dsty=%u, width=%u, height=%u)\n", + __func__, pcontext, dst, color, dstx, dsty, width, height); + context->gpu->clear_render_target(context->gpu, dst->gpu, color, dstx, dsty, width, height, render_condition); + + debug_printf("< %s()\n", __func__); } static void @@ -741,9 +1086,15 @@ tegra_clear_depth_stencil(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct tegra_surface *dst = to_tegra_surface(pdst); + debug_printf("> %s(pcontext=%p, dst=%p, flags=%x, depth=%f, stencil=%u, dstx=%u, dsty=%u, width=%u, height=%u)\n", + __func__, pcontext, dst, flags, depth, stencil, dstx, dsty, + width, height); + context->gpu->clear_depth_stencil(context->gpu, dst->gpu, flags, depth, stencil, dstx, dsty, width, height, render_condition); + + debug_printf("< %s()\n", __func__); } static void @@ -756,7 +1107,12 @@ tegra_clear_texture(struct pipe_context *pcontext, struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, presource=%p, level=%u, box=%p, data=%p)\n", + __func__, pcontext, presource, level, box, data); + context->gpu->clear_texture(context->gpu, resource->gpu, level, box, data); + + debug_printf("< %s()\n", __func__); } static void @@ -770,8 +1126,14 @@ tegra_clear_buffer(struct pipe_context *pcontext, struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, presource=%p, offset=%u, size=%u, value=%p, value_size=%d)\n", + __func__, pcontext, presource, offset, size, value, + value_size); + context->gpu->clear_buffer(context->gpu, resource->gpu, offset, size, value, value_size); + + debug_printf("< %s()\n", __func__); } static void @@ -780,7 +1142,12 @@ tegra_flush(struct pipe_context *pcontext, struct pipe_fence_handle **fence, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, fence=%p, flags=%x)\n", __func__, pcontext, + fence, flags); + context->gpu->flush(context->gpu, fence, flags); + + debug_printf("< %s()\n", __func__); } static void @@ -790,8 +1157,13 @@ tegra_create_fence_fd(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, fence=%p, fd=%d, type=%d)\n", __func__, + pcontext, fence, fd, type); + assert(type == PIPE_FD_TYPE_NATIVE_SYNC); context->gpu->create_fence_fd(context->gpu, fence, fd, type); + + debug_printf("< %s()\n", __func__); } static void @@ -800,7 +1172,11 @@ tegra_fence_server_sync(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, fence=%p)\n", __func__, pcontext, fence); + context->gpu->fence_server_sync(context->gpu, fence); + + debug_printf("< %s()\n", __func__); } static struct pipe_sampler_view * @@ -812,6 +1188,9 @@ tegra_create_sampler_view(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct tegra_sampler_view *view; + debug_printf("> %s(pcontext=%p, presource=%p, template=%p)\n", __func__, + pcontext, presource, template); + view = calloc(1, sizeof(*view)); if (!view) return NULL; @@ -826,6 +1205,7 @@ tegra_create_sampler_view(struct pipe_context *pcontext, pipe_resource_reference(&view->base.texture, presource); view->base.context = pcontext; + debug_printf("< %s() = %p\n", __func__, &view->base); return &view->base; } @@ -835,9 +1215,13 @@ tegra_sampler_view_destroy(struct pipe_context *pcontext, { struct tegra_sampler_view *view = to_tegra_sampler_view(pview); + debug_printf("> %s(pcontext=%p, view=%p)\n", __func__, pcontext, view); + pipe_resource_reference(&view->base.texture, NULL); pipe_sampler_view_reference(&view->gpu, NULL); free(view); + + debug_printf("< %s()\n", __func__); } static struct pipe_surface * @@ -849,6 +1233,9 @@ tegra_create_surface(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct tegra_surface *surface; + debug_printf("> %s(pcontext=%p, presource=%p, template=%p)\n", __func__, + pcontext, presource, template); + surface = calloc(1, sizeof(*surface)); if (!surface) return NULL; @@ -868,6 +1255,8 @@ tegra_create_surface(struct pipe_context *pcontext, pipe_resource_reference(&surface->base.texture, presource); surface->base.context = &context->base; + debug_printf(" gpu: %p\n", surface->gpu); + debug_printf("< %s() = %p\n", __func__, &surface->base); return &surface->base; } @@ -877,9 +1266,14 @@ tegra_surface_destroy(struct pipe_context *pcontext, { struct tegra_surface *surface = to_tegra_surface(psurface); + debug_printf("> %s(pcontext=%p, psurface=%p)\n", __func__, pcontext, + psurface); + pipe_resource_reference(&surface->base.texture, NULL); pipe_surface_reference(&surface->gpu, NULL); free(surface); + + debug_printf("< %s()\n", __func__); } static void * @@ -893,6 +1287,9 @@ tegra_transfer_map(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct tegra_transfer *transfer; + debug_printf("> %s(pcontext=%p, presource=%p, level=%u, usage=%x, box=%p, ptransfer=%p)\n", + __func__, pcontext, presource, level, usage, box, ptransfer); + transfer = calloc(1, sizeof(*transfer)); if (!transfer) return NULL; @@ -901,11 +1298,14 @@ tegra_transfer_map(struct pipe_context *pcontext, level, usage, box, &transfer->gpu); memcpy(&transfer->base, transfer->gpu, sizeof(*transfer->gpu)); + if (transfer->base.resource != NULL) + debug_printf(" resource: %p\n", transfer->base.resource); transfer->base.resource = NULL; pipe_resource_reference(&transfer->base.resource, presource); *ptransfer = &transfer->base; + debug_printf("< %s() = %p\n", __func__, transfer->map); return transfer->map; } @@ -917,7 +1317,12 @@ tegra_transfer_flush_region(struct pipe_context *pcontext, struct tegra_transfer *transfer = to_tegra_transfer(ptransfer); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, transfer=%p, box=%p)\n", __func__, + pcontext, transfer, box); + context->gpu->transfer_flush_region(context->gpu, transfer->gpu, box); + + debug_printf("< %s()\n", __func__); } static void @@ -927,9 +1332,14 @@ tegra_transfer_unmap(struct pipe_context *pcontext, struct tegra_transfer *transfer = to_tegra_transfer(ptransfer); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, ptransfer=%p)\n", __func__, pcontext, + ptransfer); + context->gpu->transfer_unmap(context->gpu, transfer->gpu); pipe_resource_reference(&transfer->base.resource, NULL); free(transfer); + + debug_printf("< %s()\n", __func__); } static void @@ -958,8 +1368,14 @@ tegra_texture_subdata(struct pipe_context *pcontext, struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, presource=%p, level=%u, usage=%x, box=%p, data=%p, stride=%u, layer_stride=%u)\n", + __func__, pcontext, presource, level, usage, box, data, + stride, layer_stride); + context->gpu->texture_subdata(context->gpu, resource->gpu, level, usage, box, data, stride, layer_stride); + + debug_printf("< %s()\n", __func__); } static void @@ -967,7 +1383,11 @@ tegra_texture_barrier(struct pipe_context *pcontext, unsigned int flags) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, flags=%x)\n", __func__, pcontext, flags); + context->gpu->texture_barrier(context->gpu, flags); + + debug_printf("< %s()\n", __func__); } static void @@ -975,10 +1395,14 @@ tegra_memory_barrier(struct pipe_context *pcontext, unsigned int flags) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, flags=%x)\n", __func__, pcontext, flags); + if (!(flags & ~PIPE_BARRIER_UPDATE)) return; context->gpu->memory_barrier(context->gpu, flags); + + debug_printf("< %s()\n", __func__); } static struct pipe_video_codec * @@ -986,8 +1410,15 @@ tegra_create_video_codec(struct pipe_context *pcontext, const struct pipe_video_codec *template) { struct tegra_context *context = to_tegra_context(pcontext); + struct pipe_video_codec *codec; + + debug_printf("> %s(pcontext=%p, template=%p)\n", __func__, pcontext, + template); - return context->gpu->create_video_codec(context->gpu, template); + codec = context->gpu->create_video_codec(context->gpu, template); + + debug_printf("< %s() = %p\n", __func__, codec); + return codec; } static struct pipe_video_buffer * @@ -995,8 +1426,15 @@ tegra_create_video_buffer(struct pipe_context *pcontext, const struct pipe_video_buffer *template) { struct tegra_context *context = to_tegra_context(pcontext); + struct pipe_video_buffer *buffer; + + debug_printf("> %s(pcontext=%p, template=%p)\n", __func__, pcontext, + template); - return context->gpu->create_video_buffer(context->gpu, template); + buffer = context->gpu->create_video_buffer(context->gpu, template); + + debug_printf("< %s() = %p\n", __func__, buffer); + return buffer; } static void * @@ -1004,8 +1442,15 @@ tegra_create_compute_state(struct pipe_context *pcontext, const struct pipe_compute_state *template) { struct tegra_context *context = to_tegra_context(pcontext); + void *so; + + debug_printf("> %s(pcontext=%p, template=%p)\n", __func__, pcontext, + template); - return context->gpu->create_compute_state(context->gpu, template); + so = context->gpu->create_compute_state(context->gpu, template); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -1013,7 +1458,11 @@ tegra_bind_compute_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->bind_compute_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -1021,7 +1470,11 @@ tegra_delete_compute_state(struct pipe_context *pcontext, void *so) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, so=%p)\n", __func__, pcontext, so); + context->gpu->delete_compute_state(context->gpu, so); + + debug_printf("< %s()\n", __func__); } static void @@ -1031,9 +1484,14 @@ tegra_set_compute_resources(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, start=%u, count=%u, resources=%p)\n", + __func__, pcontext, start, count, resources); + /* XXX unwrap resources */ context->gpu->set_compute_resources(context->gpu, start, count, resources); + + debug_printf("< %s()\n", __func__); } static void @@ -1043,10 +1501,15 @@ tegra_set_global_binding(struct pipe_context *pcontext, unsigned int first, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, first=%u, count=%u, resources=%p, handles=%p)\n", + __func__, pcontext, first, count, resources, handles); + /* XXX unwrap resources */ context->gpu->set_global_binding(context->gpu, first, count, resources, handles); + + debug_printf("< %s()\n", __func__); } static void @@ -1055,9 +1518,13 @@ tegra_launch_grid(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, info=%p)\n", __func__, pcontext, info); + /* XXX unwrap info->indirect? */ context->gpu->launch_grid(context->gpu, info); + + debug_printf("< %s()\n", __func__); } static void @@ -1066,15 +1533,26 @@ tegra_get_sample_position(struct pipe_context *pcontext, unsigned int count, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, count=%u, index=%u, value=%p)\n", + __func__, pcontext, count, index, value); + context->gpu->get_sample_position(context->gpu, count, index, value); + + debug_printf("< %s()\n", __func__); } static uint64_t tegra_get_timestamp(struct pipe_context *pcontext) { struct tegra_context *context = to_tegra_context(pcontext); + uint64_t timestamp; - return context->gpu->get_timestamp(context->gpu); + debug_printf("> %s(pcontext=%p)\n", __func__, pcontext); + + timestamp = context->gpu->get_timestamp(context->gpu); + + debug_printf("< %s() = %" PRIu64 "\n", __func__, timestamp); + return timestamp; } static void @@ -1084,7 +1562,12 @@ tegra_flush_resource(struct pipe_context *pcontext, struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, resource=%p)\n", __func__, pcontext, + resource); + context->gpu->flush_resource(context->gpu, resource->gpu); + + debug_printf("< %s()\n", __func__); } static void @@ -1094,15 +1577,26 @@ tegra_invalidate_resource(struct pipe_context *pcontext, struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, resource=%p)\n", __func__, pcontext, + resource); + context->gpu->invalidate_resource(context->gpu, resource->gpu); + + debug_printf("< %s()\n", __func__); } static enum pipe_reset_status tegra_get_device_reset_status(struct pipe_context *pcontext) { struct tegra_context *context = to_tegra_context(pcontext); + enum pipe_reset_status status; + + debug_printf("> %s(pcontext=%p)\n", __func__, pcontext); - return context->gpu->get_device_reset_status(context->gpu); + status = context->gpu->get_device_reset_status(context->gpu); + + debug_printf("< %s() = %d\n", __func__, status); + return status; } static void @@ -1111,7 +1605,11 @@ tegra_set_device_reset_callback(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, cb=%p)\n", __func__, pcontext, cb); + context->gpu->set_device_reset_callback(context->gpu, cb); + + debug_printf("< %s()\n", __func__); } static void @@ -1120,7 +1618,12 @@ tegra_dump_debug_state(struct pipe_context *pcontext, FILE *stream, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, stream=%p, flags=%x)\n", __func__, + pcontext, stream, flags); + context->gpu->dump_debug_state(context->gpu, stream, flags); + + debug_printf("< %s()\n", __func__); } static void @@ -1129,7 +1632,12 @@ tegra_emit_string_marker(struct pipe_context *pcontext, const char *string, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, string=%p, length=%d)\n", __func__, + pcontext, string, length); + context->gpu->emit_string_marker(context->gpu, string, length); + + debug_printf("< %s()\n", __func__); } static bool @@ -1143,10 +1651,18 @@ tegra_generate_mipmap(struct pipe_context *pcontext, { struct tegra_resource *resource = to_tegra_resource(presource); struct tegra_context *context = to_tegra_context(pcontext); + boolean ret; + + debug_printf("> %s(pcontext=%p, resource=%p, format=%d, base_level=%u, last_level=%u, first_layer=%u, last_layer=%u)\n", + __func__, pcontext, resource, format, base_level, last_level, + first_layer, last_layer); + + ret = context->gpu->generate_mipmap(context->gpu, resource->gpu, format, + base_level, last_level, first_layer, + last_layer); - return context->gpu->generate_mipmap(context->gpu, resource->gpu, format, - base_level, last_level, first_layer, - last_layer); + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static uint64_t @@ -1155,8 +1671,15 @@ tegra_create_texture_handle(struct pipe_context *pcontext, const struct pipe_sampler_state *state) { struct tegra_context *context = to_tegra_context(pcontext); + uint64_t handle; - return context->gpu->create_texture_handle(context->gpu, view, state); + debug_printf("> %s(pcontext=%p, view=%p, state=%p)\n", __func__, pcontext, + view, state); + + handle = context->gpu->create_texture_handle(context->gpu, view, state); + + debug_printf("< %s() = %" PRIu64 "\n", __func__, handle); + return handle; } static void tegra_delete_texture_handle(struct pipe_context *pcontext, @@ -1164,7 +1687,12 @@ static void tegra_delete_texture_handle(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, handle=%" PRIu64 ")\n", __func__, pcontext, + handle); + context->gpu->delete_texture_handle(context->gpu, handle); + + debug_printf("< %s()\n", __func__); } static void tegra_make_texture_handle_resident(struct pipe_context *pcontext, @@ -1172,15 +1700,26 @@ static void tegra_make_texture_handle_resident(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, handle=%" PRIu64 ")\n", __func__, pcontext, + handle); + context->gpu->make_texture_handle_resident(context->gpu, handle, resident); + + debug_printf("< %s()\n", __func__); } static uint64_t tegra_create_image_handle(struct pipe_context *pcontext, const struct pipe_image_view *image) { struct tegra_context *context = to_tegra_context(pcontext); + uint64_t handle; + + debug_printf("> %s(pcontext=%p, image=%p)\n", __func__, pcontext, image); - return context->gpu->create_image_handle(context->gpu, image); + handle = context->gpu->create_image_handle(context->gpu, image); + + debug_printf("< %s() = %" PRIu64 "\n", __func__, handle); + return handle; } static void tegra_delete_image_handle(struct pipe_context *pcontext, @@ -1188,7 +1727,12 @@ static void tegra_delete_image_handle(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, handle=%" PRIu64 ")\n", __func__, pcontext, + handle); + context->gpu->delete_image_handle(context->gpu, handle); + + debug_printf("< %s()\n", __func__); } static void tegra_make_image_handle_resident(struct pipe_context *pcontext, @@ -1197,8 +1741,13 @@ static void tegra_make_image_handle_resident(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, handle=%" PRIu64 ", access=%x, resident=%s)\n", + __func__, pcontext, handle, access, resident ? "yes" : "no"); + context->gpu->make_image_handle_resident(context->gpu, handle, access, resident); + + debug_printf("< %s()\n", __func__); } struct pipe_context * @@ -1208,6 +1757,9 @@ tegra_screen_context_create(struct pipe_screen *pscreen, void *priv, struct tegra_screen *screen = to_tegra_screen(pscreen); struct tegra_context *context; + debug_printf("> %s(pscreen=%p, priv=%p, flags=%x)\n", __func__, pscreen, + priv, flags); + context = calloc(1, sizeof(*context)); if (!context) return NULL; @@ -1378,11 +1930,13 @@ tegra_screen_context_create(struct pipe_screen *pscreen, void *priv, context->base.delete_image_handle = tegra_delete_image_handle; context->base.make_image_handle_resident = tegra_make_image_handle_resident; + debug_printf("< %s() = %p\n", __func__, &context->base); return &context->base; destroy: context->gpu->destroy(context->gpu); free: free(context); + debug_printf("< %s() = NULL\n", __func__); return NULL; } diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index 9ec3f6fe1d42..0fd37a5cc8af 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -35,7 +35,9 @@ #include "loader/loader.h" #include "pipe/p_state.h" #include "util/u_debug.h" +#include "util/u_format.h" #include "util/u_inlines.h" +#include "util/u_modifier.h" #include "state_tracker/drm_driver.h" @@ -49,8 +51,12 @@ static void tegra_screen_destroy(struct pipe_screen *pscreen) { struct tegra_screen *screen = to_tegra_screen(pscreen); + debug_printf("> %s(pscreen=%p)\n", __func__, pscreen); + screen->gpu->destroy(screen->gpu); free(pscreen); + + debug_printf("< %s()\n", __func__); } static const char * @@ -75,16 +81,28 @@ static int tegra_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; + + debug_printf("> %s(pscreen=%p, param=%d)\n", __func__, pscreen, param); - return screen->gpu->get_param(screen->gpu, param); + ret = screen->gpu->get_param(screen->gpu, param); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static float tegra_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param) { struct tegra_screen *screen = to_tegra_screen(pscreen); + float ret; - return screen->gpu->get_paramf(screen->gpu, param); + debug_printf("> %s(pscreen=%p, param=%d)\n", __func__, pscreen, param); + + ret = screen->gpu->get_paramf(screen->gpu, param); + + debug_printf("< %s() = %f\n", __func__, ret); + return ret; } static int @@ -92,8 +110,14 @@ tegra_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; + + debug_printf("> %s(pscreen=%p, param=%d)\n", __func__, pscreen, param); - return screen->gpu->get_shader_param(screen->gpu, shader, param); + ret = screen->gpu->get_shader_param(screen->gpu, shader, param); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int @@ -103,9 +127,16 @@ tegra_screen_get_video_param(struct pipe_screen *pscreen, enum pipe_video_cap param) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; + + debug_printf("> %s(pscreen=%p, profile=%d, entrypoint=%d, param=%d)\n", + __func__, pscreen, profile, entrypoint, param); - return screen->gpu->get_video_param(screen->gpu, profile, entrypoint, - param); + ret = screen->gpu->get_video_param(screen->gpu, profile, entrypoint, + param); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int @@ -115,17 +146,29 @@ tegra_screen_get_compute_param(struct pipe_screen *pscreen, void *retp) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; - return screen->gpu->get_compute_param(screen->gpu, ir_type, param, - retp); + debug_printf("> %s(pscreen=%p, ir_type=%d, param=%d, retp=%p)\n", + __func__, pscreen, ir_type, param, retp); + + ret = screen->gpu->get_compute_param(screen->gpu, ir_type, param, retp); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static uint64_t tegra_screen_get_timestamp(struct pipe_screen *pscreen) { struct tegra_screen *screen = to_tegra_screen(pscreen); + uint64_t ret; + + debug_printf("> %s(pscreen=%p)\n", __func__, pscreen); - return screen->gpu->get_timestamp(screen->gpu); + ret = screen->gpu->get_timestamp(screen->gpu); + + debug_printf("< %s() = %" PRIu64 "\n", __func__, ret); + return ret; } static bool @@ -137,10 +180,17 @@ tegra_screen_is_format_supported(struct pipe_screen *pscreen, unsigned usage) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; + + debug_printf("> %s(pscreen=%p, format=%d, target=%d, sample_count=%u, storage_sample_count=%u, usage=%x)\n", + __func__, pscreen, format, target, sample_count, storage_sample_count, usage); - return screen->gpu->is_format_supported(screen->gpu, format, target, - sample_count, storage_sample_count, - usage); + ret = screen->gpu->is_format_supported(screen->gpu, format, target, + sample_count, storage_sample_count, + usage); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static bool @@ -150,9 +200,16 @@ tegra_screen_is_video_format_supported(struct pipe_screen *pscreen, enum pipe_video_entrypoint entrypoint) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; - return screen->gpu->is_video_format_supported(screen->gpu, format, profile, - entrypoint); + debug_printf("> %s(pscreen=%p, format=%d, profile=%d, entrypoint=%d)\n", + __func__, pscreen, format, profile, entrypoint); + + ret = screen->gpu->is_video_format_supported(screen->gpu, format, profile, + entrypoint); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static bool @@ -160,8 +217,15 @@ tegra_screen_can_create_resource(struct pipe_screen *pscreen, const struct pipe_resource *template) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; + + debug_printf("> %s(pscreen=%p, template=%p)\n", __func__, pscreen, + template); - return screen->gpu->can_create_resource(screen->gpu, template); + ret = screen->gpu->can_create_resource(screen->gpu, template); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int tegra_screen_import_resource(struct tegra_screen *screen, @@ -171,20 +235,25 @@ static int tegra_screen_import_resource(struct tegra_screen *screen, bool status; int fd, err; + debug_printf("> %s(screen=%p, resource=%p, has_modifiers=%s)\n", __func__, screen, resource, has_modifiers ? "yes" : "no"); + memset(&handle, 0, sizeof(handle)); handle.modifier = DRM_FORMAT_MOD_INVALID; handle.type = WINSYS_HANDLE_TYPE_FD; status = screen->gpu->resource_get_handle(screen->gpu, NULL, resource->gpu, &handle, 0); - if (!status) - return -EINVAL; + if (!status) { + err = -EINVAL; + goto out; + } assert(handle.modifier != DRM_FORMAT_MOD_INVALID); if (handle.modifier == DRM_FORMAT_MOD_INVALID) { close(handle.handle); - return -EINVAL; + err = -EINVAL; + goto out; } resource->modifier = handle.modifier; @@ -192,11 +261,17 @@ static int tegra_screen_import_resource(struct tegra_screen *screen, fd = handle.handle; err = drmPrimeFDToHandle(screen->fd, fd, &resource->handle); - if (err < 0) + if (err < 0) { + fprintf(stderr, "drmPrimeFDToHandle() failed: %s\n", strerror(errno)); err = -errno; + close(fd); + goto out; + } close(fd); +out: + debug_printf("< %s() = %d\n", __func__, err); return err; } @@ -209,6 +284,24 @@ tegra_screen_resource_create(struct pipe_screen *pscreen, struct tegra_resource *resource; int err; + debug_printf("> %s(pscreen=%p, template=%p)\n", __func__, pscreen, + template); + debug_printf(" template: %p\n", template); + debug_printf(" target: %u\n", template->target); + debug_printf(" format: %u\n", template->format); + debug_printf(" width: %u\n", template->width0); + debug_printf(" height: %u\n", template->height0); + debug_printf(" depth: %u\n", template->depth0); + debug_printf(" array_size: %u\n", template->array_size); + debug_printf(" last_level: %u\n", template->last_level); + debug_printf(" nr_samples: %u\n", template->nr_samples); + debug_printf(" usage: %u\n", template->usage); + debug_printf(" bind: %x\n", template->bind); +#ifdef DEBUG + debug_print_bind_flags(" flags", template->bind); +#endif + debug_printf(" flags: %x\n", template->flags); + resource = calloc(1, sizeof(*resource)); if (!resource) return NULL; @@ -240,16 +333,20 @@ tegra_screen_resource_create(struct pipe_screen *pscreen, goto destroy; } + debug_printf(" gpu: %p\n", resource->gpu); + memcpy(&resource->base, resource->gpu, sizeof(*resource->gpu)); pipe_reference_init(&resource->base.reference, 1); resource->base.screen = &screen->base; + debug_printf("< %s() = %p\n", __func__, &resource->base); return &resource->base; destroy: screen->gpu->resource_destroy(screen->gpu, resource->gpu); free: free(resource); + debug_printf("< %s()\n", __func__); return NULL; } @@ -262,11 +359,15 @@ tegra_screen_resource_create_front(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); struct pipe_resource *resource; + debug_printf("> %s(pscreen=%p, template=%p, map_front_private=%p)\n", + __func__, pscreen, template, map_front_private); + resource = screen->gpu->resource_create_front(screen->gpu, template, map_front_private); if (resource) resource->screen = pscreen; + debug_printf("< %s() = %p\n", __func__, resource); return resource; } @@ -279,6 +380,25 @@ tegra_screen_resource_from_handle(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); struct tegra_resource *resource; + debug_printf("> %s(pscreen=%p, template=%p, handle=%p, usage=%u)\n", + __func__, pscreen, template, handle, usage); + debug_printf(" template: %p\n", template); + debug_printf(" target: %u\n", template->target); + debug_printf(" format: %u\n", template->format); + debug_print_format(" ", template->format); + debug_printf(" width: %u\n", template->width0); + debug_printf(" height: %u\n", template->height0); + debug_printf(" depth: %u\n", template->depth0); + debug_printf(" array_size: %u\n", template->array_size); + debug_printf(" last_level: %u\n", template->last_level); + debug_printf(" nr_samples: %u\n", template->nr_samples); + debug_printf(" usage: %u\n", template->usage); + debug_printf(" bind: %x\n", template->bind); +#ifdef DEBUG + debug_print_bind_flags(" flags", template->bind); +#endif + debug_printf(" flags: %x\n", template->flags); + resource = calloc(1, sizeof(*resource)); if (!resource) return NULL; @@ -294,6 +414,7 @@ tegra_screen_resource_from_handle(struct pipe_screen *pscreen, pipe_reference_init(&resource->base.reference, 1); resource->base.screen = &screen->base; + debug_printf("< %s() = %p\n", __func__, &resource->base); return &resource->base; } @@ -306,11 +427,15 @@ tegra_screen_resource_from_user_memory(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); struct pipe_resource *resource; + debug_printf("> %s(pscreen=%p, template=%p, buffer=%p)\n", __func__, + pscreen, template, buffer); + resource = screen->gpu->resource_from_user_memory(screen->gpu, template, buffer); if (resource) resource->screen = pscreen; + debug_printf("< %s() = %p\n", __func__, resource); return resource; } @@ -326,6 +451,25 @@ tegra_screen_resource_get_handle(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); bool ret = true; + debug_printf("> %s(pscreen=%p, presource=%p, handle=%p, usage=%u)\n", + __func__, pscreen, presource, handle, usage); + debug_printf(" resource: %p\n", presource); + debug_printf(" target: %u\n", presource->target); + debug_printf(" format: %u\n", presource->format); + debug_print_format(" ", presource->format); + debug_printf(" width: %u\n", presource->width0); + debug_printf(" height: %u\n", presource->height0); + debug_printf(" depth: %u\n", presource->depth0); + debug_printf(" array_size: %u\n", presource->array_size); + debug_printf(" last_level: %u\n", presource->last_level); + debug_printf(" nr_samples: %u\n", presource->nr_samples); + debug_printf(" usage: %u\n", presource->usage); + debug_printf(" bind: %x\n", presource->bind); +#ifdef DEBUG + debug_print_bind_flags(" flags", presource->bind); +#endif + debug_printf(" flags: %x\n", presource->flags); + /* * Assume that KMS handles for scanout resources will only ever be used * to pass buffers into Tegra DRM for display. In all other cases, return @@ -342,6 +486,13 @@ tegra_screen_resource_get_handle(struct pipe_screen *pscreen, resource->gpu, handle, usage); } + debug_printf(" handle: %u\n", handle->handle); + debug_printf(" type: %u\n", handle->type); + debug_printf(" stride: %u\n", handle->stride); + debug_printf(" offset: %u\n", handle->offset); + debug_printf(" modifier: %" PRIx64 " (%s)\n", handle->modifier, + util_modifier_name(handle->modifier)); + debug_printf("< %s() = %d\n", __func__, ret); return ret; } @@ -351,8 +502,13 @@ tegra_screen_resource_destroy(struct pipe_screen *pscreen, { struct tegra_resource *resource = to_tegra_resource(presource); + debug_printf("> %s(pscreen=%p, presource=%p)\n", __func__, pscreen, + presource); + pipe_resource_reference(&resource->gpu, NULL); free(resource); + + debug_printf("< %s()\n", __func__); } static void @@ -365,8 +521,14 @@ tegra_screen_flush_frontbuffer(struct pipe_screen *pscreen, { struct tegra_screen *screen = to_tegra_screen(pscreen); + debug_printf("> %s(pscreen=%p, resource=%p, level=%u, layer=%u, winsys_drawable_handle=%p, box=%p)\n", + __func__, pscreen, resource, level, layer, + winsys_drawable_handle, box); + screen->gpu->flush_frontbuffer(screen->gpu, resource, level, layer, winsys_drawable_handle, box); + + debug_printf("< %s()\n", __func__); } static void @@ -376,7 +538,12 @@ tegra_screen_fence_reference(struct pipe_screen *pscreen, { struct tegra_screen *screen = to_tegra_screen(pscreen); + debug_printf("> %s(pscreen=%p, ptr=%p, fence=%p)\n", __func__, pscreen, + ptr, fence); + screen->gpu->fence_reference(screen->gpu, ptr, fence); + + debug_printf("< %s()\n", __func__); } static bool @@ -387,10 +554,16 @@ tegra_screen_fence_finish(struct pipe_screen *pscreen, { struct tegra_context *context = to_tegra_context(pcontext); struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; + + debug_printf("> %s(pscreen=%p, pcontext=%p, fence=%p, timeout=%" PRIu64 ")\n", + __func__, pscreen, pcontext, fence, timeout); - return screen->gpu->fence_finish(screen->gpu, - context ? context->gpu : NULL, - fence, timeout); + ret = screen->gpu->fence_finish(screen->gpu, context ? context->gpu : NULL, + fence, timeout); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int @@ -398,8 +571,14 @@ tegra_screen_fence_get_fd(struct pipe_screen *pscreen, struct pipe_fence_handle *fence) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; - return screen->gpu->fence_get_fd(screen->gpu, fence); + debug_printf("> %s(pscreen=%p, fence=%p)\n", __func__, pscreen, fence); + + ret = screen->gpu->fence_get_fd(screen->gpu, fence); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int @@ -408,8 +587,15 @@ tegra_screen_get_driver_query_info(struct pipe_screen *pscreen, struct pipe_driver_query_info *info) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; + + debug_printf("> %s(pscreen=%p, index=%u, info=%p)\n", __func__, pscreen, + index, info); - return screen->gpu->get_driver_query_info(screen->gpu, index, info); + ret = screen->gpu->get_driver_query_info(screen->gpu, index, info); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static int @@ -418,8 +604,15 @@ tegra_screen_get_driver_query_group_info(struct pipe_screen *pscreen, struct pipe_driver_query_group_info *info) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; + + debug_printf("> %s(pscreen=%p, index=%u, info=%p)\n", __func__, pscreen, + index, info); - return screen->gpu->get_driver_query_group_info(screen->gpu, index, info); + ret = screen->gpu->get_driver_query_group_info(screen->gpu, index, info); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static void @@ -428,7 +621,11 @@ tegra_screen_query_memory_info(struct pipe_screen *pscreen, { struct tegra_screen *screen = to_tegra_screen(pscreen); + debug_printf("> %s(pscreen=%p, info=%p)\n", __func__, pscreen, info); + screen->gpu->query_memory_info(screen->gpu, info); + + debug_printf("< %s()\n", __func__); } static const void * @@ -439,9 +636,13 @@ tegra_screen_get_compiler_options(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); const void *options = NULL; + debug_printf("> %s(pscreen=%p, ir=%d, shader=%u)\n", __func__, pscreen, ir, + shader); + if (screen->gpu->get_compiler_options) options = screen->gpu->get_compiler_options(screen->gpu, ir, shader); + debug_printf("< %s() = %p\n", __func__, options); return options; } @@ -449,8 +650,14 @@ static struct disk_cache * tegra_screen_get_disk_shader_cache(struct pipe_screen *pscreen) { struct tegra_screen *screen = to_tegra_screen(pscreen); + struct disk_cache *cache; + + debug_printf("> %s(pscreen=%p)\n", __func__, pscreen); - return screen->gpu->get_disk_shader_cache(screen->gpu); + cache = screen->gpu->get_disk_shader_cache(screen->gpu); + + debug_printf("< %s() = %p\n", __func__, cache); + return cache; } static struct pipe_resource * @@ -462,7 +669,30 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); struct pipe_resource tmpl = *template; struct tegra_resource *resource; - int err; + int i, err; + + debug_printf("> %s(pscreen=%p, template=%p, modifiers=%p, count=%d)\n", + __func__, pscreen, template, modifiers, count); + debug_printf(" template: %p\n", template); + debug_printf(" target: %u\n", template->target); + debug_printf(" format: %u (%s)\n", template->format, util_format_name(template->format)); + debug_printf(" width: %u\n", template->width0); + debug_printf(" height: %u\n", template->height0); + debug_printf(" depth: %u\n", template->depth0); + debug_printf(" array_size: %u\n", template->array_size); + debug_printf(" last_level: %u\n", template->last_level); + debug_printf(" nr_samples: %u\n", template->nr_samples); + debug_printf(" usage: %u\n", template->usage); + debug_printf(" bind: %x\n", template->bind); +#ifdef DEBUG + debug_print_bind_flags(" flags", template->bind); +#endif + debug_printf(" flags: %x\n", template->flags); + debug_printf(" modifiers: %d\n", count); + + for (i = 0; i < count; i++) + debug_printf(" %d: %" PRIx64 " (%s)\n", i, modifiers[i], + util_modifier_name(modifiers[i])); resource = calloc(1, sizeof(*resource)); if (!resource) @@ -489,16 +719,20 @@ tegra_screen_resource_create_with_modifiers(struct pipe_screen *pscreen, if (err < 0) goto destroy; + debug_printf(" gpu: %p\n", resource->gpu); + memcpy(&resource->base, resource->gpu, sizeof(*resource->gpu)); pipe_reference_init(&resource->base.reference, 1); resource->base.screen = &screen->base; + debug_printf("< %s() = %p\n", __func__, resource); return &resource->base; destroy: screen->gpu->resource_destroy(screen->gpu, resource->gpu); free: free(resource); + debug_printf("< %s()\n", __func__); return NULL; } @@ -510,8 +744,13 @@ static void tegra_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen, { struct tegra_screen *screen = to_tegra_screen(pscreen); + debug_printf("> %s(pscreen=%p, format=%x, max=%d, modifiers=%p, external_only=%p, count=%p)\n", + __func__, pscreen, format, max, modifiers, external_only, count); + screen->gpu->query_dmabuf_modifiers(screen->gpu, format, max, modifiers, external_only, count); + + debug_printf("< %s()\n", __func__); } static struct pipe_memory_object * @@ -520,9 +759,16 @@ tegra_screen_memobj_create_from_handle(struct pipe_screen *pscreen, bool dedicated) { struct tegra_screen *screen = to_tegra_screen(pscreen); + struct pipe_memory_object *memobj; + + debug_printf("> %s(pscreen=%p, handle=%p, dedicated=%d))\n", __func__, + pscreen, handle, dedicated); - return screen->gpu->memobj_create_from_handle(screen->gpu, handle, - dedicated); + memobj = screen->gpu->memobj_create_from_handle(screen->gpu, handle, + dedicated); + + debug_printf("< %s() = %p\n", __func__, memobj); + return memobj; } struct pipe_screen * @@ -530,6 +776,8 @@ tegra_screen_create(int fd) { struct tegra_screen *screen; + debug_printf("> %s(fd=%d)\n", __func__, fd); + screen = calloc(1, sizeof(*screen)); if (!screen) return NULL; @@ -594,5 +842,6 @@ tegra_screen_create(int fd) screen->base.query_dmabuf_modifiers = tegra_screen_query_dmabuf_modifiers; screen->base.memobj_create_from_handle = tegra_screen_memobj_create_from_handle; + debug_printf("< %s() = %p\n", __func__, &screen->base); return &screen->base; } diff --git a/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c index e2a8efb0f63f..2875fd3e785c 100644 --- a/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c +++ b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c @@ -33,17 +33,23 @@ struct pipe_screen *tegra_drm_screen_create(int fd) { struct pipe_screen *screen; + debug_printf("> %s(fd=%d)\n", __func__, fd); + /* * NOTE: There are reportedly issues with reusing the file descriptor * as-is related to Xinerama. Duplicate it to side-step any issues. */ fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); - if (fd < 0) - return NULL; + if (fd < 0) { + screen = NULL; + goto out; + } screen = tegra_screen_create(fd); if (!screen) close(fd); +out: + debug_printf("< %s() = %p\n", __func__, screen); return screen; } |