asahi: Add a noshadow debug flag
authorAsahi Lina <lina@asahilina.net>
Sat, 22 Jul 2023 09:31:45 +0000 (18:31 +0900)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Aug 2023 20:31:27 +0000 (20:31 +0000)
This lets us trivially test whether resource shadowing helps or hurts
any given workload.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>

src/asahi/lib/agx_device.h
src/gallium/drivers/asahi/agx_pipe.c

index 837a63b..6e90132 100644 (file)
@@ -29,6 +29,7 @@ enum agx_dbg {
    AGX_DBG_SYNCTVB = BITFIELD_BIT(13),
    AGX_DBG_SMALLTILE = BITFIELD_BIT(14),
    AGX_DBG_NOMSAA = BITFIELD_BIT(15),
+   AGX_DBG_NOSHADOW = BITFIELD_BIT(16),
 };
 
 /* Dummy partial declarations, pending real UAPI */
index 720242f..5a0fa7f 100644 (file)
@@ -68,6 +68,7 @@ static const struct debug_named_value agx_debug_options[] = {
    {"synctvb",   AGX_DBG_SYNCTVB,  "Synchronous TVB growth"},
    {"smalltile", AGX_DBG_SMALLTILE,"Force 16x16 tiles"},
    {"nomsaa",    AGX_DBG_NOMSAA,   "Force disable MSAA"},
+   {"noshadow",  AGX_DBG_NOSHADOW, "Force disable resource shadowing"},
    DEBUG_NAMED_VALUE_END
 };
 /* clang-format on */
@@ -659,6 +660,9 @@ agx_shadow(struct agx_context *ctx, struct agx_resource *rsrc, bool needs_copy)
    struct agx_bo *old = rsrc->bo;
    unsigned flags = old->flags;
 
+   if (dev->debug & AGX_DBG_NOSHADOW)
+      return false;
+
    /* If a resource is (or could be) shared, shadowing would desync across
     * processes. (It's also not what this path is for.)
     */