Mesa (master): gallium/threaded_context: add another rule for buffer mapping

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 8 19:56:23 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Apr  8 14:43:04 2021 -0400

gallium/threaded_context: add another rule for buffer mapping

a synchronous driver can use PIPE_MAP_ONCE to infer that a buffer is
guaranteed to not be mapped multiple times, as this is only used when
doing map -> memcpy -> unmap directly

a threaded driver performs maps/unmaps asynchronously, so this flag
can only be used by the driver to confirm that the mapped region is accessed
exactly once, not that it will not need to remain mapped for other transfer_map
uses after it is unmapped

in short, consider this scenario:
  transfer_map(A) -> memcpy(map, data) -> transfer_unmap(map_A) ->
  transfer_map(A) -> memcpy(map, data) -> transfer_unmap(map_A)

when a synchronous driver executes this, the call chain is unmodified

when a tc driver executes this, the call chain may become:
  transfer_map(A) -> memcpy(map, data) ->
  transfer_map(A) -> memcpy(map, data) ->
  transfer_unmap(map_A) -> transfer_unmap(map_A)

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10113>

---

 src/gallium/auxiliary/util/u_threaded_context.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
index 3982fb6dab9..468221be030 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -105,6 +105,9 @@
  *    indicate this. Ignoring the flag will lead to failures.
  *    The threaded context uses its own buffer invalidation mechanism.
  *
+ * 4) PIPE_MAP_ONCE can no longer be used to infer that a buffer will not be mapped
+ *    a second time before it is unmapped.
+ *
  *
  * Rules for fences
  * ----------------



More information about the mesa-commit mailing list