diff options
author | Marek Olšák <[email protected]> | 2017-03-24 02:58:54 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 16:09:37 +0200 |
commit | a955ee788f2757c346fef5950cae8eefd311880f (patch) | |
tree | da53380b645bcd3610717e32feac2717512de028 /src/gallium/drivers/radeon | |
parent | f7bd51626eae4bf3ac3cc42a0ed5d31c0e660f6e (diff) |
gallium/radeon: add and use a new helper vi_dcc_enabled
Reviewed-by: Nicolai Hähnle <[email protected]>
Tested-by: Edmondo Tommasina <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 6eaa87a26b1..eb823b2e700 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -959,6 +959,12 @@ r600_can_sample_zs(struct r600_texture *tex, bool stencil_sampler) (!stencil_sampler && tex->can_sample_z); } +static inline bool +vi_dcc_enabled(struct r600_texture *tex, unsigned level) +{ + return tex->dcc_offset && level < tex->surface.num_dcc_levels; +} + #define COMPUTE_DBG(rscreen, fmt, args...) \ do { \ if ((rscreen->b.debug_flags & DBG_COMPUTE)) fprintf(stderr, fmt, ##args); \ diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index dbcfd58a4bc..3cf1bb76482 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -72,8 +72,8 @@ bool r600_prepare_for_dma_blit(struct r600_common_context *rctx, * src: Use the 3D path. DCC decompression is expensive. * dst: Use the 3D path to compress the pixels with DCC. */ - if ((rsrc->dcc_offset && src_level < rsrc->surface.num_dcc_levels) || - (rdst->dcc_offset && dst_level < rdst->surface.num_dcc_levels)) + if (vi_dcc_enabled(rsrc, src_level) || + vi_dcc_enabled(rdst, dst_level)) return false; /* CMASK as: @@ -1912,8 +1912,7 @@ void vi_dcc_disable_if_incompatible_format(struct r600_common_context *rctx, { struct r600_texture *rtex = (struct r600_texture *)tex; - if (rtex->dcc_offset && - level < rtex->surface.num_dcc_levels && + if (vi_dcc_enabled(rtex, level) && !vi_dcc_formats_compatible(tex->format, view_format)) if (!r600_texture_disable_dcc(rctx, (struct r600_texture*)tex)) rctx->decompress_dcc(&rctx->b, rtex); @@ -2485,7 +2484,7 @@ void vi_dcc_clear_level(struct r600_common_context *rctx, struct pipe_resource *dcc_buffer; uint64_t dcc_offset, clear_size; - assert(rtex->dcc_offset && level < rtex->surface.num_dcc_levels); + assert(vi_dcc_enabled(rtex, level)); if (rtex->dcc_separate_buffer) { dcc_buffer = &rtex->dcc_separate_buffer->b.b; @@ -2701,7 +2700,7 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx, } /* Try to clear DCC first, otherwise try CMASK. */ - if (tex->dcc_offset && tex->surface.num_dcc_levels) { + if (vi_dcc_enabled(tex, 0)) { uint32_t reset_value; bool clear_words_needed; |