Module: Mesa
Branch: staging/23.3
Commit: 3902e9302da061e8baadc8b3a3a38b30d6c20475
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3902e9302da061e8baadc8b3a3a38b30d6c20475

Author: Rob Clark <[email protected]>
Date:   Sun Nov 12 11:08:28 2023 -0800

freedreno: Always attach bo to submit

Even if app triggers undefined behaviour by using a rsc on multiple
contexts without a flush, we still should attach the bo to the batch.

Fixes: b43e5aec0d2c ("freedreno/batch: Move submit bo tracking to batch")
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26162>
(cherry picked from commit 4807c1e173e8aef4cba7ba60e6ed38248cb4d7a9)

---

 .pick_status.json                               | 2 +-
 src/gallium/drivers/freedreno/freedreno_batch.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 2ebb7bc1b12..9384d7962f6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -274,7 +274,7 @@
         "description": "freedreno: Always attach bo to submit",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "b43e5aec0d2ce542d4ba68da947e3ad752855979",
         "notes": null
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c 
b/src/gallium/drivers/freedreno/freedreno_batch.c
index 6af2c7af5b0..9c458e33e7d 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch.c
@@ -549,8 +549,10 @@ fd_batch_resource_write(struct fd_batch *batch, struct 
fd_resource *rsc)
           * ctx dependencies and let the app have the undefined behavior
           * it asked for:
           */
-         if (track->write_batch->ctx != batch->ctx)
+         if (track->write_batch->ctx != batch->ctx) {
+            fd_ringbuffer_attach_bo(batch->draw, rsc->bo);
             return;
+         }
 
          flush_write_batch(rsc);
       }
@@ -599,6 +601,7 @@ fd_batch_resource_read_slowpath(struct fd_batch *batch, 
struct fd_resource *rsc)
           * by avoiding cross-ctx dependencies and let the app have the
           * undefined behavior it asked for:
           */
+         fd_ringbuffer_attach_bo(batch->draw, rsc->bo);
          return;
       }
 

Reply via email to