Mesa (master): panfrost: Add Z/S and MRT BOs to the job

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 16 14:23:05 UTC 2019


Module: Mesa
Branch: master
Commit: f7621a8c5f6f61f41196aa797c439cbee64d5233
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7621a8c5f6f61f41196aa797c439cbee64d5233

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Jul 15 15:16:08 2019 -0700

panfrost: Add Z/S and MRT BOs to the job

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_drm.c      |  6 ------
 src/gallium/drivers/panfrost/pan_fragment.c | 16 ++++++++++++----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 8ff761ab2bd..5bd2e340751 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -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);
         }
diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium/drivers/panfrost/pan_fragment.c
index fe21cd094df..ab42e763be7 100644
--- a/src/gallium/drivers/panfrost/pan_fragment.c
+++ b/src/gallium/drivers/panfrost/pan_fragment.c
@@ -31,12 +31,17 @@
 /* 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,




More information about the mesa-commit mailing list