[PATCH 3/3] etnaviv: Add sampler TS support
Wladimir
laanwj at gmail.com
Wed Nov 8 02:41:36 UTC 2017
> +/* Return true if a resource has a TS, and it is valid for at least one level */
> +static bool
> +etna_resource_has_valid_ts(struct pipe_resource *prsc)
> +{
> + struct etna_resource *rsc = etna_resource(prsc);
> +
> + if (!rsc->ts_bo)
> + return false;
> +
> + for (int level = 0; level <= rsc->base.last_level; level++)
> + if (rsc->levels[level].ts_valid)
> + return true;
> + return false;
> +}
> static void
> -etna_update_sampler_source(struct pipe_sampler_view *view)
> +etna_update_sampler_source(struct etna_context *ctx, struct pipe_sampler_view *view, int num)
> {
> struct etna_resource *base = etna_resource(view->texture);
> struct etna_resource *to = base, *from = base;
> + bool enable_sampler_ts = false;
>
> if (base->external && etna_resource_newer(etna_resource(base->external), base))
> from = etna_resource(base->external);
> @@ -128,12 +199,19 @@ etna_update_sampler_source(struct pipe_sampler_view *view)
> etna_copy_resource(view->context, &to->base, &from->base, 0,
> view->texture->last_level);
> to->seqno = from->seqno;
> - } else if ((to == from) && etna_resource_needs_flush(to)) {
> - /* Resolve TS if needed, remove when adding sampler TS */
> - etna_copy_resource(view->context, &to->base, &from->base, 0,
> - view->texture->last_level);
> - to->flush_seqno = from->seqno;
> + } else if ((to == from) &&
> + etna_resource_needs_flush(to) &&
> + etna_resource_has_valid_ts(&to->base)) {
I just realized - would it maybe make sense to roll the call to
etna_resource_has_valid_ts into etna_resource_needs_flush?
etna_resource_needs_flush is only called from two places - here, and
in resource_flush, where it also determines whether to do a
resolve-to-self, but before presenting the image. There it also only
makes sense to do if the resource has at least a valid TS.
Wladimir
More information about the etnaviv
mailing list