Mesa (master): r600g: shortcut ctx->screen->ws to ctx->ws

Marek Olšák mareko at kemper.freedesktop.org
Sat Oct 29 17:28:02 PDT 2011


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Oct 29 17:56:12 2011 +0200

r600g: shortcut ctx->screen->ws to ctx->ws

---

 src/gallium/drivers/r600/evergreen_hw_context.c |    1 +
 src/gallium/drivers/r600/r600.h                 |    1 +
 src/gallium/drivers/r600/r600_hw_context.c      |   21 +++++++++++----------
 src/gallium/drivers/r600/r600_hw_context_priv.h |    2 +-
 src/gallium/drivers/r600/r600_pipe.c            |    2 +-
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index f9b8ec2..116fb4e 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -904,6 +904,7 @@ int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen)
 
 	memset(ctx, 0, sizeof(struct r600_context));
 	ctx->screen = screen;
+	ctx->ws = screen->ws;
 
 	LIST_INITHEAD(&ctx->active_query_list);
 
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 9367651..c38ea1b 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -190,6 +190,7 @@ struct r600_query {
 
 struct r600_context {
 	struct r600_screen	*screen;
+	struct radeon_winsys	*ws;
 	struct radeon_winsys_cs	*cs;
 
 	struct r600_range	*range;
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 70fab0b..9f03e66 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -74,10 +74,10 @@ void r600_get_backend_mask(struct r600_context *ctx)
 		goto err;
 
 	/* initialize buffer with zeroes */
-	results = ctx->screen->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE);
+	results = ctx->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE);
 	if (results) {
 		memset(results, 0, ctx->max_db * 4 * 4);
-		ctx->screen->ws->buffer_unmap(buffer->buf);
+		ctx->ws->buffer_unmap(buffer->buf);
 
 		/* emit EVENT_WRITE for ZPASS_DONE */
 		ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2, 0);
@@ -89,14 +89,14 @@ void r600_get_backend_mask(struct r600_context *ctx)
 		ctx->pm4[ctx->pm4_cdwords++] = r600_context_bo_reloc(ctx, buffer, RADEON_USAGE_WRITE);
 
 		/* analyze results */
-		results = ctx->screen->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_READ);
+		results = ctx->ws->buffer_map(buffer->buf, ctx->cs, PIPE_TRANSFER_READ);
 		if (results) {
 			for(i = 0; i < ctx->max_db; i++) {
 				/* at least highest bit will be set if backend is used */
 				if (results[i*4 + 1])
 					mask |= (1<<i);
 			}
-			ctx->screen->ws->buffer_unmap(buffer->buf);
+			ctx->ws->buffer_unmap(buffer->buf);
 		}
 	}
 
@@ -773,7 +773,7 @@ void r600_context_fini(struct r600_context *ctx)
 	free(ctx->range);
 	free(ctx->blocks);
 	free(ctx->bo);
-	ctx->screen->ws->cs_destroy(ctx->cs);
+	ctx->ws->cs_destroy(ctx->cs);
 
 	memset(ctx, 0, sizeof(struct r600_context));
 }
@@ -831,6 +831,7 @@ int r600_context_init(struct r600_context *ctx, struct r600_screen *screen)
 
 	memset(ctx, 0, sizeof(struct r600_context));
 	ctx->screen = screen;
+	ctx->ws = screen->ws;
 
 	LIST_INITHEAD(&ctx->active_query_list);
 
@@ -1500,7 +1501,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
 
 	/* Flush the CS. */
 	ctx->cs->cdw = ctx->pm4_cdwords;
-	ctx->screen->ws->cs_flush(ctx->cs, flags);
+	ctx->ws->cs_flush(ctx->cs, flags);
 
 	/* We need to get the pointer to the other CS,
 	 * the command streams are double-buffered. */
@@ -1568,7 +1569,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu
 	unsigned results_base = query->results_start;
 	u32 *map;
 
-	map = ctx->screen->ws->buffer_map(query->buffer->buf, ctx->cs,
+	map = ctx->ws->buffer_map(query->buffer->buf, ctx->cs,
 					  PIPE_TRANSFER_READ | (wait ? 0 : PIPE_TRANSFER_DONTBLOCK));
 	if (!map)
 		return FALSE;
@@ -1591,7 +1592,7 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu
 	}
 
 	query->results_start = query->results_end;
-	ctx->screen->ws->buffer_unmap(query->buffer->buf);
+	ctx->ws->buffer_unmap(query->buffer->buf);
 	return TRUE;
 }
 
@@ -1630,7 +1631,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
 		u32 *results;
 		int i;
 
-		results = ctx->screen->ws->buffer_map(query->buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE);
+		results = ctx->ws->buffer_map(query->buffer->buf, ctx->cs, PIPE_TRANSFER_WRITE);
 		if (results) {
 			results = (u32*)((char*)results + query->results_end);
 			memset(results, 0, query->result_size);
@@ -1642,7 +1643,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
 					results[(i * 4)+3] = 0x80000000;
 				}
 			}
-			ctx->screen->ws->buffer_unmap(query->buffer->buf);
+			ctx->ws->buffer_unmap(query->buffer->buf);
 		}
 	}
 
diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h b/src/gallium/drivers/r600/r600_hw_context_priv.h
index 1f18e0e..0cbd94b 100644
--- a/src/gallium/drivers/r600/r600_hw_context_priv.h
+++ b/src/gallium/drivers/r600/r600_hw_context_priv.h
@@ -78,7 +78,7 @@ static INLINE unsigned r600_context_bo_reloc(struct r600_context *ctx, struct r6
 
 	assert(usage);
 
-	reloc_index = ctx->screen->ws->cs_add_reloc(ctx->cs, rbo->cs_buf, usage);
+	reloc_index = ctx->ws->cs_add_reloc(ctx->cs, rbo->cs_buf, usage);
 	if (reloc_index >= ctx->creloc)
 		ctx->creloc = reloc_index+1;
 
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 00c2834..42b11d2 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -258,7 +258,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 		return NULL;
 	}
 
-	rctx->screen->ws->cs_set_flush_callback(rctx->ctx.cs, r600_flush_from_winsys, rctx);
+	rctx->ws->cs_set_flush_callback(rctx->ctx.cs, r600_flush_from_winsys, rctx);
 
 	util_slab_create(&rctx->pool_transfers,
 			 sizeof(struct pipe_transfer), 64,



More information about the mesa-commit mailing list