summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/r600/drm/radeon_state.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-01 14:56:04 +1000
committerDave Airlie <airlied@redhat.com>2010-09-01 14:56:04 +1000
commit1fa7245c348cb7aced81f1672140f64cb6450e2f (patch)
treeb053fbdcd99b786eebcfe40f0f3e22d62c403c56 /src/gallium/winsys/r600/drm/radeon_state.c
parentd7e2509692d3aa8afb8d2236a4f28b6ab502ec62 (diff)
Revert "r600g: precompute some of the hw state"
This reverts commit de0b76cab22caa9fc7260f80acb8f151ccced6c5, its pre-computes the texture state wrong, you can't just use an array of levels, since you can have FBOs to depth texture slices inside a level as well it would get really messy quickly. Probably need to split commits like this up into pieces for each piece of state, so we can revert bits easier in case of regressions. This also break 5 piglit tests, and valgrind starts to warn about invalid read/writes after this.
Diffstat (limited to 'src/gallium/winsys/r600/drm/radeon_state.c')
-rw-r--r--src/gallium/winsys/r600/drm/radeon_state.c62
1 files changed, 10 insertions, 52 deletions
diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c
index d4e622cf7f..ef09fdfb96 100644
--- a/src/gallium/winsys/r600/drm/radeon_state.c
+++ b/src/gallium/winsys/r600/drm/radeon_state.c
@@ -80,57 +80,13 @@ struct radeon_state *radeon_state_shader(struct radeon *radeon, u32 stype, u32 i
state->refcount = 1;
state->npm4 = found->npm4;
state->nstates = found->reginfo[shader_index].nstates;
- return state;
-}
-
-int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type)
-{
- struct radeon_stype_info *found = NULL;
- int i, j, shader_index = -1;
-
- if (state == NULL)
- return 0;
- /* traverse the stype array */
- for (i = 0; i < state->radeon->nstype; i++) {
- /* if the type doesn't match, if the shader doesn't match */
- if (stype != state->radeon->stype[i].stype)
- continue;
- if (shader_type) {
- for (j = 0; j < 4; j++) {
- if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) {
- shader_index = j;
- break;
- }
- }
- if (shader_index == -1)
- continue;
- } else {
- if (state->radeon->stype[i].reginfo[0].shader_type)
- continue;
- else
- shader_index = 0;
- }
- if (id > state->radeon->stype[i].num)
- continue;
-
- found = &state->radeon->stype[i];
- break;
- }
-
- if (!found) {
- fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type);
- return -EINVAL;
- }
-
- if (found->reginfo[shader_index].nstates != state->nstates) {
- fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n",
- state->stype->stype, state->id, state->shader_index, stype, id, shader_index);
+ state->states = calloc(1, state->nstates * 4);
+ state->pm4 = calloc(1, found->npm4 * 4);
+ if (state->states == NULL || state->pm4 == NULL) {
+ radeon_state_decref(state);
+ return NULL;
}
-
- state->stype = found;
- state->id = id;
- state->shader_index = shader_index;
- return radeon_state_pm4(state);
+ return state;
}
struct radeon_state *radeon_state(struct radeon *radeon, u32 type, u32 id)
@@ -178,6 +134,9 @@ struct radeon_state *radeon_state_decref(struct radeon_state *state)
for (i = 0; i < state->nbo; i++) {
state->bo[i] = radeon_bo_decref(state->radeon, state->bo[i]);
}
+ free(state->immd);
+ free(state->states);
+ free(state->pm4);
memset(state, 0, sizeof(*state));
free(state);
return NULL;
@@ -220,9 +179,8 @@ int radeon_state_pm4(struct radeon_state *state)
{
int r;
- if (state == NULL)
+ if (state == NULL || state->cpm4)
return 0;
- state->cpm4 = 0;
r = state->stype->pm4(state);
if (r) {
fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n",