diff options
author | Marek Olšák <[email protected]> | 2016-02-24 22:04:47 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-03-09 15:02:27 +0100 |
commit | f18fc70d6f62719e4fae2f93f2d563894bc1437f (patch) | |
tree | b2224cd381a6292da5d823d3fb5a32cb69f5b3e3 /src/gallium/drivers/radeon/r600_texture.c | |
parent | 1e48ec7571cb36b4ee5660f8066c7905a3432969 (diff) |
radeonsi: disable DCC on handle export if expecting write access
This should be okay except that sampler views and images are not re-set.
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_texture.c')
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 1fff33ef5b5..b8c4c795b3c 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -289,6 +289,31 @@ static void r600_texture_disable_cmask(struct r600_common_screen *rscreen, r600_dirty_all_framebuffer_states(rscreen); } +static void r600_texture_disable_dcc(struct r600_common_screen *rscreen, + struct r600_texture *rtex) +{ + struct r600_common_context *rctx = + (struct r600_common_context *)rscreen->aux_context; + + if (!rtex->dcc_offset) + return; + + /* Decompress DCC. */ + pipe_mutex_lock(rscreen->aux_context_lock); + rctx->decompress_dcc(&rctx->b, rtex); + rctx->b.flush(&rctx->b, NULL, 0); + pipe_mutex_unlock(rscreen->aux_context_lock); + + /* Disable DCC. */ + rtex->dcc_offset = 0; + rtex->cb_color_info &= ~VI_S_028C70_DCC_ENABLE(1); + + /* Notify all contexts about the change. */ + r600_dirty_all_framebuffer_states(rscreen); + + /* TODO: re-set all sampler views and images, but how? */ +} + static boolean r600_texture_get_handle(struct pipe_screen* screen, struct pipe_resource *resource, struct winsys_handle *whandle, @@ -311,6 +336,13 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, res->external_usage = usage; if (resource->target != PIPE_BUFFER) { + /* Since shader image stores don't support DCC on VI, + * disable it for external clients that want write + * access. + */ + if (usage & PIPE_HANDLE_USAGE_WRITE) + r600_texture_disable_dcc(rscreen, rtex); + if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) { /* Eliminate fast clear (both CMASK and DCC) */ r600_eliminate_fast_color_clear(rscreen, rtex); @@ -321,6 +353,7 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, r600_texture_disable_cmask(rscreen, rtex); } + /* Set metadata. */ r600_texture_init_metadata(rtex, &metadata); rscreen->ws->buffer_set_metadata(res->buf, &metadata); } |