[Mesa-dev] [RFC PATCH 56/65] radeonsi: decompress DCC for resident textures/images

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri May 19 16:53:01 UTC 2017


Analogous to bound textures/images. We should also update the
resident descriptors and disable COMPRESSION_EN for avoiding
useless DCC fetches, but I postpone this optimization for a
separate series.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/radeonsi/si_blit.c        | 52 +++++++++++++++++++++++++++
 src/gallium/drivers/radeonsi/si_descriptors.c | 16 +++++++++
 2 files changed, 68 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 998288dba2..4078f2498b 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -611,6 +611,54 @@ static void si_check_render_feedback_images(struct si_context *sctx,
 	}
 }
 
+static void si_check_render_feedback_resident_textures(struct si_context *sctx)
+{
+	unsigned i;
+
+	for (i = 0; i < sctx->num_resident_tex_handles; i++) {
+		struct si_texture_handle *tex_handle =
+			sctx->resident_tex_handles[i];
+		struct pipe_sampler_view *view;
+		struct r600_texture *tex;
+
+		view = &tex_handle->view->base;
+		if (view->texture->target == PIPE_BUFFER)
+			continue;
+
+		tex = (struct r600_texture *)view->texture;
+
+		si_check_render_feedback_texture(sctx, tex,
+						 view->u.tex.first_level,
+						 view->u.tex.last_level,
+						 view->u.tex.first_layer,
+						 view->u.tex.last_layer);
+	}
+}
+
+static void si_check_render_feedback_resident_images(struct si_context *sctx)
+{
+	unsigned i;
+
+	for (i = 0; i < sctx->num_resident_img_handles; i++) {
+		struct si_image_handle *img_handle =
+			sctx->resident_img_handles[i];
+		struct pipe_image_view *view;
+		struct r600_texture *tex;
+
+		view = &img_handle->view;
+		if (view->resource->target == PIPE_BUFFER)
+			continue;
+
+		tex = (struct r600_texture *)view->resource;
+
+		si_check_render_feedback_texture(sctx, tex,
+						 view->u.tex.level,
+						 view->u.tex.level,
+						 view->u.tex.first_layer,
+						 view->u.tex.last_layer);
+	}
+}
+
 static void si_check_render_feedback(struct si_context *sctx)
 {
 
@@ -621,6 +669,10 @@ static void si_check_render_feedback(struct si_context *sctx)
 		si_check_render_feedback_images(sctx, &sctx->images[i]);
 		si_check_render_feedback_textures(sctx, &sctx->samplers[i]);
 	}
+
+	si_check_render_feedback_resident_images(sctx);
+	si_check_render_feedback_resident_textures(sctx);
+
 	sctx->need_check_render_feedback = false;
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 810dd8e89a..e459f19d66 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -2416,6 +2416,13 @@ static void si_make_texture_handle_resident(struct pipe_context *ctx,
 	sview = tex_handle->view;
 
 	if (resident) {
+		if (sview->base.texture->target != PIPE_BUFFER) {
+			struct r600_texture *rtex =
+				(struct r600_texture *)sview->base.texture;
+
+			si_update_check_render_feedback(sctx, rtex);
+		}
+
 		si_add_resident_tex_handle(sctx, tex_handle);
 
 		/* Add the buffers to the current CS in case si_begin_new_cs()
@@ -2511,6 +2518,15 @@ static void si_make_image_handle_resident(struct pipe_context *ctx,
 	view = &img_handle->view;
 
 	if (resident) {
+		struct r600_resource *res =
+			(struct r600_resource *)view->resource;
+
+		if (res->b.b.target != PIPE_BUFFER) {
+			struct r600_texture *rtex = (struct r600_texture *)res;
+
+			si_update_check_render_feedback(sctx, rtex);
+		}
+
 		si_add_resident_img_handle(sctx, img_handle);
 
 		/* Add the buffers to the current CS in case si_begin_new_cs()
-- 
2.13.0



More information about the mesa-dev mailing list