freedreno/a6xx: handle non-UWC-compatible image views
authorRob Clark <robdclark@chromium.org>
Fri, 7 Jun 2019 18:00:56 +0000 (11:00 -0700)
committerRob Clark <robdclark@chromium.org>
Tue, 11 Jun 2019 17:55:27 +0000 (10:55 -0700)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/gallium/drivers/freedreno/a6xx/fd6_context.c
src/gallium/drivers/freedreno/a6xx/fd6_image.c
src/gallium/drivers/freedreno/a6xx/fd6_image.h
src/gallium/drivers/freedreno/freedreno_state.c
src/gallium/drivers/freedreno/freedreno_state.h

index 4f696ef..d16fbea 100644 (file)
@@ -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
index 51ea438..3b47644 100644 (file)
 #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;
+}
index a2dbfd3..c11b38a 100644 (file)
@@ -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_ */
index 8bf51be..238efd4 100644 (file)
@@ -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,
index ad2c494..0d8d336 100644 (file)
@@ -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_ */