[Mesa-dev] [PATCH 08/11] radeonsi: fix memory exhaustion issue with DCC statistics gathering with DRI2
Dylan Baker
dylan at pnwbakers.com
Fri Jun 29 15:40:47 UTC 2018
Quoting Marek Olšák (2018-06-18 16:33:09)
> From: Marek Olšák <marek.olsak at amd.com>
>
> Cc: 18.1 <mesa-stable at lists.freedesktop.org>
> ---
> src/gallium/drivers/radeonsi/si_blit.c | 30 +++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
> index fe059b36577..93cf7fe9001 100644
> --- a/src/gallium/drivers/radeonsi/si_blit.c
> +++ b/src/gallium/drivers/radeonsi/si_blit.c
> @@ -1320,23 +1320,47 @@ static void si_flush_resource(struct pipe_context *ctx,
> if (rtex->dcc_separate_buffer && !rtex->separate_dcc_dirty)
> return;
>
> if (!rtex->is_depth && (rtex->cmask.size || rtex->dcc_offset)) {
> si_blit_decompress_color(sctx, rtex, 0, res->last_level,
> 0, util_max_layer(res, 0),
> rtex->dcc_separate_buffer != NULL);
> }
>
> /* Always do the analysis even if DCC is disabled at the moment. */
> - if (rtex->dcc_gather_statistics && rtex->separate_dcc_dirty) {
> - rtex->separate_dcc_dirty = false;
> - vi_separate_dcc_process_and_reset_stats(ctx, rtex);
> + if (rtex->dcc_gather_statistics) {
> + bool separate_dcc_dirty = rtex->separate_dcc_dirty;
> +
> + /* If the color buffer hasn't been unbound and fast clear hasn't
> + * been used, separate_dcc_dirty is false, but there may have been
> + * new rendering. Check if the color buffer is bound and assume
> + * it's dirty.
> + *
> + * Note that DRI2 never unbinds window colorbuffers, which means
> + * the DCC pipeline statistics query would never be re-set and would
> + * keep adding new results until all free memory is exhausted if we
> + * didn't do this.
> + */
> + if (!separate_dcc_dirty) {
> + for (unsigned i = 0; i < sctx->framebuffer.state.nr_cbufs; i++) {
> + if (sctx->framebuffer.state.cbufs[i] &&
> + sctx->framebuffer.state.cbufs[i]->texture == res) {
> + separate_dcc_dirty = true;
> + break;
> + }
> + }
> + }
> +
> + if (separate_dcc_dirty) {
> + rtex->separate_dcc_dirty = false;
> + vi_separate_dcc_process_and_reset_stats(ctx, rtex);
> + }
> }
> }
>
> void si_decompress_dcc(struct si_context *sctx, struct r600_texture *rtex)
> {
> if (!rtex->dcc_offset)
> return;
>
> si_blit_decompress_color(sctx, rtex, 0, rtex->buffer.b.b.last_level,
> 0, util_max_layer(&rtex->buffer.b.b, 0),
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Hi Marek,
This didn't apply cleanly to 18.1 because of
1ba87f4438069964af6548f4fa05386be999f4de (radeonsi: rename r600_texture ->
si_texture, rxxx -> xxx or sxxx), I've attempted to rebase the commit by
changing "tex" to "rtex", please take a look at the commit in staging/18.1 in
the main tree or 18.1-proposed in my tree and let me know if it looks good to
you.
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180629/21465a4b/attachment.sig>
More information about the mesa-dev
mailing list