From patchwork Fri Nov 22 09:12:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F0D4E65D17 for ; Fri, 22 Nov 2024 09:13:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A030A10EAF5; Fri, 22 Nov 2024 09:13:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mivTKmfV"; dkim-atps=neutral Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD3AE10E1E2 for ; Fri, 22 Nov 2024 09:13:13 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53d9ff8f1e4so2042469e87.2 for ; Fri, 22 Nov 2024 01:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266792; x=1732871592; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6W3bqmSBPUsE+fVjxjecsCfWlJC1+mE/7mRAcZKJqvU=; b=mivTKmfVrJqQIZgLXnbqWQcHKcMmXXjlXBNfdL+3sDCSr7Zg/6WEeHp5GY+O9W0nux NmJksjzbHfRDwuSjj3mX8NT72/MUn2jJx2HyazuwPlE3dxTp4aQ+9ZCEpsrZv0MaD2pn TW8a1c4W1STahCswKawt2ssQOpLP4txXAAiG6pZHJwYMtHRBeug9xybxevyNRFZXfkPT Lfi2HqQeEkUliJfHYRRdmbmPlRQa6pMgrfsHtKCFGahy2dy2Y2Cxl+ur9IcO8NCLUbjB d5a9HQtrSdP8+XOHqzCTg9IczDODtO04V69HmzrMtK8Q7Xg22NitEFLmmpW4CRXaTMFQ fuvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266792; x=1732871592; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6W3bqmSBPUsE+fVjxjecsCfWlJC1+mE/7mRAcZKJqvU=; b=lAQLXRgLw9jOzKUlVWJdbR7XBBBkb1JutuKLBd7y1y25VAZixEN1HL7hjp36I//p5H u3nNEayKtgbsB+E9nRG6hmB7KVNF3LCE0Oy4HPxUO2Fu5BMynPRtjO6bVnQa2+auhzbE PJ3rgQpmsEwWRxxnqY3ZdLR9C2x7Fbtv2sUTiz6YtTOXvvkIjqSnRd7aI2DWfpdr2K0m IOyVqRs0RdqdoTaoewzUtlzcnqYHWCIbsBk2H97VHR16fl2qcqn+DiuT0RD+CCNoXtL6 WsibKsyqzAzOviC0TZ0gzunndxD3jpY/wqh5Fj6I0hwD12oLgbeNDVT5CCiOWyDgDPyc SyuA== X-Gm-Message-State: AOJu0YzBnOg4gwpIHON5WxQTYSVCkCDaaMigxUOtnKSB8XQM4gVksluh qkDglNNBth/ArGTBGhiBKBkC3ryJCZITHHIRmJcX1sVZLr3iXapUDaYmTiE+Sjw= X-Gm-Gg: ASbGncuHKrhC99Wl4PyxJbjnGMR7eXsDYIgAd/R7XaNJggBvJrqQ26Bv8lhHKHjddp+ Mr1tKBZeRjZ71SVc3bQTTnTumUmKubjCEX8M3kEZD8TsXfNBdoojLeVNaurvDeqX7vEAL8nOKF0 +G3rsZ2QeYTIN47R2neG87cQ2esP73hF0nf8brBOG6ELIQ37CHdteu02pAMBL9qFTCRBpTIYL4o IsoOmj/SgYwnNqLXeilLqQQGYPy8hZd3queu20mjRhdaBkGZRXssB8a8g== X-Google-Smtp-Source: AGHT+IF9ThfWnsEQI6UyED7pA9h6Wf7FpGWyg1saUJdib/WRVSKuqZ2ksQYV61QNiecHx3mAhZLedA== X-Received: by 2002:ac2:568f:0:b0:53d:a024:ddb2 with SMTP id 2adb3069b0e04-53dd37a6c3bmr1142300e87.24.1732266791780; Fri, 22 Nov 2024 01:13:11 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:10 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:57 +0200 Subject: [PATCH v4 01/10] drm/tests: hdmi: handle empty modes in find_preferred_mode() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-1-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1147; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=cHHtfh9y6/Xe5pWD0imwgSoaSzh5tOQpdFVxQZ5xP/s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshW4nqOdXL0T4IVeWcFtdcIU865J/geaZOs dJST3YPq1iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1aCMB/4mAMbVULeSJaQKgD/thf0SdySNUWeV6CvGlRgfogZod1ZMqfju5iE0YiqI7xy28Ycv74E B0vuUvxyNt+MKQbKrGS8BTlEhjMqCpiI/CHQBw9F6k2HpfGFkrWHDIoMHaaoW5DaERqX6xacG/s DhPpiLyKV55OciJGf0cj7Okd9I+OzcIvE3aVDAo8uG6emEXX0UO2hya4rXHN74Rwop72ki1rJn+ 7Co2fSv5VYDWughxDBVCLzuLe6u6WeSCbhxlSg97MXogFyunITxmcV5RlLk5Z5TQWDhuX4634jq pnHjEf3jhAkLQer5IkvtUgJ1d8uMHBw5CJY0WH/gX/wWSOgj X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If the connector->modes list is empty, then list_first_entry() returns a bogus entry. Change that to use list_first_entry_or_null(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c index 294773342e710dc56772f839c2db9c2e487bbc1e..1e77689af6549f162eb3026c7bd2bbd59516ed98 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -46,7 +46,7 @@ static struct drm_display_mode *find_preferred_mode(struct drm_connector *connec struct drm_display_mode *mode, *preferred; mutex_lock(&drm->mode_config.mutex); - preferred = list_first_entry(&connector->modes, struct drm_display_mode, head); + preferred = list_first_entry_or_null(&connector->modes, struct drm_display_mode, head); list_for_each_entry(mode, &connector->modes, head) if (mode->type & DRM_MODE_TYPE_PREFERRED) preferred = mode; From patchwork Fri Nov 22 09:12:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52911E65D17 for ; Fri, 22 Nov 2024 09:13:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F95610EB02; Fri, 22 Nov 2024 09:13:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KptW0JlX"; dkim-atps=neutral Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FC5E10EB02 for ; Fri, 22 Nov 2024 09:13:16 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-53dd1829b56so1472665e87.1 for ; Fri, 22 Nov 2024 01:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266794; x=1732871594; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HoL3aWMtjL9qLbqtGe43c2BpbewS4aE5M6KHnAUYZyA=; b=KptW0JlX/jGiIWAowZ3bvxitOHZyqw30dtYdJ0ad+FNUvh1mNkBytxWKfNc4xA9RZk XXG7mXj4yglCKCRpk/FOUKwY7iAi5Gcn9HNsix7afQ9NMZnRVXRkNB34uZUgjgiT+ehu Lk9WrOefRSWZCIQPw9n+88TgZxMFIE6vpgeHD/AN1KX2CmGHsh0DXrXNkeDiOOS5Sc4x dy2VdDsVbokREse6T7XLQcOPgNZUpcprdYjYqXpmNKtYcnBxQCmOMdAh03tFpiCgNEvp YKEbnYzva5ADrQXdgVe0Gqj2NIMY5UVVXo6MQ6CTIpW5vd4+/dMcG6d7yWat20yBxnIx J8DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266794; x=1732871594; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HoL3aWMtjL9qLbqtGe43c2BpbewS4aE5M6KHnAUYZyA=; b=IKlO6XYROLd7QS6gNVNW5NINtFpmLx4IlpSnnHsfmZhGpdfQGEFN3BzUI1FZFbSpFm ho0WKjPxUHcsP2XinhxdrTrjE2lEZX/CZSP8IB95KKQW7KZ8kyvqpNo1TO4X95ZmZhgR Bd4QbSlnKBu70Vqnp6icDxP1EaKwhmEm1ddSLLO/YER0JUUiAfCRa+NzDaxbU0IgGwzQ iQW1LgPc7LBxNu+zzLszdTt/vVH9+Jf2fkCxe1y9WOmF+0BzEOjIrgiEHlOraJCzz4V5 Lj+9uM+KNGdyWXJcksHhZ57PqMYiMCgVRMokAH8K9k7AmyTXa34FR2Q54uxgwZrDB6SQ GMpw== X-Gm-Message-State: AOJu0YzOGxjjhDnD5YFSAhxXP7yfckExZuRVEb8Ud/1l5F1IdOu91jEe sTV6elw+h3YcJS5PL3R0HTLVUpDDMchLr4cFn44QUewaq2En+6lS+4sSXfBup2I= X-Gm-Gg: ASbGnctsn9ohL5AhOca+7aLMdUdC3f2tMHO7I2JcplDnlqnHWmtCYZ8lWU3Q7kt4MNI idIqWCdHuMnskpJDaThwzCkijpqQOEL75mzsPiVgvO0kEZvwP1Zcak7pXBxegXSbOKSu8R3qO+r dajIPSeB9SwUHKoLeZUP3vU4t3K2Lp2x1HqqJAf6x0aHyaJEwWvlctMKxxxvPn3P2rbNc5UehRE neg+L+5P5sX7bkn0bKtrgwuROyYUcLOV/Qz7OWQICXZEVMpZlakCeRW6A== X-Google-Smtp-Source: AGHT+IGsVNjOq27k776zE/cKgwN70tM6uYhT0eEceng2yr5gRWog07KJFnzoL9IEms+6bvRWR289/w== X-Received: by 2002:a05:6512:b8a:b0:53d:d2d0:7c8f with SMTP id 2adb3069b0e04-53dd389d8c5mr910882e87.34.1732266794264; Fri, 22 Nov 2024 01:13:14 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:12 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:58 +0200 Subject: [PATCH v4 02/10] drm/tests: hdmi: rename connector creation function MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-2-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11003; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=g90UV4snbYK1PCsg8Vi4l6YeLj+54jyCttfyA/beoL8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshr58WmNMo81MG4tiQNHQeSCPOdq5T4NQZ4 z8ZTDVJEraJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1fMGB/9ZOhAOQVgQ06z4Dsew8aMKvh7Gsx2b8vApxlPuSYhFhnespRjpeyhSCxW5AAYYPlS87N3 OpezjjaXuXIKqiV1jqN8LW1Mdu4T94LRA30YeLbaImenTe4zJULUTIPgSb0YhDqlBtKMplZ+ztr xZa14xzq/fyMB1B0/kW6cpcS8Aija2dpwz7SD2cUXZ+WnR2224RqWvRC5r+3Yh3JTatsclMYRqT zFyZjeJDH8l2dK/pK7ipe0HJbkZdttc3WuNvlFBXzitXJaNC1t8gP7mfTF4ENXVC6Tna2YUX3un gPH6KVG+TF4XJf8zdGy9/ks9y9P+2SD6uG+UcQHbET/Akc4+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As pointed out by Maxime, the drm_atomic_helper_connector_hdmi_init() isn't a good name for a function inside KUnit tests. Rename it to drm_kunit_helper_connector_hdmi_init(). Suggested-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c index 1e77689af6549f162eb3026c7bd2bbd59516ed98..d81254d46975e8af0d782249928217a1ebb7646e 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -164,7 +164,7 @@ static const struct drm_connector_funcs dummy_connector_funcs = { static struct drm_atomic_helper_connector_hdmi_priv * -drm_atomic_helper_connector_hdmi_init(struct kunit *test, +drm_kunit_helper_connector_hdmi_init(struct kunit *test, unsigned int formats, unsigned int max_bpc) { @@ -247,7 +247,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -310,7 +310,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -373,7 +373,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -429,7 +429,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -485,7 +485,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -543,7 +543,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -601,7 +601,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -659,7 +659,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -719,7 +719,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -793,7 +793,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -862,7 +862,7 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -911,7 +911,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -958,7 +958,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1005,7 +1005,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1056,7 +1056,7 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1112,7 +1112,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1179,7 +1179,7 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1242,7 +1242,7 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1305,7 +1305,7 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1370,7 +1370,7 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1438,7 +1438,7 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1496,7 +1496,7 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes struct drm_crtc *crtc; int ret; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1593,7 +1593,7 @@ static void drm_test_check_broadcast_rgb_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1615,7 +1615,7 @@ static void drm_test_check_bpc_8_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1639,7 +1639,7 @@ static void drm_test_check_bpc_10_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1663,7 +1663,7 @@ static void drm_test_check_bpc_12_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1685,7 +1685,7 @@ static void drm_test_check_format_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1707,7 +1707,7 @@ static void drm_test_check_tmds_char_value(struct kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; - priv = drm_atomic_helper_connector_hdmi_init(test, + priv = drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), From patchwork Fri Nov 22 09:12:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43435E65D35 for ; Fri, 22 Nov 2024 09:13:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B922B10EB03; Fri, 22 Nov 2024 09:13:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QsFdvBzI"; dkim-atps=neutral Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4D9310EB03 for ; Fri, 22 Nov 2024 09:13:18 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53dd59a2bc1so365405e87.2 for ; Fri, 22 Nov 2024 01:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266797; x=1732871597; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bn7n+Ij/Vq2ciN8r7fMFmAZOh0BG4t/fByh+MoATRM4=; b=QsFdvBzIvM7ElQb/ch2kmjEdFuh+LLiqzwVI2CEV+7qNsrwYqp7kahYb+RnvEFZEek DYUmB/qjVsEnHnOvx9XchyY4/RRZGk3lDMKwfG6JKxPbeimEadYnBVxEBRpO6GGvM57G jPHqAe20ahbid1kFEEkIRXFajgQA0MQKBw4s65Uoe+tevLEwn9iXtUV/j6RGicn8GvaK ljswh9i5cDw+V0HHU2xDxnQS6vj5YD6voY+Bx/3f6/eRjjTKtA0b2MSvPpgGRXUUUNhj N4Un/z1UICX+4sEOdNrrFNn+k9tj2tmJgJRozEkgrl+vS46IhvnOLrvwbAHYHThZIWoW 4YaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266797; x=1732871597; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bn7n+Ij/Vq2ciN8r7fMFmAZOh0BG4t/fByh+MoATRM4=; b=MsojBj0vqq0sbWQnrKayGMymTzPpsaHKXbAXdNsDu8CKXxHJatYQYJdOVpESre111+ T58xreUCyF9hIvKAdfGGoMDNQvFbfC9IdUc5oS29pBI5YgiZ0g3PjAZ0WVaOyK+hyOX3 D9lPufGQ+XcyNa5J/UAulaUUDi0uvWwLpBlxElrd5W/iop23AnVrFyXiUa2Hvf0rrVy5 zEAc4ZB7KOHSPYNtBJDBY9058hxZ6ATqJE/ru47+X0iDAf3RvGyyDHTKU1x4OdjAl263 nprOy29NK++gnmFzXY75bMDkf89ckzhpOOkdwvZ+OjoGwM/zeLVOCNRqHIRyPFEwIqmv rSLA== X-Gm-Message-State: AOJu0YxMYhZm12jWqoZDIIWYrkBzymdaPYzTT52FKm9mr/hK0ooG4vgh sMIpFLAoCcPFisEbiZKXq2LHzIz3He2QKJTtG8y1xP6jRg9dDkWhvzFZXxrKbEg= X-Gm-Gg: ASbGncs3YK4vlHK2NeOMcF8+h+z0ViFUwcFRDgtBHRZHgNmWGhv6h5jjOYnrRReYqXd Cl8RpHAhK4DPdXIxuT58OHeKyIlQYsUE5Z061Q6YFved2Aaj/QSNrLlV7ZPTYkVThyf4SXBYHMm lWln6pPJCKMWjAnl9ZRenfGrbVJ2qdOX0QOHoC7Gu4urQxhyqlC2QNG3iC4y2UKqJAOTVrmrl3L m8MeIx9vLa/Og8vsuvMET7lwYrXzFDn8zhnQy8lUOLhDMtf/k+4k8kAuw== X-Google-Smtp-Source: AGHT+IFq3zbQ0De3BTK0sXYYbItGqTSGZgyN0ksGm0iVTU9b2Y4WWbgSyJUSMBI6BlqGlAARhL7baw== X-Received: by 2002:a05:6512:3c83:b0:539:f7ab:e161 with SMTP id 2adb3069b0e04-53dd39a4c72mr747793e87.45.1732266796855; Fri, 22 Nov 2024 01:13:16 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:15 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:59 +0200 Subject: [PATCH v4 03/10] drm/tests: hdmi: return meaningful value from set_connector_edid() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-3-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6697; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ua4QBZ4riM6Opp9fYNSoyg41GZXfyIYINU+ndYQUB6k=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshxoQTVi+os/StFFK828rJmRTkBm3HXf3HO zvtKRVX30SJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1dt8CACsBNzvug3dVlllsHPsfMwgWOnSIMgZwk0MWkGA0gAUUoTWpzd8byhb5O2YUsxEjhr8Pkc rf4sGlX9xHatXY1VjWmQallOgJ47yMezHGxAXqU2PIBMvbWSRERsZLvhhV88v00dmoXIvnRK1Ft aJl73es6aUazP/Y54Ew7mQ67iwgmpbwBjLtXuP3QjxU34fWTp0ca1GTepxqcEtGyG/w24eNDcqW K3Wm9uQY70CNwQUwLIPOI50MQCd0FBUrZ2vx6S0JW3yvojemLbXB4Hz4Yhk+OscNHFE0URzxFq3 UmTvOfjhJp4j5t73KK4l+jKMfEuWyAuHtsPfjDgiEftV8Snk X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The set_connector_edid() function returns a bogus 0, performing the check on the connector->funcs->fill_modes() result internally. Make the function pass the fill_modes()'s return value to the caller and move corresponding checks to the caller site. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c index d81254d46975e8af0d782249928217a1ebb7646e..c963d7015d179ac36e646d4c19d986ac5997dd2c 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -105,9 +105,8 @@ static int set_connector_edid(struct kunit *test, struct drm_connector *connecto mutex_lock(&drm->mode_config.mutex); ret = connector->funcs->fill_modes(connector, 4096, 4096); mutex_unlock(&drm->mode_config.mutex); - KUNIT_ASSERT_GT(test, ret, 0); - return 0; + return ret; } static const struct drm_connector_hdmi_funcs dummy_connector_hdmi_funcs = { @@ -223,7 +222,7 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test, ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); return priv; } @@ -728,7 +727,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); ctx = drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -802,7 +801,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); ctx = drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -873,7 +872,7 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) ret = set_connector_edid(test, conn, test_edid_dvi_1080p, ARRAY_SIZE(test_edid_dvi_1080p)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_FALSE(test, info->is_hdmi); @@ -920,7 +919,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); ctx = drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -967,7 +966,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); ctx = drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -1014,7 +1013,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); ctx = drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -1121,7 +1120,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1190,7 +1189,7 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1254,7 +1253,7 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1314,7 +1313,7 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1381,7 +1380,7 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1447,7 +1446,7 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test ret = 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_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1507,7 +1506,7 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes ret = set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_340mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_340mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); info = &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); From patchwork Fri Nov 22 09:13:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54DF8E65D36 for ; Fri, 22 Nov 2024 09:13:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C97EB10EB04; Fri, 22 Nov 2024 09:13:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="u3RX+7MD"; dkim-atps=neutral Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 779BC10EB04 for ; Fri, 22 Nov 2024 09:13:21 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-539f8490856so2000024e87.2 for ; Fri, 22 Nov 2024 01:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266799; x=1732871599; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ba/EAyhOmKbKPph2Ceo3mw6J0gYPpHFQfAWqlPPaiow=; b=u3RX+7MDDQK47l1+CIrtbEW0OFDAn+jqwXM2KbrFneLNIWikjo9Yq0zAs7bbvxkR8e gdVnDYlug68KXfID4l2AwmZ9WSMQ7MzRsoaUyojq7IZqWrtTnZDi5eNqBy61kdsOpqJB VTdQw1sl9wC9tPaeemlaOHILA3n8rdaXj9C9qLA8+Eua6FepKc/IyOQZ/LJTe2CSZeD3 /Bj7rsoVxfO9aHAdshJq+9kSJVyvy9oOTZvojzr9j8VPn1TAqejPfct2EpCA1cK6N24s Op4M7Gvsoc/+Cy7wTr+Rgt+jNRm8XVyQ+Lw+yV5TOiAqpOpEneuG2zioxr/K+Q+HF7zd R4Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266799; x=1732871599; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ba/EAyhOmKbKPph2Ceo3mw6J0gYPpHFQfAWqlPPaiow=; b=eSyVSN35zUhqU8uSEwD5dpcd8aNKwjJox1wYi+YS6yZCbUr/FtLEi2xCwAAHpAWxS/ BfvoWp1gRk6AY3A2tM0SPUwfvClOkghGTPyLxw123lrXxN+4tNQ3cs+H8U8td970b5Ao TbCEWQpCaqJnoH49eEG8zxiBx2WywEq81NUjxQv1WP+oU0jxdIQWEKL7oEHb6RIKRqCs dDnaTNE7a+KzhsYvtC3JgL2IcU7ttcliZASy3f53NpQdH3bWPssi9IhEulN4v9zDRh0K gXPRN1i+dtOf1nDW7AxHkQQIZHnKIDppojQKogsu4ldaDDtSvbKrRatKhKHc8vE6LOy5 IuQw== X-Gm-Message-State: AOJu0YypMpmGqE+ostHDOixoXdnVMh7GzSdiuQa8toDz24LTHGmuy013 SuBnJXHAuYsQdlP8NfrqO3v56hUu0oY/voU1X2BmqObKU0YwdINvAG5zX2cBDIA= X-Gm-Gg: ASbGncttmO+UW+EWVzeB74YJvWOaiHq4bfXw1s+Ee5IKftnEJIRGnrlfc130VDP62RQ KfSjuxMh0DZXma3AbP3dR9qUXCCk2CctJtLqpnN1NpTdfhIo0uvcvDF7cK5HDgSX2xm7vDu0HSX BfqNu2NjMQI042ahjT/BR4eGWEFz5qH11VNJoiH8AVHeYJ8BToHCLpBmy1ZX+FvQjfaS0dFb/o/ XYrYko7ACaybCL8ML5wmLSzQ0CMGZTVXnUEWfWECPDAAAxVfYgq3UkMfA== X-Google-Smtp-Source: AGHT+IEloGpSCZkAY9fYECNN7AmL5l8/ucTWWKZPqz8Es6PLt1G3lHbgplNDNueyAZtBmXwvXqVR9w== X-Received: by 2002:a05:6512:32c9:b0:536:53a9:96d5 with SMTP id 2adb3069b0e04-53dd35a89eemr1007347e87.17.1732266799401; Fri, 22 Nov 2024 01:13:19 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:18 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:00 +0200 Subject: [PATCH v4 04/10] drm/display: hdmi: add generic mode_valid helper MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-4-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=15863; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=wY/uC1PCjWkJKUNfZE4ZBtsvQAOLFrgM9xerITmFDM8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshbK5SH3bnK4fDYr0vrCrXPOL+uk2iCX+wu YtHiZpU68iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1Qa1CACaX/ne04qVJaJeop0Bkt5TjH7NRAEMDr66EmnXfWTIyQdyImdkXXd2xHDSY3PDCSU/y+4 FQrDKHTqO2bO9Rk5utuT7bcTb8x4Wd0LINyfOjhWGRCfn/VmMfvjJad9X14MnUtU9pqDas+ETpI Ymk/JF5msBfoGEEOZRNdBs99Q4/ue5RgzfRnNCVbRWKCUgU3MXd9j04thRGSpJRTxBtgLjo4Uiy /kC46wir2UB5Ui6P9Te/JautpvSreWPTLU1RW5De//miBp+kHs5XBjuVda2YjdiMYBBql+f0aLn 7IEMc65Hk5QQIODo3nDEwMzWlGhuy0C+fyf/lpIBj6pU4Ef4 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add drm_hdmi_connector_mode_valid(), generic helper for HDMI connectors. It can be either used directly or as a part of the .mode_valid callback. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 21 +++ drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 180 ++++++++++++++++++++- drivers/gpu/drm/tests/drm_kunit_edid.h | 102 ++++++++++++ include/drm/display/drm_hdmi_state_helper.h | 4 + 4 files changed, 302 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..80bf2829ba89b5f84fed4fa9eb1d6302e10a4f9e 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -521,6 +521,27 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, } EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); +/** + * drm_hdmi_connector_mode_valid() - Check if mode is valid for HDMI connector + * @connector: DRM connector to validate the mode + * @mode: Display mode to validate + * + * Generic .mode_valid implementation for HDMI connectors. + */ +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + unsigned long long clock; + + clock = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + if (!clock) + return MODE_ERROR; + + return hdmi_clock_valid(connector, mode, clock); +} +EXPORT_SYMBOL(drm_hdmi_connector_mode_valid); + static int clear_device_infoframe(struct drm_connector *connector, enum hdmi_infoframe_type type) { diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c index c963d7015d179ac36e646d4c19d986ac5997dd2c..519cfbf1a3d6e82effb2372aeb2772a292230b5d 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -124,6 +124,18 @@ static const struct drm_connector_hdmi_funcs reject_connector_hdmi_funcs = { .tmds_char_rate_valid = reject_connector_tmds_char_rate_valid, }; +static enum drm_mode_status +reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *connector, + const struct drm_display_mode *mode, + unsigned long long tmds_rate) +{ + return (tmds_rate > 100ULL * 1000 * 1000) ? MODE_BAD : MODE_OK; +} + +static const struct drm_connector_hdmi_funcs reject_100_MHz_connector_hdmi_funcs = { + .tmds_char_rate_valid = reject_100MHz_connector_tmds_char_rate_valid, +}; + static int dummy_connector_get_modes(struct drm_connector *connector) { struct drm_atomic_helper_connector_hdmi_priv *priv = @@ -146,6 +158,7 @@ static int dummy_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_helper_funcs dummy_connector_helper_funcs = { .atomic_check = drm_atomic_helper_connector_hdmi_check, .get_modes = dummy_connector_get_modes, + .mode_valid = drm_hdmi_connector_mode_valid, }; static void dummy_hdmi_connector_reset(struct drm_connector *connector) @@ -163,9 +176,10 @@ static const struct drm_connector_funcs dummy_connector_funcs = { static struct drm_atomic_helper_connector_hdmi_priv * -drm_kunit_helper_connector_hdmi_init(struct kunit *test, - unsigned int formats, - unsigned int max_bpc) +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) { struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_connector *conn; @@ -207,7 +221,7 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test, ret = drmm_connector_hdmi_init(drm, conn, "Vendor", "Product", &dummy_connector_funcs, - &dummy_connector_hdmi_funcs, + hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, NULL, formats, @@ -219,7 +233,24 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test, drm_mode_config_reset(drm); - ret = set_connector_edid(test, conn, + return priv; +} + +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 = drm_kunit_helper_connector_hdmi_init_funcs(test, + formats, max_bpc, + &dummy_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv); + + ret = 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); @@ -1733,9 +1764,148 @@ static struct kunit_suite drm_atomic_helper_connector_hdmi_reset_test_suite = { .test_cases = drm_atomic_helper_connector_hdmi_reset_tests, }; +/* + * Test that the default behaviour for drm_hdmi_connector_mode_valid() is not + * to reject any modes. Pass a correct EDID and verify that preferred mode + * matches the expectations (1080p). + */ +static void drm_test_check_mode_valid(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + + priv = drm_kunit_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + preferred = find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 1920); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 1080); + KUNIT_EXPECT_EQ(test, preferred->clock, 148500); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will reject modes depending on + * the .tmds_char_rate_valid() behaviour. + * Pass a correct EDID and verify that high-rate modes are filtered. + */ +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; + + priv = drm_kunit_helper_connector_hdmi_init_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_100_MHz_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + ret = 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 = find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will not mark any modes as + * valid if .tmds_char_rate_valid() rejects all of them. Pass a correct EDID + * and verify that there is no preferred mode and no modes were set for the + * connector. + */ +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; + int ret; + + priv = drm_kunit_helper_connector_hdmi_init_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + /* should reject all modes */ + ret = set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_200mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred = find_preferred_mode(conn); + KUNIT_ASSERT_NULL(test, preferred); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will reject modes that don't + * pass the info.max_tmds_clock filter. Pass crafted EDID and verify that + * high-rate modes are filtered. + */ +static void drm_test_check_mode_valid_reject_max_clock(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv = drm_kunit_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + ret = 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); + + preferred = find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +static struct kunit_case drm_atomic_helper_connector_hdmi_mode_valid_tests[] = { + KUNIT_CASE(drm_test_check_mode_valid), + KUNIT_CASE(drm_test_check_mode_valid_reject), + KUNIT_CASE(drm_test_check_mode_valid_reject_rate), + KUNIT_CASE(drm_test_check_mode_valid_reject_max_clock), + { } +}; + +static struct kunit_suite drm_atomic_helper_connector_hdmi_mode_valid_test_suite = { + .name = "drm_atomic_helper_connector_hdmi_mode_valid", + .test_cases = drm_atomic_helper_connector_hdmi_mode_valid_tests, +}; + kunit_test_suites( &drm_atomic_helper_connector_hdmi_check_test_suite, &drm_atomic_helper_connector_hdmi_reset_test_suite, + &drm_atomic_helper_connector_hdmi_mode_valid_test_suite, ); MODULE_AUTHOR("Maxime Ripard "); diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests/drm_kunit_edid.h index 107559900e977119d451b00a647f0bd6ab598f63..6358397a5d7ab0bcdea1c824fc9fd382560f4b0e 100644 --- a/drivers/gpu/drm/tests/drm_kunit_edid.h +++ b/drivers/gpu/drm/tests/drm_kunit_edid.h @@ -61,6 +61,108 @@ static const unsigned char test_edid_dvi_1080p[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xab }; +/* + * edid-decode (hex): + * + * 00 ff ff ff ff ff ff 00 31 d8 2a 00 00 00 00 00 + * 00 21 01 03 81 a0 5a 78 02 00 00 00 00 00 00 00 + * 00 00 00 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 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 32 + * 46 1e 46 0f 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 92 + * + * 02 03 1b 81 e3 05 00 20 41 10 e2 00 4a 6d 03 0c + * 00 12 34 00 14 20 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 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e4 + * + * ---------------- + * + * Block 0, Base EDID: + * EDID Structure Version & Revision: 1.3 + * Vendor & Product Identification: + * Manufacturer: LNX + * Model: 42 + * Made in: 2023 + * Basic Display Parameters & Features: + * Digital display + * DFP 1.x compatible TMDS + * Maximum image size: 160 cm x 90 cm + * Gamma: 2.20 + * Monochrome or grayscale display + * First detailed timing is the preferred timing + * Color Characteristics: + * Red : 0.0000, 0.0000 + * Green: 0.0000, 0.0000 + * Blue : 0.0000, 0.0000 + * White: 0.0000, 0.0000 + * Established Timings I & II: + * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz + * Standard Timings: none + * Detailed Timing Descriptors: + * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (1600 mm x 900 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): 50-70 Hz V, 30-70 kHz H, max dotclock 150 MHz + * Dummy Descriptor: + * Extension blocks: 1 + * Checksum: 0x92 + * + * ---------------- + * + * Block 1, CTA-861 Extension Block: + * Revision: 3 + * Underscans IT Video Formats by default + * Native detailed modes: 1 + * Colorimetry Data Block: + * sRGB + * Video Data Block: + * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz + * Video Capability Data Block: + * YCbCr quantization: No Data + * RGB quantization: Selectable (via AVI Q) + * PT scan behavior: No Data + * IT scan behavior: Always Underscanned + * CE scan behavior: Always Underscanned + * Vendor-Specific Data Block (HDMI), OUI 00-0C-03: + * Source physical address: 1.2.3.4 + * Maximum TMDS clock: 100 MHz + * Extended HDMI video details: + * Checksum: 0xe4 Unused space in Extension Block: 100 bytes + */ +static const unsigned char test_edid_hdmi_1080p_rgb_max_100mhz[] = { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x2a, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0x03, 0x81, 0xa0, 0x5a, 0x78, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 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, 0x32, + 0x46, 0x00, 0x00, 0xc4, 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, 0x41, 0x02, 0x03, 0x1b, 0x81, + 0xe3, 0x05, 0x00, 0x20, 0x41, 0x10, 0xe2, 0x00, 0x4a, 0x6d, 0x03, 0x0c, + 0x00, 0x12, 0x34, 0x00, 0x14, 0x20, 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, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe4 +}; + /* * edid-decode (hex): * diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..d6d65da6d8f9ee46de33114cce2d6fbe6098a862 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -20,4 +20,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector, struct drm_atomic_state *state); +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode); + #endif // DRM_HDMI_STATE_HELPER_H_ From patchwork Fri Nov 22 09:13:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D1CDE65D35 for ; Fri, 22 Nov 2024 09:13:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA0FC10E1E2; Fri, 22 Nov 2024 09:13:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="R+AXHNOE"; dkim-atps=neutral Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id E731F10EB22 for ; Fri, 22 Nov 2024 09:13:23 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-53da24e9673so1984795e87.2 for ; Fri, 22 Nov 2024 01:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266802; x=1732871602; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=R+AXHNOEBNKzhbm/SgGSO5gMP96ymZrMN/hhmyTB77tGj8lY+IyFNxlU5sAjIBbTVc dH/IR/m2NVAW4dzSw/qsKfmLRcXB8BTBqxoRbjdu7rc8dQuxQEspq4TSKUk0Dyg79nwt 0NXvTpoSjT6qDE7prafvzNuiM2Ad7i0rriMsO5GUgzZvR5d8uWhRD1fP5hh+GrIAe4bp lCEh1PsIPEhSPwMe6qA9p0N8Awj7/q5gL+ZwNFDjhvu/apqZgpruha7rXSWck0lBb5tK 9ZTXdX4QemSfTi6C7P/2/KAxTeW0cCfJ7h2UK8FAT96FeWo3H2/E2XePyfQHLGYfih06 x5LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266802; x=1732871602; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=SyeTI1aduauCA1WHphNIWD/e2S/vN1qVRP+IKZiMiocjeziXlF5DF0xzR5KXXjv5HP CDtGGwoOlUmLzl4z2uRbglgjEyp/f1KZQNH05x0IizUtm4Ab1aQib8HYMR+Ve2ktbRz9 LVYEkVg+AZ3koz7gSNc8XzUDsruIrMSa4FbvwqPHfWIwmZOdAaZResoa9+GTA+knhnFd HrzEp3wNnrNOEg8goQLHz14rgFR866iWzq4CaVmU2I/YxKac7ukFaw+WUbPMNqili1ja RHzPBBdY89+cBI7XeIFqMSjE7EDJnSJS79z7ma/doWjQDq2TcacbB+pTJ8MxaqoV5koM JD1g== X-Gm-Message-State: AOJu0Yw7L73+OcIsXmgQRJmVB1FEjPv/AyDeBLdr/w2686W2k7F4OHpl ZwDU6/AcPKg4/t03p2gbXZjSOEdl6R2xU4T/+vl0zmzERJ7UXZ6ANQrLMgRVM3E= X-Gm-Gg: ASbGnctHiWS/mCj/pznRFGoweteGeu+wH1LebwWOUSiBGhNeryfeLgLysmaWvcyer6R VA8A5DJQ4psNQZzMLbqBAwbIyerrmkNFrK8dwteb8hqnEXS8zy6T0pHo6zuwS9bpo2F2Dvvnhl4 XJdJeczMIeAlrzJytDFitbcmijghDlf2AX2yAmxjn1Lc+2Gd2672KobZ8I9Mt/MGxPbaF+7nrz9 d6X7hxb0wMHCTMoCdSZc9c+PkCy7/8V360USk2ntUMKH0icF8jD4nGsMw== X-Google-Smtp-Source: AGHT+IGGtUj/UQVAqhj71L/+WsqH4TByvBEbJYS9Kr4E80g55FT15j0av7rsnKtHopezihZc5TlJsg== X-Received: by 2002:a05:6512:114f:b0:53d:d5be:4bda with SMTP id 2adb3069b0e04-53dd5be4be0mr678315e87.17.1732266802045; Fri, 22 Nov 2024 01:13:22 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:20 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:01 +0200 Subject: [PATCH v4 05/10] drm/sun4i: use drm_hdmi_connector_mode_valid() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-5-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1574; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshvg15KlERBUKq4lR2p/TSqtj5mXXjddQL8 zndDKhDnu6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1UswB/oDlMjmP0dYXrp0SYxKvIUkgl6MY851PyW708IlMOZOJbH5lo0GCNkGsMmCV16kq0l1ais KIus1wfQ1xA0lwo8KtUJJeX6gPpLRN0nWs5AbJm2S53M1m+XwFjW11vOEZYe5BEyvuq6cTNrqOf SP5rwIdTIFJYNqC/T/oVX3emjSYFRHp0mS6piDuxv9io3UFM5M9xGCDSP9ZsYwVCe0uwtI7lOx4 VwYEaqqRz+m3DbfRHe6M2eQAtAMGgLCsyo+Rom/69e0SKJkKkWncfEMwKQez9slaQ8GeIXaA4E9 KsJ/lbh1VelTpjfb+9nV77MboAKh3hm26Msd2x+zXcDXq7U0 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index b3649449de3026784ae2f3466906403a0b6e3b47..54b72fe220afacc208b3fd48d5160031127ea14a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -205,16 +205,6 @@ static int sun4i_hdmi_connector_atomic_check(struct drm_connector *connector, return 0; } -static enum drm_mode_status -sun4i_hdmi_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - unsigned long long rate = drm_hdmi_compute_mode_clock(mode, 8, - HDMI_COLORSPACE_RGB); - - return sun4i_hdmi_connector_clock_valid(connector, mode, rate); -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); @@ -269,7 +259,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = { static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { .atomic_check = sun4i_hdmi_connector_atomic_check, - .mode_valid = sun4i_hdmi_connector_mode_valid, + .mode_valid = drm_hdmi_connector_mode_valid, .get_modes = sun4i_hdmi_get_modes, }; From patchwork Fri Nov 22 09:13:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45E74E65D39 for ; Fri, 22 Nov 2024 09:13:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD96010EB08; Fri, 22 Nov 2024 09:13:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HG2H16ke"; dkim-atps=neutral Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6772D10EB05 for ; Fri, 22 Nov 2024 09:13:26 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-53da4fd084dso3071830e87.0 for ; Fri, 22 Nov 2024 01:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266804; x=1732871604; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+yuGfl/EBV1L9yZwllQ4z7rC0GCiUIVGF8V+6a/LgMU=; b=HG2H16kesLxyLEyEJkYkBYWAFMYXqksjXaChJyeyZbdnlxXnvCrwYcg/uegUxcEFnn 6ydASDK+1hyf5nVMkogF8gnmGODuRINojh0pq2qsCcgFPYLzHxVn0HP2TxUMQmWrkr3k tV+cxkNLTuMlNzd7vhNXbSyGHfHHhX7FDpQ28M5+XD0WUp/9GfN5Eo+F+2r9coyMjbBA FRu2a57wXxnrDysdhZsyDDaEcCKV2tJbOSXgqwWSqXYrqH9KJJPm+0L+UE4do41lZTAn JaU0voDQXbWnHmAM4nmfcwzKKGUgrlMtl5Qdh02loJugCDKsDJz1XmDoK2Yt8+TCSai+ LpTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266804; x=1732871604; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+yuGfl/EBV1L9yZwllQ4z7rC0GCiUIVGF8V+6a/LgMU=; b=BhSgrDiYMM65IUWrl6L0fQYPYV6xRkwGtWp0zO6+6sHPt7CzlNQFvgKobw3+tTDux1 QG0yjK8Ohl/v5xXVm3DUNLWf3YTUF1Lx13EQTsZ7p3ENK0d1Wpy24rgMDz/pg2qYXsne eN7k+Tv98XPNySDpGU6ENO+1lVywBv4Yr0TWkhjCG/bvq8wNaLUz/qn6M4+1itnRZCbI KjO4LDxPsZ6+l1uA+Ohe97EtJNB8GRXFzbctQRFrF6ByS89rWy4IGkPSOEFGMpB69+AB 2Myx6lx9LiVss/ujqKTbsjzajM8UdwV6P2Xy7OnVHmyYnHcAU3vo10gVYw7jQbR1ZIzD kGWg== X-Gm-Message-State: AOJu0Ywk/pt5bmsNnZ6T5CC0aIXREKSuEYrHasEXD6nf6mJHwQSthP3d GtO5UY+f07EuPyaYQti7xp9qask+BPd8fMLmi0p4x+oDkAYUgRc4lAs/47V0J6s= X-Gm-Gg: ASbGncvC7xoqjhzEa+uIFREeAOv5iLyAM9r5buhCaqi8RmfFAdAe5lgvIIe3nsT5j3h TNSnjDSM6vSBWzgf226xBwuKX3VY6iHCVgyheRw8xfHuFNjgKYzTgsW2IBxvXNHnFIWJo+Vq504 QN2U/9qEiBCNZPUNIRDzA6pC6d7uEZVX/jv83kMGS0RZQL1tPrms6GO1dYBipQQuj/sbOsxSV36 nVfo8szoYN1JkfSXzoJfqTXjXuxK6556Vy7l4F9xDi/EPXm4OyfvcPLpA== X-Google-Smtp-Source: AGHT+IFLvHEAOMFsbgXw0Dwjm3ehikp3aJtpuOLNAA/Ny7NGqmxqJedFV/QSTgM4ejrUuhK9ANir2A== X-Received: by 2002:a05:6512:3c8a:b0:539:fd75:2b6c with SMTP id 2adb3069b0e04-53dc618307bmr1957531e87.21.1732266804495; Fri, 22 Nov 2024 01:13:24 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:23 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:02 +0200 Subject: [PATCH v4 06/10] drm/vc4: use drm_hdmi_connector_mode_valid() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-6-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1740; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=V4oVcdTHVT3mKFPFYYqaTi+sHqWjzKg7CIWwA7qtBbc=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7qDt5JRalysFtfhpV3XJx9r4HUI7Mk6MKsr+cPD+3Hfb Jbz8vN1MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAiGk84GPqERKMOmjLumLjD MnKKz41Pm3N+pJ9/n8z0rvuN6cMZVyc75WV+fMW/4fbSA2vvrrVpMe45G3ww+9aP3vVvnz98rSu 4O/isbPYRnyflj5ydRXks1ul3emxm9fvxfFpOelVarJm2RHEYa/6RS44puVXrtA+wmssZ5c0uzJ ygVmJ9LPPTud7Y0PcL77Sd/xHW+ob7VvMR38uiHV0XZA79iVnTJeCicc++kzU/JSzJ6oPkpn6nn mvqh9ltP5Y1VQhNcD2W0HDzreEji7nuNWpRnX37Lrr1bVsfapB0u+3tivnhToYGkh6Ov7Pn7ivy U2d2yzm0/xyn4Lp0CR2pL0vk/PYt+hT85/Dzhto1cnINAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Acked-by: Dave Stevenson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 62b82b1eeb3694d1685969c49b2760cbbddc840e..2fecaac0df0acd865186ee928cf26449799fc7ba 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -580,6 +580,7 @@ static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = .detect_ctx = vc4_hdmi_connector_detect_ctx, .get_modes = vc4_hdmi_connector_get_modes, .atomic_check = vc4_hdmi_connector_atomic_check, + .mode_valid = drm_hdmi_connector_mode_valid, }; static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs; @@ -1752,7 +1753,6 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, const struct drm_display_mode *mode) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); - unsigned long long rate; if (vc4_hdmi->variant->unsupported_odd_h_timings && !(mode->flags & DRM_MODE_FLAG_DBLCLK) && @@ -1760,8 +1760,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder, (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return vc4_hdmi_connector_clock_valid(&vc4_hdmi->connector, mode, rate); + return MODE_OK; } static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { From patchwork Fri Nov 22 09:13:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C5A1E65D17 for ; Fri, 22 Nov 2024 09:13:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3A9B10EB14; Fri, 22 Nov 2024 09:13:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YmNrzQWT"; dkim-atps=neutral Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE42510EB05 for ; Fri, 22 Nov 2024 09:13:28 +0000 (UTC) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-53da07b78dfso2093321e87.0 for ; Fri, 22 Nov 2024 01:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266807; x=1732871607; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=YmNrzQWTPfCqLhhNS+X44vHDkwLi9iZSBhIiF2Tw7zy7uidfhmAPHfe9tykZRuLkpo 5DRb1hF6u51jpYG4okSs/ehVNMljDr/ZQzKEtIqUTYQAj10e8bPHYEeUy927I4G2FvYb bPQnLBXKxBwlfXSk/68cziKuTwwNOjc5mJ0KTLgE9cg7dNUcKAKmJwSRsnrHMevv98jd GgQN/0yreJoQLKQoE6qIvSTeFvMkUTQoOg2C4cyh6q29kg4G/PR5NZa2cLFT9Z5RG+6l 8BA3FyyP3oHXXes/fkPDlBEuD9G8WOkcaFhr2dA73tYBdqRT5hm9XVAjMYpH96Ubiynm quTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266807; x=1732871607; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=kXpW4TujmGE8BwMOpyp7sHxBS9tM653G8z+ODXStcS5B+q8cA86mLXkePdMwsYwaFU CfLOmZhw/PZqQk8ue+Ih1UPstSgxbGoB4fwTsqvZmTiDyLRaLEbXIlFblMAU5J8WwpRb u2es1cfWrxqYXtwoDZbLBPgJ390Vd+vS1VlZi7cnsX0u8P4TGYOB2258ySuzHXncL1ST j2hOxXD+ICvXbxIppqXFgiZ1YKwfSBY5d7OhVq1rw4Sobl6JQH82tuojjn/2bccCUwiY w9796yp5gyIG8tmEyGiXgkKnoa8bp8gPYTxX+aX53FB8+9Tz+VDFuYTgJGlBphAyJvxu KKiA== X-Gm-Message-State: AOJu0Yz3PCmdFqrdxXfjnjoYKCi9E6vUN4TXD+99+4iz09vb5A0Rkp4n /cqAB71MCLCdzHp9ZLQwjXJa+zYv6RdrIa0rvu2eInemGvdl29QpbONUIzwjQ9U= X-Gm-Gg: ASbGnctDRnT5U3TOA5krihNtrG99FeWeCvPsUMo4pag5VRMXzcLvwDR9G4SSigbpIkR 86j3SZpXTdtjeroOnFdytiadE02xNR6SiHWjdw3uy4HnKb6rMBnbjB/+zR+BQ8nQpbGPQnH06Mk ZRABCvEBIsg4oE0WVsgjkWceWTN7rAfBLRmRJymsdQZhtnQwpD3agdcQ1D5Mg58EAV72vIJa0s7 Gc3tPcy/WzqNnD7QZuKnfsJpUEerMhMItw/3OVLaov2yEQ3yWilTvIxkA== X-Google-Smtp-Source: AGHT+IGP0twniqH2U7ywDpdM5USOAfTTfwclZMuf64h3sSsbdQOKH5VgJsG4NoD2/EPGUBvock6QuA== X-Received: by 2002:a05:6512:3c96:b0:53d:a27a:2106 with SMTP id 2adb3069b0e04-53dd3ab0eebmr902104e87.55.1732266806968; Fri, 22 Nov 2024 01:13:26 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:25 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:03 +0200 Subject: [PATCH v4 07/10] drm/display: bridge_connector: use drm_bridge_connector_mode_valid() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-7-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1872; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=V6uHu+T4+xW+xwMuVx/apScXj6PwN9KdCvTiBY/zzqA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsipUZxr2L4H1CSYJPqrSWitJVJYT8cvGGNx VzJVBpVLQiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1Wg8CACUh+Qp1wI3QCkqrRc4xvtyhadjSchb8neePNvcL0EeS3MTH3BWZCvgSLpKslneK9k6yVL 9DTKhgzCmZL0UPCkBx9as8mvdKQBUN1m/r3gplfEUsQe2bFoVBzI24JWS3ZAVJbe0RlQe5A+N4X EOOFCw+LkSv89UJBKWSvUvCm4ez0JYCuuQEDWX2MivOuHLjIzOHKXnubiYcFK9u3+KsRADnp1mi RBNUHr/fnJw+uvGlqRKuh3Z3pa9ig+V2gAlc7T2X4/0rhodFgbNr3XmxnOOKnL3E4DJ7eP9ejOS 8KSZ5CU2TIorVoGQxGUAz2vtTDQ5bGJWekzxiEE6bqzE6v0O X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use new drm_bridge_connector_mode_valid() helper if there is a HDMI bridge in the bridge chain. This removes the need to perform TMDS char rate check manually in the bridge driver. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..512ced87ea18c74e182a558a686ddd83de891814 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -18,6 +18,7 @@ #include #include #include +#include #include /** @@ -299,9 +300,22 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector) return 0; } +static enum drm_mode_status +drm_bridge_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + + if (bridge_connector->bridge_hdmi) + return drm_hdmi_connector_mode_valid(connector, mode); + + return MODE_OK; +} + static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = { .get_modes = drm_bridge_connector_get_modes, - /* No need for .mode_valid(), the bridges are checked by the core. */ + .mode_valid = drm_bridge_connector_mode_valid, .enable_hpd = drm_bridge_connector_enable_hpd, .disable_hpd = drm_bridge_connector_disable_hpd, }; From patchwork Fri Nov 22 09:13:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB37FE65D35 for ; Fri, 22 Nov 2024 09:13:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D55110EB05; Fri, 22 Nov 2024 09:13:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Nk/FiZxR"; dkim-atps=neutral Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E05D10EB0B for ; Fri, 22 Nov 2024 09:13:31 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-53dd59a2bc1so365655e87.2 for ; Fri, 22 Nov 2024 01:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266809; x=1732871609; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+hHECBYEofE1LVFfISufmiOFENr43Xg+pptUAkUKUyA=; b=Nk/FiZxRZn6Julye2u2tZVWyaWUKcvHXWPO+abJiSCJDdYzu0zjANVWa5+yL7+zcpg dYCkeTSPEi1RM9GGgQXU4yo6VKLkoj1BtwMwFQOmciu1fTD2B4GBjDV6472yXdjIYmZ9 udeTFc/R8VLZo0s8s5O/2logDoMhBok6T8+PQx0x7Uqz9u9cWvuvtCRBjv3czD+nudCl YmITUeHvj6QYXZfb6agcKNBXurLlyCLlohk5CHmxui9dP6bOpIacOoGFVXXmmw+uIgSF qTpEZ5DdLWCPrcoHFchJwXFB420XDQRww9/yTqPC4ziFgwCNBcN7hOQ6pEgolcgJj8SC fGLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266809; x=1732871609; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+hHECBYEofE1LVFfISufmiOFENr43Xg+pptUAkUKUyA=; b=NhJ1af97Q605zvBviSBhgJfOXSQOoHD9ZH0bBvtORbaodW83KT/IdOfFzt25tOf9Rz 8BXP81qJ7YHpp4JozaTDqxt/Io1BvMed3A+DDdjFKevYAv+p1qGTyYeBug3e6pttjHKn jUnlwn2k/L6DZz4pRqlN76/kdBFEgUJ+DB/p6YEahuYQrXoCrbvVg1/vTWE6D+pNT/Ie povUaDMaaz8SGHtR9t0s7jszSiy7UUlZfc4FmmgoVi1Jv1TWgyIQSTzUkDlOg6hnDAqG O6ToWG8XkZPVXZ1SgbLXGErBm3k0Sml6gFtgpj1tgZviiU4m+CkCpSWqocKlNC1bEy/P UaKA== X-Gm-Message-State: AOJu0YzXWzKYxh5stZk5dSAx6VYd4rbT+vwxb8wHXbVJcOYbq5cPC56M khuXEA8M4x0pKgfwsTMwP4IYd3kKwHKznh/xy391ZdY9a23NXKij765taFRK0pY= X-Gm-Gg: ASbGncuQPhwTF3sN7zRPT8hnKjXBoK1+zTmcGv/AhJ7PwdjPaS/jPGl0eB8kb3dS9mt D9+59aAgLme2VdIm0ucTNJE3I+bQZKpUVR48G9/N0NRlN1Kz46BspJfdcmTr+Q3hOW5ZTbO0nuu ADgLt1DJkS1fIr3o16CaznliLRwgU+j2Zn4n6Zff00A6vGdA6iR9vuTuE8H8vTLKBctD/xvIDtZ h4lSPugp2Ow6PewCCWlAVMMNHOP+jRwmSculaxkAhzVySMbVyAgWo9aBw== X-Google-Smtp-Source: AGHT+IEacF2R7IM1WOXDiiyEZw72yOQOODx70vgQAIsHBOvrbaiI7+vacg+XzA2nbeGhQv/5FVkoNw== X-Received: by 2002:a05:6512:33d1:b0:53d:d661:ada with SMTP id 2adb3069b0e04-53dd6610bdcmr495351e87.8.1732266809396; Fri, 22 Nov 2024 01:13:29 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:28 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:04 +0200 Subject: [PATCH v4 08/10] drm/bridge: lontium-lt9611: drop TMDS char rate check in mode_valid MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-8-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1393; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=CHPPIcbOk/4oF+oFDkgVgA19LBW1SDNLoLgjIjG3wi4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsiedj1vWQXgZXcLJ02DcFxwDE5gszj18sAt X34dCGJZmKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1bSCB/9slyF05dGTP/R8bS3bpgFrC80+3aCli/HGX/hh9ZecB7M0/4Gtv1SuBYM+KdZhbrux6LE pczE2VQiA9zmyEtW0G5wbp1FeQvVBM8ruyAQIhmvjHQQTlnjC8Upiw/vuPynB4nUVZWHfhhYQmL zAEr0NKRnfHyVcsBRwxOdxyoVLnAqyl4aW9Ms616ITIiIb8MXaArqLlDxULPZrDRxxX17OEl0V6 PCmq7Qc1dmPgMoaJfFSHCVIrgBet7swGVQ7Bft4pgEsIeljuwq+YPquR/XJM8bitfAaIpRNn1BX frUWcluAbmUtixwbfjgPP6l9mfVYq5tjcrdl+FwRNElIvckp X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Drop manual check of the TMDS char rate in the mode_valid callback. This check is now being performed by the core. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 8f25b338a8d8f95dc0691735ac6343675098f7f7..1ffbe473e4103dfc315a8cd3571e9407bf518797 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -757,7 +757,6 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - unsigned long long rate; if (mode->hdisplay > 3840) return MODE_BAD_HVALUE; @@ -765,8 +764,7 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return bridge->funcs->hdmi_tmds_char_rate_valid(bridge, mode, rate); + return MODE_OK; } static int lt9611_bridge_atomic_check(struct drm_bridge *bridge, From patchwork Fri Nov 22 09:13:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8192EE65D35 for ; Fri, 22 Nov 2024 09:13:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1142410EB0B; Fri, 22 Nov 2024 09:13:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TLBLh4/a"; dkim-atps=neutral Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0BF610EB0B for ; Fri, 22 Nov 2024 09:13:33 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2ffab850d74so408881fa.0 for ; Fri, 22 Nov 2024 01:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266812; x=1732871612; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=TLBLh4/a9JE3tZNZLAyuXC8dqLyewqsL72BxRTu/TfqCPpzoCy8INbb6mrte6wzDb/ pdiUp+t8MehkNqEc8aN7GjCmtlHxrg2RSfm+DQD89kqnLR6U7MjSimTNdzQR9B6l0FhY rBK3j7sebsxu4cmB3gvdvE5Ng4s5QG7zcnTrJfFs+n1oojEuWcOLnlX2WXis7v8wCHEp 6QTNFPh+e/zTAKum46naLhc6d9s1zi1DoyJQEFosM0+SE7+XO+w8lRtaES0qDMu2uaH0 O3kopBUnBAONX3WaeI/nM7C6jvTFEelGlOJNGqLsfAQS13d71kcN4HT8e9iCfaEqG8Xg dtyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266812; x=1732871612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=PnNdTqgIJvhtrGLIzVe6m/1KpXbmUiWeo84bvOGE0qE2ddNpkL0IMFA3Wr2iZbm4ms WDXTgGrX/rQeJFky91nkPgiH4YeELDJxd48Nyhm6x1U3raUB/pakBlNbQWwaGuYMEamm B4x8Vaf0jdxSAI8RKIC2JIyW9CG5p44wTYOeOoU75kwed6gwaY7Cqrt55MxeoL2JUvzP M3bzKsYafyjpXjSNFriUJFoEqOhY1U7fHMrkCOJKHiJaNHNG0YNIkmgGua45geOsa1PG ouma0iVVI+e/kpB1EkQLP2tfwkLlH3FjZ4UukIPMG1EBgPs4NdrfBeOsVofoAOdY2qpj XfMw== X-Gm-Message-State: AOJu0YxrvEpn2RNQm5j0i9x+OKFIZjCDR0wGhoDXT33tmTWfTk0/ra/j o/uBcG2v/eGb3EllQ8o3wJu3abTryXlX2MuYrMJ/FCd1Jl0zVmI/4OBN53fSsdU= X-Gm-Gg: ASbGncvjRY5dQabjDWGCDHPhcyjLJ+iUPEqbU8+hpzV7FL1F6P5IZr4hFFw0jCnfSv2 tfmRF36IRNP1J1BBuYrQXRqjlSdQQojZ8Rj5/dMRG05m2kYv7SEWjiiHELhbo+5vySqkgXDtS0I 6nCpA8l1mo9oJ39z29gC4hVre3V6p8TaB2nNFPvM7BTRRAUajSxuxyvbW/5ZVC/9/2Ed+xyM9qr Em9IWmikfPOdBNYz3KNA8WtYF++p9rm1dEtdPtxDQPa839dclApfkjoSQ== X-Google-Smtp-Source: AGHT+IGDeNFqG4MBKTEb+7vEM0EHIe+kSHIzZU4cqUcGBYdZXfjh6XYO9X/0YkMh3CxsrBHQKu0dXQ== X-Received: by 2002:a05:6512:ea2:b0:53d:c9ae:a978 with SMTP id 2adb3069b0e04-53dd29c2410mr650169e87.4.1732266811943; Fri, 22 Nov 2024 01:13:31 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:30 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:05 +0200 Subject: [PATCH v4 09/10] drm/bridge: dw-hdmi-qp: replace mode_valid with tmds_char_rate MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-9-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2092; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=UjNMLqX51SwfyB+kbUbjnJt95fAbmRoKvLYOPQ8ek9c=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsinpLwtf2P+iapQrUkEDkXySbQ1SEGNPG+E yMN1AXKzKeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1UAWB/wNkyuzaaWNjb3TQ3pzTEcHC7B/Rpy9L6BOjIvOeuTqTWll9d3zLo9QEE1PDxJLav2S509 /GcNdsoEza+Au8Yx2/cJRv0J8J0BcqhPP6v01atHSxQ/lQESAhnjtbezigKj5F6augKx4qn+hBU 05oVtI6caS1lItX/bI51kj0LEdFXBhJhBE6wQ8+jdC/YQiN6kTW7lFsat02wgdaeNGebhcNB3x5 S4eJMeHGa15XNxAzBSWFbFzktMTFpbMpPra4zPxZpisIFGPMIpdwOSUiRLCP8Z24s4vpMhROld2 EsX+4FEudWGB4pshKsMVn0Zbj+v8pVuawOqXGg9LMIj+ZYLn X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace .mode_valid() callback with .hdmi_tmds_char_rate_valid(). It is more generic and is used in other mode validation paths. The rate validation for .mode_valid() will be performed by the drm_bridge_connector code. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c index 181c5164b23192f0b557624d73c6223032b90ec6..c686671e4850a1af75b82995185ffc3cbb22a447 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -442,16 +442,14 @@ dw_hdmi_qp_bridge_edid_read(struct drm_bridge *bridge, } static enum drm_mode_status -dw_hdmi_qp_bridge_mode_valid(struct drm_bridge *bridge, - const struct drm_display_info *info, - const struct drm_display_mode *mode) +dw_hdmi_qp_bridge_tmds_char_rate_valid(const struct drm_bridge *bridge, + const struct drm_display_mode *mode, + unsigned long long rate) { struct dw_hdmi_qp *hdmi = bridge->driver_private; - unsigned long long rate; - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); if (rate > HDMI14_MAX_TMDSCLK) { - dev_dbg(hdmi->dev, "Unsupported mode clock: %d\n", mode->clock); + dev_dbg(hdmi->dev, "Unsupported TMDS char rate: %lld\n", rate); return MODE_CLOCK_HIGH; } @@ -510,7 +508,7 @@ static const struct drm_bridge_funcs dw_hdmi_qp_bridge_funcs = { .atomic_disable = dw_hdmi_qp_bridge_atomic_disable, .detect = dw_hdmi_qp_bridge_detect, .edid_read = dw_hdmi_qp_bridge_edid_read, - .mode_valid = dw_hdmi_qp_bridge_mode_valid, + .hdmi_tmds_char_rate_valid = dw_hdmi_qp_bridge_tmds_char_rate_valid, .hdmi_clear_infoframe = dw_hdmi_qp_bridge_clear_infoframe, .hdmi_write_infoframe = dw_hdmi_qp_bridge_write_infoframe, }; From patchwork Fri Nov 22 09:13:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13882922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5BCFE65D35 for ; Fri, 22 Nov 2024 09:13:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3615910EB15; Fri, 22 Nov 2024 09:13:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TtP7f3LC"; dkim-atps=neutral Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D02710EB17 for ; Fri, 22 Nov 2024 09:13:36 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-53dd59a2bc1so365773e87.2 for ; Fri, 22 Nov 2024 01:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266814; x=1732871614; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=TtP7f3LCB5IToXeFSn8LrhdXwCWKlfAetZpNxxTHB4HztvoiRXjcPij05zHS1SenSP mX2UhXnpEnZNRTClfr63wQy+xztWu7E95gkT19oEsI03B62/Oi+Rg08ZjuONg7iQknrN cNcoQ93eYtyhv2z27YPwhpO0kJ7M5Q4smiSJHwnojHg0E1wF4x2rVg4tXyxhRCp8VYRW fM6q/3ftnzb1dMxzVyBhU3JhqPl8t7WSy3dF8i7N9Ma0I40pBVTRhWdITt1GuzaMyQNb i7At8TvZi94GuIyH1RmEd91ypQgjPZOki63vSSFz+jAelw06jyv52pdJlF25zNd1v6jM sT1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266814; x=1732871614; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=vqe7/NtgLKCcgXj5uzuY+7F2HJPQOfeHOfQhXiPdUYQ14uOvSxIPpwpjKP4lwUdSqr ynTgrhrlbyWUEZLmKjFCWX91rJzEpDoJMZEkBuHm6vZTWabfWrOWOXv5U5IcRZuv8eu9 BeVG6rynLoOQT44H3qgH3eVtanBdRRB/nVSKOaCHDfq9FYf4vUbmyFpF4XOdNH9t0pYT RkqoVO3codSHHsQNCZWzYD4TdfM16DLjLVceIF9psGjCHv3Ru+hp1eB8XQYvrDnbSOH+ zBFNYSR2YOThX3sBCGfm2Mp0KbVzz5vRUHHSnS//mdEri7mzUhcYBZ4odgqTziMcGs8r tzhg== X-Gm-Message-State: AOJu0YxMITdaeBVJplONDeEy+fjm9vp8YV+ehqPv2IA6Ojv5ln1pfuN7 nJkgI77zjix3eSYStPva6VQpGdayHOPj9sFADrPhBhp54fplwJBjSXAyexyjoXQ= X-Gm-Gg: ASbGncvP43cks+fCmEVYAWBdFuA0KY+NPViu8fGNc9e2I4usWVJjmp9ONz4j3TvLpLr a6pnuJixL99FMtQCHpJtTv4dXZqNoubGwb8wy5j2bnC3mJiPg9U798kX6zRpZBb7kwdjG0I2nPD P7NwCPhzQ18z/Rnr3cvnQKIcbypJMZdE7mu0ArmgKBajY/1zhrvlqKmZKnfNj3EbmzbxSGt13H5 zyc9r92y/hIAjacqU013OMgbPfwqTA/ZV5bvDPXwRc+WO5Ht5lDayBelQ== X-Google-Smtp-Source: AGHT+IFuPDVVeiIBHBx+sqGVLigoH/J3FctzJhynNILKoVJRUYGgovyLxnstEYxyEorm8Lhl1P2kvQ== X-Received: by 2002:a05:6512:230b:b0:539:f6c4:c29d with SMTP id 2adb3069b0e04-53dd39b4d2bmr879301e87.54.1732266814401; Fri, 22 Nov 2024 01:13:34 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:33 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:06 +0200 Subject: [PATCH v4 10/10] drm/sun4i: use drm_atomic_helper_connector_hdmi_check() MIME-Version: 1.0 Message-Id: <20241122-hdmi-mode-valid-v4-10-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2011; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=NRpLumrdDZhSXCJcusWkwzHsBkwvkTsOwVSCIyGYQBU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsiTDOV2BoHyoyOts+0adMkGX+r4MYsJsnPa Far8OQb/72JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1UrVB/4mHUMcziWq1wY32ABnFkVrTROOJMHkHk+6+aK4dszHbnC762R/MtVLV2lOqnA6MnxSNW0 EVuY2bQWv4PVDAZe+RPKyAm1fyLq9OizOUvRo1l12zL/O2139m41O4x3tI0r6uFqif8Pn4rZMCk t2ZMyaLmzPC6ufRtblUgk+VXVLehNTanDBHYRGga0siqsAnC662tRVl9Nf7/u1NOCILS6qYcKel P1sPNcHJSvULZIp9OJpXG/FZB4M7PHg/tR5MlTQzjrj0PWaj0798D+vDyF6eDysiUqnzifGcaGx giuaughGqZtani8SvGv0/wuVrNdnUepnAPAPfoATeqV2sc3E X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace sun4i_hdmi_connector_atomic_check(), which performs just TMDS char rate check, with drm_atomic_helper_connector_hdmi_check(), which performs additional checks basing on the HDMI Connector's state. Suggested-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 54b72fe220afacc208b3fd48d5160031127ea14a..b05fd77870b00aac97d003f3fb9c2b98cb73abc0 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -187,24 +187,6 @@ sun4i_hdmi_connector_clock_valid(const struct drm_connector *connector, return MODE_NOCLOCK; } -static int sun4i_hdmi_connector_atomic_check(struct drm_connector *connector, - struct drm_atomic_state *state) -{ - struct drm_connector_state *conn_state = - drm_atomic_get_new_connector_state(state, connector); - struct drm_crtc *crtc = conn_state->crtc; - struct drm_crtc_state *crtc_state = crtc->state; - struct drm_display_mode *mode = &crtc_state->adjusted_mode; - enum drm_mode_status status; - - status = sun4i_hdmi_connector_clock_valid(connector, mode, - conn_state->hdmi.tmds_char_rate); - if (status != MODE_OK) - return -EINVAL; - - return 0; -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); @@ -258,7 +240,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = { }; static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { - .atomic_check = sun4i_hdmi_connector_atomic_check, + .atomic_check = drm_atomic_helper_connector_hdmi_check, .mode_valid = drm_hdmi_connector_mode_valid, .get_modes = sun4i_hdmi_get_modes, };