Mesa (master): gallium/radeon: inline r600_context_add_resource_size

Marek Olšák mareko at kemper.freedesktop.org
Tue Oct 4 14:13:48 UTC 2016


Module: Mesa
Branch: master
Commit: 37065b0583fff17b6d0ecc4b5800b585043b23c0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=37065b0583fff17b6d0ecc4b5800b585043b23c0

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Oct  2 15:36:19 2016 +0200

gallium/radeon: inline r600_context_add_resource_size

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

---

 src/gallium/drivers/radeon/r600_pipe_common.c | 20 --------------------
 src/gallium/drivers/radeon/r600_pipe_common.h | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 95950c3..0f156df 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -601,26 +601,6 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
 	rctx->ws->fence_reference(&rctx->last_sdma_fence, NULL);
 }
 
-void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r)
-{
-	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
-	struct r600_resource *rr = (struct r600_resource *)r;
-
-	if (!r) {
-		return;
-	}
-
-	/*
-	 * The idea is to compute a gross estimate of memory requirement of
-	 * each draw call. After each draw call, memory will be precisely
-	 * accounted. So the uncertainty is only on the current draw call.
-	 * In practice this gave very good estimate (+/- 10% of the target
-	 * memory limit).
-	 */
-	rctx->vram += rr->vram_usage;
-	rctx->gtt += rr->gart_usage;
-}
-
 /*
  * pipe_screen
  */
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index c6669cc..038c7c7 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -718,7 +718,6 @@ bool r600_common_context_init(struct r600_common_context *rctx,
 			      struct r600_common_screen *rscreen,
 			      unsigned context_flags);
 void r600_common_context_cleanup(struct r600_common_context *rctx);
-void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r);
 bool r600_can_dump_shader(struct r600_common_screen *rscreen,
 			  unsigned processor);
 void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
@@ -857,6 +856,19 @@ r600_texture_reference(struct r600_texture **ptr, struct r600_texture *res)
 	pipe_resource_reference((struct pipe_resource **)ptr, &res->resource.b.b);
 }
 
+static inline void
+r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r)
+{
+	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
+	struct r600_resource *res = (struct r600_resource *)r;
+
+	if (res) {
+		/* Add memory usage for need_gfx_cs_space */
+		rctx->vram += res->vram_usage;
+		rctx->gtt += res->gart_usage;
+	}
+}
+
 static inline bool r600_get_strmout_en(struct r600_common_context *rctx)
 {
 	return rctx->streamout.streamout_enabled ||




More information about the mesa-commit mailing list