Mesa (master): r600g: Store the chip class directly in r600_bc.

Henri Verbeet hverbeet at kemper.freedesktop.org
Sat Jul 9 16:13:24 UTC 2011


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

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Sat Jul  9 17:18:59 2011 +0200

r600g: Store the chip class directly in r600_bc.

Instead of deriving it from the family again.

Signed-off-by: Henri Verbeet <hverbeet at gmail.com>

---

 src/gallium/drivers/r600/r600_asm.c    |   48 ++-----------------------------
 src/gallium/drivers/r600/r600_asm.h    |    3 +-
 src/gallium/drivers/r600/r600_shader.c |    4 +--
 3 files changed, 6 insertions(+), 49 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 471fc65..5fae2b0 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -195,48 +195,10 @@ static struct r600_bc_tex *r600_bc_tex(void)
 	return tex;
 }
 
-int r600_bc_init(struct r600_bc *bc, enum radeon_family family)
+void r600_bc_init(struct r600_bc *bc, enum chip_class chip_class)
 {
 	LIST_INITHEAD(&bc->cf);
-	bc->family = family;
-	switch (bc->family) {
-	case CHIP_R600:
-	case CHIP_RV610:
-	case CHIP_RV630:
-	case CHIP_RV670:
-	case CHIP_RV620:
-	case CHIP_RV635:
-	case CHIP_RS780:
-	case CHIP_RS880:
-		bc->chip_class = R600;
-		break;
-	case CHIP_RV770:
-	case CHIP_RV730:
-	case CHIP_RV710:
-	case CHIP_RV740:
-		bc->chip_class = R700;
-		break;
-	case CHIP_CEDAR:
-	case CHIP_REDWOOD:
-	case CHIP_JUNIPER:
-	case CHIP_CYPRESS:
-	case CHIP_HEMLOCK:
-	case CHIP_PALM:
-	case CHIP_SUMO:
-	case CHIP_SUMO2:
-	case CHIP_BARTS:
-	case CHIP_TURKS:
-	case CHIP_CAICOS:
-		bc->chip_class = EVERGREEN;
-		break;
-	case CHIP_CAYMAN:
-		bc->chip_class = CAYMAN;
-		break;
-	default:
-		R600_ERR("unknown family %d\n", bc->family);
-		return -EINVAL;
-	}
-	return 0;
+	bc->chip_class = chip_class;
 }
 
 static int r600_bc_add_cf(struct r600_bc *bc)
@@ -1701,7 +1663,7 @@ int r600_bc_build(struct r600_bc *bc)
 					r = r700_bc_alu_build(bc, alu, addr);
 					break;
 				default:
-					R600_ERR("unknown family %d\n", bc->family);
+					R600_ERR("unknown chip class %d.\n", bc->chip_class);
 					return -EINVAL;
 				}
 				if (r)
@@ -2180,9 +2142,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
 	}
 
 	memset(&bc, 0, sizeof(bc));
-	r = r600_bc_init(&bc, r600_get_family(rctx->radeon));
-	if (r)
-		return r;
+	r600_bc_init(&bc, rctx->chip_class);
 
 	for (i = 0; i < ve->count; i++) {
 		if (elements[i].instance_divisor > 1) {
diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h
index 423e94b..cbdaacf 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -171,7 +171,6 @@ struct r600_cf_callstack {
 };
 
 struct r600_bc {
-	enum radeon_family		family;
 	enum chip_class			chip_class;
 	int				type;
 	struct list_head		cf;
@@ -193,7 +192,7 @@ struct r600_bc {
 int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf);
 
 /* r600_asm.c */
-int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
+void r600_bc_init(struct r600_bc *bc, enum chip_class chip_class);
 void r600_bc_clear(struct r600_bc *bc);
 int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu);
 int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx);
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 6f84d87..de49d21 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -609,9 +609,7 @@ static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pi
 
 	ctx.bc = &shader->bc;
 	ctx.shader = shader;
-	r = r600_bc_init(ctx.bc, rctx->family);
-	if (r)
-		return r;
+	r600_bc_init(ctx.bc, rctx->chip_class);
 	ctx.tokens = tokens;
 	tgsi_scan_shader(tokens, &ctx.info);
 	tgsi_parse_init(&ctx.parse, tokens);




More information about the mesa-commit mailing list