Module: Mesa Branch: main Commit: 83a05447c58ee4bea2aa899633baea1486848c51 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=83a05447c58ee4bea2aa899633baea1486848c51
Author: Lucas Stach <[email protected]> Date: Fri Nov 18 11:04:24 2022 +0100 etnaviv: optimize resource copies by skipping clean levels If we sync/flush a full resource we can skip any level where the target is of the same age as the source. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19964> --- src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index 442257138ec..0b077ad9e85 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -217,6 +217,15 @@ etna_copy_resource(struct pipe_context *pctx, struct pipe_resource *dst, /* Copy each level and each layer */ for (int level = first_level; level <= last_level; level++) { + /* skip levels that don't need to be flushed or are of the same age */ + if (src == dst) { + if (!etna_resource_level_needs_flush(&src_priv->levels[level])) + continue; + } else { + if (!etna_resource_level_older(&dst_priv->levels[level], &src_priv->levels[level])) + continue; + } + blit.src.level = blit.dst.level = level; blit.src.box.width = blit.dst.box.width = MIN2(src_priv->levels[level].padded_width, dst_priv->levels[level].padded_width);
