Mesa (master): panfrost: Add panfrost_job_type_for_pipe helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 12 21:33:43 UTC 2019
Module: Mesa
Branch: master
Commit: f8a4090f80cfd87d9648e90c39292b0d0611b2e6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8a4090f80cfd87d9648e90c39292b0d0611b2e6
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jun 4 23:47:35 2019 +0000
panfrost: Add panfrost_job_type_for_pipe helper
This logic is repeated in a bunch of places and will only grow worse as
we support more job types; collect it.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_context.c | 31 ++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index cacad77d162..d9939641cff 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -53,6 +53,31 @@ extern const char *pan_counters_base;
/* Do not actually send anything to the GPU; merely generate the cmdstream as fast as possible. Disables framebuffer writes */
//#define DRY_RUN
+static enum mali_job_type
+panfrost_job_type_for_pipe(enum pipe_shader_type type)
+{
+ switch (type) {
+ case PIPE_SHADER_VERTEX:
+ return JOB_TYPE_VERTEX;
+
+ case PIPE_SHADER_FRAGMENT:
+ /* Note: JOB_TYPE_FRAGMENT is different.
+ * JOB_TYPE_FRAGMENT actually executes the
+ * fragment shader, but JOB_TYPE_TILER is how you
+ * specify it*/
+ return JOB_TYPE_TILER;
+
+ case PIPE_SHADER_GEOMETRY:
+ return JOB_TYPE_GEOMETRY;
+
+ case PIPE_SHADER_COMPUTE:
+ return JOB_TYPE_COMPUTE;
+
+ default:
+ unreachable("Unsupported shader stage");
+ }
+}
+
static void
panfrost_enable_checksum(struct panfrost_context *ctx, struct panfrost_resource *rsrc)
{
@@ -1808,7 +1833,8 @@ panfrost_bind_fs_state(
/* Now we have a variant selected, so compile and go */
if (!shader_state->compiled) {
- panfrost_shader_compile(ctx, shader_state->tripipe, NULL, JOB_TYPE_TILER, shader_state);
+ panfrost_shader_compile(ctx, shader_state->tripipe, NULL,
+ panfrost_job_type_for_pipe(PIPE_SHADER_FRAGMENT), shader_state);
shader_state->compiled = true;
}
}
@@ -1834,7 +1860,8 @@ panfrost_bind_vs_state(
ctx->vs->variants[0].tripipe = (struct mali_shader_meta *) transfer.cpu;
ctx->vs->variants[0].tripipe_gpu = transfer.gpu;
- panfrost_shader_compile(ctx, ctx->vs->variants[0].tripipe, NULL, JOB_TYPE_VERTEX, &ctx->vs->variants[0]);
+ panfrost_shader_compile(ctx, ctx->vs->variants[0].tripipe, NULL,
+ panfrost_job_type_for_pipe(PIPE_SHADER_VERTEX), &ctx->vs->variants[0]);
ctx->vs->variants[0].compiled = true;
}
}
More information about the mesa-commit
mailing list