summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-08-21 12:30:21 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-09-05 18:01:15 +0200
commit01dd73f2f42f0d017c2c6ccf1138a9c222953d52 (patch)
treeb3e451310107bfa53dc30128abd630a1b954d9ad
parentd22feeaa9d65126e9775fcbaec8007e349f7fac5 (diff)
gallium/radeon: use the current ctx for CMASK elimination in resource_get_handle
For coherency with the current context. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index e7be768f571..912d1234aef 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -340,15 +340,20 @@ static void r600_dirty_all_framebuffer_states(struct r600_common_screen *rscreen
p_atomic_inc(&rscreen->dirty_fb_counter);
}
-static void r600_eliminate_fast_color_clear(struct r600_common_screen *rscreen,
- struct r600_texture *rtex)
+static void r600_eliminate_fast_color_clear(struct r600_common_context *rctx,
+ struct r600_texture *rtex)
{
- struct pipe_context *ctx = rscreen->aux_context;
+ struct r600_common_screen *rscreen = rctx->screen;
+ struct pipe_context *ctx = &rctx->b;
+
+ if (ctx == rscreen->aux_context)
+ pipe_mutex_lock(rscreen->aux_context_lock);
- pipe_mutex_lock(rscreen->aux_context_lock);
ctx->flush_resource(ctx, &rtex->resource.b.b);
ctx->flush(ctx, NULL, 0);
- pipe_mutex_unlock(rscreen->aux_context_lock);
+
+ if (ctx == rscreen->aux_context)
+ pipe_mutex_unlock(rscreen->aux_context_lock);
}
static void r600_texture_discard_cmask(struct r600_common_screen *rscreen,
@@ -545,7 +550,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) &&
rtex->cmask.size) {
/* Eliminate fast clear (both CMASK and DCC) */
- r600_eliminate_fast_color_clear(rscreen, rtex);
+ r600_eliminate_fast_color_clear(rctx, rtex);
/* Disable CMASK if flush_resource isn't going
* to be called.