[PATCH 3/3] etnaviv: Add sampler TS support

Lucas Stach l.stach at pengutronix.de
Thu Nov 9 17:15:51 UTC 2017


Hi Wladimir!

Am Mittwoch, den 08.11.2017, 03:41 +0100 schrieb Wladimir:
> > +/* 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.

Yes, this makes sense.

Also I've just tested this and I've seen some intermittent missing
shadow tiles in the glmark2 shadow demo. Probably you are now missing
the TS cache flush we would normally do before blitting the shadow
image with the RS.

Regards,
Lucas


More information about the etnaviv mailing list