Mesa (master): gallium: add TGSI_MEMORY_STREAM_CACHE_POLICY
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 29 19:32:05 UTC 2018
Module: Mesa
Branch: master
Commit: 8f6e06d1608bff31165511787a06da8c635e6da0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f6e06d1608bff31165511787a06da8c635e6da0
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Jul 25 00:41:48 2018 -0400
gallium: add TGSI_MEMORY_STREAM_CACHE_POLICY
For internal radeonsi shaders.
---
src/gallium/auxiliary/tgsi/tgsi_strings.c | 3 ++-
src/gallium/auxiliary/tgsi/tgsi_strings.h | 2 +-
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 3 +++
src/gallium/include/pipe/p_shader_tokens.h | 8 ++++++--
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 434871273f..03261ed2d9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -228,11 +228,12 @@ const char *tgsi_immediate_type_names[6] =
"INT64",
};
-const char *tgsi_memory_names[3] =
+const char *tgsi_memory_names[4] =
{
"COHERENT",
"RESTRICT",
"VOLATILE",
+ "STREAM_CACHE_POLICY",
};
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h
index 20e3f7127f..61068d562d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h
@@ -62,7 +62,7 @@ extern const char *tgsi_fs_coord_pixel_center_names[2];
extern const char *tgsi_immediate_type_names[6];
-extern const char *tgsi_memory_names[3];
+extern const char *tgsi_memory_names[4];
const char *
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 8e0578b4d5..eaa200a95d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -331,6 +331,9 @@ static unsigned get_cache_policy(struct si_shader_context *ctx,
inst->Memory.Qualifier & (TGSI_MEMORY_COHERENT | TGSI_MEMORY_VOLATILE)))
cache_policy |= ac_glc;
+ if (inst->Memory.Qualifier & TGSI_MEMORY_STREAM_CACHE_POLICY)
+ cache_policy |= ac_slc;
+
return cache_policy;
}
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 08ed08156e..bef826f23b 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -790,16 +790,20 @@ struct tgsi_dst_register
#define TGSI_MEMORY_COHERENT (1 << 0)
#define TGSI_MEMORY_RESTRICT (1 << 1)
#define TGSI_MEMORY_VOLATILE (1 << 2)
+/* The "stream" cache policy will minimize memory cache usage if other
+ * memory operations need the cache.
+ */
+#define TGSI_MEMORY_STREAM_CACHE_POLICY (1 << 3)
/**
* Specifies the type of memory access to do for the LOAD/STORE instruction.
*/
struct tgsi_instruction_memory
{
- unsigned Qualifier : 3; /* TGSI_MEMORY_ */
+ unsigned Qualifier : 4; /* TGSI_MEMORY_ */
unsigned Texture : 8; /* only for images: TGSI_TEXTURE_ */
unsigned Format : 10; /* only for images: PIPE_FORMAT_ */
- unsigned Padding : 11;
+ unsigned Padding : 10;
};
#define TGSI_MEMBAR_SHADER_BUFFER (1 << 0)
More information about the mesa-commit
mailing list