From 4907bb44c3c9bdeac0077ce8d0a533d3ef685920 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 6 May 2020 20:56:52 -0400 Subject: [PATCH] radeonsi: simplify setting resource usage for si_init_temp_resource_from_box usage was set twice, once in the function, and then after the function Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_texture.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 328587c9565..6c893e33b70 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1548,7 +1548,7 @@ bool si_init_flushed_depth_texture(struct pipe_context *ctx, struct pipe_resourc */ static void si_init_temp_resource_from_box(struct pipe_resource *res, struct pipe_resource *orig, const struct pipe_box *box, unsigned level, - unsigned flags) + unsigned usage, unsigned flags) { memset(res, 0, sizeof(*res)); res->format = orig->format; @@ -1556,7 +1556,7 @@ static void si_init_temp_resource_from_box(struct pipe_resource *res, struct pip res->height0 = box->height; res->depth0 = 1; res->array_size = 1; - res->usage = flags & SI_RESOURCE_FLAG_TRANSFER ? PIPE_USAGE_STAGING : PIPE_USAGE_DEFAULT; + res->usage = usage; res->flags = flags; if (flags & SI_RESOURCE_FLAG_TRANSFER && util_format_is_compressed(orig->format)) { @@ -1695,8 +1695,9 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resou struct pipe_resource resource; struct si_texture *staging; - si_init_temp_resource_from_box(&resource, texture, box, level, SI_RESOURCE_FLAG_TRANSFER); - resource.usage = (usage & PIPE_TRANSFER_READ) ? PIPE_USAGE_STAGING : PIPE_USAGE_STREAM; + unsigned bo_usage = usage & PIPE_TRANSFER_READ ? PIPE_USAGE_STAGING : PIPE_USAGE_STREAM; + si_init_temp_resource_from_box(&resource, texture, box, level, bo_usage, + SI_RESOURCE_FLAG_TRANSFER); /* Since depth-stencil textures don't support linear tiling, * blit from ZS to color and vice versa. u_blitter will do -- 2.30.2