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_texture.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_texture.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_texture.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 1c52ff8c83b..4fb10ca031d 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -481,13 +481,12 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, 0, NULL, TRUE, &surface); } -static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, +struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe, struct pipe_resource *texture, - const struct pipe_surface *templ) + const struct pipe_surface *templ, + unsigned width, unsigned height) { - struct r600_texture *rtex = (struct r600_texture*)texture; struct r600_surface *surface = CALLOC_STRUCT(r600_surface); - unsigned level = templ->u.tex.level; assert(templ->u.tex.first_layer == templ->u.tex.last_layer); if (surface == NULL) @@ -496,13 +495,25 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, pipe_resource_reference(&surface->base.texture, texture); surface->base.context = pipe; surface->base.format = templ->format; - surface->base.width = rtex->surface.level[level].npix_x; - surface->base.height = rtex->surface.level[level].npix_y; + surface->base.width = width; + surface->base.height = height; surface->base.usage = templ->usage; surface->base.u = templ->u; return &surface->base; } +static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, + struct pipe_resource *texture, + const struct pipe_surface *templ) +{ + struct r600_texture *rtex = (struct r600_texture*)texture; + unsigned level = templ->u.tex.level; + + return r600_create_surface_custom(pipe, texture, templ, + rtex->surface.level[level].npix_x, + rtex->surface.level[level].npix_y); +} + static void r600_surface_destroy(struct pipe_context *pipe, struct pipe_surface *surface) { |