diff options
author | Boris Brezillon <[email protected]> | 2020-03-06 08:57:31 +0100 |
---|---|---|
committer | Boris Brezillon <[email protected]> | 2020-03-10 12:47:34 +0100 |
commit | 251e685e726173f7256d12bdb6ce882859994793 (patch) | |
tree | 972febd63f8180deb8ae84be682cd11b9b3a30ba /src/gallium/drivers | |
parent | 5d9995e82cdbf41efb7fb886922244eb958e4a9d (diff) |
panfrost: Inline panfrost_queue_draw() and panfrost_emit_for_draw()
Now that panfrost_queue_draw() and panfrost_emit_for_draw() are
small enough, we can move the code to panfrost_draw_vbo() and have all
vt and emit calls grouped in one place.
Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 96 |
1 files changed, 36 insertions, 60 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 1208097f990..f09c0edf385 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -250,64 +250,6 @@ panfrost_ubo_count(struct panfrost_context *ctx, enum pipe_shader_type stage) return 32 - __builtin_clz(mask); } -/* Go through dirty flags and actualise them in the cmdstream. */ - -static void -panfrost_emit_for_draw(struct panfrost_context *ctx) -{ - struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - - panfrost_batch_add_fbo_bos(batch); - - for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) - panfrost_vt_attach_framebuffer(ctx, &ctx->payloads[i]); - - panfrost_emit_vertex_data(batch); - - /* Varyings emitted for -all- geometry */ - unsigned total_count = ctx->padded_count * ctx->instance_count; - panfrost_emit_varying_descriptor(ctx, total_count); - - panfrost_batch_set_requirements(batch); - - panfrost_vt_update_rasterizer(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]); - panfrost_vt_update_occlusion_query(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]); - - panfrost_emit_shader_meta(batch, PIPE_SHADER_VERTEX, - &ctx->payloads[PIPE_SHADER_VERTEX]); - panfrost_emit_shader_meta(batch, PIPE_SHADER_FRAGMENT, - &ctx->payloads[PIPE_SHADER_FRAGMENT]); - - panfrost_emit_vertex_attr_meta(batch, - &ctx->payloads[PIPE_SHADER_VERTEX]); - - for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) { - panfrost_emit_sampler_descriptors(batch, i, &ctx->payloads[i]); - panfrost_emit_texture_descriptors(batch, i, &ctx->payloads[i]); - panfrost_emit_const_buf(batch, i, &ctx->payloads[i]); - } - - /* TODO: Upload the viewport somewhere more appropriate */ - - panfrost_emit_viewport(batch, &ctx->payloads[PIPE_SHADER_FRAGMENT]); -} - -/* Corresponds to exactly one draw, but does not submit anything */ - -static void -panfrost_queue_draw(struct panfrost_context *ctx) -{ - /* Handle dirty flags now */ - panfrost_emit_for_draw(ctx); - - struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - - panfrost_emit_vertex_tiler_jobs(batch, - &ctx->payloads[PIPE_SHADER_VERTEX], - &ctx->payloads[PIPE_SHADER_FRAGMENT]); - panfrost_batch_adjust_stack_size(batch); -} - /* The entire frame is in memory -- send it off to the kernel! */ void @@ -468,7 +410,10 @@ panfrost_draw_vbo( /* Now that we have a guaranteed terminating path, find the job. * Assignment commented out to prevent unused warning */ - /* struct panfrost_batch *batch = */ panfrost_get_batch_for_fbo(ctx); + struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); + + panfrost_batch_add_fbo_bos(batch); + panfrost_batch_set_requirements(batch); /* Take into account a negative bias */ ctx->vertex_count = info->count + abs(info->index_bias); @@ -482,6 +427,12 @@ panfrost_draw_vbo( &ctx->payloads[PIPE_SHADER_FRAGMENT], &vertex_count, &ctx->padded_count); + for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) + panfrost_vt_attach_framebuffer(ctx, &ctx->payloads[i]); + + panfrost_vt_update_rasterizer(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]); + panfrost_vt_update_occlusion_query(ctx, &ctx->payloads[PIPE_SHADER_FRAGMENT]); + panfrost_statistics_record(ctx, info); /* Dispatch "compute jobs" for the vertex/tiler pair as (1, @@ -493,8 +444,33 @@ panfrost_draw_vbo( 1, vertex_count, info->instance_count, 1, 1, 1); + /* Emit all sort of descriptors. */ + panfrost_emit_vertex_data(batch); + panfrost_emit_varying_descriptor(ctx, + ctx->padded_count * + ctx->instance_count); + panfrost_emit_shader_meta(batch, PIPE_SHADER_VERTEX, + &ctx->payloads[PIPE_SHADER_VERTEX]); + panfrost_emit_shader_meta(batch, PIPE_SHADER_FRAGMENT, + &ctx->payloads[PIPE_SHADER_FRAGMENT]); + panfrost_emit_vertex_attr_meta(batch, + &ctx->payloads[PIPE_SHADER_VERTEX]); + + for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) { + panfrost_emit_sampler_descriptors(batch, i, &ctx->payloads[i]); + panfrost_emit_texture_descriptors(batch, i, &ctx->payloads[i]); + panfrost_emit_const_buf(batch, i, &ctx->payloads[i]); + } + + panfrost_emit_viewport(batch, &ctx->payloads[PIPE_SHADER_FRAGMENT]); + /* Fire off the draw itself */ - panfrost_queue_draw(ctx); + panfrost_emit_vertex_tiler_jobs(batch, + &ctx->payloads[PIPE_SHADER_VERTEX], + &ctx->payloads[PIPE_SHADER_FRAGMENT]); + + /* Adjust the batch stack size based on the new shader stack sizes. */ + panfrost_batch_adjust_stack_size(batch); /* Increment transform feedback offsets */ panfrost_update_streamout_offsets(ctx); |