From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BA6E37204A; Sat, 12 Sep 2026 07:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789197063; cv=none; b=IMjM/6oxxg7FCXSdR4Dkf+7eCFXi0aRH3Z8IhvxcBwYK3hSdO1pPIMTY6+3PJJr66XPZJA85BWs/akgXy0qGFYe9rlmuXXxpylDZQidHQXToNgt+E1FV5EeJJ4YMEHRzOkuA4lMJjxDMxML90OzyVvl0dtmxxi5txmwGYl7YH6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789197063; c=relaxed/simple; bh=tSOG7Ep18TLs8xi16bdCcDPg6vOYzYLRSiQQznHnn24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j1KCdKAgkyHbsgDX0bqis/q+BrTiWeJYwYCmjlgV/U5lNxFPqfnZHrSFUoZSN7euCXfuDzMd+SiFrLm+ka+gPLgTc8mNjLxqDfQYK4HukDRuGcCS5eIw5M3LE7yarVY8KUTj7/jUhRqw4YVu1GVt95Qkr5xDx/HudqGXpj+Eqvo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dg42rC/x; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dg42rC/x" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FD451F000FF; Sat, 12 Sep 2026 07:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789197062; bh=TvNWCCJ+7aKwws44acJ9XLl/6P3S1Abt0gzau5XE02M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dg42rC/xqQJ8aY0nHwZadbDZUz4hLdK33KAVaaSI+MZ/BZOlb8pOUVHXMKQquI1at ghz846rGgUgD1zEwUBTPKxqXkRBYXOuAPoYzu/5lrKIpNT8v1wWiaufG0GBIApdrfY h9hAJw84DKbJSUDvL2uRHsJHjESgfJJlQpZJ5tfM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maxime Ripard , Dmitry Baryshkov , Daniel Stone , Nicolas Frattaroli , Daniel Stone , Sasha Levin Subject: [PATCH 7.2 0050/1815] drm/display: hdmi-state-helper: Try subsampling in mode_valid Date: Sat, 12 Sep 2026 08:30:00 +0200 Message-ID: <20260912065650.193621063@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolas Frattaroli [ Upstream commit f532dc0ea55a25dd24a79442fd0348da09b04b72 ] drm_hdmi_connector_mode_valid assumes modes are only valid if they work with RGB. The reality is more complex however: YCbCr 4:2:0 chroma-subsampled modes only require half the pixel clock that the same mode would require in RGB. This leads to drm_hdmi_connector_mode_valid rejecting perfectly valid 420-only or 420-also modes. Fix this by checking whether the mode is 420-capable first. If so, then proceed by checking it with DRM_OUTPUT_COLOR_FORMAT_YCBCR420 so long as the connector has legalized 420, otherwise error out. If the mode is not 420-capable, check with RGB as was previously always the case. Fixes: 47368ab437fd ("drm/display: hdmi: add generic mode_valid helper") Reviewed-by: Maxime Ripard Reviewed-by: Dmitry Baryshkov Reviewed-by: Daniel Stone Signed-off-by: Nicolas Frattaroli Link: https://patch.msgid.link/20260609-color-format-v17-9-35739b5782cc@collabora.com Signed-off-by: Daniel Stone Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index cae0d85fb4407..a3aee41385548 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -910,8 +910,21 @@ drm_hdmi_connector_mode_valid(struct drm_connector *connector, const struct drm_display_mode *mode) { unsigned long long clock; + enum drm_output_color_format fmt; + + if (drm_mode_is_420_only(&connector->display_info, mode)) { + if (connector->ycbcr_420_allowed) + fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR420; + else + return MODE_NO_420; + } else if (drm_mode_is_420_also(&connector->display_info, mode) && + connector->ycbcr_420_allowed) { + fmt = DRM_OUTPUT_COLOR_FORMAT_YCBCR420; + } else { + fmt = DRM_OUTPUT_COLOR_FORMAT_RGB444; + } - clock = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); + clock = drm_hdmi_compute_mode_clock(mode, 8, fmt); if (!clock) return MODE_ERROR; -- 2.53.0