diff options
-rw-r--r-- | src/gallium/drivers/tegra/tegra_context.c | 297 | ||||
-rw-r--r-- | src/gallium/drivers/tegra/tegra_resource.c | 43 | ||||
-rw-r--r-- | src/gallium/drivers/tegra/tegra_screen.c | 87 | ||||
-rw-r--r-- | src/gallium/winsys/tegra/drm/tegra_drm_winsys.c | 9 |
4 files changed, 411 insertions, 25 deletions
diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c index a7a7690ec7bb..389bc8bc6a59 100644 --- a/src/gallium/drivers/tegra/tegra_context.c +++ b/src/gallium/drivers/tegra/tegra_context.c @@ -35,8 +35,12 @@ tegra_destroy(struct pipe_context *pcontext) { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p)\n", __func__, pcontext); + context->gpu->destroy(context->gpu); free(context); + + debug_printf("< %s()\n", __func__); } static void @@ -46,13 +50,24 @@ tegra_draw_vbo(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct pipe_draw_info info; + debug_printf("> %s(pcontext=%p, pinfo=%p)\n", __func__, pcontext, + pinfo); + debug_printf(" pinfo:\n"); + debug_printf(" indexed: %d\n", pinfo->indexed); + 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) { + debug_printf(" unwrapping pipe_draw_info\n"); memcpy(&info, pinfo, sizeof(info)); info.indirect = tegra_resource_unwrap(info.indirect); pinfo = &info; } context->gpu->draw_vbo(context->gpu, pinfo); + + debug_printf("< %s()\n", __func__); } static void * @@ -60,8 +75,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 @@ -70,7 +91,11 @@ tegra_bind_blend_state(struct pipe_context *pcontext, { 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 @@ -79,7 +104,11 @@ tegra_delete_blend_state(struct pipe_context *pcontext, { 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 * @@ -87,8 +116,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; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_sampler_state(context->gpu, cso); - return context->gpu->create_sampler_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -100,8 +135,14 @@ tegra_bind_sampler_states(struct pipe_context *pcontext, { 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 @@ -110,7 +151,11 @@ tegra_delete_sampler_state(struct pipe_context *pcontext, { 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 * @@ -118,8 +163,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); + + so = context->gpu->create_rasterizer_state(context->gpu, cso); - return context->gpu->create_rasterizer_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -128,7 +179,11 @@ tegra_bind_rasterizer_state(struct pipe_context *pcontext, { 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 @@ -137,7 +192,11 @@ tegra_delete_rasterizer_state(struct pipe_context *pcontext, { 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 * @@ -145,9 +204,15 @@ 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 @@ -156,7 +221,11 @@ tegra_bind_depth_stencil_alpha_state(struct pipe_context *pcontext, { 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 @@ -165,7 +234,11 @@ tegra_delete_depth_stencil_alpha_state(struct pipe_context *pcontext, { 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 * @@ -173,8 +246,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 @@ -183,7 +262,11 @@ tegra_bind_fs_state(struct pipe_context *pcontext, { 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 @@ -192,7 +275,11 @@ tegra_delete_fs_state(struct pipe_context *pcontext, { 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 * @@ -200,8 +287,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); + + so = context->gpu->create_vs_state(context->gpu, cso); - return context->gpu->create_vs_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -210,7 +303,11 @@ tegra_bind_vs_state(struct pipe_context *pcontext, { 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 @@ -219,7 +316,11 @@ tegra_delete_vs_state(struct pipe_context *pcontext, { 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 * @@ -227,8 +328,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; + + debug_printf("> %s(pcontext=%p, cso=%p)\n", __func__, pcontext, cso); + + so = context->gpu->create_gs_state(context->gpu, cso); - return context->gpu->create_gs_state(context->gpu, cso); + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -237,7 +344,11 @@ tegra_bind_gs_state(struct pipe_context *pcontext, { 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 @@ -246,7 +357,11 @@ tegra_delete_gs_state(struct pipe_context *pcontext, { 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 * @@ -255,10 +370,17 @@ 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); - return context->gpu->create_vertex_elements_state(context->gpu, - num_elements, - elements); + so = context->gpu->create_vertex_elements_state(context->gpu, + num_elements, + elements); + + debug_printf("< %s() = %p\n", __func__, so); + return so; } static void @@ -267,7 +389,11 @@ tegra_bind_vertex_elements_state(struct pipe_context *pcontext, { 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 @@ -276,7 +402,11 @@ tegra_delete_vertex_elements_state(struct pipe_context *pcontext, { 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 @@ -288,13 +418,20 @@ tegra_set_constant_buffer(struct pipe_context *pcontext, 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 @@ -305,21 +442,29 @@ 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 @@ -328,7 +473,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 @@ -339,8 +489,13 @@ tegra_set_scissor_states(struct pipe_context *pcontext, { 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 @@ -351,8 +506,14 @@ tegra_set_viewport_states(struct pipe_context *pcontext, { 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 @@ -366,11 +527,17 @@ tegra_set_sampler_views(struct pipe_context *pcontext, 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 @@ -381,8 +548,13 @@ tegra_set_shader_resources(struct pipe_context *pcontext, { struct tegra_context *context = to_tegra_context(pcontext); + debug_printf("> %s(pcontext=%p, startt=%u, count=%u, resources=%p)\n", + __func__, pcontext, start, count, resources); + context->gpu->set_shader_resources(context->gpu, start, count, resources); + + debug_printf("< %s()\n", __func__); } static void @@ -395,17 +567,33 @@ tegra_set_vertex_buffers(struct pipe_context *pcontext, 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(" offset: %u\n", buffers[i].buffer_offset); + debug_printf(" buffer: %p\n", buffers[i].buffer); + debug_printf(" user: %p\n", buffers[i].user_buffer); + } + memcpy(buf, buffers, num_buffers * sizeof(struct pipe_vertex_buffer)); - for (i = 0; i < num_buffers; i++) + for (i = 0; i < num_buffers; i++) { + debug_printf(" %u: %p -> %p\n", i, buf[i].buffer, + tegra_resource_unwrap(buf[i].buffer)); buf[i].buffer = tegra_resource_unwrap(buf[i].buffer); + } buffers = buf; } context->gpu->set_vertex_buffers(context->gpu, start_slot, num_buffers, buffers); + + debug_printf("< %s()\n", __func__); } static void @@ -415,13 +603,20 @@ tegra_set_index_buffer(struct pipe_context *pcontext, struct tegra_context *context = to_tegra_context(pcontext); struct pipe_index_buffer buf; + debug_printf("> %s(pcontext=%p, buffer=%p)\n", __func__, pcontext, + buffer); + if (buffer) { memcpy(&buf, buffer, sizeof(buf)); + debug_printf(" buffer: %p -> %p\n", buf.buffer, + tegra_resource_unwrap(buf.buffer)); buf.buffer = tegra_resource_unwrap(buf.buffer); buffer = &buf; } context->gpu->set_index_buffer(context->gpu, buffer); + + debug_printf("< %s()\n", __func__); } static struct pipe_stream_output_target * @@ -432,11 +627,19 @@ 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; - return context->gpu->create_stream_output_target(context->gpu, - resource->gpu, - buffer_offset, - buffer_size); + 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); + + debug_printf("< %s() = %p\n", __func__, target); + return target; } static void @@ -445,7 +648,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 @@ -456,8 +664,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 @@ -467,6 +680,9 @@ tegra_blit(struct pipe_context *pcontext, 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); @@ -475,6 +691,8 @@ tegra_blit(struct pipe_context *pcontext, } context->gpu->blit(context->gpu, pinfo); + + debug_printf("< %s()\n", __func__); } static void @@ -486,7 +704,12 @@ tegra_clear(struct pipe_context *pcontext, { 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 @@ -496,7 +719,12 @@ tegra_flush(struct pipe_context *pcontext, { 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 struct pipe_sampler_view * @@ -508,6 +736,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, ptexture=%p, template=%p)\n", + __func__, pcontext, ptexture, template); + view = calloc(1, sizeof(*view)); if (!view) return NULL; @@ -523,6 +754,7 @@ tegra_create_sampler_view(struct pipe_context *pcontext, pipe_resource_reference(&view->base.texture, ptexture); view->base.context = pcontext; + debug_printf("< %s() = %p\n", __func__, &view->base); return &view->base; } @@ -532,9 +764,14 @@ 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 void @@ -544,7 +781,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, presource=%p)\n", __func__, pcontext, + presource); + context->gpu->flush_resource(context->gpu, resource->gpu); + + debug_printf("< %s()\n", __func__); } static void * @@ -559,6 +801,10 @@ 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; @@ -570,11 +816,14 @@ tegra_transfer_map(struct pipe_context *pcontext, 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; } @@ -585,9 +834,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 @@ -603,9 +857,15 @@ tegra_transfer_inline_write(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->transfer_inline_write(context->gpu, resource->gpu, level, usage, box, data, stride, layer_stride); + + debug_printf("< %s()\n", __func__); } struct pipe_context * @@ -614,6 +874,8 @@ tegra_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)\n", __func__, pscreen, priv); + context = calloc(1, sizeof(*context)); if (!context) return NULL; @@ -695,5 +957,6 @@ tegra_context_create(struct pipe_screen *pscreen, void *priv) context->base.transfer_unmap = tegra_transfer_unmap; context->base.transfer_inline_write = tegra_transfer_inline_write; + debug_printf("< %s() = %p\n", __func__, &context->base); return &context->base; } diff --git a/src/gallium/drivers/tegra/tegra_resource.c b/src/gallium/drivers/tegra/tegra_resource.c index 8c5b7d4e41fc..3b8accad9f3d 100644 --- a/src/gallium/drivers/tegra/tegra_resource.c +++ b/src/gallium/drivers/tegra/tegra_resource.c @@ -47,6 +47,23 @@ tegra_resource_create(struct pipe_screen *pscreen, struct tegra_screen *screen = to_tegra_screen(pscreen); struct tegra_resource *resource; + 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); + debug_printf(" flags: %x\n", template->flags); + */ + resource = calloc(1, sizeof(*resource)); if (!resource) return NULL; @@ -104,10 +121,13 @@ tegra_resource_create(struct pipe_screen *pscreen, goto free; } + 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: @@ -125,6 +145,9 @@ tegra_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)\n", __func__, + pscreen, template); + resource = calloc(1, sizeof(*resource)); if (!resource) return NULL; @@ -141,6 +164,7 @@ tegra_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; } @@ -153,6 +177,9 @@ tegra_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)\n", __func__, + pscreen, presource, handle); + if (presource->bind & PIPE_BIND_SCANOUT) { handle->handle = resource->handle; handle->stride = resource->stride; @@ -162,6 +189,7 @@ tegra_resource_get_handle(struct pipe_screen *pscreen, handle); } + debug_printf("< %s() = %d\n", __func__, ret); return ret; } @@ -171,8 +199,13 @@ tegra_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__); } struct pipe_surface * @@ -184,6 +217,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; @@ -204,6 +240,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; } @@ -213,7 +251,12 @@ 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__); } diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index aa7bf65cb7ec..b6394faa0c61 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -54,24 +54,42 @@ 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 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; + + debug_printf("> %s(pscreen=%p, param=%d)\n", __func__, pscreen, + param); + + ret = screen->gpu->get_paramf(screen->gpu, param); - return screen->gpu->get_paramf(screen->gpu, param); + debug_printf("< %s() = %f\n", __func__, ret); + return ret; } static int @@ -80,8 +98,15 @@ tegra_screen_get_shader_param(struct pipe_screen *pscreen, enum pipe_shader_cap param) { struct tegra_screen *screen = to_tegra_screen(pscreen); + int ret; - return screen->gpu->get_shader_param(screen->gpu, shader, param); + debug_printf("> %s(pscreen=%p, param=%d)\n", __func__, pscreen, + param); + + ret = screen->gpu->get_shader_param(screen->gpu, shader, param); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static boolean @@ -92,9 +117,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); - return screen->gpu->is_format_supported(screen->gpu, format, target, - sample_count, usage); + ret = screen->gpu->is_format_supported(screen->gpu, format, target, + sample_count, usage); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static void @@ -104,7 +136,12 @@ tegra_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 @@ -112,8 +149,15 @@ tegra_fence_signalled(struct pipe_screen *pscreen, struct pipe_fence_handle *fence) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; - return screen->gpu->fence_signalled(screen->gpu, fence); + debug_printf("> %s(pscreen=%p, fence=%p)\n", __func__, pscreen, + fence); + + ret = screen->gpu->fence_signalled(screen->gpu, fence); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static boolean @@ -122,8 +166,15 @@ tegra_fence_finish(struct pipe_screen *pscreen, uint64_t timeout) { struct tegra_screen *screen = to_tegra_screen(pscreen); + boolean ret; + + debug_printf("> %s(pscreen=%p, fence=%p, timeout=%llu)\n", __func__, + pscreen, fence, timeout); - return screen->gpu->fence_finish(screen->gpu, fence, timeout); + ret = screen->gpu->fence_finish(screen->gpu, fence, timeout); + + debug_printf("< %s() = %d\n", __func__, ret); + return ret; } static struct udev_device *udev_device_new_from_fd(struct udev *udev, int fd) @@ -151,14 +202,20 @@ static struct udev_device *udev_device_get_root(struct udev_device *device) { struct udev_device *parent; + debug_printf("> %s(device=%p)\n", __func__, device); + debug_printf(" syspath: %s\n", udev_device_get_syspath(device)); + while (true) { parent = udev_device_get_parent(device); if (!parent) break; + debug_printf(" parent: %p\n", parent); + debug_printf(" syspath: %s\n", udev_device_get_syspath(parent)); device = parent; } + debug_printf("< %s() = %p\n", __func__, device); return device; } @@ -187,6 +244,8 @@ static int tegra_open_render_node(int fd) return -ENODEV; } + debug_printf("path: %s\n", udev_device_get_devpath(display)); + parent = udev_device_get_parent(display); if (!parent) { udev_device_unref(display); @@ -194,6 +253,8 @@ static int tegra_open_render_node(int fd) return -ENODEV; } + debug_printf("parent: %s\n", udev_device_get_syspath(parent)); + display = parent; root = udev_device_get_root(display); @@ -203,6 +264,8 @@ static int tegra_open_render_node(int fd) return -ENODEV; } + debug_printf("root: %s\n", udev_device_get_syspath(root)); + enumerate = udev_enumerate_new(udev); if (!enumerate) { udev_device_unref(display); @@ -216,6 +279,8 @@ static int tegra_open_render_node(int fd) list = udev_enumerate_get_list_entry(enumerate); + debug_printf("devices:\n"); + udev_list_entry_foreach(entry, list) { const char *path = udev_list_entry_get_name(entry); struct udev_device *device, *bus; @@ -248,6 +313,8 @@ static int tegra_open_render_node(int fd) /* both devices need to be on the same bus, though */ if (udev_device_match(bus, root)) { + debug_printf("match found: %s\n", path); + fd = open(path, O_RDWR); if (fd < 0) fd = -errno; @@ -267,6 +334,8 @@ tegra_screen_create(int fd) { struct tegra_screen *screen; + debug_printf("> %s()\n", __func__); + screen = calloc(1, sizeof(*screen)); if (!screen) return NULL; @@ -289,6 +358,9 @@ tegra_screen_create(int fd) return NULL; } + debug_printf("GPU: %p\n", screen->gpu); + debug_printf(" fd: %d\n", screen->gpu_fd); + screen->base.get_name = tegra_get_name; screen->base.get_vendor = tegra_get_vendor; screen->base.destroy = tegra_screen_destroy; @@ -307,5 +379,6 @@ tegra_screen_create(int fd) screen->base.fence_signalled = tegra_fence_signalled; screen->base.fence_finish = tegra_fence_finish; + 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 99b0e1649026..037a043360ab 100644 --- a/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c +++ b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c @@ -29,5 +29,12 @@ struct pipe_screen *tegra_drm_screen_create(int fd); struct pipe_screen *tegra_drm_screen_create(int fd) { - return tegra_screen_create(fd); + struct pipe_screen *screen; + + debug_printf("> %s(fd=%d)\n", __func__, fd); + + screen = tegra_screen_create(fd); + + debug_printf("< %s() = %p\n", __func__, screen); + return screen; } |