[Mesa-dev] [PATCH 10/15] r600g: remove dead code for tracking relocations

Marek Olšák maraeo at gmail.com
Mon Jan 30 12:23:13 PST 2012


---
 src/gallium/drivers/r600/evergreen_hw_context.c |    7 -------
 src/gallium/drivers/r600/r600_hw_context.c      |   13 -------------
 src/gallium/drivers/r600/r600_hw_context_priv.h |   10 +---------
 src/gallium/drivers/r600/r600_pipe.h            |    3 ---
 4 files changed, 1 insertions(+), 32 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index 118ba26..8fc8351 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -997,13 +997,6 @@ int evergreen_context_init(struct r600_context *ctx)
 
 	ctx->cs = ctx->ws->cs_create(ctx->ws);
 
-	/* allocate cs variables */
-	ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
-	if (ctx->bo == NULL) {
-		r = -ENOMEM;
-		goto out_err;
-	}
-
 	r600_init_cs(ctx);
 	ctx->max_db = 8;
 	return 0;
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 9e3d577..c2c3f13 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -781,7 +781,6 @@ void r600_context_fini(struct r600_context *ctx)
 	r600_free_resource_range(ctx, &ctx->fs_resources, ctx->num_fs_resources);
 	free(ctx->range);
 	free(ctx->blocks);
-	free(ctx->bo);
 	ctx->ws->cs_destroy(ctx->cs);
 }
 
@@ -913,13 +912,6 @@ int r600_context_init(struct r600_context *ctx)
 
 	ctx->cs = ctx->ws->cs_create(ctx->ws);
 
-	/* allocate cs variables */
-	ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
-	if (ctx->bo == NULL) {
-		r = -ENOMEM;
-		goto out_err;
-	}
-
 	r600_init_cs(ctx);
 	ctx->max_db = 4;
 	return 0;
@@ -1462,11 +1454,6 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
 	/* Flush the CS. */
 	ctx->ws->cs_flush(ctx->cs, flags);
 
-	/* restart */
-	for (int i = 0; i < ctx->creloc; i++) {
-		pipe_resource_reference((struct pipe_resource**)&ctx->bo[i], NULL);
-	}
-	ctx->creloc = 0;
 	ctx->pm4_dirty_cdwords = 0;
 	ctx->flags = 0;
 
diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h b/src/gallium/drivers/r600/r600_hw_context_priv.h
index 79fa57b..55df6e9 100644
--- a/src/gallium/drivers/r600/r600_hw_context_priv.h
+++ b/src/gallium/drivers/r600/r600_hw_context_priv.h
@@ -74,16 +74,8 @@ void evergreen_set_streamout_enable(struct r600_context *ctx, unsigned buffer_en
 static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r600_resource *rbo,
 					     enum radeon_bo_usage usage)
 {
-	unsigned reloc_index;
-
 	assert(usage);
-
-	reloc_index = ctx->ws->cs_add_reloc(ctx->cs, rbo->cs_buf, usage, rbo->domains);
-	if (reloc_index >= ctx->creloc)
-		ctx->creloc = reloc_index+1;
-
-	pipe_resource_reference((struct pipe_resource**)&ctx->bo[reloc_index], &rbo->b.b.b);
-	return reloc_index * 4;
+	return ctx->ws->cs_add_reloc(ctx->cs, rbo->cs_buf, usage, rbo->domains) * 4;
 }
 
 #endif
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index c327954..a9d21bd 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -294,9 +294,6 @@ struct r600_context {
 	unsigned		ctx_pm4_ndwords;
 	unsigned		init_dwords;
 
-	unsigned		creloc;
-	struct r600_resource	**bo;
-
 	/* The list of active queries. Only one query of each type can be active. */
 	struct list_head	active_query_list;
 	unsigned		num_cs_dw_queries_suspend;
-- 
1.7.5.4



More information about the mesa-dev mailing list