[igt-dev] [PATCH i-g-t 8/8] lib: Add support for rendering into packed YCbCr framebuffers

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Feb 28 14:59:46 UTC 2018


On Tue, Feb 27, 2018 at 09:36:54PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2018-02-27 21:21:20)
> > +static void convert_yuyv_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_upload *blit,
> > +                                 const unsigned char swz[4])
> > +{
> > +       int i, j;
> > +       const uint8_t *yuyv;
> > +       uint8_t *rgb24 = blit->rgb24.map;
> > +       unsigned rgb24_stride = blit->rgb24.stride, yuyv_stride = blit->linear.stride;
> > +       uint8_t *buf = malloc(blit->linear.size);
> > +       bool full_range = false; /* FIXME */
> > +       const struct igt_color_encoding *e = &igt_ycbcr_bt601; /* FIXME */
> > +       struct igt_mat4 m = igt_ycbcr_to_rgb_matrix(e, full_range);
> > +
> > +       igt_assert((fb->width & 1) == 0);
> > +
> > +       /*
> > +        * 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.
> > +        */
> > +       memcpy(buf, blit->linear.map, blit->linear.size);
> 
> Frequent enough to do memcpy_from_wc?

I've not measured how bad this actually is, but optimizing memcpies
when possible doesn't seem like a bad idea to me. Maarten?

-- 
Ville Syrjälä
Intel OTC


More information about the igt-dev mailing list