summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorJerome Glisse <[email protected]>2010-09-27 14:58:01 -0400
committerJerome Glisse <[email protected]>2010-09-27 15:00:17 -0400
commit1617daaf496573eba70b35a760183b427adeff1b (patch)
tree580d296cbb39883d1f16bef5fe305ac63019ee9f /src/gallium/winsys
parent99c422ef5ab3924aad66af026945f491d75d226f (diff)
r600g: fix pointsprite & resource unbinding
When asking to bind NULL resource assume it's unbinding so free resource and unreference assoicated buffer. Also fix pointsprite parameter. Fix glsl-fs-pointcoord & fp-fragment-position Signed-off-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/r600/drm/evergreen_state.c25
-rw-r--r--src/gallium/winsys/r600/drm/r600_state2.c29
2 files changed, 40 insertions, 14 deletions
diff --git a/src/gallium/winsys/r600/drm/evergreen_state.c b/src/gallium/winsys/r600/drm/evergreen_state.c
index c2455e3a490..1cc22a98fd1 100644
--- a/src/gallium/winsys/r600/drm/evergreen_state.c
+++ b/src/gallium/winsys/r600/drm/evergreen_state.c
@@ -625,6 +625,12 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context
offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset;
id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2];
block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ return;
+ }
block->reg[0] = state->regs[0].value;
block->reg[1] = state->regs[1].value;
block->reg[2] = state->regs[2].value;
@@ -673,6 +679,10 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context
offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset;
id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2];
block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ return;
+ }
block->reg[0] = state->regs[0].value;
block->reg[1] = state->regs[1].value;
block->reg[2] = state->regs[2].value;
@@ -689,6 +699,13 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c
fake_offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].start_offset;
id = ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].offset_block_id[fake_offset >> 2];
block = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ return;
+ }
+ if (state->nregs <= 3) {
+ return;
+ }
block->reg[0] = id;
block->reg[1] = state->regs[3].value;
block->reg[2] = state->regs[4].value;
@@ -704,9 +721,7 @@ void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struc
offset = 0x0003C000 + id * 0xc;
evergreen_context_pipe_state_set_sampler(ctx, state, offset);
- if (state->nregs > 3) {
- evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id);
- }
+ evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id);
}
void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
@@ -715,9 +730,7 @@ void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struc
offset = 0x0003C0D8 + id * 0xc;
evergreen_context_pipe_state_set_sampler(ctx, state, offset);
- if (state->nregs > 3) {
- evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id);
- }
+ evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id);
}
diff --git a/src/gallium/winsys/r600/drm/r600_state2.c b/src/gallium/winsys/r600/drm/r600_state2.c
index c4b45e565c5..97aecc7a42c 100644
--- a/src/gallium/winsys/r600/drm/r600_state2.c
+++ b/src/gallium/winsys/r600/drm/r600_state2.c
@@ -802,6 +802,12 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx
offset -= ctx->groups[R600_GROUP_RESOURCE].start_offset;
id = ctx->groups[R600_GROUP_RESOURCE].offset_block_id[offset >> 2];
block = &ctx->groups[R600_GROUP_RESOURCE].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ return;
+ }
block->reg[0] = state->regs[0].value;
block->reg[1] = state->regs[1].value;
block->reg[2] = state->regs[2].value;
@@ -849,6 +855,10 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx,
offset -= ctx->groups[R600_GROUP_SAMPLER].start_offset;
id = ctx->groups[R600_GROUP_SAMPLER].offset_block_id[offset >> 2];
block = &ctx->groups[R600_GROUP_SAMPLER].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ return;
+ }
block->reg[0] = state->regs[0].value;
block->reg[1] = state->regs[1].value;
block->reg[2] = state->regs[2].value;
@@ -865,6 +875,13 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex
offset -= ctx->groups[R600_GROUP_CONFIG].start_offset;
id = ctx->groups[R600_GROUP_CONFIG].offset_block_id[offset >> 2];
block = &ctx->groups[R600_GROUP_CONFIG].blocks[id];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ return;
+ }
+ if (state->nregs <= 3) {
+ return;
+ }
block->reg[0] = state->regs[3].value;
block->reg[1] = state->regs[4].value;
block->reg[2] = state->regs[5].value;
@@ -880,10 +897,8 @@ void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r60
offset = 0x0003C000 + id * 0xc;
r600_context_pipe_state_set_sampler(ctx, state, offset);
- if (state->nregs > 3) {
- offset = 0x0000A400 + id * 0x10;
- r600_context_pipe_state_set_sampler_border(ctx, state, offset);
- }
+ offset = 0x0000A400 + id * 0x10;
+ r600_context_pipe_state_set_sampler_border(ctx, state, offset);
}
void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
@@ -892,10 +907,8 @@ void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r60
offset = 0x0003C0D8 + id * 0xc;
r600_context_pipe_state_set_sampler(ctx, state, offset);
- if (state->nregs > 3) {
- offset = 0x0000A600 + id * 0x10;
- r600_context_pipe_state_set_sampler_border(ctx, state, offset);
- }
+ offset = 0x0000A600 + id * 0x10;
+ r600_context_pipe_state_set_sampler_border(ctx, state, offset);
}
void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group)