[Mesa-dev] [PATCH 7/8] radeonsi: Do not decompress DCC textures for sampling.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Sep 4 12:47:14 PDT 2015


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 src/gallium/drivers/radeonsi/si_blit.c        | 18 ++++++++++++------
 src/gallium/drivers/radeonsi/si_descriptors.c |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 98913e5..1c08329 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -255,7 +255,8 @@ void si_flush_depth_textures(struct si_context *sctx,
 static void si_blit_decompress_color(struct pipe_context *ctx,
 		struct r600_texture *rtex,
 		unsigned first_level, unsigned last_level,
-		unsigned first_layer, unsigned last_layer)
+		unsigned first_layer, unsigned last_layer,
+		bool need_dcc_decompress)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	unsigned layer, level, checked_last_layer, max_layer;
@@ -264,6 +265,9 @@ static void si_blit_decompress_color(struct pipe_context *ctx,
 		return;
 
 	for (level = first_level; level <= last_level; level++) {
+		if (!(rtex->dirty_level_mask & (1 << level)) && !need_dcc_decompress)
+			continue;
+
 		if (!(rtex->dirty_level_mask & (1 << level)) && !(rtex->dcc_compressed_level_mask & (1 << level)))
 			continue;
 
@@ -284,7 +288,7 @@ static void si_blit_decompress_color(struct pipe_context *ctx,
 
 			if(rtex->fmask.size) {
 				custom_blend = sctx->custom_blend_decompress;
-			} else if(rtex->dcc_buffer) {
+			} else if(rtex->dcc_buffer && need_dcc_decompress) {
 				/* also eliminates the fast clear if necessary */
 				custom_blend = sctx->custom_blend_dcc_decompress;
 			} else {
@@ -302,7 +306,9 @@ static void si_blit_decompress_color(struct pipe_context *ctx,
 		 * I don't think this case occurs often though. */
 		if (first_layer == 0 && last_layer == max_layer) {
 			rtex->dirty_level_mask &= ~(1 << level);
-			rtex->dcc_compressed_level_mask &= ~(1 << level);
+
+			if(need_dcc_decompress)
+				rtex->dcc_compressed_level_mask &= ~(1 << level);
 		}
 	}
 }
@@ -327,7 +333,7 @@ void si_decompress_color_textures(struct si_context *sctx,
 
 		si_blit_decompress_color(&sctx->b.b, tex,
 					 view->u.tex.first_level, view->u.tex.last_level,
-					 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level));
+					 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level), false);
 	}
 }
 
@@ -450,7 +456,7 @@ static void si_decompress_subresource(struct pipe_context *ctx,
 						  first_layer, last_layer);
 	} else if (rtex->fmask.size || rtex->cmask.size || rtex->dcc_buffer) {
 		si_blit_decompress_color(ctx, rtex, level, level,
-					 first_layer, last_layer);
+					 first_layer, last_layer, false);
 	}
 }
 
@@ -719,7 +725,7 @@ static void si_flush_resource(struct pipe_context *ctx,
 
 	if (!rtex->is_depth && (rtex->cmask.size || rtex->dcc_buffer)) {
 		si_blit_decompress_color(ctx, rtex, 0, res->last_level,
-					 0, util_max_layer(res, 0));
+					 0, util_max_layer(res, 0), true);
 	}
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index d23da1d..14ebd92 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -245,7 +245,7 @@ static void si_set_sampler_views(struct pipe_context *ctx,
 			} else {
 				samplers->depth_texture_mask &= ~(1 << slot);
 			}
-			if (rtex->cmask.size || rtex->fmask.size || rtex->dcc_buffer) {
+			if (rtex->cmask.size || rtex->fmask.size) {
 				samplers->compressed_colortex_mask |= 1 << slot;
 			} else {
 				samplers->compressed_colortex_mask &= ~(1 << slot);
-- 
2.5.1



More information about the mesa-dev mailing list