summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-09-20 11:58:00 -0400
committerJerome Glisse <jglisse@redhat.com>2010-09-20 11:59:20 -0400
commit363dfb83f1ca7f1ab09eec30aeb89732c5ce3e02 (patch)
tree909be9a4766d6af3f5a22730a9595e8ed2a23921 /src/gallium/drivers
parent6ea16b6c510ee7f0e68505838a99562f0852f8e4 (diff)
r600g: move chip class to radeon common structure
So texture code can be shared btw new state design & old one. Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600.h7
-rw-r--r--src/gallium/drivers/r600/r600_blit.c4
-rw-r--r--src/gallium/drivers/r600/r600_context.c2
-rw-r--r--src/gallium/drivers/r600/r600_hw_states.c4
-rw-r--r--src/gallium/drivers/r600/r600_screen.c32
-rw-r--r--src/gallium/drivers/r600/r600_screen.h9
-rw-r--r--src/gallium/drivers/r600/r600_state.c2
-rw-r--r--src/gallium/drivers/r600/r600_state2.c28
-rw-r--r--src/gallium/drivers/r600/r600_texture.c6
-rw-r--r--src/gallium/drivers/r600/radeon.h7
10 files changed, 26 insertions, 75 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 7cbacea89a..a123eb62e0 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -90,7 +90,14 @@ enum radeon_family {
CHIP_LAST,
};
+enum chip_class {
+ R600,
+ R700,
+ EVERGREEN,
+};
+
enum radeon_family r600_get_family(struct radeon *rw);
+enum chip_class r600_get_family_class(struct radeon *radeon);
/* lowlevel WS bo */
struct radeon_ws_bo;
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 54fbc50bbc..0506e8280a 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -283,7 +283,7 @@ static void r600_blit_state_vs_shader(struct r600_screen *rscreen, struct radeon
radeon_ws_bo_reference(rscreen->rw, &bo, NULL);
return;
}
- switch (rscreen->chip_class) {
+ switch (radeon_get_family_class(rscreen->rw)) {
case R600:
memcpy(data, shader_bc_r600, 128);
break;
@@ -347,7 +347,7 @@ static void r600_blit_state_ps_shader(struct r600_screen *rscreen, struct radeon
radeon_ws_bo_reference(rscreen->rw, &bo, NULL);
return;
}
- switch (rscreen->chip_class) {
+ switch (radeon_get_family_class(rscreen->rw)) {
case R600:
memcpy(data, shader_bc_r600, 48);
break;
diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c
index 97b21d5e31..72aab91d04 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -113,7 +113,7 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
rctx->screen = rscreen;
rctx->rw = rscreen->rw;
- if (rscreen->chip_class == EVERGREEN)
+ if (radeon_get_family_class(rscreen->rw) == EVERGREEN)
rctx->vtbl = &eg_hw_state_vtbl;
else
rctx->vtbl = &r600_hw_state_vtbl;
diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c
index a4cd1bf1a1..271bd1ac50 100644
--- a/src/gallium/drivers/r600/r600_hw_states.c
+++ b/src/gallium/drivers/r600/r600_hw_states.c
@@ -457,7 +457,7 @@ static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate)
if (query_running) {
db_render_override |= S_028D10_NOOP_CULL_DISABLE(1);
- if (rscreen->chip_class == R700)
+ if (radeon_get_family_class(rscreen->rw) == R700)
db_render_control |= S_028D0C_R700_PERFECT_ZPASS_COUNTS(1);
}
@@ -656,7 +656,7 @@ static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask;
rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask;
rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control;
- if (rscreen->chip_class == R700)
+ if (radeon_get_family_class(rscreen->rw) == R700)
rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = shader_control;
rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c
index 1711fabfc7..d280a45bab 100644
--- a/src/gallium/drivers/r600/r600_screen.c
+++ b/src/gallium/drivers/r600/r600_screen.c
@@ -242,39 +242,13 @@ struct pipe_screen *r600_screen_create(struct radeon *rw)
if (rscreen == NULL) {
return NULL;
}
-
+
/* don't enable mem constant for r600 yet */
rscreen->use_mem_constant = FALSE;
-
- switch (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:
- rscreen->chip_class = R600;
- break;
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- rscreen->chip_class = R700;
- break;
- case CHIP_CEDAR:
- case CHIP_REDWOOD:
- case CHIP_JUNIPER:
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
- rscreen->chip_class = EVERGREEN;
+ if (radeon_get_family_class(rw) == EVERGREEN) {
rscreen->use_mem_constant = TRUE;
- break;
- default:
- FREE(rscreen);
- return NULL;
}
+
radeon_set_mem_constant(rw, rscreen->use_mem_constant);
rscreen->rw = rw;
rscreen->screen.winsys = (struct pipe_winsys*)rw;
diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h
index 4be77865fb..502444f03a 100644
--- a/src/gallium/drivers/r600/r600_screen.h
+++ b/src/gallium/drivers/r600/r600_screen.h
@@ -42,17 +42,10 @@ struct r600_transfer {
struct pipe_resource *linear_texture;
};
-enum chip_class {
- R600,
- R700,
- EVERGREEN,
-};
-
struct r600_screen {
struct pipe_screen screen;
struct radeon *rw;
- enum chip_class chip_class;
- boolean use_mem_constant;
+ boolean use_mem_constant;
};
static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen)
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 2b97c2a94e..424f7a8913 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -527,7 +527,7 @@ void r600_init_state_functions(struct r600_context *rctx)
rctx->context.set_blend_color = r600_set_blend_color;
rctx->context.set_clip_state = r600_set_clip_state;
- if (rctx->screen->chip_class == EVERGREEN)
+ if (radeon_get_family_class(rctx->rw) == EVERGREEN)
rctx->context.set_constant_buffer = eg_set_constant_buffer;
else if (rctx->screen->use_mem_constant)
rctx->context.set_constant_buffer = r600_set_constant_buffer_mem;
diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c
index a190204ef4..ffb18ab7fb 100644
--- a/src/gallium/drivers/r600/r600_state2.c
+++ b/src/gallium/drivers/r600/r600_state2.c
@@ -56,12 +56,6 @@ uint32_t r600_translate_texformat(enum pipe_format format,
#include "r600_state_inlines.h"
-enum chip_class {
- R600,
- R700,
- EVERGREEN,
-};
-
enum r600_pipe_state_id {
R600_PIPE_STATE_BLEND = 0,
R600_PIPE_STATE_BLEND_COLOR,
@@ -85,7 +79,6 @@ enum r600_pipe_state_id {
struct r600_screen {
struct pipe_screen screen;
struct radeon *radeon;
- unsigned chip_class;
};
struct r600_pipe_sampler_view {
@@ -2189,27 +2182,6 @@ struct pipe_screen *r600_screen_create2(struct radeon *radeon)
return NULL;
}
- switch (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:
- rscreen->chip_class = R600;
- break;
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- rscreen->chip_class = R700;
- break;
- default:
- FREE(rscreen);
- return NULL;
- }
rscreen->radeon = radeon;
rscreen->screen.winsys = (struct pipe_winsys*)radeon;
rscreen->screen.destroy = r600_destroy_screen;
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 0d24f6ab0d..6633258090 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -107,7 +107,6 @@ static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_cla
struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
- struct r600_screen *rscreen = r600_screen(screen);
struct r600_resource_texture *rtex;
struct r600_resource *resource;
struct radeon *radeon = (struct radeon *)screen->winsys;
@@ -121,7 +120,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
resource->base.vtbl = &r600_texture_vtbl;
pipe_reference_init(&resource->base.b.reference, 1);
resource->base.b.screen = screen;
- r600_setup_miptree(rtex, rscreen->chip_class);
+ r600_setup_miptree(rtex, radeon_get_family_class(radeon));
/* FIXME alignment 4096 enought ? too much ? */
resource->domain = r600_domain_from_usage(resource->base.b.bind);
@@ -320,7 +319,6 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx,
void* r600_texture_transfer_map(struct pipe_context *ctx,
struct pipe_transfer* transfer)
{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct radeon_ws_bo *bo;
enum pipe_format format = transfer->resource->format;
@@ -334,7 +332,7 @@ void* r600_texture_transfer_map(struct pipe_context *ctx,
bo = ((struct r600_resource *)rtransfer->linear_texture)->bo;
} else {
rtex = (struct r600_resource_texture*)transfer->resource;
- if (rtex->depth && rscreen->chip_class != EVERGREEN) {
+ if (rtex->depth && radeon_get_family_class(radeon) != EVERGREEN) {
r = r600_texture_from_depth(ctx, rtex, transfer->sr.level);
if (r) {
return NULL;
diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h
index 06b5cec5a6..e52dcb4a34 100644
--- a/src/gallium/drivers/r600/radeon.h
+++ b/src/gallium/drivers/r600/radeon.h
@@ -79,6 +79,12 @@ enum radeon_family {
CHIP_LAST,
};
+enum chip_class {
+ R600,
+ R700,
+ EVERGREEN,
+};
+
enum {
R600_SHADER_PS = 1,
R600_SHADER_VS,
@@ -88,6 +94,7 @@ enum {
};
enum radeon_family radeon_get_family(struct radeon *rw);
+enum chip_class radeon_get_family_class(struct radeon *radeon);
void radeon_set_mem_constant(struct radeon *radeon, boolean state);
/* lowlevel WS bo */