diff options
author | Rob Clark <[email protected]> | 2019-06-07 10:31:59 -0700 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-06-11 10:55:27 -0700 |
commit | dac3bc986281cdce3299bc197c0f19429b321747 (patch) | |
tree | 80bc4e53f721b042dd638e2807a41771e7aaddc1 /src/gallium/drivers | |
parent | fe5c7b2b75acb448947a4e8a6d19de52348b7365 (diff) |
freedreno/a6xx: handle non-UBWC-compatible texture views
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_resource.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_resource.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 3 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c index ca475f30ef6..d855ad1d9d2 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c @@ -260,6 +260,24 @@ fd6_fill_ubwc_buffer_sizes(struct fd_resource *rsc) return meta_size; } +/** + * Ensure the rsc is in an ok state to be used with the specified format. + * This handles the case of UBWC buffers used with non-UBWC compatible + * formats, by triggering an uncompress. + */ +void +fd6_validate_format(struct fd_context *ctx, struct fd_resource *rsc, + enum pipe_format format) +{ + if (!rsc->ubwc_size) + return; + + if (ok_ubwc_format(fd6_pipe2color(format))) + return; + + fd_resource_uncompress(ctx, rsc); +} + uint32_t fd6_setup_slices(struct fd_resource *rsc) { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.h b/src/gallium/drivers/freedreno/a6xx/fd6_resource.h index 83b6fb246c7..80751d49ca9 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.h @@ -31,6 +31,8 @@ #include "freedreno_resource.h" uint32_t fd6_fill_ubwc_buffer_sizes(struct fd_resource *rsc); +void fd6_validate_format(struct fd_context *ctx, struct fd_resource *rsc, + enum pipe_format format); uint32_t fd6_setup_slices(struct fd_resource *rsc); #endif /* FD6_RESOURCE_H_ */ diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index 608aa08833e..2cb69e01a2e 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -33,6 +33,7 @@ #include "util/hash_table.h" #include "fd6_texture.h" +#include "fd6_resource.h" #include "fd6_format.h" #include "fd6_emit.h" @@ -225,6 +226,8 @@ fd6_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, if (!so) return NULL; + fd6_validate_format(fd_context(pctx), rsc, format); + if (format == PIPE_FORMAT_X32_S8X24_UINT) { rsc = rsc->stencil; format = rsc->base.format; |