[igt-dev] [PATCH i-g-t 4/4] lib/igt_fb: Generalize the slow read from gtt mmap handling
Ville Syrjälä
ville.syrjala at linux.intel.com
Fri Nov 2 19:30:29 UTC 2018
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.
>
> > + igt_memcpy_from_wc(buf, cvt->src.ptr, cvt->src.fb->size);
> > +
> > + return buf;
> > +}
> > +
> > +static void convert_src_put(const struct fb_convert *cvt,
> > + void *src_buf)
> > +{
> > + /*
> > + * 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.
> > + */
> > + if (cvt->src.slow_reads)
>
> if (src_buf != cvt->src.ptr)
Yes, that is better (tm).
>
> > + free(src_buf);
> > +}
--
Ville Syrjälä
Intel
More information about the igt-dev
mailing list