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

Chris Wilson
2018-11-02T19:17:10Z

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;

> + 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)

> + free(src_buf);
> +}