lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241202-divergent-holistic-seal-b24cd6@houat>
Date: Mon, 2 Dec 2024 12:59:45 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, 
	Simona Vetter <simona@...ll.ch>, kernel@...labora.com, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] drm/connector: hdmi: Add support for YUV420 format
 verification

On Mon, Dec 02, 2024 at 01:15:36PM +0200, Cristian Ciocaltea wrote:
> Hi Maxime,
> 
> On 12/2/24 12:50 PM, Maxime Ripard wrote:
> > On Sat, Nov 30, 2024 at 01:56:33AM +0200, Cristian Ciocaltea wrote:
> >> Provide the necessary constraints verification in
> >> sink_supports_format_bpc() in order to support handling of YUV420
> >> output format.
> >>
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
> >> ---
> >>  drivers/gpu/drm/display/drm_hdmi_state_helper.c | 40 +++++++++++++++++++++++--
> >>  1 file changed, 37 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> index 0cbcee7e77cd8dff387044487ce28ee5748f5587..3a55881a544a519bb1254968db891c814f831a0f 100644
> >> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> >> @@ -3,6 +3,7 @@
> >>  #include <drm/drm_atomic.h>
> >>  #include <drm/drm_connector.h>
> >>  #include <drm/drm_edid.h>
> >> +#include <drm/drm_modes.h>
> >>  #include <drm/drm_print.h>
> >>  
> >>  #include <drm/display/drm_hdmi_helper.h>
> >> @@ -114,6 +115,12 @@ sink_supports_format_bpc(const struct drm_connector *connector,
> >>  		return false;
> >>  	}
> >>  
> >> +	if (drm_mode_is_420_only(info, mode) && format != HDMI_COLORSPACE_YUV420) {
> >> +		drm_dbg_kms(dev, "%s format unsupported by the sink for VIC%u.\n",
> >> +			    drm_hdmi_connector_get_output_format_name(format), vic);
> >> +		return false;
> >> +	}
> >> +
> >>  	switch (format) {
> >>  	case HDMI_COLORSPACE_RGB:
> >>  		drm_dbg_kms(dev, "RGB Format, checking the constraints.\n");
> >> @@ -144,9 +151,36 @@ sink_supports_format_bpc(const struct drm_connector *connector,
> >>  		return true;
> >>  
> >>  	case HDMI_COLORSPACE_YUV420:
> >> -		/* TODO: YUV420 is unsupported at the moment. */
> >> -		drm_dbg_kms(dev, "YUV420 format isn't supported yet.\n");
> >> -		return false;
> >> +		drm_dbg_kms(dev, "YUV420 format, checking the constraints.\n");
> >> +
> >> +		if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR420)) {
> >> +			drm_dbg_kms(dev, "Sink doesn't support YUV420.\n");
> >> +			return false;
> >> +		}
> >> +
> >> +		if (!drm_mode_is_420(info, mode)) {
> >> +			drm_dbg_kms(dev, "Sink doesn't support YUV420 for VIC%u.\n", vic);
> >> +			return false;
> >> +		}
> >> +
> >> +		if (bpc == 10 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_30)) {
> >> +			drm_dbg_kms(dev, "10 BPC but sink doesn't support Deep Color 30.\n");
> >> +			return false;
> >> +		}
> >> +
> >> +		if (bpc == 12 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_36)) {
> >> +			drm_dbg_kms(dev, "12 BPC but sink doesn't support Deep Color 36.\n");
> >> +			return false;
> >> +		}
> >> +
> >> +		if (bpc == 16 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) {
> >> +			drm_dbg_kms(dev, "16 BPC but sink doesn't support Deep Color 48.\n");
> >> +			return false;
> >> +		}
> >> +
> >> +		drm_dbg_kms(dev, "YUV420 format supported in that configuration.\n");
> >> +
> >> +		return true;
> > 
> > We also need to check whether the source supports it or not.
> 
> I assumed the following check does already handle that:
> 
> 	if (!(connector->hdmi.supported_formats & BIT(format))) {
> 		drm_dbg_kms(dev, "%s format unsupported by the connector.\n",
> 
> Is there anything else missing?

You're right, sorry for the noise :)

Maxime

Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ