Mesa (master): freedreno/a6xx: Enable UBWC modifier

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 1 15:52:16 UTC 2019


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

Author: Fritz Koenig <frkoenig at google.com>
Date:   Tue Feb 26 18:31:38 2019 -0800

freedreno/a6xx: Enable UBWC modifier

Adding the supported_modifiers allows buffers
to be created with UBWC

---

 src/gallium/drivers/freedreno/a6xx/fd6_screen.c    | 9 +++++++++
 src/gallium/drivers/freedreno/freedreno_resource.c | 6 ++++++
 src/gallium/drivers/freedreno/freedreno_screen.c   | 1 +
 src/gallium/drivers/freedreno/freedreno_util.h     | 2 +-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
index d5c78c16dc7..33e740f32fe 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
@@ -25,6 +25,7 @@
  *    Rob Clark <robclark at freedesktop.org>
  */
 
+#include "drm-uapi/drm_fourcc.h"
 #include "pipe/p_screen.h"
 #include "util/u_format.h"
 
@@ -137,4 +138,12 @@ fd6_screen_init(struct pipe_screen *pscreen)
 	screen->setup_slices = fd6_setup_slices;
 	screen->tile_mode = fd6_tile_mode;
 	screen->fill_ubwc_buffer_sizes = fd6_fill_ubwc_buffer_sizes;
+
+	static const uint64_t supported_modifiers[] = {
+		DRM_FORMAT_MOD_LINEAR,
+		DRM_FORMAT_MOD_QCOM_COMPRESSED,
+	};
+
+	screen->supported_modifiers = supported_modifiers;
+	screen->num_supported_modifiers = ARRAY_SIZE(supported_modifiers);
 }
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 22e3874a246..36d61d715ef 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -922,6 +922,12 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
 	if (tmpl->bind & PIPE_BIND_SHARED)
 		allow_ubwc = find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
 
+	/* TODO turn on UBWC for all internal buffers
+	 * Manhattan benchmark shows artifacts when enabled.  Once this
+	 * is fixed the following line can be removed.
+	 */
+	allow_ubwc &= !!(fd_mesa_debug & FD_DBG_UBWC);
+
 	if (screen->tile_mode &&
 			(tmpl->target != PIPE_BUFFER) &&
 			!linear) {
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 5b107b87ba8..98f720afbf0 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -88,6 +88,7 @@ static const struct debug_named_value debug_options[] = {
 		{"ttile",     FD_DBG_TTILE,  "Enable texture tiling (a5xx)"},
 		{"perfcntrs", FD_DBG_PERFC,  "Expose performance counters"},
 		{"softpin",   FD_DBG_SOFTPIN,"Enable softpin command submission (experimental)"},
+		{"ubwc",      FD_DBG_UBWC,   "Enable UBWC for all internal buffers (experimental)"},
 		DEBUG_NAMED_VALUE_END
 };
 
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 3e7ea638a6e..51eefc41f52 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -85,7 +85,7 @@ enum adreno_stencil_op fd_stencil_op(unsigned op);
 #define FD_DBG_TTILE  0x200000
 #define FD_DBG_PERFC  0x400000
 #define FD_DBG_SOFTPIN 0x800000
-
+#define FD_DBG_UBWC  0x1000000
 extern int fd_mesa_debug;
 extern bool fd_binning_enabled;
 




More information about the mesa-commit mailing list