From nobody Fri Dec 27 13:54:02 2024 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FC4C27726 for ; Sat, 30 Nov 2024 00:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732924835; cv=none; b=uGSegd0NYzihtG1IgQHb9EdbzH34S/koGIZO/o+C/matzcwfuTPedrSCm/o7N690tQBMlCwM4DlChvaLcwBYU3ZsqJCSsyazbZgr+Fiqwa7Bx5mZzfyndTImSfD4WBIYANL0+RnghU8lZEJRksm5PksUooYJyb4SqCkflrtf/00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732924835; c=relaxed/simple; bh=Cza86IcsLPmgAtr3aY7j2z93JXxEWnTLFN4ccz2Y7tA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gG04krFhCE5Vcf7Q7VouMf8ig6Xe62le6B0hYa8ohA4iDpZljQxOAkHreSPe8Qjk/0T6pb0UE2uHkBSKMsY3PuExZlTULRvm1Ujrp94+svSzP7+i1K0dS4FPC0UleY6EigAwUDKN9ZnyAd+cDTWZHVPK0d9HG/a+8r3Z9YSjUOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Qi95bxbh; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Qi95bxbh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1732924831; bh=Cza86IcsLPmgAtr3aY7j2z93JXxEWnTLFN4ccz2Y7tA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Qi95bxbhHt/xrTnYL0cSIahFCfQJ+geCLTtTT9ZKN0q/y+8JDtU9vLawsdyRU33jm ZQSvQ5i8ZF6kajwuv7rLkzrsS3X31bH5sly9fLdXDRib5AnBog1ivzlEI7dfSxuHOr le+fX1OobfmRz08cWD13rQxDs9U0RvHtbLyCx3541N+oa/YjwDubyw1T3EhgXyCY9x RD9TrRsd3ZDvBsYRWrYnHLd2xBW9WwWQbEJLPtCANMY6KAluBoXOWdXKr/SRGVZg49 dVgvZE43UCYzV+cVIChVvEvSzCt/9nnJebpi1IZIr6EKn3Y2s6tWvBC8/KdaslCeqm TGo0Re6ei+/gg== Received: from localhost (unknown [86.120.21.57]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 4EC0317E0E6E; Sat, 30 Nov 2024 01:00:31 +0100 (CET) From: Cristian Ciocaltea Date: Sat, 30 Nov 2024 01:56:33 +0200 Subject: [PATCH 2/3] drm/connector: hdmi: Add support for YUV420 format verification Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241130-hdmi-conn-yuv-v1-2-254279a08671@collabora.com> References: <20241130-hdmi-conn-yuv-v1-0-254279a08671@collabora.com> In-Reply-To: <20241130-hdmi-conn-yuv-v1-0-254279a08671@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Provide the necessary constraints verification in sink_supports_format_bpc() in order to support handling of YUV420 output format. Signed-off-by: Cristian Ciocaltea --- 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..3a55881a544a519bb1254968db8= 91c814f831a0f 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 #include #include +#include #include =20 #include @@ -114,6 +115,12 @@ sink_supports_format_bpc(const struct drm_connector *c= onnector, return false; } =20 + if (drm_mode_is_420_only(info, mode) && format !=3D HDMI_COLORSPACE_YUV42= 0) { + 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 *c= onnector, return true; =20 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 =3D=3D 10 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_3= 0)) { + drm_dbg_kms(dev, "10 BPC but sink doesn't support Deep Color 30.\n"); + return false; + } + + if (bpc =3D=3D 12 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_3= 6)) { + drm_dbg_kms(dev, "12 BPC but sink doesn't support Deep Color 36.\n"); + return false; + } + + if (bpc =3D=3D 16 && !(info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_4= 8)) { + 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; =20 case HDMI_COLORSPACE_YUV422: drm_dbg_kms(dev, "YUV422 format, checking the constraints.\n"); --=20 2.47.0