diff options
author | Marek Olšák <[email protected]> | 2012-09-23 23:12:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-10-06 04:31:16 +0200 |
commit | 6db53ca490b22ba3f16b3ab0beef7a5fc071a074 (patch) | |
tree | 854d44928640da4085b6d4c3ce6aa81c6fde9dc1 /src/gallium/drivers/r600/r600_state.c | |
parent | d063c7b1421a6e8ad4e2efc1bf913920766cc5ee (diff) |
r600g: don't modify pipe_resource in resource_copy_region, fixing race condition
pipe_resource can be shared between contexts, we shouldn't modify its
description. Instead, let's use the resource "views" (sampler views and
surfaces), where we can freely change almost any property of a resource.
Diffstat (limited to 'src/gallium/drivers/r600/r600_state.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 3347e6d872f..1d6171debb5 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1007,9 +1007,11 @@ static void *r600_create_sampler_state(struct pipe_context *ctx, return ss; } -static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state) +struct pipe_sampler_view * +r600_create_sampler_view_custom(struct pipe_context *ctx, + struct pipe_resource *texture, + const struct pipe_sampler_view *state, + unsigned width_first_level, unsigned height_first_level) { struct r600_pipe_sampler_view *view = CALLOC_STRUCT(r600_pipe_sampler_view); struct r600_texture *tmp = (struct r600_texture*)texture; @@ -1055,8 +1057,8 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c offset_level = state->u.tex.first_level; last_level = state->u.tex.last_level - offset_level; - width = tmp->surface.level[offset_level].npix_x; - height = tmp->surface.level[offset_level].npix_y; + width = width_first_level; + height = height_first_level; depth = tmp->surface.level[offset_level].npix_z; pitch = tmp->surface.level[offset_level].nblk_x * util_format_get_blockwidth(state->format); tile_type = tmp->tile_type; @@ -1116,6 +1118,18 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c return &view->base; } +static struct pipe_sampler_view * +r600_create_sampler_view(struct pipe_context *ctx, + struct pipe_resource *tex, + const struct pipe_sampler_view *state) +{ + struct r600_texture *rtex = (struct r600_texture*)tex; + + return r600_create_sampler_view_custom(ctx, tex, state, + rtex->surface.level[state->u.tex.first_level].npix_x, + rtex->surface.level[state->u.tex.first_level].npix_y); +} + static void r600_emit_clip_state(struct r600_context *rctx, struct r600_atom *atom) { struct radeon_winsys_cs *cs = rctx->cs; |