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 4f696ef092c4a7167d8d949ade545c311dceb4c3..d16fbea6c6c34891d3be04ec13b6a3f34a7408ef 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 51ea438b672a3413387bcf76e14fc47a2dbbf128..3b476440856fabc7e449216727c42c460edde8bb 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 a2dbfd3c1a8b41c231ffef3feed918e9ab52d839..c11b38a02336851ed895f5c0af438e2a074e91cd 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 8bf51bee6153289b46ca59d87f9da23a9727cc71..238efd448991dabe76ad4757db934f8ba1eb8771 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 ad2c4943ec8b9ad22e9cea037cf06db479af10de..0d8d3368ad48cf6a25934df43eeb562a15928c01 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_ */