Module: Mesa
Branch: staging/21.1
Commit: c044a30f9ed5051a860bee584ebf48e8547a5d3d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c044a30f9ed5051a860bee584ebf48e8547a5d3d

Author: Icecream95 <i...@disroot.org>
Date:   Sat May  1 22:45:11 2021 +1200

panfrost: Always write reloaded tiles when making CRC data valid

If CRC data is currently invalid and the current batch will make it
valid, write even clean tiles to make sure CRC data is updated.

Fixes: 8ba2f9f6985 ("panfrost: Create a blitter library to replace the existing 
preload helpers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10566>
(cherry picked from commit e241ca6e9c6cefa8dae04501ecbef0783771aca9)

---

 .pick_status.json              |  2 +-
 src/panfrost/lib/pan_blitter.c | 27 ++++++++++++++++++++++++---
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ecb39411597..6a39f1b8b03 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1777,7 +1777,7 @@
         "description": "panfrost: Always write reloaded tiles when making CRC 
data valid",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "8ba2f9f698584d20830ef31bbc2fb8a6635c8314"
     },
diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 203b9ff9255..42c830716e3 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -892,7 +892,7 @@ pan_preload_emit_dcd(struct pan_pool *pool,
                      struct pan_fb_info *fb, bool zs,
                      mali_ptr coordinates,
                      mali_ptr tsd, mali_ptr rsd,
-                     void *out)
+                     void *out, bool always_write)
 {
         pan_pack(out, DRAW, cfg) {
                 cfg.four_components_per_vertex = true;
@@ -942,7 +942,8 @@ pan_preload_emit_midgard_tiler_job(struct pan_pool 
*desc_pool,
                 panfrost_pool_alloc_desc(desc_pool, MIDGARD_TILER_JOB);
 
         pan_preload_emit_dcd(desc_pool, fb, zs, coords, tsd, rsd,
-                             pan_section_ptr(job.cpu, MIDGARD_TILER_JOB, 
DRAW));
+                             pan_section_ptr(job.cpu, MIDGARD_TILER_JOB, DRAW),
+                             false);
 
         pan_section_pack(job.cpu, MIDGARD_TILER_JOB, PRIMITIVE, cfg) {
                 cfg.draw_mode = MALI_DRAW_MODE_TRIANGLE_STRIP;
@@ -970,13 +971,32 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool 
*desc_pool,
                                        mali_ptr coords, mali_ptr rsd,
                                        mali_ptr tsd)
 {
+        struct panfrost_device *dev = desc_pool->dev;
+
         unsigned dcd_idx = zs ? 0 : 1;
         pan_preload_fb_bifrost_alloc_pre_post_dcds(desc_pool, fb);
         assert(fb->bifrost.pre_post.dcds.cpu);
         void *dcd = fb->bifrost.pre_post.dcds.cpu +
                     (dcd_idx * (MALI_DRAW_LENGTH + MALI_DRAW_PADDING_LENGTH));
 
-        pan_preload_emit_dcd(desc_pool, fb, zs, coords, tsd, rsd, dcd);
+        int crc_rt = pan_select_crc_rt(dev, fb);
+
+        bool always_write = false;
+
+        /* If CRC data is currently invalid and this batch will make it valid,
+         * write even clean tiles to make sure CRC data is updated. */
+        if (crc_rt >= 0) {
+                unsigned level = fb->rts[crc_rt].view->first_level;
+                bool valid = fb->rts[crc_rt].state->slices[level].crc_valid;
+                bool full = !fb->extent.minx && !fb->extent.miny &&
+                        fb->extent.maxx == (fb->width - 1) &&
+                        fb->extent.maxy == (fb->height - 1);
+
+                if (full && !valid)
+                        always_write = true;
+        }
+
+        pan_preload_emit_dcd(desc_pool, fb, zs, coords, tsd, rsd, dcd, 
always_write);
         if (zs) {
                 enum pipe_format fmt = fb->zs.view.zs->image->layout.format;
                 bool always = false;
@@ -1005,6 +1025,7 @@ pan_preload_emit_bifrost_pre_frame_dcd(struct pan_pool 
*desc_pool,
                         MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
         } else {
                 fb->bifrost.pre_post.modes[dcd_idx] =
+                        always_write ? MALI_PRE_POST_FRAME_SHADER_MODE_ALWAYS :
                         MALI_PRE_POST_FRAME_SHADER_MODE_INTERSECT;
         }
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to