panfrost: Add Z/S and MRT BOs to the job
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 15 Jul 2019 22:16:08 +0000 (15:16 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 16 Jul 2019 14:19:28 +0000 (07:19 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_drm.c
src/gallium/drivers/panfrost/pan_fragment.c

index 8ff761ab2bde9a14f27c7b1f0298c71d6d2af75d..5bd2e340751f19ce9cbd789bc47acc36f7f03297 100644 (file)
@@ -293,12 +293,6 @@ panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool
         }
 
         if (job->first_tiler.gpu || job->clear) {
-                struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
-                if (surf) {
-                        struct panfrost_resource *res = pan_resource(surf->texture);
-                        assert(res->bo);
-                        panfrost_job_add_bo(job, res->bo);
-                }
                 ret = panfrost_drm_submit_job(ctx, panfrost_fragment_job(ctx, has_draws), PANFROST_JD_REQ_FS);
                 assert(!ret);
         }
index fe21cd094dfa2f8fb620ee8c54c6a38ea05828bf..ab42e763be75fa7231836584cf0954c4de4fe669 100644 (file)
 /* Mark a surface as written */
 
 static void
-panfrost_initialize_surface(struct pipe_surface *surf)
+panfrost_initialize_surface(
+                struct panfrost_job *batch,
+                struct pipe_surface *surf)
 {
         unsigned level = surf->u.tex.level;
         struct panfrost_resource *rsrc = pan_resource(surf->texture);
 
         rsrc->slices[level].initialized = true;
+
+        assert(rsrc->bo);
+        panfrost_job_add_bo(batch, rsrc->bo);
 }
 
 /* Generate a fragment job. This should be called once per frame. (According to
@@ -49,15 +54,18 @@ panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws)
                                panfrost_sfbd_fragment(ctx, has_draws) :
                                panfrost_mfbd_fragment(ctx, has_draws);
 
-        /* Mark the affected buffers as initialized, since we're writing to it */
+        /* Mark the affected buffers as initialized, since we're writing to it.
+         * Also, add the surfaces we're writing to to the batch */
+
         struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
+        struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
 
         for (unsigned i = 0; i < fb->nr_cbufs; ++i) {
-                panfrost_initialize_surface(fb->cbufs[i]);
+                panfrost_initialize_surface(batch, fb->cbufs[i]);
         }
 
         if (fb->zsbuf)
-                panfrost_initialize_surface(fb->zsbuf);
+                panfrost_initialize_surface(batch, fb->zsbuf);
 
         struct mali_job_descriptor_header header = {
                 .job_type = JOB_TYPE_FRAGMENT,