[Mesa-dev] [PATCH 03/15] r600g: don't initialize the screen and winsys pointer twice

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


---
 src/gallium/drivers/r600/evergreen_hw_context.c |    7 ++-----
 src/gallium/drivers/r600/r600.h                 |    4 ++--
 src/gallium/drivers/r600/r600_hw_context.c      |    7 ++-----
 src/gallium/drivers/r600/r600_pipe.c            |    4 ++--
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c
index b95491a..f8820f9 100644
--- a/src/gallium/drivers/r600/evergreen_hw_context.c
+++ b/src/gallium/drivers/r600/evergreen_hw_context.c
@@ -908,13 +908,10 @@ static int evergreen_loop_const_init(struct r600_context *ctx, uint32_t offset)
 	return r600_context_add_block(ctx, r600_loop_consts, nreg, PKT3_SET_LOOP_CONST, EVERGREEN_LOOP_CONST_OFFSET);
 }
 
-int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen)
+int evergreen_context_init(struct r600_context *ctx)
 {
 	int r;
 
-	ctx->screen = screen;
-	ctx->ws = screen->ws;
-
 	LIST_INITHEAD(&ctx->active_query_list);
 
 	/* init dirty list */
@@ -998,7 +995,7 @@ int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen)
 	if (r)
 		goto out_err;
 
-	ctx->cs = screen->ws->cs_create(screen->ws);
+	ctx->cs = ctx->ws->cs_create(ctx->ws);
 
 	/* allocate cs variables */
 	ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index a32c3b1..626ab4d 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -213,7 +213,7 @@ struct r600_context;
 struct r600_screen;
 
 void r600_get_backend_mask(struct r600_context *ctx);
-int r600_context_init(struct r600_context *ctx, struct r600_screen *screen);
+int r600_context_init(struct r600_context *ctx);
 void r600_context_fini(struct r600_context *ctx);
 void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state);
 void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
@@ -244,7 +244,7 @@ void r600_context_streamout_begin(struct r600_context *ctx);
 void r600_context_streamout_end(struct r600_context *ctx);
 void r600_context_draw_opaque_count(struct r600_context *ctx, struct r600_so_target *t);
 
-int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen);
+int evergreen_context_init(struct r600_context *ctx);
 void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
 void evergreen_context_flush_dest_caches(struct r600_context *ctx);
 void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_resource_state *state, unsigned rid);
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index b25006d..b6375c2 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -827,13 +827,10 @@ int r600_setup_block_table(struct r600_context *ctx)
 	return 0;
 }
 
-int r600_context_init(struct r600_context *ctx, struct r600_screen *screen)
+int r600_context_init(struct r600_context *ctx)
 {
 	int r;
 
-	ctx->screen = screen;
-	ctx->ws = screen->ws;
-
 	LIST_INITHEAD(&ctx->active_query_list);
 
 	/* init dirty list */
@@ -909,7 +906,7 @@ int r600_context_init(struct r600_context *ctx, struct r600_screen *screen)
 	if (r)
 		goto out_err;
 
-	ctx->cs = screen->ws->cs_create(screen->ws);
+	ctx->cs = ctx->ws->cs_create(ctx->ws);
 
 	/* allocate cs variables */
 	ctx->bo = calloc(RADEON_MAX_CMDBUF_DWORDS, sizeof(void *));
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 9f86f4a..d61855d 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -236,7 +236,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 	case R600:
 	case R700:
 		r600_init_state_functions(rctx);
-		if (r600_context_init(rctx, rctx->screen)) {
+		if (r600_context_init(rctx)) {
 			r600_destroy_context(&rctx->context);
 			return NULL;
 		}
@@ -246,7 +246,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 	case EVERGREEN:
 	case CAYMAN:
 		evergreen_init_state_functions(rctx);
-		if (evergreen_context_init(rctx, rctx->screen)) {
+		if (evergreen_context_init(rctx)) {
 			r600_destroy_context(&rctx->context);
 			return NULL;
 		}
-- 
1.7.5.4



More information about the mesa-dev mailing list