summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-11-17 16:48:23 +0100
committerThierry Reding <treding@nvidia.com>2018-04-04 16:24:13 +0200
commiteb28f44371e04a7fc8428a86fd485c3a8c0dc96b (patch)
tree12e95121f5a89aca13be4410e1f12c3efde64daf
parent384873a960c67a28e27f49495bd124dd550688e9 (diff)
HACK: tegra: Add debugging output
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--src/gallium/drivers/tegra/tegra_context.c624
-rw-r--r--src/gallium/drivers/tegra/tegra_screen.c320
-rw-r--r--src/gallium/winsys/tegra/drm/tegra_drm_winsys.c10
3 files changed, 889 insertions, 65 deletions
diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c
index bbc03628336..4dfd40eae13 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 boolean
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 boolean
@@ -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, boolean 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, boolean 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
@@ -587,8 +869,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)\n",
+ __func__, pcontext, shader, start, count, buffers);
+
context->gpu->set_shader_buffers(context->gpu, shader, start, count,
buffers);
+
+ debug_printf("< %s()\n", __func__);
}
static void
@@ -598,8 +885,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
@@ -611,10 +903,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);
}
@@ -624,6 +930,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 *
@@ -634,11 +942,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
@@ -647,7 +962,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
@@ -658,8 +978,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
@@ -677,9 +1002,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
@@ -688,6 +1019,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);
@@ -696,6 +1029,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
@@ -705,7 +1040,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
@@ -721,8 +1061,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
@@ -740,9 +1085,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
@@ -755,7 +1106,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
@@ -769,8 +1125,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
@@ -779,7 +1141,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
@@ -789,8 +1156,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
@@ -799,7 +1171,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 *
@@ -811,6 +1187,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;
@@ -825,6 +1204,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;
}
@@ -834,9 +1214,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 *
@@ -848,6 +1232,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;
@@ -867,6 +1254,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;
}
@@ -876,9 +1265,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 *
@@ -892,6 +1286,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;
@@ -900,11 +1297,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;
}
@@ -916,7 +1316,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
@@ -926,9 +1331,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
@@ -957,8 +1367,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
@@ -966,7 +1382,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
@@ -974,7 +1394,11 @@ 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);
+
context->gpu->memory_barrier(context->gpu, flags);
+
+ debug_printf("< %s()\n", __func__);
}
static struct pipe_video_codec *
@@ -982,8 +1406,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 *
@@ -991,8 +1422,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 *
@@ -1000,8 +1438,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
@@ -1009,7 +1454,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
@@ -1017,7 +1466,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
@@ -1027,9 +1480,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
@@ -1039,10 +1497,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
@@ -1051,9 +1514,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
@@ -1062,15 +1529,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
@@ -1080,7 +1558,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
@@ -1090,15 +1573,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
@@ -1107,7 +1601,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
@@ -1116,7 +1614,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
@@ -1125,7 +1628,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 boolean
@@ -1139,10 +1647,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
@@ -1151,8 +1667,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,
@@ -1160,7 +1683,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,
@@ -1168,15 +1696,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,
@@ -1184,7 +1723,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,
@@ -1193,8 +1737,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 *
@@ -1204,6 +1753,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;
@@ -1374,11 +1926,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 e03e71f81a2..11e2f808620 100644
--- a/src/gallium/drivers/tegra/tegra_screen.c
+++ b/src/gallium/drivers/tegra/tegra_screen.c
@@ -34,7 +34,9 @@
#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"
@@ -48,8 +50,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 *
@@ -74,16 +80,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
@@ -91,8 +109,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);
+
+ ret = screen->gpu->get_shader_param(screen->gpu, shader, param);
- return screen->gpu->get_shader_param(screen->gpu, shader, param);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static int
@@ -102,9 +126,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);
+
+ ret = screen->gpu->get_video_param(screen->gpu, profile, entrypoint,
+ param);
- return screen->gpu->get_video_param(screen->gpu, profile, entrypoint,
- param);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static int
@@ -114,17 +145,29 @@ tegra_screen_get_compute_param(struct pipe_screen *pscreen,
void *retp)
{
struct tegra_screen *screen = to_tegra_screen(pscreen);
+ int ret;
+
+ debug_printf("> %s(pscreen=%p, ir_type=%d, param=%d, retp=%p)\n",
+ __func__, pscreen, ir_type, param, retp);
- return screen->gpu->get_compute_param(screen->gpu, 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);
+
+ ret = screen->gpu->get_timestamp(screen->gpu);
- return screen->gpu->get_timestamp(screen->gpu);
+ debug_printf("< %s() = %" PRIu64 "\n", __func__, ret);
+ return ret;
}
static boolean
@@ -135,9 +178,16 @@ 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, usage=%x)\n",
+ __func__, pscreen, format, target, sample_count, usage);
+
+ ret = screen->gpu->is_format_supported(screen->gpu, format, target,
+ sample_count, usage);
- return screen->gpu->is_format_supported(screen->gpu, format, target,
- sample_count, usage);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static boolean
@@ -147,9 +197,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;
+
+ debug_printf("> %s(pscreen=%p, format=%d, profile=%d, entrypoint=%d)\n",
+ __func__, pscreen, format, profile, entrypoint);
- return screen->gpu->is_video_format_supported(screen->gpu, 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 boolean
@@ -157,15 +214,24 @@ 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_open_render_node(void)
{
drmDevicePtr *devices, device;
int err, render = -ENOENT, fd;
- unsigned int num, i;
+ unsigned int num, i, j;
+
+ debug_printf("> %s()\n", __func__);
err = drmGetDevices2(0, NULL, 0);
if (err < 0)
@@ -186,6 +252,15 @@ static int tegra_open_render_node(void)
for (i = 0; i < num; i++) {
device = devices[i];
+ debug_printf("device: %p\n", device);
+ debug_printf(" available nodes: %x\n", device->available_nodes);
+ debug_printf(" bus: %d\n", device->bustype);
+
+ for (j = 0; j < DRM_NODE_MAX; j++) {
+ if (device->available_nodes & (1 << j))
+ debug_printf(" node: %s\n", device->nodes[j]);
+ }
+
if ((device->available_nodes & (1 << DRM_NODE_RENDER)) &&
(device->bustype == DRM_BUS_PLATFORM)) {
drmVersionPtr version;
@@ -205,6 +280,9 @@ static int tegra_open_render_node(void)
continue;
}
+ debug_printf("match found: %s (%s)\n", device->nodes[DRM_NODE_RENDER],
+ version->name);
+
drmFreeVersion(version);
render = fd;
break;
@@ -215,6 +293,7 @@ static int tegra_open_render_node(void)
free:
free(devices);
+ debug_printf("< %s() = %d\n", __func__, render);
return render;
}
@@ -226,20 +305,25 @@ static int tegra_screen_import_resource(struct tegra_screen *screen,
boolean 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 = DRM_API_HANDLE_TYPE_FD;
status = screen->gpu->resource_get_handle(screen->gpu, NULL, resource->gpu,
&handle, usage);
- 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;
@@ -247,11 +331,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;
}
@@ -264,6 +354,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;
@@ -295,16 +403,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;
}
@@ -317,11 +429,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;
}
@@ -334,6 +450,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;
@@ -349,6 +484,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;
}
@@ -361,11 +497,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;
}
@@ -381,6 +521,25 @@ tegra_screen_resource_get_handle(struct pipe_screen *pscreen,
struct tegra_screen *screen = to_tegra_screen(pscreen);
boolean 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
@@ -397,6 +556,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;
}
@@ -406,8 +572,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
@@ -420,8 +591,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
@@ -431,7 +608,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 boolean
@@ -442,10 +624,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);
+
+ ret = screen->gpu->fence_finish(screen->gpu, context ? context->gpu : NULL,
+ fence, timeout);
- return screen->gpu->fence_finish(screen->gpu,
- context ? context->gpu : NULL,
- fence, timeout);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static int
@@ -453,8 +641,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;
+
+ debug_printf("> %s(pscreen=%p, fence=%p)\n", __func__, pscreen, fence);
- return screen->gpu->fence_get_fd(screen->gpu, fence);
+ ret = screen->gpu->fence_get_fd(screen->gpu, fence);
+
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static int
@@ -463,8 +657,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;
- return screen->gpu->get_driver_query_info(screen->gpu, index, info);
+ debug_printf("> %s(pscreen=%p, index=%u, info=%p)\n", __func__, pscreen,
+ index, info);
+
+ ret = screen->gpu->get_driver_query_info(screen->gpu, index, info);
+
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static int
@@ -473,8 +674,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);
+
+ ret = screen->gpu->get_driver_query_group_info(screen->gpu, index, info);
- return screen->gpu->get_driver_query_group_info(screen->gpu, index, info);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
static void
@@ -483,7 +691,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 *
@@ -494,9 +706,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;
}
@@ -504,8 +720,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;
- return screen->gpu->get_disk_shader_cache(screen->gpu);
+ debug_printf("> %s(pscreen=%p)\n", __func__, pscreen);
+
+ cache = screen->gpu->get_disk_shader_cache(screen->gpu);
+
+ debug_printf("< %s() = %p\n", __func__, cache);
+ return cache;
}
static struct pipe_resource *
@@ -517,7 +739,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)
@@ -544,16 +789,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;
}
@@ -565,8 +814,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 *
@@ -575,9 +829,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 *
@@ -585,6 +846,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;
@@ -649,5 +912,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 e2a8efb0f63..2875fd3e785 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;
}