panfrost: Figure out job requirements in pan_job.c
authorRohan Garg <rohan.garg@collabora.com>
Wed, 5 Jun 2019 15:49:14 +0000 (17:49 +0200)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 18 Jun 2019 16:52:20 +0000 (09:52 -0700)
Requirements for a job should be figured out in pan_job.c

v2: [Alyssa] Fix early return

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h

index 0441c3d573c52f3e39b4964dd518d7a8a53b1aca..65f9255dd725fc765637a935e79f6f3cdc7e6089 100644 (file)
@@ -1103,14 +1103,6 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                 SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_MSAA, !msaa);
         }
 
-        /* Enable job requirements at draw-time */
-
-        if (msaa)
-                job->requirements |= PAN_REQ_MSAA;
-
-        if (ctx->depth_stencil->depth.writemask)
-                job->requirements |= PAN_REQ_DEPTH_WRITE;
-
         if (ctx->occlusion_query) {
                 ctx->payload_tiler.gl_enables |= MALI_OCCLUSION_QUERY | MALI_OCCLUSION_PRECISE;
                 ctx->payload_tiler.postfix.occlusion_counter = ctx->occlusion_query->transfer.gpu;
index 333c9f1f1471a40fac2a6715559ba003b2f792fd..a7fc5f975cfac0f72286dbe65dc007264da57e82 100644 (file)
@@ -89,6 +89,7 @@ panfrost_get_job(struct panfrost_context *ctx,
 
         memcpy(&job->key, &key, sizeof(key));
         _mesa_hash_table_insert(ctx->jobs, &job->key, job);
+        panfrost_job_set_requirements(ctx, job);
 
         return job;
 }
@@ -164,6 +165,17 @@ panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job)
         ctx->tiler_job_count = 0;
 }
 
+void
+panfrost_job_set_requirements(struct panfrost_context *ctx,
+                         struct panfrost_job *job)
+{
+        if (ctx->rasterizer && ctx->rasterizer->base.multisample)
+                job->requirements |= PAN_REQ_MSAA;
+
+        if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask)
+                job->requirements |= PAN_REQ_DEPTH_WRITE;
+}
+
 void
 panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
                                 struct pipe_resource *prsc)
index afc9ac4e58f27902b9048a7406383a9c806829e3..cbfd6cb0c7f495bad356c5ffd3f9c321403ad822 100644 (file)
@@ -90,4 +90,8 @@ panfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost,
 
 void
 panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job);
+
+void
+panfrost_job_set_requirements(struct panfrost_context *ctx,
+                         struct panfrost_job *job);
 #endif