diff options
author | Marek Olšák <[email protected]> | 2016-06-27 19:47:27 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-06-29 20:12:00 +0200 |
commit | 63f8d648f019c4df8d4870539ea2c3f4bd468917 (patch) | |
tree | 08e1dace9c5b5a079472d02304a562a50e40fd42 /src | |
parent | 44906101c4bcd630733ee46fcd9a3b718314461d (diff) |
gallium/radeon: remove zombie textures kept alive by DCC stat gathering
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 776ad7c68d0..68f17012a7a 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1716,6 +1716,25 @@ unsigned r600_translate_colorswap(enum pipe_format format, bool do_endian_swap) /* PIPELINE_STAT-BASED DCC ENABLEMENT FOR DISPLAYABLE SURFACES */ +static void vi_dcc_clean_up_context_slot(struct r600_common_context *rctx, + int slot) +{ + int i; + + if (rctx->dcc_stats[slot].query_active) + vi_separate_dcc_stop_query(&rctx->b, + rctx->dcc_stats[slot].tex); + + for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats[slot].ps_stats); i++) + if (rctx->dcc_stats[slot].ps_stats[i]) { + rctx->b.destroy_query(&rctx->b, + rctx->dcc_stats[slot].ps_stats[i]); + rctx->dcc_stats[slot].ps_stats[i] = NULL; + } + + r600_texture_reference(&rctx->dcc_stats[slot].tex, NULL); +} + /** * Return the per-context slot where DCC statistics queries for the texture live. */ @@ -1724,6 +1743,13 @@ static unsigned vi_get_context_dcc_stats_index(struct r600_common_context *rctx, { int i, empty_slot = -1; + /* Remove zombie textures (textures kept alive by this array only). */ + for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats); i++) + if (rctx->dcc_stats[i].tex && + rctx->dcc_stats[i].tex->resource.b.b.reference.count == 1) + vi_dcc_clean_up_context_slot(rctx, i); + + /* Find the texture. */ for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats); i++) { /* Return if found. */ if (rctx->dcc_stats[i].tex == tex) { @@ -1747,18 +1773,7 @@ static unsigned vi_get_context_dcc_stats_index(struct r600_common_context *rctx, oldest_slot = i; /* Clean up the oldest slot. */ - if (rctx->dcc_stats[oldest_slot].query_active) - vi_separate_dcc_stop_query(&rctx->b, - rctx->dcc_stats[oldest_slot].tex); - - for (i = 0; i < ARRAY_SIZE(rctx->dcc_stats[oldest_slot].ps_stats); i++) - if (rctx->dcc_stats[oldest_slot].ps_stats[i]) { - rctx->b.destroy_query(&rctx->b, - rctx->dcc_stats[oldest_slot].ps_stats[i]); - rctx->dcc_stats[oldest_slot].ps_stats[i] = NULL; - } - - r600_texture_reference(&rctx->dcc_stats[oldest_slot].tex, NULL); + vi_dcc_clean_up_context_slot(rctx, oldest_slot); empty_slot = oldest_slot; } |