summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric R. Smith <eric.smith@collabora.com>2024-03-26 17:56:04 -0300
committerEric Engestrom <eric@engestrom.ch>2024-04-22 09:57:42 +0200
commit7afd8e495ad94e97861fe86ea3ee6582be0ce536 (patch)
tree54ebf8f7480a309ab8970f1111d6431f8f001314
parent062a7642588d640a97f3ea1b7814011674e47af0 (diff)
panfrost: fix a GPU/CPU synchronization problem
Remove a premature optimization. When PIPE_MAP_DISCARD_WHOLE_RESOURCE is set we were setting create_new_bo, and then if that was set we skipped a set of tests which if passed would cause a panfrost_flush_writer. In fact we need that flush in some cases (e.g. when any batch is reading the resource). Moreover, we should sometimes copy the resource (set the copy_resource flag) and that again was being skipped if create_new_bo was initially true due to PIPE_MAP_DISCARD_WHOLE_RESOURCE being set. Cc: mesa-stable Signed-off-by: Eric R. Smith <eric.smith@collabora.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28406> (cherry picked from commit e3d123b7a67aff618720e0bc550b2d27b1e56fc5)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 12ed6dea203..5ab8f901fd6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2614,7 +2614,7 @@
"description": "panfrost: fix a GPU/CPU synchronization problem",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index aa2974eb5eb..7bf25155e51 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -1181,7 +1181,7 @@ panfrost_ptr_map(struct pipe_context *pctx, struct pipe_resource *resource,
bool create_new_bo = usage & PIPE_MAP_DISCARD_WHOLE_RESOURCE;
bool copy_resource = false;
- if (!create_new_bo && !(usage & PIPE_MAP_UNSYNCHRONIZED) &&
+ if (!(usage & PIPE_MAP_UNSYNCHRONIZED) &&
!(resource->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) &&
(usage & PIPE_MAP_WRITE) && panfrost_any_batch_reads_rsrc(ctx, rsrc)) {
/* When a resource to be modified is already being used by a