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/evergreen_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/evergreen_state.c')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 169499bcee9..c126e7dfc3d 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -979,9 +979,11 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, return ss; } -static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state) +struct pipe_sampler_view * +evergreen_create_sampler_view_custom(struct pipe_context *ctx, + struct pipe_resource *texture, + const struct pipe_sampler_view *state, + unsigned width0, unsigned height0) { struct r600_screen *rscreen = (struct r600_screen*)ctx->screen; struct r600_pipe_sampler_view *view = CALLOC_STRUCT(r600_pipe_sampler_view); @@ -1027,8 +1029,8 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte endian = r600_colorformat_endian_swap(format); - width = tmp->surface.level[0].npix_x; - height = tmp->surface.level[0].npix_y; + width = width0; + height = height0; depth = tmp->surface.level[0].npix_z; pitch = tmp->surface.level[0].nblk_x * util_format_get_blockwidth(state->format); tile_type = tmp->tile_type; @@ -1116,6 +1118,15 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte return &view->base; } +static struct pipe_sampler_view * +evergreen_create_sampler_view(struct pipe_context *ctx, + struct pipe_resource *tex, + const struct pipe_sampler_view *state) +{ + return evergreen_create_sampler_view_custom(ctx, tex, state, + tex->width0, tex->height0); +} + static void evergreen_emit_clip_state(struct r600_context *rctx, struct r600_atom *atom) { struct radeon_winsys_cs *cs = rctx->cs; |