summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_texture.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-03-01 21:50:25 +0100
committerMarek Olšák <marek.olsak@amd.com>2016-03-09 15:02:27 +0100
commit970b979da1639d57e89169f96cc0064db9dae43a (patch)
tree1417f5a6303f226ff91be085e28339cd754c247d /src/gallium/drivers/radeon/r600_texture.c
parentabac6bf67a85310908c79187d102a86ee8fe6dd6 (diff)
downloadexternal_mesa3d-970b979da1639d57e89169f96cc0064db9dae43a.zip
external_mesa3d-970b979da1639d57e89169f96cc0064db9dae43a.tar.gz
external_mesa3d-970b979da1639d57e89169f96cc0064db9dae43a.tar.bz2
gallium/radeon: eliminate fast color clear before sharing
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_texture.c')
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 229fa5e..ec2f245 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -249,6 +249,17 @@ static void r600_texture_init_metadata(struct r600_texture *rtex,
metadata->scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0;
}
+static void r600_eliminate_fast_color_clear(struct r600_common_screen *rscreen,
+ struct r600_texture *rtex)
+{
+ struct pipe_context *ctx = rscreen->aux_context;
+
+ 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);
+}
+
static boolean r600_texture_get_handle(struct pipe_screen* screen,
struct pipe_resource *resource,
struct winsys_handle *whandle,
@@ -271,6 +282,11 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
res->external_usage = usage;
if (resource->target != PIPE_BUFFER) {
+ if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) {
+ /* Eliminate fast clear (both CMASK and DCC) */
+ r600_eliminate_fast_color_clear(rscreen, rtex);
+ }
+
r600_texture_init_metadata(rtex, &metadata);
rscreen->ws->buffer_set_metadata(res->buf, &metadata);
}