Mesa (master): freedreno/a6xx: handle non-UWC-compatible image views

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 11 18:13:18 UTC 2019


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Jun  7 11:00:56 2019 -0700

freedreno/a6xx: handle non-UWC-compatible image views

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>

---

 src/gallium/drivers/freedreno/a6xx/fd6_context.c |  4 +++
 src/gallium/drivers/freedreno/a6xx/fd6_image.c   | 33 ++++++++++++++++++++++++
 src/gallium/drivers/freedreno/a6xx/fd6_image.h   |  2 ++
 src/gallium/drivers/freedreno/freedreno_state.c  |  2 +-
 src/gallium/drivers/freedreno/freedreno_state.h  |  5 ++++
 5 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_context.c b/src/gallium/drivers/freedreno/a6xx/fd6_context.c
index 4f696ef092c..d16fbea6c6c 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_context.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_context.c
@@ -34,6 +34,7 @@
 #include "fd6_draw.h"
 #include "fd6_emit.h"
 #include "fd6_gmem.h"
+#include "fd6_image.h"
 #include "fd6_program.h"
 #include "fd6_query.h"
 #include "fd6_rasterizer.h"
@@ -105,6 +106,9 @@ fd6_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
 	if (!pctx)
 		return NULL;
 
+	/* after fd_context_init() to override set_shader_images() */
+	fd6_image_init(pctx);
+
 	util_blitter_set_texture_multisample(fd6_ctx->base.blitter, true);
 
 	/* fd_context_init overwrites delete_rasterizer_state, so set this
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c
index 51ea438b672..3b476440856 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c
@@ -28,8 +28,11 @@
 #include "pipe/p_state.h"
 
 #include "freedreno_resource.h"
+#include "freedreno_state.h"
+
 #include "fd6_image.h"
 #include "fd6_format.h"
+#include "fd6_resource.h"
 #include "fd6_texture.h"
 
 struct fd6_image {
@@ -301,3 +304,33 @@ fd6_build_ibo_state(struct fd_context *ctx, const struct ir3_shader_variant *v,
 
 	return state;
 }
+
+static void fd6_set_shader_images(struct pipe_context *pctx,
+		enum pipe_shader_type shader,
+		unsigned start, unsigned count,
+		const struct pipe_image_view *images)
+{
+	struct fd_context *ctx = fd_context(pctx);
+	struct fd_shaderimg_stateobj *so = &ctx->shaderimg[shader];
+
+	fd_set_shader_images(pctx, shader, start, count, images);
+
+	if (!images)
+		return;
+
+	for (unsigned i = 0; i < count; i++) {
+		unsigned n = i + start;
+		struct pipe_image_view *buf = &so->si[n];
+
+		if (!buf->resource)
+			continue;
+
+		fd6_validate_format(ctx, fd_resource(buf->resource), buf->format);
+	}
+}
+
+void
+fd6_image_init(struct pipe_context *pctx)
+{
+	pctx->set_shader_images = fd6_set_shader_images;
+}
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.h b/src/gallium/drivers/freedreno/a6xx/fd6_image.h
index a2dbfd3c1a8..c11b38a0233 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_image.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.h
@@ -37,4 +37,6 @@ struct ir3_shader_variant;
 struct fd_ringbuffer * fd6_build_ibo_state(struct fd_context *ctx,
 		const struct ir3_shader_variant *v, enum pipe_shader_type shader);
 
+void fd6_image_init(struct pipe_context *pctx);
+
 #endif /* FD6_IMAGE_H_ */
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 8bf51bee615..238efd44899 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -165,7 +165,7 @@ fd_set_shader_buffers(struct pipe_context *pctx,
 	ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_SSBO;
 }
 
-static void
+void
 fd_set_shader_images(struct pipe_context *pctx,
 		enum pipe_shader_type shader,
 		unsigned start, unsigned count,
diff --git a/src/gallium/drivers/freedreno/freedreno_state.h b/src/gallium/drivers/freedreno/freedreno_state.h
index ad2c4943ec8..0d8d3368ad4 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.h
+++ b/src/gallium/drivers/freedreno/freedreno_state.h
@@ -55,6 +55,11 @@ static inline bool fd_blend_enabled(struct fd_context *ctx, unsigned n)
 	return ctx->blend && ctx->blend->rt[n].blend_enable;
 }
 
+void fd_set_shader_images(struct pipe_context *pctx,
+		enum pipe_shader_type shader,
+		unsigned start, unsigned count,
+		const struct pipe_image_view *images);
+
 void fd_state_init(struct pipe_context *pctx);
 
 #endif /* FREEDRENO_STATE_H_ */




More information about the mesa-commit mailing list