aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/gallium/winsys/r600/drm/r600.c36
-rw-r--r--src/gallium/winsys/r600/drm/r600_priv.h1
-rw-r--r--src/gallium/winsys/r600/drm/radeon.c36
-rw-r--r--src/gallium/winsys/r600/drm/radeon_priv.h1
14 files changed, 100 insertions, 75 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index 7cbacea89a1..a123eb62e0f 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 54fbc50bbc4..0506e8280af 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 97b21d5e31d..72aab91d04e 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 a4cd1bf1a1d..271bd1ac506 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 1711fabfc7a..d280a45bab7 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 4be77865fbd..502444f03ac 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 2b97c2a94e3..424f7a8913f 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 a190204ef47..ffb18ab7fb3 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 0d24f6ab0d1..66332580908 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 06b5cec5a6e..e52dcb4a341 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 */
diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c
index af9b9187ab1..fdcadffc532 100644
--- a/src/gallium/winsys/r600/drm/r600.c
+++ b/src/gallium/winsys/r600/drm/r600.c
@@ -32,6 +32,11 @@ enum radeon_family r600_get_family(struct radeon *r600)
return r600->family;
}
+enum chip_class r600_get_family_class(struct radeon *radeon)
+{
+ return radeon->chip_class;
+}
+
static int r600_get_device(struct radeon *r600)
{
struct drm_radeon_info info;
@@ -117,6 +122,37 @@ struct radeon *r600_new(int fd, unsigned device)
R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device);
break;
}
+
+ /* setup class */
+ switch (r600->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:
+ r600->chip_class = R600;
+ break;
+ case CHIP_RV770:
+ case CHIP_RV730:
+ case CHIP_RV710:
+ case CHIP_RV740:
+ r600->chip_class = R700;
+ break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ r600->chip_class = EVERGREEN;
+ break;
+ default:
+ R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device);
+ break;
+ }
+
return r600;
}
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h
index 7a9025ad3c2..d02562f17f3 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -38,6 +38,7 @@ struct radeon {
int refcount;
unsigned device;
unsigned family;
+ enum chip_class chip_class;
};
struct radeon *r600_new(int fd, unsigned device);
diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c
index f39d020559c..c3d345fef92 100644
--- a/src/gallium/winsys/r600/drm/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
@@ -30,6 +30,11 @@ enum radeon_family radeon_get_family(struct radeon *radeon)
return radeon->family;
}
+enum chip_class radeon_get_family_class(struct radeon *radeon)
+{
+ return radeon->chip_class;
+}
+
void radeon_set_mem_constant(struct radeon *radeon, boolean state)
{
radeon->use_mem_constant = state;
@@ -127,6 +132,37 @@ struct radeon *radeon_new(int fd, unsigned device)
break;
}
+ /* setup class */
+ switch (radeon->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:
+ radeon->chip_class = R600;
+ break;
+ case CHIP_RV770:
+ case CHIP_RV730:
+ case CHIP_RV710:
+ case CHIP_RV740:
+ radeon->chip_class = R700;
+ break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ radeon->chip_class = EVERGREEN;
+ break;
+ default:
+ fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
+ __func__, radeon->device);
+ break;
+ }
+
radeon->mman = pb_malloc_bufmgr_create();
if (!radeon->mman)
return NULL;
diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h
index c284f6aa7d1..85aea89c700 100644
--- a/src/gallium/winsys/r600/drm/radeon_priv.h
+++ b/src/gallium/winsys/r600/drm/radeon_priv.h
@@ -83,6 +83,7 @@ struct radeon {
int refcount;
unsigned device;
unsigned family;
+ enum chip_class chip_class;
unsigned nstype;
struct radeon_stype_info *stype;
unsigned max_states;