[PATCH RFC v2 1/2] drm: Add optinal YCBCR_ENCODING property to drm_plane

Hans Verkuil hverkuil at xs4all.nl
Thu May 4 09:25:35 UTC 2017


Hi Jyri,

On 05/04/17 09:14, Jyri Sarha wrote:
> Add a standard optinal property to control YCbCr conversion in DRM
> planes. The property is stored to drm_plane object to allow different
> set of supported conversion modes for different planes on the device.
> 
> Signed-off-by: Jyri Sarha <jsarha at ti.com>
> ---
>  drivers/gpu/drm/drm_atomic.c     |  5 ++++
>  drivers/gpu/drm/drm_color_mgmt.c | 59 ++++++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/drm_plane.c      |  3 ++
>  include/drm/drm_color_mgmt.h     | 14 ++++++++++
>  include/drm/drm_plane.h          |  6 ++++
>  5 files changed, 87 insertions(+)
> 

<snip>

> @@ -37,4 +39,16 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
>  int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
>  				 int gamma_size);
>  
> +enum drm_plane_ycbcr_encoding {
> +	DRM_PLANE_YCBCR_BT601_FULL_RANGE = 0,
> +	DRM_PLANE_YCBCR_BT601_LIMITED_RANGE,
> +	DRM_PLANE_YCBCR_BT709_LIMITED_RANGE,
> +	DRM_PLANE_YCBCR_BT2020_LIMITED_RANGE,
> +};

I did a lot of work and research into colorspace handling for V4L2, and I
strongly recommend that you do not combine the ycbcr encoding with the quantization
range setting. I.e., make this two properties.

This is a good reference (but I'm biased, since I wrote it :-) ):

https://linuxtv.org/downloads/v4l-dvb-apis-new/uapi/v4l/colorspaces.html
(and the two following sections as well).

The four 'parameters' that control how to interpret colors (colorspace,
transfer function, ycbcr encoding, quantization range) are all independent
of one another, and combining two or more into one property will become
a hassle to maintain.

Regards,

	Hans


More information about the dri-devel mailing list