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 0F858C4332F for ; Wed, 13 Dec 2023 09:24:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C084210E757; Wed, 13 Dec 2023 09:24:34 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9C8CD10E751 for ; Wed, 13 Dec 2023 09:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702459472; x=1733995472; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Tjf+7+H1ti3QSq/1M6/m1i1FqmevB/RgJx+0/fu3kg=; b=RTr5oSZaj8QugY8q8fxOelPLrwlKJ+nB6/R9VChy3sksHZ1xcjIZHlkO iOEHYmJ3AcXsqX+xFi3d6ZtdaGdS7gu/F1P+7jXyklsGqsZEQRXO1EtaS 05xgjznyA1n3P6+0CPov5LJVszjHQ2KOs2L4c8DBUQpCPqIZdn3N/n/cV DiyETmAW3i3MPxeRAz4QyHPTQJ+0IT/IA0vqn1IPKu5ggxyJ+EtjKVr/E IBYRtLQmVJzWY2xv2+zOFD2dnPKKxtwPqZ7/UZcx5h8mM5cLX4JTdDiOy yoUP+ApuFU+/arYwNYiWvvvBzUsXL7YKhXxWx7gHfDJU4DeVDVaGowhk/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="13632995" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="13632995" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 01:24:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="17665277" 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; 13 Dec 2023 01:24:30 -0800 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 4/5] drm/i915/dp_mst: Use helpers to get dsc min/max input bpc Date: Wed, 13 Dec 2023 14:46:31 +0530 Message-Id: <20231213091632.431557-5-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231213091632.431557-1-ankit.k.nautiyal@intel.com> References: <20231213091632.431557-1-ankit.k.nautiyal@intel.com> 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-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. While at it, make them return int instead of u8. v2: Make the helpers return int instead of u8. (Jani) v3: Use min/max macros instead of min_t/max_t. (Jani) 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 | 13 +++++-------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 1f95ba9cf5fd..e8aa2f469142 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1626,7 +1626,6 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, return -EINVAL; } -static int intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915) { if (!HAS_DSC(i915)) @@ -2026,7 +2025,6 @@ static int dsc_compute_compressed_bpp(struct intel_dp *intel_dp, dsc_max_bpp, dsc_min_bpp, pipe_bpp, timeslots); } -static int 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 05db46b111f2..f613ced9eda6 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -184,5 +184,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); +int intel_dp_dsc_max_src_input_bpc(struct drm_i915_private *i915); +int 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 e8940acea8ad..a80e59597996 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -293,17 +293,14 @@ 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; + int dsc_max_bpc, dsc_min_bpc; int min_compressed_bpp, max_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; + max_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp); + min_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp); num_bpc = drm_dp_dsc_sink_supported_input_bpcs(connector->dp.dsc_dpcd, dsc_bpc); -- 2.40.1