Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B97E6606A32C for ; Fri, 4 Dec 2026 09:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Dwe63t8L Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BDF8112DD0; Fri, 4 Dec 2026 09:20:35 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 071B8112DCF; Fri, 4 Dec 2026 09:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796376029; x=1827912029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OR008/R0KVaFUK9h0HWToetwi2yna1IUQH9LuOeZqww=; b=Dwe63t8LtPbASzsmIp5hXxz+Ga//YZdNCzPyL03fdylLPaak9Ktv93kQ Bx3H0w5neoikBCr12xFOdy6LGPviHJJYtMggV10Gq1jYLH5uyvdYDAhio nGa/GjOS3SJSO3Lk/iawdLU2eJ561pnwLoMEB76eHnpqfXK9rQrnuVUHp Ax8RmMjoAcTnQIdIr3Q5PQRo1+A09dfBf3sqEStl34FmulmYgNhBAd+1z Yz91e4QcrD6pECaNkFKXPWMara49FaiieUojlSqkuUpdQoY/lcxAaW8oF SedaRVdum+SYD1lEbwhJ2S8LVbu9gS56yZjxAgF7FdiwvWx/c0RF5igR8 A==; X-CSE-ConnectionGUID: 7sCYMTVHSHGJhDywwx46Pw== X-CSE-MsgGUID: +P7uJy8mSNiC834qGROVXg== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="108982" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="108982" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa114.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 01:13:20 -0800 X-CSE-ConnectionGUID: haE5olrlSSmzxj2LsyY7yg== X-CSE-MsgGUID: Hug6SHFVQBidxyE4NpnSXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="13864024" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 01:13:18 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, alexander.kaplan@sms-medipool.de, suraj.kandpal@intel.com, Ankit Nautiyal Subject: [PATCH v5 03/15] drm/i915/hdmi: Clamp the target_bpp only when it equals the link bpp Date: Fri, 4 Dec 2026 14:27:34 +0530 Message-ID: <20261204085746.391918-4-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261204085746.391918-1-ankit.k.nautiyal@intel.com> References: <20261204085746.391918-1-ankit.k.nautiyal@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-gfx" X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The max bpp from intel_hdmi_dsc_get_min_max_bpp() is at most the uncompressed link bpp, so when picking the compressed bpp we reduce the target to keep it below the uncompressed link bpp. Doing this unconditionally makes the search skip both the max and min boundaries, returning 0 when max_dsc_bpp equals min_dsc_bpp. That case isn't hit as of now, but an upcoming FRL link-bandwidth clamp can make max_dsc_bpp == min_dsc_bpp. Reduce the target only when it equals the uncompressed link bpp, start at max_dsc_bpp otherwise, and iterate down to and including min_dsc_bpp. v2: Use link bpp, reuse intel_dp_output_format_link_bpp_x16(). (Suraj) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_hdmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 7c44fb03f6c9..b4b39f5edfae 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -3402,13 +3402,15 @@ intel_hdmi_dsc_bpp_fits_chunk_bytes(int bpp, int num_slices, int slice_width, } static int -get_dsc_compressed_bpp(int num_slices, int slice_width, int hdmi_max_chunk_bytes, +get_dsc_compressed_bpp(enum intel_output_format output_format, int bpc, + int num_slices, int slice_width, int hdmi_max_chunk_bytes, int src_fractional_bpp, int min_dsc_bpp, int max_dsc_bpp) { bool bpp_found = false; int bpp_decrement_x16; int bpp_target; int bpp_target_x16; + int link_bpp_x16 = intel_dp_output_format_link_bpp_x16(output_format, 3 * bpc); /* * The Sink has a limit of compressed data in bytes for a scanline, @@ -3433,9 +3435,13 @@ get_dsc_compressed_bpp(int num_slices, int slice_width, int hdmi_max_chunk_bytes if (!src_fractional_bpp) src_fractional_bpp = 1; bpp_decrement_x16 = DIV_ROUND_UP(16, src_fractional_bpp); - bpp_target_x16 = (bpp_target * 16) - bpp_decrement_x16; + bpp_target_x16 = bpp_target * 16; - while (bpp_target_x16 > (min_dsc_bpp * 16)) { + /* The compressed bpp can't be the same as the uncompressed link bpp */ + if (bpp_target_x16 == link_bpp_x16) + bpp_target_x16 -= bpp_decrement_x16; + + while (bpp_target_x16 >= (min_dsc_bpp * 16)) { int bpp; bpp = DIV_ROUND_UP(bpp_target_x16, 16); @@ -3477,7 +3483,8 @@ intel_hdmi_dsc_get_bpp(int src_fractional_bpp, int slice_width, int num_slices, intel_hdmi_dsc_get_min_max_bpp(output_format, bpc, hdmi_all_bpp, &min_dsc_bpp, &max_dsc_bpp); - dsc_bpp_x16 = get_dsc_compressed_bpp(num_slices, slice_width, + dsc_bpp_x16 = get_dsc_compressed_bpp(output_format, bpc, + num_slices, slice_width, hdmi_max_chunk_bytes, src_fractional_bpp, min_dsc_bpp, max_dsc_bpp); -- 2.50.1