From dce4aa83e4f07aba08bbdf70889e1be74c9c7b27 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 18 Nov 2022 18:00:58 +0100 Subject: [PATCH] etnaviv: allow sampler TS even if the resource is flushed As long as the TS is valid we can use the tile status to optimize the sample fetch, even if the resource has been flushed for any reason. Do the check for valid TS first when checking whether to enable sampler TS to avoid all the other checks when TS isn't usable. Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_texture.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c index 0d1d4a6..1cd06d3 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c @@ -125,6 +125,10 @@ etna_can_use_sampler_ts(struct pipe_sampler_view *view, int num) /* Sampler TS can be used under the following conditions: */ + /* The resource TS is valid for level 0. */ + if (!etna_resource_level_ts_valid(&rsc->levels[0])) + return false; + /* The hardware supports it. */ if (!VIV_FEATURE(screen, chipMinorFeatures2, TEXTURE_TILED_READ)) return false; @@ -150,10 +154,6 @@ etna_can_use_sampler_ts(struct pipe_sampler_view *view, int num) MIN2(view->u.tex.last_level, rsc->base.last_level) != 0) return false; - /* The resource TS is valid for level 0. */ - if (!etna_resource_level_ts_valid(&rsc->levels[0])) - return false; - return true; } @@ -176,10 +176,10 @@ etna_update_sampler_source(struct pipe_sampler_view *view, int num) view->u.tex.first_level, MIN2(view->texture->last_level, view->u.tex.last_level)); ctx->dirty |= ETNA_DIRTY_TEXTURE_CACHES; - } else if ((to == from) && etna_resource_needs_flush(to)) { + } else if (to == from) { if (etna_can_use_sampler_ts(view, num)) { enable_sampler_ts = true; - } else { + } else if (etna_resource_needs_flush(to)) { /* Resolve TS if needed */ etna_copy_resource(view->context, &to->base, &from->base, view->u.tex.first_level, -- 2.7.4