From nobody Fri Dec 19 18:47:59 2025 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 95021267B73 for ; Tue, 27 May 2025 12:11:24 +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=1748347886; cv=none; b=ABQjlgmCfiGrV9n8R1wOYqVmxhJdtyme2FEDVretkVxJ8908Gd9UqUP5xXj0OuEmSnxH1XSxelKp0Z6GZZXoET87gitMKCvs/QFKp4HjyIugoRUobLtJMjM69rB/5ASx9kjkHgB+oVTOfLd+1nk5P+LsOm+PyU5md1TQrEE1tGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347886; c=relaxed/simple; bh=ertypj0AnpHiBou1hqzJWD+8cegVzAjr/+BAe6GSyhQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=koLebZKOliuIhseDv9hAC5HFf/6gjxJ0GxEOn6v/OtvQIAyu2NRM6+ABx5hqWvKqgQeTQGqWScT5I/bi1hW9mZkUJK8nnp6VTaMUamN6alG1ePbp/ZPvvE5sOec2as6iH1JwhnqgdkIlYFH1A+KDcV+hlzUIlKJYY4f7lBwGuts= 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=ZbJXsSCo; 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="ZbJXsSCo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347882; bh=ertypj0AnpHiBou1hqzJWD+8cegVzAjr/+BAe6GSyhQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZbJXsSCoZqaJYHC8sILS2YjrZEFImXntFuL1yZI0v+JcZbnTquViCcKeAaQyOUBH0 DE16Nhm+KTPrBuHS7MUy8OxFTxF7JzKuWDF4dDd0sUeKJcbhi0y/HKq505CXYuOdBk Pe27qW47SkVBXCpQhM11Pd2xg3TvRDeAPRF6rtFwjafQ6I0kWDEzD2OWT8/GkOTxPK bN7fH9Hxl4AYStUXf+eWxS4lbi5NJj7PvgLLFM2VLWU3dRR1nEct6WLn5ybsxb2sv5 xxn8ivH9XWX850w3EO2h4lkwkG5xbQ6qFFBlAPG58EUrc14i9scRVU/B1YYDdyZeHB MBcyjt4qgFvIA== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 7DBB217E0FA8; Tue, 27 May 2025 14:11:22 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:09 +0300 Subject: [PATCH v5 01/19] drm/connector: hdmi: Evaluate limited range after computing format 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: <20250527-hdmi-conn-yuv-v5-1-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Evaluating the requirement to use a limited RGB quantization range involves a verification of the output format, among others, but this is currently performed before actually computing the format, hence relying on the old connector state. Move the call to hdmi_is_limited_range() after hdmi_compute_config() to ensure the verification is done on the updated output format. Fixes: 027d43590649 ("drm/connector: hdmi: Add RGB Quantization Range to th= e connector state") Reviewed-by: Dmitry Baryshkov Signed-off-by: Cristian Ciocaltea Acked-by: Maxime Ripard --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index bae7aa624f7db61cc7d5ff7a86a413938963543f..97cb4f29c4b5d88f4b6288bd93c= 6abb33bb7c17a 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -799,12 +799,12 @@ int drm_atomic_helper_connector_hdmi_check(struct drm= _connector *connector, if (!new_conn_state->crtc || !new_conn_state->best_encoder) return 0; =20 - new_conn_state->hdmi.is_limited_range =3D hdmi_is_limited_range(connector= , new_conn_state); - ret =3D hdmi_compute_config(connector, new_conn_state, mode); if (ret) return ret; =20 + new_conn_state->hdmi.is_limited_range =3D hdmi_is_limited_range(connector= , new_conn_state); + ret =3D hdmi_generate_infoframes(connector, new_conn_state); if (ret) return ret; --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 9040C267B9B for ; Tue, 27 May 2025 12:11:25 +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=1748347887; cv=none; b=DVZgj5wcgn4xbGM2OyFpuJ1ahMKiiVxHHM6xzW0wgrK6hjBC0N5P9uZts5uLWmsd9wz4uKKekSqQtNlMk6NzJenBBs51IsCOPULrnD/IPKDO9+LmfRPtw6+sxcgwQ0QimZrLlPG12ug9nC/YGnAj+zM7C2pz6F5JAmC1g4ma0zM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347887; c=relaxed/simple; bh=ozLZjulX/zJsG4ctxBw/HBy+KYKTHzkW7T/oqzmDhLg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qpx/Pruht7oE/qQC8cfX4HBVW+XGJ5OKMgp9dnA1G6/HECIienO4z9r+5WBuu8HwIwXPPXxHJuUNXUfzgjhBZxPAeL0yv6nByIAulymXGffUDzO+zW9HZVpWLqtSFF0xXnIXH5n2PtD9nXdtFi/acXnlEC4bBcrupTELWMasNeY= 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=prwHG+aQ; 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="prwHG+aQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347883; bh=ozLZjulX/zJsG4ctxBw/HBy+KYKTHzkW7T/oqzmDhLg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=prwHG+aQEdW23t0aOAQp0Ki5FHGeTfwWxrXn8bzkj99dp+66uq6gd5kUE5LyrjYU7 9EOwZM6AZct2LZjfG/3rSfQEmKWu660U3gtmmK2/xOFuXgdB2o4rPmFybtFN3faUpx 6wvi45IKOup2NQgtILsgQqoAy/SLf1YvWydJkaYkQ8odFgGb0SKq0ekhlUPPV5cdm9 7VblUlD+96goTz5gGnLBvmN9jNLTSeH1kGwzkL/FAeiYA2LIV6CtkB5OMK1oi8mV9H dwVwHRvUQcOAE7LevAxkc9Z9veM5MrQHhijwQXbwwoWi1b5rMK6Pi2krm57NGNtQcP A0HxD1LX3n5EQ== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 6815C17E1509; Tue, 27 May 2025 14:11:23 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:10 +0300 Subject: [PATCH v5 02/19] 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: <20250527-hdmi-conn-yuv-v5-2-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov 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. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 39 +++++++++++++++++++++= ++-- 1 file changed, 36 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 97cb4f29c4b5d88f4b6288bd93c6abb33bb7c17a..e026f1ca82848f3be874245c060= 93d3be8355c5c 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 @@ -408,6 +409,11 @@ 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, "Mode can be only supported in YUV420 format.\n"); + return false; + } + switch (format) { case HDMI_COLORSPACE_RGB: drm_dbg_kms(dev, "RGB Format, checking the constraints.\n"); @@ -438,9 +444,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, "Mode cannot be supported in YUV420 format.\n"); + 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.49.0 From nobody Fri Dec 19 18:47:59 2025 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 522F526868E for ; Tue, 27 May 2025 12:11:26 +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=1748347888; cv=none; b=AnBXFPaDqh+FElLdK805YYrKvxSC5oSr0sA8K8jxS+HWNsz82Qc3s7dbHRB2pV6QS4grdqSQW8Q4hvRBsinjbCRjUPts95a0tDFgeMxL+lxOAA5zuXy4Tt4Y/q5yzZ7ZDlioYun6VYQo3y0pG2SRUaadL+O19b2L+9V9nN7Yvv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347888; c=relaxed/simple; bh=nRhKCOHaGlbyoPioyQ83hEvXV7afirLJpLonj5Rf/LA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jfGE0EMlx5UTGJQYwk1GAiaYRPmzBGEtv9QrNnhY5oSTe2g1kE3O8deqWBUjiZULYWY5GdLc59B1OI4cNbEz/BdKDOAklSC25TmGhSzCgIuTddyvWoMXHB8nC/JXRGYp8SWrrjfAaTyMVssPQ92rAAimuCuZJeiHKiU8xHF+ng4= 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=Ari3QlGU; 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="Ari3QlGU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347884; bh=nRhKCOHaGlbyoPioyQ83hEvXV7afirLJpLonj5Rf/LA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ari3QlGUxHL93fBidRJi87Fcb8fXeeo/efi6iMcGA1NrKTWvCLHlagjaIODMOGPQK g0hxWZLCVaqmYracZd7h9vHbq8P++yiTsEgZKYWx9i59/QLf8BrkkTK9C1X1kp1Rvf 3msnjY+JzRUtYliHu71vQCEfx8nsqCYkAPRnA5kvh9pfIyb5vFGi5hdXMtNhITvM6I ej41hWnC6vL8ouDXBUqsR182GbiCmariUAtGA8hD3lnggxT/E96Sz2nXG4zd33Vg+n hGmoIBOtHe2Qko+vg6B97ad4Q7dfCd7Jlw/iUcHy4Zd7luNxxEqhFuMnilxr0Wp1ag PlDp9VWc8u42w== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 4C58F17E153B; Tue, 27 May 2025 14:11:24 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:11 +0300 Subject: [PATCH v5 03/19] drm/connector: hdmi: Improve debug message for supported format 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: <20250527-hdmi-conn-yuv-v5-3-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Add the missing 'bpc' string to the debug message indicating the supported format identified within hdmi_try_format_bpc() helper. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index e026f1ca82848f3be874245c06093d3be8355c5c..b05099c18f64a9cf1acecbfca8c= 9117b753117e4 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -597,7 +597,7 @@ hdmi_try_format_bpc(const struct drm_connector *connect= or, return false; } =20 - drm_dbg_kms(dev, "%s output format supported with %u (TMDS char rate: %ll= u Hz)\n", + drm_dbg_kms(dev, "%s output format supported with %u bpc (TMDS char rate:= %llu Hz)\n", drm_hdmi_connector_get_output_format_name(fmt), bpc, conn_state->hdmi.tmds_char_rate); =20 --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 2347C269806 for ; Tue, 27 May 2025 12:11:26 +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=1748347888; cv=none; b=JeWJdUdHbxwd1I9yzhROIwvIXR/AG+x7VqsjQbs0dLWiGWo8G0zhXJU3IBVzsk6YPwl/iaxB+z9piKZT2wkdyxK7me3xNwSQ6sU/NLP1CXMutA8d6x0bVw36JzbBGDmW82SXIrV5WuHdVmvPCbjE0vZ5CmDw7xuKWNuYRcC3APc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347888; c=relaxed/simple; bh=nijtXNzysgHLE928c8E4bJ3fEU89OD4M7b36fpgO9SI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D86w22MvMr6YEEe6dIdVHx3z+WHX1Dj2BeFVfvnuuD3tBrzKV6LE41BiX5FN0B4Xg5+8NBcyD37zehonKwrfE95TooOE1JtGvNf6o948BQJ9J7aMkf5lrBWs5m4WYt36CpEt7ncgrg5pZE2LjUa05XO9obGcoxgX0NvS2jPoZA4= 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=CfMsGv9k; 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="CfMsGv9k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347885; bh=nijtXNzysgHLE928c8E4bJ3fEU89OD4M7b36fpgO9SI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CfMsGv9kZInhHbdfDUdwGhHCl2qSm19UN7WZWqGPIEuzk3Ic8KhqkfN4Ytoz1rCnP 6lCNCLMEgdv5vWqvXQYxX8t0jULGhMrEgIWWo9VdPyg/gjyMWci5lPMPgDO7sMTgxK 80LC/8hr9VcgdOvguE+a6weuZ8DKdc/SwhqK3uVj90Angf8FjDVMqC2NGoV7sTGDSo 833FwIC2b/PKR9RNlBgWzarRWjyvdzHJ4pOVw5sfC+TT7k8sBoFSIXM34JOMOhD0d0 XjAyRxEq4nH0fMYurqLD358VZnL52/fmx6E+5qSHtX6bsZYPnCTwSbeppKukRIXe7Z 5IAALtMWs7yKg== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 1721017E378D; Tue, 27 May 2025 14:11:25 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:12 +0300 Subject: [PATCH v5 04/19] drm/connector: hdmi: Add missing bpc debug info to hdmi_try_format_bpc() 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: <20250527-hdmi-conn-yuv-v5-4-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 The very first debug message in hdmi_try_format_bpc() is incomplete, as it doesn't provide the given bpc in addition to the tried format. Add the missing debug information and drop the now redundant message from hdmi_compute_config(). Reviewed-by: Dmitry Baryshkov Signed-off-by: Cristian Ciocaltea Reviewed-by: Maxime Ripard --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index b05099c18f64a9cf1acecbfca8c9117b753117e4..45a650b461abdfa50787a92a9d6= 5f48c97f317a7 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -579,8 +579,9 @@ hdmi_try_format_bpc(const struct drm_connector *connect= or, struct drm_device *dev =3D connector->dev; int ret; =20 - drm_dbg_kms(dev, "Trying %s output format\n", - drm_hdmi_connector_get_output_format_name(fmt)); + drm_dbg_kms(dev, "Trying %s output format with %u bpc\n", + drm_hdmi_connector_get_output_format_name(fmt), + bpc); =20 if (!sink_supports_format_bpc(connector, info, mode, fmt, bpc)) { drm_dbg_kms(dev, "%s output format not supported with %u bpc\n", @@ -639,8 +640,6 @@ hdmi_compute_config(const struct drm_connector *connect= or, int ret; =20 for (bpc =3D max_bpc; bpc >=3D 8; bpc -=3D 2) { - drm_dbg_kms(dev, "Trying with a %d bpc output\n", bpc); - ret =3D hdmi_compute_format(connector, conn_state, mode, bpc); if (ret) continue; --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 5A45B26A08C for ; Tue, 27 May 2025 12:11:28 +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=1748347890; cv=none; b=qn/YacHoC0eRndS7F14eclccnjI9550tj3RCAggx+oZy8XjVZLR5Qe0jy+H8v3/lO8NCz5/de3eJ2opfFcpP7k2m22t3sn8CXTV7Xi2FWJRdj1UgpNrdarpO0nEocfQmoVIpAqO0c6V2Z4f7P2EC4sGCmx3Shs/aK5lC+qYge4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347890; c=relaxed/simple; bh=60Q9YGJFxkYXokTEGw8Vd2judhNXO2bs3vTtJNqz7ow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P64Z8uuDZyNidRuxdywLZf1mBCgavrkfNem+/kzO29g8V6fnWCrFaDVAx0S/s4sLYC6OL9YQX1tm3UUE5lcXVv0G1kOgu9EczBNVhM5Z2GiAw6ce5LKayxhayuhtAYUJG/25sFejF0Mwg36ecgLmTPmf32EQvSd7E5s5KUnmodo= 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=ZmvPCFbg; 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="ZmvPCFbg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347886; bh=60Q9YGJFxkYXokTEGw8Vd2judhNXO2bs3vTtJNqz7ow=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZmvPCFbgVH6RLKJFItoD4yCwK42ZSHp5TojE4SjO/iPH4CkRGzPI2NJvJHwI065B9 MFNd2B8Wmzj5VTVnYhkZYoinElbdQZJn6V3gT6DvtUhSqjWmcRqABLtRtPzyC+ZH5I Cg2eU45N9wKmjjjUrm50mNTzfnTvOl+yLU+W100Ig4hEXGY4G2+VQojSlaUdSXvNOg quyYw/rFGg19uf85wEkLgNDkQndth0QraCWHejF6eL4xqCv3gLWND/oVhXdbgjsjrY Dp4XByf28V/p9qMCXCLs+nR4jGJcoYH74XsPicMRwd6fl7nMgO9B2jgpzfHxW+BuNv P0ehoz4Y3vF8A== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id DA57317E056F; Tue, 27 May 2025 14:11:25 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:13 +0300 Subject: [PATCH v5 05/19] drm/connector: hdmi: Factor out bpc and format computation logic 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: <20250527-hdmi-conn-yuv-v5-5-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 In preparation to support fallback to an alternative output format, e.g. YUV420, when RGB cannot be used for any of the available color depths, move the bpc try loop out of hdmi_compute_config() and, instead, make it part of hdmi_compute_format(), while adding a new parameter to the latter holding the output format to be checked and eventually set. Since this helper now also changes hdmi.output_bpc in addition to hdmi.output_format, highlight the extended functionality by renaming it to hdmi_compute_format_bpc(). This improves code reusability and further extensibility, without introducing any functional changes. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 60 ++++++++++++---------= ---- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index 45a650b461abdfa50787a92a9d65f48c97f317a7..a9733a2e1b632e02f535c5ece64= 762f8ed9e4af2 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -606,45 +606,22 @@ hdmi_try_format_bpc(const struct drm_connector *conne= ctor, } =20 static int -hdmi_compute_format(const struct drm_connector *connector, - struct drm_connector_state *conn_state, - const struct drm_display_mode *mode, - unsigned int bpc) -{ - struct drm_device *dev =3D connector->dev; - - /* - * TODO: Add support for YCbCr420 output for HDMI 2.0 capable - * devices, for modes that only support YCbCr420. - */ - if (hdmi_try_format_bpc(connector, conn_state, mode, bpc, HDMI_COLORSPACE= _RGB)) { - conn_state->hdmi.output_format =3D HDMI_COLORSPACE_RGB; - return 0; - } - - drm_dbg_kms(dev, "Failed. No Format Supported for that bpc count.\n"); - - return -EINVAL; -} - -static int -hdmi_compute_config(const struct drm_connector *connector, - struct drm_connector_state *conn_state, - const struct drm_display_mode *mode) +hdmi_compute_format_bpc(const struct drm_connector *connector, + struct drm_connector_state *conn_state, + const struct drm_display_mode *mode, + unsigned int max_bpc, enum hdmi_colorspace fmt) { struct drm_device *dev =3D connector->dev; - unsigned int max_bpc =3D clamp_t(unsigned int, - conn_state->max_bpc, - 8, connector->max_bpc); unsigned int bpc; int ret; =20 for (bpc =3D max_bpc; bpc >=3D 8; bpc -=3D 2) { - ret =3D hdmi_compute_format(connector, conn_state, mode, bpc); - if (ret) + ret =3D hdmi_try_format_bpc(connector, conn_state, mode, bpc, fmt); + if (!ret) continue; =20 conn_state->hdmi.output_bpc =3D bpc; + conn_state->hdmi.output_format =3D fmt; =20 drm_dbg_kms(dev, "Mode %ux%u @ %uHz: Found configuration: bpc: %u, fmt: %s, clock: %= llu\n", @@ -656,9 +633,32 @@ hdmi_compute_config(const struct drm_connector *connec= tor, return 0; } =20 + drm_dbg_kms(dev, "Failed. %s output format not supported for any bpc coun= t.\n", + drm_hdmi_connector_get_output_format_name(fmt)); + return -EINVAL; } =20 +static int +hdmi_compute_config(const struct drm_connector *connector, + struct drm_connector_state *conn_state, + const struct drm_display_mode *mode) +{ + unsigned int max_bpc =3D clamp_t(unsigned int, + conn_state->max_bpc, + 8, connector->max_bpc); + int ret; + + /* + * TODO: Add support for YCbCr420 output for HDMI 2.0 capable + * devices, for modes that only support YCbCr420. + */ + ret =3D hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc, + HDMI_COLORSPACE_RGB); + + return ret; +} + static int hdmi_generate_avi_infoframe(const struct drm_connector *connect= or, struct drm_connector_state *conn_state) { --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 A434526A0FF for ; Tue, 27 May 2025 12:11:28 +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=1748347890; cv=none; b=QWXYDeCpmMq7xl+kcHFYkWbYtA1XTwCo6n2Dk3sUPnIOoolxojuCiLKUzzhpavhnwlzHXFlWPlsbpJ6TcH5n/sf1tNgyOBDjfujHHFgjRX000uaNWGHUkAUA5d5P6d4Cq1x9NLbr1qkxxuIat5opCmjZoInHaU0oB00zy6GcuAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347890; c=relaxed/simple; bh=V8rTl9ii8sCL9VzDqwU9C3Ust3q3I9zLhb7qtia09Sk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jjoRHUxPZCxAidTaF0jjPPXJMKb5J4fbQIlc+Pc/tBeQLfjVaDOGRXDgBgYMbeQBm2/Di8sHMIEXudlM+l5c/hFQoffM2YbEi5MgxTxfj+ZxtJQHgo9gsRVC18OU5Pp5vmQwfG6vV7khOdsW9kzoc2fr3wNRrOQKYA53blxmJVo= 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=EFJ/TVyM; 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="EFJ/TVyM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347887; bh=V8rTl9ii8sCL9VzDqwU9C3Ust3q3I9zLhb7qtia09Sk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EFJ/TVyM8H/ViO+gnxF/M8OgAN0dx0CFAS/dAVNXa7v/vJQVeqUrgi5k8yzCmp47/ daucDwbi097rQJL1E8J4b05JgkId7MidV0v9n5OEFJfD4agobPiXjFOAN2NTfqK4vy G/+73W42dpiprrpuqDbqeSMW/I28EWnaubP60huM78XvPAhPAsLpdE7cyPTKaAgl5A MnInmC+lbojUtH3Xv3JTwtfCvUVCQdJwEMtK82+jNGpwfB1i+SQHyxK4JJDXSXxSAm cA3eunW85FYt9FP7xVRksB8NFAQT0mUEyJsoZvEED5+zxncYxhHTEEsoX++52pwBXa FB1056264bXmw== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id BDF4117E09FA; Tue, 27 May 2025 14:11:26 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:14 +0300 Subject: [PATCH v5 06/19] drm/connector: hdmi: Use YUV420 output format as an RGB fallback 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: <20250527-hdmi-conn-yuv-v5-6-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Try to make use of YUV420 when computing the best output format and RGB cannot be supported for any of the available color depths. Signed-off-by: Cristian Ciocaltea Reviewed-by: Maxime Ripard --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index a9733a2e1b632e02f535c5ece64762f8ed9e4af2..2c641add743466841cb2e777a07= 633dc5686ccd8 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -649,12 +649,22 @@ hdmi_compute_config(const struct drm_connector *conne= ctor, 8, connector->max_bpc); int ret; =20 - /* - * TODO: Add support for YCbCr420 output for HDMI 2.0 capable - * devices, for modes that only support YCbCr420. - */ ret =3D hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc, HDMI_COLORSPACE_RGB); + if (ret) { + if (connector->ycbcr_420_allowed) { + ret =3D hdmi_compute_format_bpc(connector, conn_state, + mode, max_bpc, + HDMI_COLORSPACE_YUV420); + if (ret) + drm_dbg_kms(connector->dev, + "YUV420 output format doesn't work.\n"); + } else { + drm_dbg_kms(connector->dev, + "YUV420 output format not allowed for connector.\n"); + ret =3D -EINVAL; + } + } =20 return ret; } --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 7473326F46F for ; Tue, 27 May 2025 12:11:29 +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=1748347891; cv=none; b=h17gknZCLg2gQrIDqLwKzwBzgFYkqZwz7uCm+txvj1m9OXgMhQgdcs/XOsoH0Ih44YNHaBd+VIxM0nfub+kt+JdWkaztFxJvY1H4+PBxBAsIZ/N7hDziAv1zPxmmO3DCOfILx2amrPKE8pZXaXFHiXoEMImo5sf3q21CDgVx1+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347891; c=relaxed/simple; bh=NruFgDuKcybA47PQbjsX1kS5Pj95cphmU3z7U+LSFiQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ClkY+QbYQv7+GTnhxMQlcmuyNVZc7bcfPSznNdZlRiKm1HUshbZGC0mFrnmYgeEp/DLt7HYIIMYzWQrJclGt99IEdh0W+E1R7IT6A1ymJACo4/z/FUIbast22n9A73QR/HNxN2UeXhXDmYbRXciCktR3m/hqs3EZPqKpbG95+lU= 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=p4vMYG9R; 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="p4vMYG9R" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347887; bh=NruFgDuKcybA47PQbjsX1kS5Pj95cphmU3z7U+LSFiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=p4vMYG9Rh57T4duGrZ6KfXVGLOH4S6eZYLNFHtyMzg1zG3HoFPRcecPP1qpMYNv4/ D8kY4QgYa2VL4FZQtS2fEo5/eDkp8UHFPA7a413V6Jh9W1ohxEiTPv5kwxnC1dtugA lW3GnOnjzoA8dzFr6jsPbEPkQ6VD7ryufue9GbAEqDWvSfGTg+b03B9QxAeVzEmSAb UDUCz1gFs7/8VVgQqAutTiGN3OwKOAJj6OCWebhBxvv5LXV6zIZPdcj9Z2oe5GJ8Cs Spx2RQBqHqROXyOFlkORJBAFmLS6kj4o99enm9p/EWsGsAxif5I5D5pntLfW6mbLrJ atI92u7ehEuEA== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 96D0717E3789; Tue, 27 May 2025 14:11:27 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:15 +0300 Subject: [PATCH v5 07/19] drm/tests: hdmi: Replace '[_]MHz' with 'mhz' 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: <20250527-hdmi-conn-yuv-v5-7-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Improve consistency throughout drm_hdmi_state_helper_test.c by replacing the two occurrences of '[_]MHz' substring with 'mhz'. As a bonus, this also helps getting rid of checkpatch.pl complaint: CHECK: Avoid CamelCase: Reviewed-by: Dmitry Baryshkov Signed-off-by: Cristian Ciocaltea Reviewed-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 7ffd666753b10bc991894e238206a3c5328d0e23..c8dc6fa0f925e35e9903a18bac7= f78f9d8165960 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -89,15 +89,15 @@ static const struct drm_connector_hdmi_funcs reject_con= nector_hdmi_funcs =3D { }; =20 static enum drm_mode_status -reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *c= onnector, +reject_100mhz_connector_tmds_char_rate_valid(const struct drm_connector *c= onnector, const struct drm_display_mode *mode, unsigned long long tmds_rate) { return (tmds_rate > 100ULL * 1000 * 1000) ? MODE_BAD : MODE_OK; } =20 -static const struct drm_connector_hdmi_funcs reject_100_MHz_connector_hdmi= _funcs =3D { - .tmds_char_rate_valid =3D reject_100MHz_connector_tmds_char_rate_valid, +static const struct drm_connector_hdmi_funcs reject_100mhz_connector_hdmi_= funcs =3D { + .tmds_char_rate_valid =3D reject_100mhz_connector_tmds_char_rate_valid, }; =20 static int dummy_connector_get_modes(struct drm_connector *connector) @@ -1934,7 +1934,7 @@ static void drm_test_check_mode_valid_reject_rate(str= uct kunit *test) priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, BIT(HDMI_COLORSPACE_RGB), 8, - &reject_100_MHz_connector_hdmi_funcs); + &reject_100mhz_connector_hdmi_funcs); KUNIT_ASSERT_NOT_NULL(test, priv); =20 conn =3D &priv->connector; --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 620C3270572 for ; Tue, 27 May 2025 12:11:30 +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=1748347892; cv=none; b=Zk2HQbyiF57Sm1Gj/ZWH0/lHTH+avNUNwZYl1317yjLmF6gSlRf+cwiFle0znqzCrvYFkukQN4xId7K6CERlVQfeNPLNalPZdTvxoxKqr7xAhttnVyaTlJasqIv6sOKtVp/4cAVhsbJfAx/MHbmRU6okuNDKpvp+mi/Htk1gKjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347892; c=relaxed/simple; bh=L/0iOYUvrFmB2bU6oHMPLyfBc1hpgRFdxe/rWnvnSRo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dJA4tVmNVD/uAWp3lyTtSTk0NpCBa/L7iCsTjZ3xWQgTg+K32xulpVrbN2Y+524EEZn5KtzAua+A5XtrSqKrZEEqv+rCszoaPwFbLhyNC6ks/a1KYOSD/uqGWJTJbbKmzBbQFaWFvVvzTSJ2B+MYFtMVizxGa0itYUXfIEsXoUs= 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=KSunYObP; 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="KSunYObP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347888; bh=L/0iOYUvrFmB2bU6oHMPLyfBc1hpgRFdxe/rWnvnSRo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KSunYObPflWL9GGUUmQrltwsBZFrF//8xb/ZwvnnwfnzXuee++51PPlosdDpZ5YCV kPnF/xDzGKO1sp6I+CmiYdgC/pM/Y7TPQQRsY+hR6CbJ7qgLJpMluoPbhhuvGpaAV6 grXewBpOlYo3GNrr4au3qcYOL+exi6KNNqrwWJmt/FrFXEWoWZ0G5obO5eMh5/cEYl 4mavZ3UrEeTBux8jWf3axT1mBA5zAPBnbzeg/PzeCiB/he7Z2D+24ROnD2lUS++kno o8mvFaISPy/l4JWHIT5Hoxyf2emFFcrw3sbjdyFlMrttErbIfZfxyUZg0uOr5H9kZG Qd/ns9o5wSJ7g== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 6D3A017E37BE; Tue, 27 May 2025 14:11:28 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:16 +0300 Subject: [PATCH v5 08/19] drm/tests: hdmi: Switch to 'void *' type for EDID data 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: <20250527-hdmi-conn-yuv-v5-8-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jani Nikula X-Mailer: b4 0.14.2 Replace 'const char *' with 'const void *' type for current_edid member in struct drm_atomic_helper_connector_hdmi_priv, as well as for the edid parameter of set_connector_edid() function. Suggested-by: Jani Nikula Signed-off-by: Cristian Ciocaltea Reviewed-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index c8dc6fa0f925e35e9903a18bac7f78f9d8165960..00576f747f1f36a100e13b0316c= b492f76474d45 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -33,7 +33,7 @@ struct drm_atomic_helper_connector_hdmi_priv { struct drm_encoder encoder; struct drm_connector connector; =20 - const char *current_edid; + const void *current_edid; size_t current_edid_len; }; =20 @@ -56,7 +56,7 @@ static struct drm_display_mode *find_preferred_mode(struc= t drm_connector *connec } =20 static int set_connector_edid(struct kunit *test, struct drm_connector *co= nnector, - const char *edid, size_t edid_len) + const void *edid, size_t edid_len) { struct drm_atomic_helper_connector_hdmi_priv *priv =3D connector_to_priv(connector); --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 3EAEA271458 for ; Tue, 27 May 2025 12:11:30 +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=1748347893; cv=none; b=uxm4gBJKgZNGG4TJwP+LbMyz15QO3t0GprRcQnst4jBokAU5lgQJOTqSg94kA4VXklZkIeY2ymDKJiR5+YBNXLYuf809+kYrAzs4kG34mOAVpauxC6bDDBrtEbNdGe67SSS8nJiIErfIoY0eXIZyFqj0nVVjmPzaAwAGkgUb6Pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347893; c=relaxed/simple; bh=PDRraluMv402z66JOvqFUR/pJRZy6LQeNSrabWEsSyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lKwMJXG6nOSaHsvbTeQnTW8ZdEAsUYmng4UkDB/hzmtuOY25I2+LjiP3Q/P91kNOEAxUYEtljdtT9Aaqvy8NgvGWFPnog2C7YUbmI1et+2JqYfcrGywxpFZhRjshCd6QDUo1MMBnJHFuL1qvEId8lKk23n9NIS0CxT/7y8VXvxs= 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=R4/S/4Af; 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="R4/S/4Af" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347889; bh=PDRraluMv402z66JOvqFUR/pJRZy6LQeNSrabWEsSyY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=R4/S/4AfRhLvxwwjx94VuOuLqutTFenopeo1tGUkfk1eFNmhys50yojp3GPGN8g/2 pdGhzyMnAT/KylFBppdUe6v6tuAUEPTrZJJy3hF0idv5x2kgxlfywBLfe5Zjx8Lbk0 e63U2g5tM4fJ/+z7IDoGkW+0lu4dm2QTGXXGB/OWY0xLNijQFFYYjMGjU+0fRJCGSP KbSFMm0P4UHalMpONQuRf2Tc3lV3clUVm3AiErjNh02rqcjVpda3roS4ZUX91PaDY+ P7breEtD+3fxySeh8l/O40RVfgaAhBzYDTezK8MDLtznlN5H/ThxXFoWu5OvAVLXBR wKSY0oTtqrNig== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 3BAB217E37C0; Tue, 27 May 2025 14:11:29 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:17 +0300 Subject: [PATCH v5 09/19] drm/tests: hdmi: Add macro to simplify EDID setup 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: <20250527-hdmi-conn-yuv-v5-9-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Factor out the HDMI connector initialization from drm_kunit_helper_connector_hdmi_init_funcs() into a common __connector_hdmi_init() function, while extending its functionality to allow setting custom (i.e. non-default) EDID data. Introduce a macro as a wrapper over the new helper to allow dropping the open coded EDID setup from all test cases. The actual conversion will be handled separately; for now just apply it to drm_kunit_helper_connector_hdmi_init() helper. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 46 +++++++++++++-----= ---- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 00576f747f1f36a100e13b0316cb492f76474d45..beee73e7a4d297dd068a42b583f= a547e93e7301e 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -140,10 +140,11 @@ static const struct drm_connector_funcs dummy_connect= or_funcs =3D { =20 static struct drm_atomic_helper_connector_hdmi_priv * -drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test, - unsigned int formats, - unsigned int max_bpc, - const struct drm_connector_hdmi_funcs *hdmi_funcs) +__connector_hdmi_init(struct kunit *test, + unsigned int formats, + unsigned int max_bpc, + const struct drm_connector_hdmi_funcs *hdmi_funcs, + const void *edid_data, size_t edid_len) { struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_connector *conn; @@ -197,29 +198,38 @@ drm_kunit_helper_connector_hdmi_init_funcs(struct kun= it *test, =20 drm_mode_config_reset(drm); =20 + if (edid_data && edid_len) { + ret =3D set_connector_edid(test, &priv->connector, edid_data, edid_len); + KUNIT_ASSERT_GT(test, ret, 0); + } + return priv; } =20 +static +struct drm_atomic_helper_connector_hdmi_priv * +drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test, + unsigned int formats, + unsigned int max_bpc, + const struct drm_connector_hdmi_funcs *hdmi_funcs) +{ + return __connector_hdmi_init(test, formats, max_bpc, hdmi_funcs, NULL, 0); +} + +#define drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, formats= , max_bpc, funcs, edid) \ + __connector_hdmi_init(test, formats, max_bpc, funcs, edid, ARRAY_SIZE(edi= d)) + static struct drm_atomic_helper_connector_hdmi_priv * drm_kunit_helper_connector_hdmi_init(struct kunit *test, unsigned int formats, unsigned int max_bpc) { - struct drm_atomic_helper_connector_hdmi_priv *priv; - int ret; - - priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, - formats, max_bpc, - &dummy_connector_hdmi_funcs); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv); - - ret =3D set_connector_edid(test, &priv->connector, - test_edid_hdmi_1080p_rgb_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - - return priv; + return drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + formats, + max_bpc, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_200mhz); } =20 /* --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 4B1A7272E41 for ; Tue, 27 May 2025 12:11:31 +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=1748347894; cv=none; b=X9n3kvMM0SW3jUYC5DExVu0urQU6Xq7hHPXEB7NySOndlawUVxvOtVMoWCeI5MpfxiHB7wS6jE4Bizi9aGejpbT34EQJHRizVHQputvsH/t3IyNSpA6Z3v5FFq/4HI7gttiyGigl9xlLT5t6++Xz7b+DG23r6zo0arzjaULApIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347894; c=relaxed/simple; bh=57yi0XK9XcHNtkQawvMiOVp99ZTQFqvyzf4886ogGv0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rqXr/tJn0MDRS/5ejYWQU3xH0z1rCL/ioQ6oWeElgaK3HIze3gzf3C/BV7gx+dUCUIsb/Pm9bL5H17BytOAScNUxqr1llXMT7Ss/KUV+KvFpO9ld9tmwZdN0BXUukizbMWKYnITlzZCsQdxbCv26xm2vVfclpOYy23xly+W7z5A= 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=g4YvKz+G; 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="g4YvKz+G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347890; bh=57yi0XK9XcHNtkQawvMiOVp99ZTQFqvyzf4886ogGv0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g4YvKz+GXx3EoadrPfZqvLL5Vx0yi280CN9DzB2bczKqFSekWYOYiMGP8202IA38N o9GGjfNvehQn6MHYXaiqWSI5wVM3czLoF2UqXRhvFolL3n2zuCWuuD6yzroPcVYUg/ bLnyK9ayof81/EUg8gMrIez0rW/WlTcQevQxc0RDycL2rM1bXYW3bRc7JzSEkt/LIi ay+FhEhdvNLigCirQQsDOZaRDkXz9/U3dwzzszsP69dhPhEwEqx3FZLX6MWnOIq6o0 +vRkZpjH8FsglxXOI2c2jzsnCrUul1H6n5VekRx1CrkykncTN3qscfcOq470ceGaOW PBeRWYfW0DafQ== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 1D3C617E37CD; Tue, 27 May 2025 14:11:30 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:18 +0300 Subject: [PATCH v5 10/19] drm/tests: hdmi: Replace open coded EDID setup 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: <20250527-hdmi-conn-yuv-v5-10-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Make use of the recently introduced macros to reduce boilerplate code around EDID setup. This also helps dropping the redundant calls to set_connector_edid(). No functional changes intended. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 234 ++++++++---------= ---- 1 file changed, 92 insertions(+), 142 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index beee73e7a4d297dd068a42b583fa547e93e7301e..b8f4dc677be7c8833a2cb09aa6b= 44b5e9b2f5378 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -762,19 +762,16 @@ static void drm_test_check_output_bpc_crtc_mode_chang= ed(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 10); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 10, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - preferred =3D find_preferred_mode(conn); KUNIT_ASSERT_NOT_NULL(test, preferred); =20 @@ -841,19 +838,16 @@ static void drm_test_check_output_bpc_crtc_mode_not_c= hanged(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 10); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 10, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - preferred =3D find_preferred_mode(conn); KUNIT_ASSERT_NOT_NULL(test, preferred); =20 @@ -915,21 +909,18 @@ static void drm_test_check_output_bpc_dvi(struct kuni= t *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV422) | + BIT(HDMI_COLORSPACE_YUV444), + 12, + &dummy_connector_hdmi_funcs, + test_edid_dvi_1080p); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_dvi_1080p, - ARRAY_SIZE(test_edid_dvi_1080p)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_FALSE(test, info->is_hdmi); =20 @@ -969,19 +960,16 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(st= ruct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 8); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - preferred =3D find_preferred_mode(conn); KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); @@ -1021,19 +1009,16 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc= (struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 10); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 10, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - preferred =3D find_preferred_mode(conn); KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); @@ -1073,19 +1058,16 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc= (struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - preferred =3D find_preferred_mode(conn); KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); @@ -1191,19 +1173,16 @@ static void drm_test_check_max_tmds_rate_bpc_fallba= ck(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1263,21 +1242,18 @@ static void drm_test_check_max_tmds_rate_format_fal= lback(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV422) | + BIT(HDMI_COLORSPACE_YUV444), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1331,20 +1307,17 @@ static void drm_test_check_output_bpc_format_vic_1(= struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV422) | + BIT(HDMI_COLORSPACE_YUV444), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1398,19 +1371,16 @@ static void drm_test_check_output_bpc_format_driver= _rgb_only(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1468,21 +1438,18 @@ static void drm_test_check_output_bpc_format_displa= y_rgb_only(struct kunit *test struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV422) | + BIT(HDMI_COLORSPACE_YUV444), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1541,19 +1508,16 @@ static void drm_test_check_output_bpc_format_driver= _8bpc_only(struct kunit *test struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 8); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1604,21 +1568,18 @@ static void drm_test_check_output_bpc_format_displa= y_8bpc_only(struct kunit *tes struct drm_crtc *crtc; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), - 12); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV422) | + BIT(HDMI_COLORSPACE_YUV444), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_340mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 drm =3D &priv->drm; crtc =3D priv->crtc; conn =3D &priv->connector; - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_max_340mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_340mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); @@ -1937,28 +1898,20 @@ static void drm_test_check_mode_valid(struct kunit = *test) static void drm_test_check_mode_valid_reject_rate(struct kunit *test) { struct drm_atomic_helper_connector_hdmi_priv *priv; - struct drm_connector *conn; struct drm_display_mode *preferred; - int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, - BIT(HDMI_COLORSPACE_RGB), - 8, - &reject_100mhz_connector_hdmi_funcs); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_100mhz_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_200mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 - conn =3D &priv->connector; - - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_max_200mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - /* * Unlike the drm_test_check_mode_valid() here 1080p is rejected, but * 480p is allowed. */ - preferred =3D find_preferred_mode(conn); + preferred =3D find_preferred_mode(&priv->connector); KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); @@ -1976,12 +1929,14 @@ static void drm_test_check_mode_valid_reject(struct= kunit *test) struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_connector *conn; struct drm_display_mode *preferred; + unsigned char no_edid[] =3D {}; int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, - BIT(HDMI_COLORSPACE_RGB), - 8, - &reject_connector_hdmi_funcs); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_connector_hdmi_funcs, + no_edid); KUNIT_ASSERT_NOT_NULL(test, priv); =20 conn =3D &priv->connector; @@ -2006,20 +1961,15 @@ static void drm_test_check_mode_valid_reject_max_cl= ock(struct kunit *test) struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_connector *conn; struct drm_display_mode *preferred; - int ret; =20 - priv =3D drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), - 8); + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_max_100mhz); KUNIT_ASSERT_NOT_NULL(test, priv); =20 conn =3D &priv->connector; - - ret =3D set_connector_edid(test, conn, - test_edid_hdmi_1080p_rgb_max_100mhz, - ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_100mhz)); - KUNIT_ASSERT_GT(test, ret, 0); - KUNIT_ASSERT_EQ(test, conn->display_info.max_tmds_clock, 100 * 1000); =20 preferred =3D find_preferred_mode(conn); --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 C54CC270EAB for ; Tue, 27 May 2025 12:11: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=1748347894; cv=none; b=lZEqMJCtluQoAnS4+oeWumkI0MTK+EfPf9bHXmvWX+EIkFr4DEZJ4k4MU0kiJzVkHOOnQwbKPnJVg2iI20+yJrcEVeX/QLNxj7mQl3DdkGLZcyzMn95KQHkGZVSQRA1qNQdmbiw1YDVhHJhpqxF4t1hkW+Jrb6qRtk17or8QqeI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347894; c=relaxed/simple; bh=1DuTA5HzhC4tan5w27hz1UdHQupn7FllR02MG7+gbxg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AfVCaoCBbu4+yrfjpcLJMjrsKLL9u2g2AGMBaEhxlAOBCc/AomL99Lbm+qwtyFi9ehdQB5D9WoeyrNWjxboEr/PKhi8W7XY4wqiPpMc51JsxA03UoNDjNA9HilvpULislyG7Xb3sqPoLs39Q52PrUGXvw44PSZzjIrjgwRhsHYw= 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=nmxZmoM1; 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="nmxZmoM1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347891; bh=1DuTA5HzhC4tan5w27hz1UdHQupn7FllR02MG7+gbxg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nmxZmoM1lXW1lTEq2BqXzI0nIFfMihdrRRv5Ak7Jbu0h2SBVGzvVmoNIOA/ZK0C/N CUfC3B0JnxoYMOeSWUugOilPudLJGSKRoFrDrmnxyGUykOd3v1QD8sjzaW/SmgHPW3 qZWmkkUOo2BCWaRm6/Kg+k5TOJBonnpxKYfnaoRdQ9gApJQg99LxkQ0vhWXV7uSZqR JA1rNABoXUa2Gwysc/rs/nsguxkiWY/Uk21m6oBeGxXsZvgvg+QySoQ10pSpCHhGqN o1EySuEjqEqhURL6eQs/AdtEpvjcq42QxBKd5g4/KKZtjJdsG6G69YWp9+jUu1X52C 5CKBTUItnG3Cg== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id E41B917E37CF; Tue, 27 May 2025 14:11:30 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:19 +0300 Subject: [PATCH v5 11/19] drm/tests: hdmi: Drop unused drm_kunit_helper_connector_hdmi_init_funcs() 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: <20250527-hdmi-conn-yuv-v5-11-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 After updating the code to make use of the new EDID setup helper, drm_kunit_helper_connector_hdmi_init_funcs() became unused, hence drop it. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index b8f4dc677be7c8833a2cb09aa6b44b5e9b2f5378..64037110bcaa9713999d77a254f= c9377170a41bb 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -206,16 +206,6 @@ __connector_hdmi_init(struct kunit *test, return priv; } =20 -static -struct drm_atomic_helper_connector_hdmi_priv * -drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test, - unsigned int formats, - unsigned int max_bpc, - const struct drm_connector_hdmi_funcs *hdmi_funcs) -{ - return __connector_hdmi_init(test, formats, max_bpc, hdmi_funcs, NULL, 0); -} - #define drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, formats= , max_bpc, funcs, edid) \ __connector_hdmi_init(test, formats, max_bpc, funcs, edid, ARRAY_SIZE(edi= d)) =20 --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 C07142749DB for ; Tue, 27 May 2025 12:11:33 +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=1748347895; cv=none; b=dhqUZTLXz0KUKeBNCSyZ8wVu8o744Eu6mxDEhS7HuHEkf8JEnh+Cl8z2seM7GlyyntlAoO0ikN2M1L5W8pR9tHMbCInJacpSFyMb/xconzcTLH+4YYOsF2AwWSM4GBtDFEVqlGDSQxyTi2u1kFBWLD0BoVxgjTVdaDVZbylOxpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347895; c=relaxed/simple; bh=q9WzOnxUTPg/Zdl2c63Tbt+DCpbXd/HVonjfgjlirC8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=soHtt9qKUcNoSqYte1CfjsiCBi8UmYGSTNEpOPOvwFK2VTMhEUoxIX0JqMzQdauSVQP9Y0UGtzkiHdmZ6bgJcO5Ddtvh4Moc7W3wKQEvRWK2yXkluVojQp/c7GfL6Q7H6a2K+NCTQhu/audwCbnlNI6G3FchqKT7gRIxdAq8z0I= 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=HCfS26OV; 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="HCfS26OV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347891; bh=q9WzOnxUTPg/Zdl2c63Tbt+DCpbXd/HVonjfgjlirC8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HCfS26OVMTU0wAKANDLsMt9kRoP8+VFbq8f50t8xbUIxjhjRBlNC9Fpvxzd2+kKjy mOI3K9hKksP7/9leOiJbxOemaXY6+1aVrTZyzEJVKdKHfHbZmtvEJ8w5H3D/7f3G70 XjDIqpniRJpbA56IwMUOFDMuD0mMyf9SBfFy5jrT2NhrcDe+dGyF35Ca7Y73E14NwW V6IONDg8QT3xFdDyoo4Hpa+meyqcnVG1hMtbUbauUzuLvCu0fI1qo1GP68N9GfyWHC u1puA11cXvb3JRgyQAMF3P1o9mDhK5dCKE26P3BfbzMo2x/a3ZCBBapX6YQbfSzLBj iSh6/cc/aJqbw== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id B9FA017E37D0; Tue, 27 May 2025 14:11:31 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:20 +0300 Subject: [PATCH v5 12/19] drm/tests: hdmi: Setup ycbcr_420_allowed before initializing connector 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: <20250527-hdmi-conn-yuv-v5-12-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Initializing HDMI connector via drmm_connector_hdmi_init() requires its ->ycbcr_420_allowed flag to be adjusted according to the supported formats passed as function argument, prior to the actual invocation. In order to allow providing test coverage for YUV420 modes, ensure the flag is properly setup. Reviewed-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 64037110bcaa9713999d77a254fc9377170a41bb..e3e2878d29ea5bfe107a5098d0c= bf2653af0bc9b 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -183,6 +183,8 @@ __connector_hdmi_init(struct kunit *test, enc->possible_crtcs =3D drm_crtc_mask(priv->crtc); =20 conn =3D &priv->connector; + conn->ycbcr_420_allowed =3D !!(formats & BIT(HDMI_COLORSPACE_YUV420)); + ret =3D drmm_connector_hdmi_init(drm, conn, "Vendor", "Product", &dummy_connector_funcs, --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 98432274FEB for ; Tue, 27 May 2025 12:11:34 +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=1748347896; cv=none; b=K3fBtK81HSD+Nu6M5jzom1eIKSICck5qhOu3u7uJH+IqptJhAMGU6PNQteBw97nAtfa0olvT96JL2LvBMFU8jrGEn3LoielKhq+ttxF0glKQNeeMf0nY8H6SY3Qf5hCeZ253t3Ox9JNbsoMhy0gftG9LSplZQv+Hy0HfiLcs8wA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347896; c=relaxed/simple; bh=Uajc0TXmqgnkuOfOebILUOgudIxuBQ++KVKDQhgvIZA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jXipkTGiPPPrecH1GHt/qgJHOjiqD003iYc9QY8lPlZe/pFoT+ETqKE6hoamEkuwuqvWtaPmwb45YgGRWcuY6ta0ZiRzgbUp8ArbnMGcaLwSxUZII7WsfPS5dAHCkwwJ4uaoG8lAz7PynzzeZN25r/M5HziQmbKAFt79ZYJtQTc= 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=fdUyCAyA; 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="fdUyCAyA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347892; bh=Uajc0TXmqgnkuOfOebILUOgudIxuBQ++KVKDQhgvIZA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fdUyCAyA106iWEXOWQuxRKieSa39mtgXBdv1QkOjECxLWZD1WopF4QQIwubhuvrEl ehIDLkzCsHnsaboZAeHe2/7+kJymBaTcVU8mIEbNSWMmEVO3N/ehRkvMRNbDtlTxEG VYE1aUie+EPVggayDKyHUSA4gYLYVLIXHtWGj4psJ/qt1r/LceISjMeDVmTM0SzA2+ aMeLry/lakEipH1cG3uPUs2KKGcMGWMUka9GnOvStW9r3AzC82xUWmNU7wTaNNUiWg jdwU2FW3zmDLPf6ze6Hn5ab6ep/+Ow69/UOb1ieBKRlc2c1zhmTGhjRZ5nGoAep4cj 0caSYLVHvaz3g== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 9809B17E37D6; Tue, 27 May 2025 14:11:32 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:21 +0300 Subject: [PATCH v5 13/19] drm/tests: hdmi: Switch to drm_atomic_get_new_connector_state() where possible 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: <20250527-hdmi-conn-yuv-v5-13-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Replace the calls to drm_atomic_get_connector_state() with drm_atomic_get_new_connector_state() for cases which do not require allocating the connector state, e.g. after drm_atomic_check_only() when the intent is to only read the new connector state. The rational is to avoid the need to handle the potential EDEADLK error returned by the former helper, which would require restarting the entire atomic sequence. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index e3e2878d29ea5bfe107a5098d0cbf2653af0bc9b..168fe25529e5861ebee2d8a929f= 912436c485c60 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -416,7 +416,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(= struct kunit *test) ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); @@ -476,7 +476,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_= vic_1(struct kunit *test) ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_EXPECT_FALSE(test, conn_state->hdmi.is_limited_range); @@ -535,7 +535,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(= struct kunit *test) ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_ASSERT_EQ(test, @@ -597,7 +597,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_= vic_1(struct kunit *test) ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_ASSERT_EQ(test, @@ -660,7 +660,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mo= de(struct kunit *test) ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_ASSERT_EQ(test, @@ -722,7 +722,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mo= de_vic_1(struct kunit *te ret =3D drm_atomic_check_only(state); KUNIT_ASSERT_EQ(test, ret, 0); =20 - conn_state =3D drm_atomic_get_connector_state(state, conn); + conn_state =3D drm_atomic_get_new_connector_state(state, conn); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); =20 KUNIT_ASSERT_EQ(test, --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 6D72D25D1EC for ; Tue, 27 May 2025 12:11:35 +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=1748347897; cv=none; b=E7uHlvH3HN+2d79IbcANggK8ca+HRI6+YH/LZDGRPYYa63IUzLkRu+MULlRh4QJbnKkgy2QuwihKpmPD4cJghj90Q/273RcFX0Mdgqbuk12oq4iXWzShjzo41vjvQj7+G98nHWkFpEgKbKg7x46sRlBiG+DNLkYzK2tf7YuesVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347897; c=relaxed/simple; bh=BmdyyiCmh17F0HsNev4bloXgXMh1KfYqZ7GidykMPow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k0ojbBdspAT8GZIeTdrPutM57nz+ORiAZi1zjVSGAgGYDrXglkD3UczpqqTT4lhNXjRI4EqwG87XliuKo9Cq8nTzNGcvlfBKYrTT2aWGODg9lcSHpG2LlgfcOqTYlYIPgePklwlXpZZ0OjZXpifRdcZRqT0VGcE5HXlL4Vjqi3Q= 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=UdlJ+2JF; 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="UdlJ+2JF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347893; bh=BmdyyiCmh17F0HsNev4bloXgXMh1KfYqZ7GidykMPow=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UdlJ+2JFizlj7+4Q/AXaVDpsiw8ym+P+vnoQEJzbZU7eVokcT5WEQqMPrSR4dW1Tr yPsm5JjaO9e0AnSbTjmm8eWuDiO8Cxss/lpJSMZfyFm959X36WuLLmLESVrkbzDfW6 AZN97bI2WtCT39SfhVWVqjOJsr5rOwZeZURRPrg3R840Wo5imAa9RGXUMMFZ7DxBrf IuKdAjw/j6nuomf56XPVG+zl5HAaBtIysWQDUoZQgfxJ39nLvQquXQCGLrlivo2ELs s54akbAK7DyKwtAOlk1zq6mvWJP+/DmULRiHkKtTstEU9U+EABAyA+dw+UjtQmn5Q4 8XXzRHQsxcb6g== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 7B3BF17E01FD; Tue, 27 May 2025 14:11:33 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:22 +0300 Subject: [PATCH v5 14/19] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with YUV420 only 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: <20250527-hdmi-conn-yuv-v5-14-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Create a test EDID advertising the following capabilities: Max resolution: - 1920x1080@60Hz with RGB, YUV444, YUV422 - 3840x2160@30Hz with YUV420 only Max BPC: 16 for all modes Max TMDS clock: 200 MHz Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_kunit_edid.h | 118 +++++++++++++++++++++++++++++= ++++ 1 file changed, 118 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests= /drm_kunit_edid.h index 6358397a5d7ab0bcdea1c824fc9fd382560f4b0e..027d8aa5bccd0ee101fbe7e147f= 0e418581e9c3d 100644 --- a/drivers/gpu/drm/tests/drm_kunit_edid.h +++ b/drivers/gpu/drm/tests/drm_kunit_edid.h @@ -583,4 +583,122 @@ static const unsigned char test_edid_hdmi_1080p_rgb_y= uv_dc_max_340mhz[] =3D { 0x00, 0x00, 0x00, 0x8c }; =20 +/* + * Max resolution: + * - 1920x1080@60Hz with RGB, YUV444, YUV422 + * - 3840x2160@30Hz with YUV420 only + * Max BPC: 16 for all modes + * Max TMDS clock: 200 MHz + * + * edid-decode (hex): + * + * 00 ff ff ff ff ff ff 00 31 d8 34 00 00 00 00 00 + * ff 23 01 03 80 60 36 78 0f ee 91 a3 54 4c 99 26 + * 0f 50 54 20 00 00 01 01 01 01 01 01 01 01 01 01 + * 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c + * 45 00 c0 1c 32 00 00 1e 00 00 00 fc 00 54 65 73 + * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 18 + * 55 18 5e 11 00 0a 20 20 20 20 20 20 00 00 00 10 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 bb + * + * 02 03 29 31 42 90 5f 6c 03 0c 00 10 00 78 28 20 + * 00 00 01 03 6d d8 5d c4 01 28 80 07 00 00 00 00 + * 00 00 e3 0f 00 00 e2 0e 5f 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ca + * + * ---------------- + * + * Block 0, Base EDID: + * EDID Structure Version & Revision: 1.3 + * Vendor & Product Identification: + * Manufacturer: LNX + * Model: 52 + * Model year: 2025 + * Basic Display Parameters & Features: + * Digital display + * Maximum image size: 96 cm x 54 cm + * Gamma: 2.20 + * RGB color display + * Default (sRGB) color space is primary color space + * First detailed timing is the preferred timing + * Supports GTF timings within operating range + * Color Characteristics: + * Red : 0.6396, 0.3300 + * Green: 0.2998, 0.5996 + * Blue : 0.1503, 0.0595 + * White: 0.3125, 0.3291 + * Established Timings I & II: + * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175= 000 MHz + * Standard Timings: none + * Detailed Timing Descriptors: + * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000= MHz (960 mm x 540 mm) + * Hfront 88 Hsync 44 Hback 148 Hpol P + * Vfront 4 Vsync 5 Vback 36 Vpol P + * Display Product Name: 'Test EDID' + * Display Range Limits: + * Monitor ranges (GTF): 24-85 Hz V, 24-94 kHz H, max dotclock 170 M= Hz + * Dummy Descriptor: + * Extension blocks: 1 + * Checksum: 0xbb + * + * ---------------- + * + * Block 1, CTA-861 Extension Block: + * Revision: 3 + * Supports YCbCr 4:4:4 + * Supports YCbCr 4:2:2 + * Native detailed modes: 1 + * Video Data Block: + * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.5000= 00 MHz (native) + * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.0000= 00 MHz + * Vendor-Specific Data Block (HDMI), OUI 00-0C-03: + * Source physical address: 1.0.0.0 + * DC_48bit + * DC_36bit + * DC_30bit + * DC_Y444 + * Maximum TMDS clock: 200 MHz + * Extended HDMI video details: + * Vendor-Specific Data Block (HDMI Forum), OUI C4-5D-D8: + * Version: 1 + * Maximum TMDS Character Rate: 200 MHz + * SCDC Present + * Supports 16-bits/component Deep Color 4:2:0 Pixel Encoding + * Supports 12-bits/component Deep Color 4:2:0 Pixel Encoding + * Supports 10-bits/component Deep Color 4:2:0 Pixel Encoding + * YCbCr 4:2:0 Capability Map Data Block: + * Empty Capability Map + * YCbCr 4:2:0 Video Data Block: + * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.0000= 00 MHz + * Checksum: 0xca + */ +static const unsigned char test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_2= 00mhz[] =3D { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x34, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x23, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, + 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x20, + 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, + 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44, + 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, + 0x55, 0x18, 0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xbb, 0x02, 0x03, 0x29, 0x31, + 0x42, 0x90, 0x5f, 0x6c, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x78, 0x28, 0x20, + 0x00, 0x00, 0x01, 0x03, 0x6d, 0xd8, 0x5d, 0xc4, 0x01, 0x28, 0x80, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x0f, 0x00, 0x00, 0xe2, 0x0e, + 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xca +}; + #endif // DRM_KUNIT_EDID_H_ --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 E775D27587F for ; Tue, 27 May 2025 12:11:35 +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=1748347897; cv=none; b=LbseKqXAEcH0Ib0nrXnmxQJ1Oi3Cd91glnRQhlRnp8uQ/bquYt5mpHfzP5W2UoEJUAkTQwR/ertrKXu2HP96TyQo2N+68IMbbUxVqtzoo3zviCI7TZ5BiaNnTl8pXeu3rn/wnBkSMVXUlHosohiiUVHaGtG9vaME6pdwpvKjq4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347897; c=relaxed/simple; bh=YWFru4H/Eik0gnTLq2MsHqXdolUJMnLe+KhSqLrLUCo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lvTNpwLI1GXdNbHE78wq2H5rmfSGShFCGosvO3y9ABztZzfJcRCI/6s0PQl9JgaS1bYtQrZuEQbca1Thet2X1U27HSmwOkySqSDQ1TB5lrPrHRDAUGHPNVco25TJ/Hy1nGQaR42CnJ1PfbPPBSn8Xw5uWms3FqurqmcInGTSScs= 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=fWbAFVEh; 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="fWbAFVEh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347894; bh=YWFru4H/Eik0gnTLq2MsHqXdolUJMnLe+KhSqLrLUCo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fWbAFVEhceDwgM+8HFKVpbHJRqUmcpbglp8UgfSKCMqlRgDEwpUQBjGUvpelebu8T LGd1kF4S79bNZmqUofw5eNsbeWGbj9qduzAi+De7lYaicDjeEPZna2GQ+qbWf0LxK6 DQqDTyzU197MliyAOZ+xmf/1QQQWXaUQZFiccdcdIkPVei5n0bJkloL5+qZD1U95F7 OIfux7vPPUBBlIL/qDfegctvEZ7TnQ0Z0V7WL6bHfmaAUTTTG7e+nkBWbmMB2p1BxL jfftP1jPqTHhlsAP8Ti5MJgv29aB6gYMKfzfPleemog/H3HTUMO77+Ixgvh6KUjSzz Z1SUrBOR7tISg== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 4818317E0FA8; Tue, 27 May 2025 14:11:34 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:23 +0300 Subject: [PATCH v5 15/19] drm/tests: hdmi: Add limited range tests for YUV420 mode 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: <20250527-hdmi-conn-yuv-v5-15-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Provide tests to verify that drm_atomic_helper_connector_hdmi_check() helper behaviour when using YUV420 output format is to always set the limited RGB quantization range to 'limited', no matter what the value of Broadcast RGB property is. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 108 +++++++++++++++++= +++- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 168fe25529e5861ebee2d8a929f912436c485c60..8015e4c469049c611f7fcc24269= cd349680900c9 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -735,6 +735,107 @@ static void drm_test_check_broadcast_rgb_limited_cea_= mode_vic_1(struct kunit *te drm_modeset_acquire_fini(&ctx); } =20 +/* + * Test that for an HDMI connector, with an HDMI monitor, we will + * get a limited RGB Quantization Range with a YUV420 mode, no + * matter what the value of the Broadcast RGB property is set to. + */ +static void drm_test_check_broadcast_rgb_cea_mode_yuv420(struct kunit *tes= t) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + enum drm_hdmi_broadcast_rgb broadcast_rgb; + struct drm_modeset_acquire_ctx ctx; + struct drm_connector_state *conn_state; + struct drm_atomic_state *state; + struct drm_display_mode *mode; + struct drm_connector *conn; + struct drm_device *drm; + struct drm_crtc *crtc; + int ret; + + broadcast_rgb =3D *(enum drm_hdmi_broadcast_rgb *)test->param_value; + + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV420), + 8, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); + KUNIT_ASSERT_NOT_NULL(test, priv); + + drm =3D &priv->drm; + crtc =3D priv->crtc; + conn =3D &priv->connector; + KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); + + mode =3D drm_kunit_display_mode_from_cea_vic(test, drm, 95); + KUNIT_ASSERT_NOT_NULL(test, mode); + + drm_modeset_acquire_init(&ctx, 0); + +retry_conn_enable: + ret =3D drm_kunit_helper_enable_crtc_connector(test, drm, crtc, conn, + mode, &ctx); + if (ret =3D=3D -EDEADLK) { + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_enable; + } + KUNIT_ASSERT_EQ(test, ret, 0); + + state =3D drm_kunit_helper_atomic_state_alloc(test, drm, &ctx); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); + +retry_conn_state: + conn_state =3D drm_atomic_get_connector_state(state, conn); + if (PTR_ERR(conn_state) =3D=3D -EDEADLK) { + drm_atomic_state_clear(state); + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_state; + } + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); + + conn_state->hdmi.broadcast_rgb =3D broadcast_rgb; + + ret =3D drm_atomic_check_only(state); + if (ret =3D=3D -EDEADLK) { + drm_atomic_state_clear(state); + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_state; + } + KUNIT_ASSERT_EQ(test, ret, 0); + + conn_state =3D drm_atomic_get_new_connector_state(state, conn); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); + + KUNIT_ASSERT_EQ(test, conn_state->hdmi.broadcast_rgb, broadcast_rgb); + KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV= 420); + + KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); +} + +static const enum drm_hdmi_broadcast_rgb check_broadcast_rgb_cea_mode_yuv4= 20_tests[] =3D { + DRM_HDMI_BROADCAST_RGB_AUTO, + DRM_HDMI_BROADCAST_RGB_FULL, + DRM_HDMI_BROADCAST_RGB_LIMITED, +}; + +static void +check_broadcast_rgb_cea_mode_yuv420_desc(const enum drm_hdmi_broadcast_rgb= *broadcast_rgb, + char *desc) +{ + sprintf(desc, "%s", drm_hdmi_connector_get_broadcast_rgb_name(*broadcast_= rgb)); +} + +KUNIT_ARRAY_PARAM(check_broadcast_rgb_cea_mode_yuv420, + check_broadcast_rgb_cea_mode_yuv420_tests, + check_broadcast_rgb_cea_mode_yuv420_desc); + /* * Test that if we change the maximum bpc property to a different value, * we trigger a mode change on the connector's CRTC, which will in turn @@ -1667,11 +1768,8 @@ static struct kunit_case drm_atomic_helper_connector= _hdmi_check_tests[] =3D { KUNIT_CASE(drm_test_check_broadcast_rgb_full_cea_mode_vic_1), KUNIT_CASE(drm_test_check_broadcast_rgb_limited_cea_mode), KUNIT_CASE(drm_test_check_broadcast_rgb_limited_cea_mode_vic_1), - /* - * TODO: When we'll have YUV output support, we need to check - * that the limited range is always set to limited no matter - * what the value of Broadcast RGB is. - */ + KUNIT_CASE_PARAM(drm_test_check_broadcast_rgb_cea_mode_yuv420, + check_broadcast_rgb_cea_mode_yuv420_gen_params), KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_changed), KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_not_changed), KUNIT_CASE(drm_test_check_disable_connector), --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 2AD87277027 for ; Tue, 27 May 2025 12:11:36 +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=1748347899; cv=none; b=FA3HwsvHS3Y6dLeTf2hN7iShTEd20wLAT9T3k/MbSLUWhSJsv+8DTqb/n5HrG6zDhfqcOt3EEhKOm98f+tjXNtRu5JbhZTL+D6NmTnyKgavCZ0yet2XNWTY3BsUuiK/EDuY2PoYOxWJFR4GWPd0lAE4o95lMr6ZAs8n1KiLqogk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347899; c=relaxed/simple; bh=Kr9JGkqSj9Ped/Q6Pi3Di8bZNdl/U2IOTHASMaKOiXo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XjMv/2NOND13k+qeg+KPly6qZqBgDvaqBOgk08b+ihoSr7PVT3+VRobBwZD+cxMT+o2H6yVkdYVejPrX3lPceLvG5EMdHgS2SORjIL18TtUltcF+KYdsdGGYiJhPdVU+G1pDNS4JnspN8vP+UwaRut0ns9fRHtqRbb7E0zEAGFQ= 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=n6uC7Qhr; 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="n6uC7Qhr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347895; bh=Kr9JGkqSj9Ped/Q6Pi3Di8bZNdl/U2IOTHASMaKOiXo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=n6uC7Qhr0Vkcs/w3e0pnn+5rZoqNDbDB9BvGpSQAmi5i4eqpjY0ArnUyHD5P7TFi/ wFxfKDZQ5hivjc5TnYxLNTNE4pG4S7B+umOzk+vSJ0tJAKAlPMFYuDQsP5dx0gSN4g qxgk8wHWsVGSiDVdCfnnN6Gofg5jTXQBHOw2wwupYghlk6hwHVKy9Uw6rxA5IVKTYV 5ub0SENDcrCgej3zeHLnvP8aOzu1/WEgZ8UQ1llS2r/Yk8sZ7+8TEDJEZevxbRMgUI OSvpNbiu72YpgFHdUeCjW2hoYTL/rj71oz2VXI8xV4eBsxJRiUletvttbYB7n3G397 qNa23ogzI/cTg== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 2B02817E056F; Tue, 27 May 2025 14:11:35 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:24 +0300 Subject: [PATCH v5 16/19] drm/tests: hdmi: Rename max TMDS rate fallback tests 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: <20250527-hdmi-conn-yuv-v5-16-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 In preparation to extend the max TMDS rate fallback tests for covering YUV420 output, update the rather generic function names drm_test_check_max_tmds_rate_{bpc|format}_fallback() to properly indicate the intended test cases. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 8015e4c469049c611f7fcc24269cd349680900c9..c6f7c33f5f7142d6ee80970f73e= 9757fbc08b3d5 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -1253,7 +1253,7 @@ static void drm_test_check_hdmi_funcs_reject_rate(str= uct kunit *test) * Then we will pick the latter, and the computed TMDS character rate * will be equal to 1.25 times the mode pixel clock. */ -static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) +static void drm_test_check_max_tmds_rate_bpc_fallback_rgb(struct kunit *te= st) { struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_modeset_acquire_ctx ctx; @@ -1322,7 +1322,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback= (struct kunit *test) * Then we will prefer to keep the RGB format with a lower bpc over * picking YUV422. */ -static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *tes= t) +static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422(struct= kunit *test) { struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_modeset_acquire_ctx ctx; @@ -1774,8 +1774,8 @@ static struct kunit_case drm_atomic_helper_connector_= hdmi_check_tests[] =3D { KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_not_changed), KUNIT_CASE(drm_test_check_disable_connector), KUNIT_CASE(drm_test_check_hdmi_funcs_reject_rate), - KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback), - KUNIT_CASE(drm_test_check_max_tmds_rate_format_fallback), + KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_rgb), + KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed), KUNIT_CASE(drm_test_check_output_bpc_dvi), --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 E16CC27780C for ; Tue, 27 May 2025 12:11:37 +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=1748347899; cv=none; b=datY5GZq/RS3HMduYQI+9XqLjP53Gb+S/TTqoaUg/fcyIhgO3lhz3CQExIRA7XyXmZhu7fvrW2q9Ra0yBa3RZRgWEm/Ge+i5ydGQKlapt7M8pXA14wz04TBB+fFp2wtJgMWMZZx4GPqSbi1VvQ/XFnuawue48VTu+jJFDM0SjHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347899; c=relaxed/simple; bh=E8jHiQFEwsAMvUpmWYirs9M3Gw0LxjojaSfhG8OOdSg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g8m66VKGFFBpoIsaUpHxzDDGByS+2lkAKmQjtivtmsxeCA7Z+cY1HDeQT940CQeVht1LQseqprKkdM0w78tHSaAK+7UkKVc4esHWI8iQuBMaXTr/vJpKUguIbnwRlAGFd43Rav6ubW9kqHEDB2Bhq1fGQMfn/zp3jfez6VBtMdQ= 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=OkNpjuGA; 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="OkNpjuGA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347896; bh=E8jHiQFEwsAMvUpmWYirs9M3Gw0LxjojaSfhG8OOdSg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OkNpjuGAxPpKlIZjGlTkThRK5xKEEjluw9yMqOxtNyLeB0ch/f7sIkUK9mqE9tdeJ GcGkycj9saLIEJuvTTcgukeE+l3DqHo1w8H3Ky7nMKpOVR3H2nt2njLvqUzwwUYuS1 AxpiaCoN95/JR6g3rbQ5M95CyV6vAXX8B0vvzt9AtogSoaVCUPhFA/J0fbbIoFM2RU mefFGMGZV64pXVjrl3D99o1iflnJxP8TYEj6QykFPEQrIb9Fud4bhGfJvBtfsnnvoO d1LAvMO2xawlNTLGjgX9dkVakdYqs1lgI2R0sLJCmAsbXJDVBOiKlD6qVU04iJAfoN AJhA5nyVbyvkw== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id 0A70817E09FA; Tue, 27 May 2025 14:11:36 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:25 +0300 Subject: [PATCH v5 17/19] drm/tests: hdmi: Provide EDID supporting 4K@30Hz with RGB/YUV 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: <20250527-hdmi-conn-yuv-v5-17-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Create a test EDID advertising the following capabilities: Max resolution: 3840x2160@30Hz with RGB, YUV444, YUV422, YUV420 Max BPC: 16 for all modes Max TMDS clock: 340 MHz Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_kunit_edid.h | 114 +++++++++++++++++++++++++++++= ++++ 1 file changed, 114 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests= /drm_kunit_edid.h index 027d8aa5bccd0ee101fbe7e147f0e418581e9c3d..02e2761b3b1f9f7d778e13745c2= 9956b3687404c 100644 --- a/drivers/gpu/drm/tests/drm_kunit_edid.h +++ b/drivers/gpu/drm/tests/drm_kunit_edid.h @@ -701,4 +701,118 @@ static const unsigned char test_edid_hdmi_1080p_rgb_y= uv_4k_yuv420_dc_max_200mhz[ 0x00, 0x00, 0x00, 0xca }; =20 +/* + * Max resolution: 3840x2160@30Hz with RGB, YUV444, YUV422, YUV420 + * Max BPC: 16 for all modes + * Max TMDS clock: 340 MHz + * + * edid-decode (hex): + * + * 00 ff ff ff ff ff ff 00 31 d8 34 00 00 00 00 00 + * ff 23 01 03 80 60 36 78 0f ee 91 a3 54 4c 99 26 + * 0f 50 54 20 00 00 01 01 01 01 01 01 01 01 01 01 + * 01 01 01 01 01 01 04 74 00 30 f2 70 5a 80 b0 58 + * 8a 00 40 84 63 00 00 1e 00 00 00 fc 00 54 65 73 + * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 18 + * 55 18 5e 22 00 0a 20 20 20 20 20 20 00 00 00 10 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ce + * + * 02 03 27 31 41 5f 6c 03 0c 00 10 00 78 44 20 00 + * 00 01 03 6d d8 5d c4 01 44 80 07 00 00 00 00 00 + * 00 e3 0f 01 00 e1 0e 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 84 + * + * ---------------- + * + * Block 0, Base EDID: + * EDID Structure Version & Revision: 1.3 + * Vendor & Product Identification: + * Manufacturer: LNX + * Model: 52 + * Model year: 2025 + * Basic Display Parameters & Features: + * Digital display + * Maximum image size: 96 cm x 54 cm + * Gamma: 2.20 + * RGB color display + * Default (sRGB) color space is primary color space + * First detailed timing is the preferred timing + * Supports GTF timings within operating range + * Color Characteristics: + * Red : 0.6396, 0.3300 + * Green: 0.2998, 0.5996 + * Blue : 0.1503, 0.0595 + * White: 0.3125, 0.3291 + * Established Timings I & II: + * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175= 000 MHz + * Standard Timings: none + * Detailed Timing Descriptors: + * DTD 1: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.000000= MHz (1600 mm x 900 mm) + * Hfront 176 Hsync 88 Hback 296 Hpol P + * Vfront 8 Vsync 10 Vback 72 Vpol P + * Display Product Name: 'Test EDID' + * Display Range Limits: + * Monitor ranges (GTF): 24-85 Hz V, 24-94 kHz H, max dotclock 340 M= Hz + * Dummy Descriptor: + * Extension blocks: 1 + * Checksum: 0xce + * + * ---------------- + * + * Block 1, CTA-861 Extension Block: + * Revision: 3 + * Supports YCbCr 4:4:4 + * Supports YCbCr 4:2:2 + * Native detailed modes: 1 + * Video Data Block: + * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.0000= 00 MHz + * Vendor-Specific Data Block (HDMI), OUI 00-0C-03: + * Source physical address: 1.0.0.0 + * DC_48bit + * DC_36bit + * DC_30bit + * DC_Y444 + * Maximum TMDS clock: 340 MHz + * Extended HDMI video details: + * Vendor-Specific Data Block (HDMI Forum), OUI C4-5D-D8: + * Version: 1 + * Maximum TMDS Character Rate: 340 MHz + * SCDC Present + * Supports 16-bits/component Deep Color 4:2:0 Pixel Encoding + * Supports 12-bits/component Deep Color 4:2:0 Pixel Encoding + * Supports 10-bits/component Deep Color 4:2:0 Pixel Encoding + * YCbCr 4:2:0 Capability Map Data Block: + * VIC 95: 3840x2160 30.000000 Hz 16:9 67.500 kHz 297.0000= 00 MHz + * YCbCr 4:2:0 Video Data Block: + * Checksum: 0x84 + */ +static const unsigned char test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz[] = =3D { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x34, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x23, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, + 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x20, + 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x74, 0x00, 0x30, 0xf2, 0x70, + 0x5a, 0x80, 0xb0, 0x58, 0x8a, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44, + 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, + 0x55, 0x18, 0x5e, 0x22, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0x02, 0x03, 0x27, 0x31, + 0x41, 0x5f, 0x6c, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x78, 0x44, 0x20, 0x00, + 0x00, 0x01, 0x03, 0x6d, 0xd8, 0x5d, 0xc4, 0x01, 0x44, 0x80, 0x07, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x0f, 0x01, 0x00, 0xe1, 0x0e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x84 +}; + #endif // DRM_KUNIT_EDID_H_ --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 9296F278172 for ; Tue, 27 May 2025 12:11:38 +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=1748347900; cv=none; b=pPYbjE4olF7uYByJsV46VigBp8vn9/l7bqCASSua9l0e7O+WewIYLvi8ovbhkLACw4NBNiCPDXqe7co884iJ4Nx15k952+C9qlxJA1lU19Nsqh8zfL9xn+FNJGW8T1h6aWpXc4eGP2PzD0ITEggQBOruFAm9BDqagMhcXQsb+i4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347900; c=relaxed/simple; bh=ztV+12rydUJsG7fHN8tZ18UBlJrT90/y+3ZYYbTzYS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bo89lq95tlZATzjzrDSLsywdvfoTxGsfz0tnN/pQdj7XLYY5KXOIIvMfgJBuWIgz9jAx2su9WsEYqjwQyfryBwP5FM9KzLZU5c5n1eUGpgA9UWpQ883/RYyK/Qp2NXka3YNj1Q2j7OVZBhQGfKWl6bcfkiGYy0JPBBD951x35bA= 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=V4auGwRQ; 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="V4auGwRQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347897; bh=ztV+12rydUJsG7fHN8tZ18UBlJrT90/y+3ZYYbTzYS4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V4auGwRQVWlbLTB02vj9xgFim1Cex3R0ctXyP1FjC5I0K2vqd1hnA2p9VnPlGRtTh T6UPVtsYBOi274QLqAu07uodf5/zIomLmjPuQOjS/reWANEKrf+uD32yKIw35YHd6g rJrB5O4LVf27eQpA+W8kOAmd4Rva2jDQmZ43Y0CuodBh8jG//s2zOqt538fayzPBxW HN3yO2eXJLb7fxgYjIre9lzKazz765oRwIVLlAYZ+blvJ/e3aCvRTdZsFslvUgFSzr QluxcY7noLJ39dRqP84mmjG9sfhKcxQZB24Ydspucy+P3N6m4IdkYgsRzDsSS7NhS/ e3xdQkPn+0Njw== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id E10A517E1509; Tue, 27 May 2025 14:11:36 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:26 +0300 Subject: [PATCH v5 18/19] drm/tests: hdmi: Add max TMDS rate fallback tests for YUV420 mode 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: <20250527-hdmi-conn-yuv-v5-18-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Provide tests to verify drm_atomic_helper_connector_hdmi_check() helper fallback behavior when using YUV420 output format. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 154 +++++++++++++++++= ++++ 1 file changed, 154 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index c6f7c33f5f7142d6ee80970f73e9757fbc08b3d5..d98fb9803b46902016747f3fc97= 01eacd493d473 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -1309,6 +1309,80 @@ static void drm_test_check_max_tmds_rate_bpc_fallbac= k_rgb(struct kunit *test) drm_modeset_acquire_fini(&ctx); } =20 +/* + * Test that if: + * - We have an HDMI connector and a display supporting both RGB and YUV420 + * - The chosen mode can be supported in YUV420 output format only + * - The chosen mode has a TMDS character rate higher than the display + * supports in YUV420/12bpc + * - The chosen mode has a TMDS character rate lower than the display + * supports in YUV420/10bpc. + * + * Then we will pick the latter, and the computed TMDS character rate + * will be equal to 1.25 * 0.5 times the mode pixel clock. + */ +static void drm_test_check_max_tmds_rate_bpc_fallback_yuv420(struct kunit = *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_modeset_acquire_ctx ctx; + struct drm_connector_state *conn_state; + struct drm_display_info *info; + struct drm_display_mode *yuv420_only_mode; + unsigned long long rate; + struct drm_connector *conn; + struct drm_device *drm; + struct drm_crtc *crtc; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV420), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); + KUNIT_ASSERT_NOT_NULL(test, priv); + + drm =3D &priv->drm; + crtc =3D priv->crtc; + conn =3D &priv->connector; + info =3D &conn->display_info; + KUNIT_ASSERT_TRUE(test, info->is_hdmi); + KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed); + + yuv420_only_mode =3D drm_kunit_display_mode_from_cea_vic(test, drm, 95); + KUNIT_ASSERT_NOT_NULL(test, yuv420_only_mode); + KUNIT_ASSERT_TRUE(test, drm_mode_is_420_only(info, yuv420_only_mode)); + + rate =3D drm_hdmi_compute_mode_clock(yuv420_only_mode, 12, HDMI_COLORSPAC= E_YUV420); + KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); + + rate =3D drm_hdmi_compute_mode_clock(yuv420_only_mode, 10, HDMI_COLORSPAC= E_YUV420); + KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); + + drm_modeset_acquire_init(&ctx, 0); + +retry_conn_enable: + ret =3D drm_kunit_helper_enable_crtc_connector(test, drm, crtc, conn, + yuv420_only_mode, &ctx); + if (ret =3D=3D -EDEADLK) { + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_enable; + } + KUNIT_EXPECT_EQ(test, ret, 0); + + conn_state =3D conn->state; + KUNIT_ASSERT_NOT_NULL(test, conn_state); + + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV= 420); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, yuv420_only_mode->= clock * 625); + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); +} + /* * Test that if: * - We have an HDMI connector supporting both RGB and YUV422 and up to @@ -1382,6 +1456,84 @@ static void drm_test_check_max_tmds_rate_bpc_fallbac= k_ignore_yuv422(struct kunit drm_modeset_acquire_fini(&ctx); } =20 +/* + * Test that if: + * - We have an HDMI connector supporting both RGB and YUV420 and up to + * 12 bpc + * - The chosen mode has a TMDS character rate higher than the display + * supports in RGB/10bpc but lower than the display supports in + * RGB/8bpc + * - The chosen mode has a TMDS character rate lower than the display + * supports in YUV420/12bpc. + * + * Then we will prefer to keep the RGB format with a lower bpc over + * picking YUV420. + */ +static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420(struct= kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_modeset_acquire_ctx ctx; + struct drm_connector_state *conn_state; + struct drm_display_info *info; + struct drm_display_mode *preferred; + unsigned long long rate; + struct drm_connector *conn; + struct drm_device *drm; + struct drm_crtc *crtc; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB) | + BIT(HDMI_COLORSPACE_YUV420), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz); + KUNIT_ASSERT_NOT_NULL(test, priv); + + drm =3D &priv->drm; + crtc =3D priv->crtc; + conn =3D &priv->connector; + info =3D &conn->display_info; + KUNIT_ASSERT_TRUE(test, info->is_hdmi); + KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0); + KUNIT_ASSERT_TRUE(test, conn->ycbcr_420_allowed); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); + KUNIT_ASSERT_TRUE(test, drm_mode_is_420_also(info, preferred)); + + rate =3D drm_hdmi_compute_mode_clock(preferred, 8, HDMI_COLORSPACE_RGB); + KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); + + rate =3D drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB); + KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); + + rate =3D drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV42= 0); + KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); + + drm_modeset_acquire_init(&ctx, 0); + +retry_conn_enable: + ret =3D drm_kunit_helper_enable_crtc_connector(test, drm, crtc, conn, + preferred, &ctx); + if (ret =3D=3D -EDEADLK) { + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_enable; + } + KUNIT_EXPECT_EQ(test, ret, 0); + + conn_state =3D conn->state; + KUNIT_ASSERT_NOT_NULL(test, conn_state); + + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB= ); + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); +} + /* * Test that if a driver and screen supports RGB and YUV formats, and we * try to set the VIC 1 mode, we end up with 8bpc RGB even if we could @@ -1775,7 +1927,9 @@ static struct kunit_case drm_atomic_helper_connector_= hdmi_check_tests[] =3D { KUNIT_CASE(drm_test_check_disable_connector), KUNIT_CASE(drm_test_check_hdmi_funcs_reject_rate), KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_rgb), + KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_yuv420), KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422), + KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed), KUNIT_CASE(drm_test_check_output_bpc_dvi), --=20 2.49.0 From nobody Fri Dec 19 18:47:59 2025 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 AA030279347 for ; Tue, 27 May 2025 12:11:39 +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=1748347901; cv=none; b=cJ1E2gCBwcLFEtxBlLdXRD7mpCfhAq9pJ3y0g51ATHzhlMxpwwdN4aXFWflEadoBeq4o0JnkD+/Fh9ghoz+F29i79chpamyhBqY6OhpTNBQoPHKjp2g0XAQDOHGVVMOomSq1UM0k3ZyADnar9gh7ag2wHyNOtl5YCdBIlutMMZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748347901; c=relaxed/simple; bh=PulNnSsltbQ+MARfRqcc9kgwnExkeYPES13ryRMA7qM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MAI4ufBJA8uKLnSOSaIYj/TwLFwUvUnBO1CXywmmtWCSqVK0Wg+FdhocoVu0mBbsx/0fLx/OGvUSKpo7eU6b1FjIHG1unyr2WfgmSl7Pv5hSHuUwJ30UgIMJJ9f7ewEwVKMpC+SKOOjra9mSog6UWJ+BOG7EcAdDGaZSQ3JiqtE= 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=M2LUNIkF; 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="M2LUNIkF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1748347897; bh=PulNnSsltbQ+MARfRqcc9kgwnExkeYPES13ryRMA7qM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=M2LUNIkFNN5w6AW9pPkh9+lzwUiLh1TVFpp78VMCduyew7J6KMWD/qAQbFgMjjLOe cO00YGtH4dXxgd3YoIhejxvyTm5O0as4fQf9m9L6xESTCBhRdc3YAU4cNYLw7QDyJz zuzhjg2LQ0bOJpqzO3m8u7qtRB/79febY4QVS23z2pT4GeSRJ6EyYFyvBBZecMSqF7 jyeXCib1AkApDmDWUKZypragMpGALCKowabx1Az9cSDgSY4hM1TtM04BbcuN8gxNMD /5JUM+wrIIs8jm6RJ37m5VvunXbelyIJyR6iWwVMbMgWM7vIV4ZdCzmQzpJnlhyGv3 E+CRhBJp8P/og== Received: from localhost (unknown [82.76.59.134]) (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 UTF8SMTPSA id BBB0917E01FD; Tue, 27 May 2025 14:11:37 +0200 (CEST) From: Cristian Ciocaltea Date: Tue, 27 May 2025 15:11:27 +0300 Subject: [PATCH v5 19/19] drm/tests: hdmi: Add test for unsuccessful fallback to YUV420 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: <20250527-hdmi-conn-yuv-v5-19-74c9c4a8ac0c@collabora.com> References: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> In-Reply-To: <20250527-hdmi-conn-yuv-v5-0-74c9c4a8ac0c@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , Dmitry Baryshkov , Dmitry Baryshkov , Dmitry Baryshkov Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Provide test to verify a mandatory fallback to YUV420 output cannot succeed when driver doesn't advertise YUV420 support. Acked-by: Maxime Ripard Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 87 ++++++++++++++++++= ++++ 1 file changed, 87 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index d98fb9803b46902016747f3fc9701eacd493d473..8bd412735000cb18e66aeca2143= 3b2ebbefe2b44 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -1534,6 +1534,92 @@ static void drm_test_check_max_tmds_rate_bpc_fallbac= k_ignore_yuv420(struct kunit drm_modeset_acquire_fini(&ctx); } =20 +/* + * Test that if a driver supports only RGB, but the chosen mode can be + * supported by the screen only in YUV420 output format, we end up with + * unsuccessful fallback attempts. + */ +static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit= *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_modeset_acquire_ctx ctx; + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + struct drm_atomic_state *state; + struct drm_display_info *info; + struct drm_display_mode *preferred, *yuv420_only_mode; + struct drm_connector *conn; + struct drm_device *drm; + struct drm_crtc *crtc; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 12, + &dummy_connector_hdmi_funcs, + test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); + KUNIT_ASSERT_NOT_NULL(test, priv); + + drm =3D &priv->drm; + crtc =3D priv->crtc; + conn =3D &priv->connector; + info =3D &conn->display_info; + KUNIT_ASSERT_TRUE(test, info->is_hdmi); + KUNIT_ASSERT_FALSE(test, conn->ycbcr_420_allowed); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_ASSERT_FALSE(test, drm_mode_is_420_also(info, preferred)); + + yuv420_only_mode =3D drm_kunit_display_mode_from_cea_vic(test, drm, 95); + KUNIT_ASSERT_NOT_NULL(test, yuv420_only_mode); + KUNIT_ASSERT_TRUE(test, drm_mode_is_420_only(info, yuv420_only_mode)); + + drm_modeset_acquire_init(&ctx, 0); + +retry_conn_enable: + ret =3D drm_kunit_helper_enable_crtc_connector(test, drm, crtc, conn, + preferred, &ctx); + if (ret =3D=3D -EDEADLK) { + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_conn_enable; + } + KUNIT_EXPECT_EQ(test, ret, 0); + + conn_state =3D conn->state; + KUNIT_ASSERT_NOT_NULL(test, conn_state); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB= ); + + state =3D drm_kunit_helper_atomic_state_alloc(test, drm, &ctx); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); + +retry_crtc_state: + crtc_state =3D drm_atomic_get_crtc_state(state, crtc); + if (PTR_ERR(crtc_state) =3D=3D -EDEADLK) { + drm_atomic_state_clear(state); + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_crtc_state; + } + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state); + + ret =3D drm_atomic_set_mode_for_crtc(crtc_state, yuv420_only_mode); + KUNIT_EXPECT_EQ(test, ret, 0); + + ret =3D drm_atomic_check_only(state); + if (ret =3D=3D -EDEADLK) { + drm_atomic_state_clear(state); + ret =3D drm_modeset_backoff(&ctx); + if (!ret) + goto retry_crtc_state; + } + KUNIT_ASSERT_LT(test, ret, 0); + + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); +} + /* * Test that if a driver and screen supports RGB and YUV formats, and we * try to set the VIC 1 mode, we end up with 8bpc RGB even if we could @@ -1930,6 +2016,7 @@ static struct kunit_case drm_atomic_helper_connector_= hdmi_check_tests[] =3D { KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_yuv420), KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422), KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420), + KUNIT_CASE(drm_test_check_driver_unsupported_fallback_yuv420), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_changed), KUNIT_CASE(drm_test_check_output_bpc_crtc_mode_not_changed), KUNIT_CASE(drm_test_check_output_bpc_dvi), --=20 2.49.0