From patchwork Tue Nov 7 04:17:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Nautiyal X-Patchwork-Id: 13447870 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 3E8C1C4167D for ; Tue, 7 Nov 2023 04:23:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C19A10E146; Tue, 7 Nov 2023 04:23:43 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id F03F210E122 for ; Tue, 7 Nov 2023 04:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699331020; x=1730867020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HlHRc7IYf3v8BrRXNqaX1C91t96i8UaxvEZrGwdspXM=; b=TXftLPtzdxRAYqDSpPxdD0EX7Rcj5B5zjIRvEb6xkVdQQfWSq6VBmdc5 ksS6d3PN99TV2kMpLnnGz3UKSt6V6pfNNGREWh4Bny2ECLN67ZmmJPAwX SO7AvsJnNKb+g1nkZTCunBILPvaus2mTYOlMYAoYFTCLLRWL5n7UoYRAG Nc9yfKeW63qcENVmPjkNFWbeBbhwdhZvogTqkgLi7SKmcZ9nODW/kMUl4 DlUIJJqI7MixV7/fi35erAPK2IuJY3ckDacS1SqYKCR913iMM/biZcp0d pyCVx0iFwk5TRG9R5xiPyiiB1FVEWxtvGs6ZdXdHkpXKbsNCAQFa3XnsJ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="475667574" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="475667574" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="712435775" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="712435775" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:38 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Nov 2023 09:47:37 +0530 Message-Id: <20231107041740.3718419-2-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> References: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/4] drm/i915/dp: Simplify checks for helper intel_dp_dsc_max_src_input_bpc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Return 0 if platform doesn't support DSC, and return 12 for Display ver 12+. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 1891c0cc187d..d9e1d15a386e 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1569,13 +1569,14 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, static u8 intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915) { + if (!HAS_DSC(i915)) + return 0; + /* Max DSC Input BPC for ICL is 10 and for TGL+ is 12 */ - if (DISPLAY_VER(i915) >= 12) - return 12; if (DISPLAY_VER(i915) == 11) return 10; - return 0; + return 12; } int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector, From patchwork Tue Nov 7 04:17:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Nautiyal X-Patchwork-Id: 13447871 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 5FDCCC4332F for ; Tue, 7 Nov 2023 04:23:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D5BF10E142; Tue, 7 Nov 2023 04:23:44 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3934310E142 for ; Tue, 7 Nov 2023 04:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699331023; x=1730867023; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+GhTTJx8t7YsWzE0rwosfM9b/cPtPyqLqUt3qYTlHF0=; b=PBzJWeLnuexlpeVZ7a+5DSemiQP3hm7hnVUnbngHaLowYfnu7vwEKLm9 PeqUq+yGxZ+rJP6dQqauX3mReTLtpAVLwwoMYOS/nO5vKLzGBTUf22c7o WF12NAZQ8T2rbmpJ56dlDRo/5vkj/N8kiE7wMeXfcTwZcT3HKBP+6t98R 00FemyZ2V1u0mcSt/19QJXQqib3G2A+TV8Gv5GbDPH7rjwmT2JHHuf0I+ FCcpxo+Rqpfnua40WR51bF/33SwMzqlNdYnHNGjNx5fJ//SfKhBxfm/gF uokU5TyywmE0Y0TFDvWSiOKzORHmN+6q7xHa4YfVonUxkO7TgVf9/vV9m g==; X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="475667575" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="475667575" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="712435790" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="712435790" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:40 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Nov 2023 09:47:38 +0530 Message-Id: <20231107041740.3718419-3-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> References: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/4] drm/i915/dp: Fix the max DSC bpc supported by source X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use correct helper for getting max DSC bpc supported by the source. Fixes: 1c56e9a39833 ("drm/i915/dp: Get optimal link config to have best compressed bpp") Cc: Ankit Nautiyal Cc: Stanislav Lisovskiy Cc: Jani Nikula Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d9e1d15a386e..5adab761f2e8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -2022,7 +2022,7 @@ static int intel_dp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp, } } - dsc_max_bpc = intel_dp_dsc_min_src_input_bpc(i915); + dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915); if (!dsc_max_bpc) return -EINVAL; From patchwork Tue Nov 7 04:17:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Nautiyal X-Patchwork-Id: 13447872 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 18545C4167B for ; Tue, 7 Nov 2023 04:23:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95DC310E4A4; Tue, 7 Nov 2023 04:23:46 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DEE310E4A4 for ; Tue, 7 Nov 2023 04:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699331025; x=1730867025; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ppjlOPE//91YCz7C3ZQbRi1JJ+4U1j72zYFJYE6XX4I=; b=khODHmFsdNw+SLsSQTuXnyso+G0kok/baKR3wiQsMMSv6ira8cK+q256 IL6qXIE3FD4Nc5IezQvcsajqiAWqDrf0aCrrCWHEZBPFFlVsK0ybpLJqV 6QOH11D/4D+VO/I7z/+Yy2TR6bNaD60tQLcTsoW5AWE8ISArSCJg2xrl1 52vVjBnl9XucEOAu0lPAFeU9jMzwGJIKiQ9vsZ8wkxn2kNaFxgUl/cCba wRci9XGDKDQv6s1Es916Z74Z3TRt3UqBAAdc3J9kcCmqe4+iHM17P1jHO QBK8Om0lERHGvNA/eY+JIrCFjk1slK3jRwZjJNgXeWr5KI/l0SCUnEwoG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="475667576" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="475667576" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="712435804" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="712435804" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:43 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Nov 2023 09:47:39 +0530 Message-Id: <20231107041740.3718419-4-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> References: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/4] drm/i915/dp_mst: Use helpers to get dsc min/max input bpc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use helpers for source min/max input bpc with DSC. Signed-off-by: Ankit Nautiyal Reviewed-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/intel_dp.c | 2 -- drivers/gpu/drm/i915/display/intel_dp.h | 2 ++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 5adab761f2e8..abc718f1a878 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1566,7 +1566,6 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, return -EINVAL; } -static u8 intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915) { if (!HAS_DSC(i915)) @@ -1946,7 +1945,6 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp, dsc_max_bpp, dsc_min_bpp, pipe_bpp, timeslots); } -static u8 intel_dp_dsc_min_src_input_bpc(struct drm_i915_private *i915) { /* Min DSC Input BPC for ICL+ is 8 */ diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h index 484aea215a25..53e88c00900c 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -164,5 +164,7 @@ intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp, struct link_config_limits *limits); void intel_dp_get_dsc_sink_cap(u8 dpcd_rev, struct intel_connector *connector); +u8 intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915); +u8 intel_dp_dsc_min_src_input_bpc(struct drm_i915_private *i915); #endif /* __INTEL_DP_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 7b4628f4f124..d32e5258e1ec 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -194,18 +194,15 @@ static int intel_dp_dsc_mst_compute_link_config(struct intel_encoder *encoder, int i, num_bpc; u8 dsc_bpc[3] = {}; int min_bpp, max_bpp, sink_min_bpp, sink_max_bpp; - u8 dsc_max_bpc; + u8 dsc_max_bpc, dsc_min_bpc; bool need_timeslot_recalc = false; u32 last_compressed_bpp; - /* Max DSC Input BPC for ICL is 10 and for TGL+ is 12 */ - if (DISPLAY_VER(i915) >= 12) - dsc_max_bpc = min_t(u8, 12, conn_state->max_requested_bpc); - else - dsc_max_bpc = min_t(u8, 10, conn_state->max_requested_bpc); + dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915); + dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915); max_bpp = min_t(u8, dsc_max_bpc * 3, limits->pipe.max_bpp); - min_bpp = limits->pipe.min_bpp; + min_bpp = max_t(u8, dsc_min_bpc * 3, limits->pipe.min_bpp); num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector->dp.dsc_dpcd, dsc_bpc); From patchwork Tue Nov 7 04:17:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Nautiyal X-Patchwork-Id: 13447873 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 C9A04C4332F for ; Tue, 7 Nov 2023 04:23:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D678B10E4A7; Tue, 7 Nov 2023 04:23:49 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD0B810E4A7 for ; Tue, 7 Nov 2023 04:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699331027; x=1730867027; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VW7PE8VzdCLsaJLoDNFngkDsz0UC+A16nE4+XsGNAuQ=; b=ZFS8ioBhDQ6MJhGrmlqqv/DWroHlpDwW7JLqZ/U1hWDF/dMP6TTgRPLv H6qJ1n/rY8T5Rc4zjJhuEiaQ6JWdYO2uRkDNwTarcc89PL4kem8naWwRx +UVHxDmj30sYByxjbKr/kDiDZsTwhpPhnCvLBUBnwjArYjKGito7nAHje Q6n8Twv/5jpzxM1dq0itYoiwf1qLmnRA3pnW99gNerXQEkGYUXxgVEG51 R312nv8Q8azd2PNvKvp6CixFc3UpltNqoJNQH0ik2TnCBs9A5mqJAeNCG 6xt9DzVfbiW0V499hfVz82AKcCeI2dSt+VfOb6RLtSnO3E5z4RmKo+9rE A==; X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="475667578" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="475667578" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10886"; a="712435819" X-IronPort-AV: E=Sophos;i="6.03,282,1694761200"; d="scan'208";a="712435819" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2023 20:23:45 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Nov 2023 09:47:40 +0530 Message-Id: <20231107041740.3718419-5-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> References: <20231107041740.3718419-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 4/4] drm/i915/dp: Ignore max_requested_bpc if its too low for DSC X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" At the moment, while choosing the input bpc for DSC, we take into account the max_requested_bpc property. This creates a problem, if the max_requested_bpc is lower than the minimum bpc required by source with DSC. So consider max_requested_bpc if its within the limits that we can support with DSC. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index abc718f1a878..ea4c42a5705e 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1578,6 +1578,16 @@ u8 intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915) return 12; } +static int +intel_dp_dsc_limit_max_bpc(int max_requested_bpc, int src_dsc_max_bpc, int src_dsc_min_bpc) +{ + /* Consider max_requested_bpc only if src can support it with DSC */ + if (max_requested_bpc >= src_dsc_min_bpc) + return min(src_dsc_max_bpc, max_requested_bpc); + + return src_dsc_max_bpc; +} + int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector, u8 max_req_bpc) { @@ -1591,7 +1601,8 @@ int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector, if (!dsc_max_bpc) return dsc_max_bpc; - dsc_max_bpc = min_t(u8, dsc_max_bpc, max_req_bpc); + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(max_req_bpc, dsc_max_bpc, + intel_dp_dsc_min_src_input_bpc(i915)); num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector->dp.dsc_dpcd, dsc_bpc); @@ -1959,8 +1970,11 @@ bool is_dsc_pipe_bpp_sufficient(struct drm_i915_private *i915, { u8 dsc_max_bpc, dsc_min_bpc, dsc_max_pipe_bpp, dsc_min_pipe_bpp; - dsc_max_bpc = min(intel_dp_dsc_max_src_input_bpc(i915), conn_state->max_requested_bpc); dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915); + dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915); + + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(conn_state->max_requested_bpc, + dsc_max_bpc, dsc_min_bpc); dsc_max_pipe_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp); dsc_min_pipe_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp); @@ -2020,14 +2034,14 @@ static int intel_dp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp, } } + dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915); dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(i915); if (!dsc_max_bpc) return -EINVAL; - dsc_max_bpc = min_t(u8, dsc_max_bpc, max_req_bpc); + dsc_max_bpc = intel_dp_dsc_limit_max_bpc(max_req_bpc, dsc_max_bpc, dsc_min_bpc); dsc_max_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp); - dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915); dsc_min_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp); /*