Mesa (master): radeonsi: move ps sampler views into PM4 stream
Christian König
deathsimple at kemper.freedesktop.org
Wed Aug 15 20:13:50 UTC 2012
Module: Mesa
Branch: master
Commit: ec5b698525ccd9d5cd734e723e284dea7cc2041d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec5b698525ccd9d5cd734e723e284dea7cc2041d
Author: Christian König <deathsimple at vodafone.de>
Date: Sun Aug 12 19:32:51 2012 +0200
radeonsi: move ps sampler views into PM4 stream
Signed-off-by: Christian König <deathsimple at vodafone.de>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
src/gallium/drivers/radeonsi/si_state.c | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 1d6d214..bbbf203 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1958,22 +1958,16 @@ static void si_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
struct r600_context *rctx = (struct r600_context *)ctx;
struct si_pipe_sampler_view **resource = (struct si_pipe_sampler_view **)views;
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
- struct si_resource *bo;
- int i;
+ int i, j;
int has_depth = 0;
- uint64_t va;
- char *ptr;
if (!count)
goto out;
si_pm4_inval_texture_cache(pm4);
- bo = si_resource_create_custom(ctx->screen, PIPE_USAGE_IMMUTABLE,
- count * sizeof(resource[0]->state));
- ptr = rctx->ws->buffer_map(bo->cs_buf, rctx->cs, PIPE_TRANSFER_WRITE);
-
- for (i = 0; i < count; i++, ptr += sizeof(resource[0]->state)) {
+ si_pm4_sh_data_begin(pm4);
+ for (i = 0; i < count; i++) {
struct r600_resource_texture *tex = (void *)resource[i]->base.texture;
pipe_sampler_view_reference(
@@ -1982,26 +1976,17 @@ static void si_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
si_pm4_add_bo(pm4, &tex->resource, RADEON_USAGE_READ);
- if (resource[i]) {
- if (tex->depth)
- has_depth = 1;
-
- memcpy(ptr, resource[i]->state, sizeof(resource[0]->state));
- } else
- memset(ptr, 0, sizeof(resource[0]->state));
+ for (j = 0; j < Elements(resource[i]->state); ++j) {
+ si_pm4_sh_data_add(pm4, resource[i]->state[j]);
+ }
}
- rctx->ws->buffer_unmap(bo->cs_buf);
-
for (i = count; i < NUM_TEX_UNITS; i++) {
if (rctx->ps_samplers.views[i])
pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
}
- va = r600_resource_va(ctx->screen, (void *)bo);
- si_pm4_add_bo(pm4, bo, RADEON_USAGE_READ);
- si_pm4_set_reg(pm4, R_00B040_SPI_SHADER_USER_DATA_PS_4, va);
- si_pm4_set_reg(pm4, R_00B044_SPI_SHADER_USER_DATA_PS_5, va >> 32);
+ si_pm4_sh_data_end(pm4, R_00B040_SPI_SHADER_USER_DATA_PS_4);
out:
si_pm4_set_state(rctx, ps_sampler_views, pm4);
More information about the mesa-commit
mailing list