[PATCH 8/9] drm/imx: ipuv3-plane: add support for YUV 4:2:2 and 4:4:4, NV12, and NV16 formats

Philipp Zabel p.zabel at pengutronix.de
Wed Oct 19 09:33:55 UTC 2016


Am Mittwoch, den 19.10.2016, 15:49 +0800 schrieb Ying Liu:
[...]
> > @@ -406,10 +425,16 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
> >         switch (fb->pixel_format) {
> >         case DRM_FORMAT_YUV420:
> >         case DRM_FORMAT_YVU420:
> > +       case DRM_FORMAT_YUV422:
> > +       case DRM_FORMAT_YVU422:
> > +       case DRM_FORMAT_YUV444:
> > +       case DRM_FORMAT_YVU444:
> >                 ubo = drm_plane_state_to_ubo(state);
> >                 vbo = drm_plane_state_to_vbo(state);
> >
> > -               if (fb->pixel_format == DRM_FORMAT_YUV420)
> > +               if (fb->pixel_format != DRM_FORMAT_YVU420 &&
> > +                   fb->pixel_format != DRM_FORMAT_YVU422 &&
> > +                   fb->pixel_format != DRM_FORMAT_YVU444)
> 
> Nit:
> This looks more straightforward, perhaps.
> 
> +               if (fb->pixel_format == DRM_FORMAT_YUV420 ||
> +                   fb->pixel_format == DRM_FORMAT_YUV422 ||
> +                   fb->pixel_format == DRM_FORMAT_YUV444)

I've inverted it at first because I mistakenly thought I'd also have to
add NV12 and NV16 to the list otherwise. I'd like to change this to:

	ubo = drm_plane_state_to_ubo(state);
	vbo = drm_plane_state_to_vbo(state);

	if (fb->pixel_format == DRM_FORMAT_YVU420 ||
	    fb->pixel_format == DRM_FORMAT_YVU422 ||
	    fb->pixel_format == DRM_FORMAT_YVU444)
		swap(ubo, vbo);
                                                                                                                                      
	ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
				      fb->pitches[1], ubo, vbo);

to make it even more obvious that we just switch the U/V buffer offsets
for YVU formats.

thanks
Philipp



More information about the dri-devel mailing list