[igt-dev] [PATCH i-g-t 4/4] lib/igt_fb: Generalize the slow read from gtt mmap handling

Chris Wilson chris at chris-wilson.co.uk
Fri Nov 2 19:32:02 UTC 2018


Quoting Ville Syrjälä (2018-11-02 19:30:29)
> On Fri, Nov 02, 2018 at 07:17:03PM +0000, Chris Wilson wrote:
> > Quoting Ville Syrjala (2018-11-02 19:06:51)
> > > +static void *convert_src_get(const struct fb_convert *cvt)
> > > +{
> > > +       void *buf;
> > > +
> > > +       if (!cvt->src.slow_reads)
> > > +               return cvt->src.ptr;
> > > +
> > > +       /*
> > > +        * Reading from the BO is awfully slow because of lack of read caching,
> > > +        * it's faster to copy the whole BO to a temporary buffer and convert
> > > +        * from there.
> > > +        */
> > > +       buf = malloc(cvt->src.fb->size);
> > 
> > if (!buf)
> >       return cvt->src.ptr;
> 
> Sure, why not.

The other choice being igt_assert(buf) or igt_xmalloc() :)
-Chris


More information about the igt-dev mailing list