From patchwork Thu Aug 29 13:18:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783203 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 0A10AC83F16 for ; Thu, 29 Aug 2024 13:16:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ECC710E113; Thu, 29 Aug 2024 13:16:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="U7Yrztcg"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD5BD10E67C; Thu, 29 Aug 2024 13:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937418; x=1756473418; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d7FUbqN02FptBmZjOWEZN+iv24GXxvGRKomC8B1Cl78=; b=U7YrztcgThUGpfISSRys6W9rl5UKYkoAEy8kx2uucXZzLshz6wplChgj XNSUTwcGFaJAQu+R5vqdvjG6uiIN22C8YT7oYprVfHOUj2fNj9OftbvV+ n/B/FjStEn7WesqsIop7Bv6IY6TsUPKLsIBJV7y+id8XoAXDaEYmTLGZw agWoPc3dOzSiE81qu4BLJAH781/xqXGm34O/EEme30qSAp7gbG8KybBem 3kpE4EEJSnYhEfkMzi2URxcXbWR24gM+KFkViTvq5x8Sozf7rU++PewiO SdRIrhiigcREm9v7Om59cPIjL/b6iBheq1riIXE7UOgp2NcVo+rsdpVKp w==; X-CSE-ConnectionGUID: kphEaLspRR+LUvBrUVDtSA== X-CSE-MsgGUID: fjLTq/QKQJim/r1UhsBC/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667218" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667218" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:16:58 -0700 X-CSE-ConnectionGUID: bipqev2uQwSC4NFpAeuKGg== X-CSE-MsgGUID: KUzA361JQlmYWfQZxdfElQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261414" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:16:55 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 01/19] drm/i915/display: Move all DSS control registers to a new file Date: Thu, 29 Aug 2024 18:48:09 +0530 Message-ID: <20240829131828.2350930-2-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move all registers and bits related to dss ctl to a new file. v2: Move modification to use REG_* macros to a new patch. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/icl_dsi.c | 2 +- drivers/gpu/drm/i915/display/intel_ddi.c | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/display/intel_dss_regs.h | 49 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_vdsc.c | 1 + .../gpu/drm/i915/display/intel_vdsc_regs.h | 38 -------------- 6 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dss_regs.h diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 293efc1f841d..5ad5011e1fee 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -44,9 +44,9 @@ #include "intel_de.h" #include "intel_dsi.h" #include "intel_dsi_vbt.h" +#include "intel_dss_regs.h" #include "intel_panel.h" #include "intel_vdsc.h" -#include "intel_vdsc_regs.h" #include "skl_scaler.h" #include "skl_universal_plane.h" diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 25ff3ff0ab95..4566a60c981c 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -57,6 +57,7 @@ #include "intel_dp_tunnel.h" #include "intel_dpio_phy.h" #include "intel_dsi.h" +#include "intel_dss_regs.h" #include "intel_encoder.h" #include "intel_fdi.h" #include "intel_fifo_underrun.h" @@ -74,7 +75,6 @@ #include "intel_snps_phy.h" #include "intel_tc.h" #include "intel_vdsc.h" -#include "intel_vdsc_regs.h" #include "skl_scaler.h" #include "skl_universal_plane.h" diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 1042f65967ba..8bce46bb7f3f 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -87,6 +87,7 @@ #include "intel_drrs.h" #include "intel_dsb.h" #include "intel_dsi.h" +#include "intel_dss_regs.h" #include "intel_dvo.h" #include "intel_fb.h" #include "intel_fbc.h" @@ -118,7 +119,6 @@ #include "intel_tv.h" #include "intel_vblank.h" #include "intel_vdsc.h" -#include "intel_vdsc_regs.h" #include "intel_vga.h" #include "intel_vrr.h" #include "intel_wm.h" diff --git a/drivers/gpu/drm/i915/display/intel_dss_regs.h b/drivers/gpu/drm/i915/display/intel_dss_regs.h new file mode 100644 index 000000000000..b1e24ea027c3 --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_dss_regs.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright © 2024 Intel Corporation + */ + +#ifndef __INTEL_DSS_REGS_H__ +#define __INTEL_DSS_REGS_H__ + +#include "intel_display_reg_defs.h" + +/* Display Stream Splitter Control */ +#define DSS_CTL1 _MMIO(0x67400) +#define SPLITTER_ENABLE (1 << 31) +#define JOINER_ENABLE (1 << 30) +#define DUAL_LINK_MODE_INTERLEAVE (1 << 24) +#define DUAL_LINK_MODE_FRONTBACK (0 << 24) +#define OVERLAP_PIXELS_MASK (0xf << 16) +#define OVERLAP_PIXELS(pixels) ((pixels) << 16) +#define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) +#define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) +#define MAX_DL_BUFFER_TARGET_DEPTH 0x5a0 + +#define DSS_CTL2 _MMIO(0x67404) +#define LEFT_BRANCH_VDSC_ENABLE (1 << 31) +#define RIGHT_BRANCH_VDSC_ENABLE (1 << 15) +#define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) +#define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) + +#define _ICL_PIPE_DSS_CTL1_PB 0x78200 +#define _ICL_PIPE_DSS_CTL1_PC 0x78400 +#define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ + _ICL_PIPE_DSS_CTL1_PB, \ + _ICL_PIPE_DSS_CTL1_PC) +#define BIG_JOINER_ENABLE (1 << 29) +#define PRIMARY_BIG_JOINER_ENABLE (1 << 28) +#define VGA_CENTERING_ENABLE (1 << 27) +#define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25) +#define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0) +#define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1) +#define UNCOMPRESSED_JOINER_PRIMARY (1 << 21) +#define UNCOMPRESSED_JOINER_SECONDARY (1 << 20) + +#define _ICL_PIPE_DSS_CTL2_PB 0x78204 +#define _ICL_PIPE_DSS_CTL2_PC 0x78404 +#define ICL_PIPE_DSS_CTL2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ + _ICL_PIPE_DSS_CTL2_PB, \ + _ICL_PIPE_DSS_CTL2_PC) + +#endif /* __INTEL_DSS_REGS_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c index 2e849b015e74..891346f1f09a 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.c +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c @@ -15,6 +15,7 @@ #include "intel_de.h" #include "intel_display_types.h" #include "intel_dsi.h" +#include "intel_dss_regs.h" #include "intel_qp_tables.h" #include "intel_vdsc.h" #include "intel_vdsc_regs.h" diff --git a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h index f921ad67b587..27c696e266af 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h +++ b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h @@ -8,44 +8,6 @@ #include "intel_display_reg_defs.h" -/* Display Stream Splitter Control */ -#define DSS_CTL1 _MMIO(0x67400) -#define SPLITTER_ENABLE (1 << 31) -#define JOINER_ENABLE (1 << 30) -#define DUAL_LINK_MODE_INTERLEAVE (1 << 24) -#define DUAL_LINK_MODE_FRONTBACK (0 << 24) -#define OVERLAP_PIXELS_MASK (0xf << 16) -#define OVERLAP_PIXELS(pixels) ((pixels) << 16) -#define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) -#define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) -#define MAX_DL_BUFFER_TARGET_DEPTH 0x5a0 - -#define DSS_CTL2 _MMIO(0x67404) -#define LEFT_BRANCH_VDSC_ENABLE (1 << 31) -#define RIGHT_BRANCH_VDSC_ENABLE (1 << 15) -#define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) -#define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) - -#define _ICL_PIPE_DSS_CTL1_PB 0x78200 -#define _ICL_PIPE_DSS_CTL1_PC 0x78400 -#define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ - _ICL_PIPE_DSS_CTL1_PB, \ - _ICL_PIPE_DSS_CTL1_PC) -#define BIG_JOINER_ENABLE (1 << 29) -#define PRIMARY_BIG_JOINER_ENABLE (1 << 28) -#define VGA_CENTERING_ENABLE (1 << 27) -#define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25) -#define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0) -#define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1) -#define UNCOMPRESSED_JOINER_PRIMARY (1 << 21) -#define UNCOMPRESSED_JOINER_SECONDARY (1 << 20) - -#define _ICL_PIPE_DSS_CTL2_PB 0x78204 -#define _ICL_PIPE_DSS_CTL2_PC 0x78404 -#define ICL_PIPE_DSS_CTL2(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ - _ICL_PIPE_DSS_CTL2_PB, \ - _ICL_PIPE_DSS_CTL2_PC) - /* Icelake Display Stream Compression Registers */ #define DSCA_PICTURE_PARAMETER_SET_0 _MMIO(0x6B200) #define DSCC_PICTURE_PARAMETER_SET_0 _MMIO(0x6BA00) From patchwork Thu Aug 29 13:18:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783205 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 18476C83F16 for ; Thu, 29 Aug 2024 13:17:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF16C10E684; Thu, 29 Aug 2024 13:17:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dbkam7QL"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 80F8410E67F; Thu, 29 Aug 2024 13:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937420; x=1756473420; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bLgsHe1cR/czH5W9dItRaNRIamDW7jPpteiLzIgebZ4=; b=dbkam7QLs5wOCVz/a2KHtgOiPYP+s+0KDAIySeAK/60FhIRKBB3FPk0T So9XQlK5ZEytOqoJhKOtuDY7OqtsyZxVM743H5fZyVIzwihAGewqUpBRa UKF0oAnSR3BbuAerHg/xh2bwdQmm1YTsKWsaHu4l7Wjpakok6n6p7qaBo ZVzpZzvm2KkkLBAg05dQRoLP8h2TTm1nWV4MqWyma8TrTMZPgQBZpgUyu edjUIEJnofeDUDsVC/UThp9wYOnQasEAS/+K6o9amw8HJuz0u1hW2ZFLb i+HGhtK9E3xt3UROPX135mVFINczH9LljKaAI9K4XwOGjn/nzatKX2xuS Q==; X-CSE-ConnectionGUID: TaNojWcfQ5+M97EoISVxDA== X-CSE-MsgGUID: 5TzbtuYKQoePg46TPfkT/g== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667221" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667221" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:00 -0700 X-CSE-ConnectionGUID: 9EaN3WoKS/abjrBEZEwneg== X-CSE-MsgGUID: MsDW4dpAQlK5auOYaAMKSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261433" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:16:57 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 02/19] drm/i915/dss_regs: Use REG_* macros for the DSS ctl bits Date: Thu, 29 Aug 2024 18:48:10 +0530 Message-ID: <20240829131828.2350930-3-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Cleanup register definitions for DSS CLT reg bits. Replace the hand rolled (1< --- drivers/gpu/drm/i915/display/intel_dss_regs.h | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dss_regs.h b/drivers/gpu/drm/i915/display/intel_dss_regs.h index b1e24ea027c3..cfc8ef451917 100644 --- a/drivers/gpu/drm/i915/display/intel_dss_regs.h +++ b/drivers/gpu/drm/i915/display/intel_dss_regs.h @@ -10,35 +10,37 @@ /* Display Stream Splitter Control */ #define DSS_CTL1 _MMIO(0x67400) -#define SPLITTER_ENABLE (1 << 31) -#define JOINER_ENABLE (1 << 30) -#define DUAL_LINK_MODE_INTERLEAVE (1 << 24) +#define SPLITTER_ENABLE REG_BIT(31) +#define JOINER_ENABLE REG_BIT(30) +#define DUAL_LINK_MODE_INTERLEAVE REG_BIT(24) #define DUAL_LINK_MODE_FRONTBACK (0 << 24) -#define OVERLAP_PIXELS_MASK (0xf << 16) -#define OVERLAP_PIXELS(pixels) ((pixels) << 16) -#define LEFT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) -#define LEFT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) +#define OVERLAP_PIXELS_MASK REG_GENMASK(19, 16) +#define OVERLAP_PIXELS(pixels) REG_FIELD_PREP(OVERLAP_PIXELS_MASK, pixels) +#define LEFT_DL_BUF_TARGET_DEPTH_MASK REG_GENMASK(11, 0) +#define LEFT_DL_BUF_TARGET_DEPTH(pixels) REG_FIELD_PREP(LEFT_DL_BUF_TARGET_DEPTH_MASK, \ + pixels) #define MAX_DL_BUFFER_TARGET_DEPTH 0x5a0 #define DSS_CTL2 _MMIO(0x67404) -#define LEFT_BRANCH_VDSC_ENABLE (1 << 31) -#define RIGHT_BRANCH_VDSC_ENABLE (1 << 15) -#define RIGHT_DL_BUF_TARGET_DEPTH_MASK (0xfff << 0) -#define RIGHT_DL_BUF_TARGET_DEPTH(pixels) ((pixels) << 0) +#define LEFT_BRANCH_VDSC_ENABLE REG_BIT(31) +#define RIGHT_BRANCH_VDSC_ENABLE REG_BIT(15) +#define RIGHT_DL_BUF_TARGET_DEPTH_MASK REG_GENMASK(11, 0) +#define RIGHT_DL_BUF_TARGET_DEPTH(pixels) REG_FIELD_PREP(RIGHT_DL_BUF_TARGET_DEPTH_MASK,\ + pixels) #define _ICL_PIPE_DSS_CTL1_PB 0x78200 #define _ICL_PIPE_DSS_CTL1_PC 0x78400 #define ICL_PIPE_DSS_CTL1(pipe) _MMIO_PIPE((pipe) - PIPE_B, \ _ICL_PIPE_DSS_CTL1_PB, \ _ICL_PIPE_DSS_CTL1_PC) -#define BIG_JOINER_ENABLE (1 << 29) -#define PRIMARY_BIG_JOINER_ENABLE (1 << 28) -#define VGA_CENTERING_ENABLE (1 << 27) +#define BIG_JOINER_ENABLE REG_BIT(29) +#define PRIMARY_BIG_JOINER_ENABLE REG_BIT(28) +#define VGA_CENTERING_ENABLE REG_BIT(27) #define SPLITTER_CONFIGURATION_MASK REG_GENMASK(26, 25) #define SPLITTER_CONFIGURATION_2_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0) #define SPLITTER_CONFIGURATION_4_SEGMENT REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1) -#define UNCOMPRESSED_JOINER_PRIMARY (1 << 21) -#define UNCOMPRESSED_JOINER_SECONDARY (1 << 20) +#define UNCOMPRESSED_JOINER_PRIMARY REG_BIT(21) +#define UNCOMPRESSED_JOINER_SECONDARY REG_BIT(20) #define _ICL_PIPE_DSS_CTL2_PB 0x78204 #define _ICL_PIPE_DSS_CTL2_PC 0x78404 From patchwork Thu Aug 29 13:18:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783206 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 BEB4BC83F16 for ; Thu, 29 Aug 2024 13:17:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69EB210E683; Thu, 29 Aug 2024 13:17:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="WEvi9bht"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC13810E682; Thu, 29 Aug 2024 13:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937422; x=1756473422; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WZqKxVKTQLyEJR9rmuDuUym7wRVGIH57Mge+JxtJ4KQ=; b=WEvi9bhtqrO4OjFDTdPh5oiGK8bGH/Q1ZcJFmfNBH7lseDZXJPvEsNQz 6ec8Fb/HZNv5z6Qc83aUZplaFTAkhTwmrECGbE4ZR6JfJGUMPzgAT9EPf oQqs8wvtYfF/B3TqlOCUuPg9bCUM3uE1tKFQV3VwqXgWkw341DtjtKGA4 jKlkIS42UW0GkLAIyNncW34McwNRzw0ZBR7J+5Vuyo4QmqG4zyGWmfq+e 9siG1C8n4ZMUiTTsMkdGKBdc8lRumKiAqtageddFLZhXljZ2XHl9cgH8o N/V71I76hf7tnhVGR93503zaC/krRkqQFTYGJiG72gfYQPAASnhU6h0jN w==; X-CSE-ConnectionGUID: hWuNQN0tQS2+R0Paeb1Beg== X-CSE-MsgGUID: WggSnbrHT3S7CvjdB0cUCg== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667225" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667225" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:02 -0700 X-CSE-ConnectionGUID: Ir8jw01XQhSNzNrkXhvwXg== X-CSE-MsgGUID: Ckj8C62OQQeO+1x4S54Cpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261455" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:16:59 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 03/19] drm/i915/ddi: Move all mso related helpers to a new file Date: Thu, 29 Aug 2024 18:48:11 +0530 Message-ID: <20240829131828.2350930-4-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the MSO related helper functions from intel_ddi.c to a new file intel_dss.c to improve code modularity and maintainability. The corresponding headers are also moved to intel_dss.h. v2: Retain the old naming scheme for the functions and only add dss prefix. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_ddi.c | 86 ++--------------------- drivers/gpu/drm/i915/display/intel_dss.c | 87 ++++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dss.h | 21 ++++++ drivers/gpu/drm/xe/Makefile | 1 + 5 files changed, 115 insertions(+), 81 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dss.c create mode 100644 drivers/gpu/drm/i915/display/intel_dss.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index c63fa2133ccb..e55ce8ba123c 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -328,6 +328,7 @@ i915-y += \ display/intel_dsi.o \ display/intel_dsi_dcs_backlight.o \ display/intel_dsi_vbt.o \ + display/intel_dss.o \ display/intel_dvo.o \ display/intel_encoder.o \ display/intel_gmbus.o \ diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 4566a60c981c..7cc766043a5b 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -57,7 +57,7 @@ #include "intel_dp_tunnel.h" #include "intel_dpio_phy.h" #include "intel_dsi.h" -#include "intel_dss_regs.h" +#include "intel_dss.h" #include "intel_encoder.h" #include "intel_fdi.h" #include "intel_fifo_underrun.h" @@ -2349,82 +2349,6 @@ static void intel_ddi_power_up_lanes(struct intel_encoder *encoder, } } -/* - * Splitter enable for eDP MSO is limited to certain pipes, on certain - * platforms. - */ -static u8 intel_ddi_splitter_pipe_mask(struct drm_i915_private *i915) -{ - if (DISPLAY_VER(i915) > 20) - return ~0; - else if (IS_ALDERLAKE_P(i915)) - return BIT(PIPE_A) | BIT(PIPE_B); - else - return BIT(PIPE_A); -} - -static void intel_ddi_mso_get_config(struct intel_encoder *encoder, - struct intel_crtc_state *pipe_config) -{ - struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); - enum pipe pipe = crtc->pipe; - u32 dss1; - - if (!HAS_MSO(i915)) - return; - - dss1 = intel_de_read(i915, ICL_PIPE_DSS_CTL1(pipe)); - - pipe_config->splitter.enable = dss1 & SPLITTER_ENABLE; - if (!pipe_config->splitter.enable) - return; - - if (drm_WARN_ON(&i915->drm, !(intel_ddi_splitter_pipe_mask(i915) & BIT(pipe)))) { - pipe_config->splitter.enable = false; - return; - } - - switch (dss1 & SPLITTER_CONFIGURATION_MASK) { - default: - drm_WARN(&i915->drm, true, - "Invalid splitter configuration, dss1=0x%08x\n", dss1); - fallthrough; - case SPLITTER_CONFIGURATION_2_SEGMENT: - pipe_config->splitter.link_count = 2; - break; - case SPLITTER_CONFIGURATION_4_SEGMENT: - pipe_config->splitter.link_count = 4; - break; - } - - pipe_config->splitter.pixel_overlap = REG_FIELD_GET(OVERLAP_PIXELS_MASK, dss1); -} - -static void intel_ddi_mso_configure(const struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); - enum pipe pipe = crtc->pipe; - u32 dss1 = 0; - - if (!HAS_MSO(i915)) - return; - - if (crtc_state->splitter.enable) { - dss1 |= SPLITTER_ENABLE; - dss1 |= OVERLAP_PIXELS(crtc_state->splitter.pixel_overlap); - if (crtc_state->splitter.link_count == 2) - dss1 |= SPLITTER_CONFIGURATION_2_SEGMENT; - else - dss1 |= SPLITTER_CONFIGURATION_4_SEGMENT; - } - - intel_de_rmw(i915, ICL_PIPE_DSS_CTL1(pipe), - SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK | - OVERLAP_PIXELS_MASK, dss1); -} - static u8 mtl_get_port_width(u8 lane_count) { switch (lane_count) { @@ -2559,7 +2483,7 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state, /* * 6.e Program CoG/MSO configuration bits in DSS_CTL1 if selected. */ - intel_ddi_mso_configure(crtc_state); + intel_dss_mso_configure(crtc_state); if (!is_mst) intel_dp_set_power(intel_dp, DP_SET_POWER_D0); @@ -2714,7 +2638,7 @@ static void tgl_ddi_pre_enable_dp(struct intel_atomic_state *state, /* * 7.g Program CoG/MSO configuration bits in DSS_CTL1 if selected. */ - intel_ddi_mso_configure(crtc_state); + intel_dss_mso_configure(crtc_state); if (!is_mst) intel_dp_set_power(intel_dp, DP_SET_POWER_D0); @@ -3959,7 +3883,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, intel_ddi_read_func_ctl(encoder, pipe_config); - intel_ddi_mso_get_config(encoder, pipe_config); + intel_dss_mso_get_config(encoder, pipe_config); pipe_config->has_audio = intel_ddi_is_audio_enabled(dev_priv, cpu_transcoder); @@ -5191,7 +5115,7 @@ void intel_ddi_init(struct intel_display *display, dig_port->hpd_pulse = intel_dp_hpd_pulse; if (dig_port->dp.mso_link_count) - encoder->pipe_mask = intel_ddi_splitter_pipe_mask(dev_priv); + encoder->pipe_mask = intel_dss_mso_pipe_mask(dev_priv); } /* diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c new file mode 100644 index 000000000000..e774f55f7008 --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2024 Intel Corporation + */ + +#include "i915_drv.h" +#include "i915_reg_defs.h" +#include "intel_de.h" +#include "intel_display_types.h" +#include "intel_dss.h" +#include "intel_dss_regs.h" + +/* + * Splitter enable for eDP MSO is limited to certain pipes, on certain + * platforms. + */ +u8 intel_dss_mso_pipe_mask(struct drm_i915_private *i915) +{ + if (DISPLAY_VER(i915) > 20) + return ~0; + else if (IS_ALDERLAKE_P(i915)) + return BIT(PIPE_A) | BIT(PIPE_B); + else + return BIT(PIPE_A); +} + +void intel_dss_mso_get_config(struct intel_encoder *encoder, + struct intel_crtc_state *pipe_config) +{ + struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); + struct drm_i915_private *i915 = to_i915(crtc->base.dev); + enum pipe pipe = crtc->pipe; + u32 dss1; + + if (!HAS_MSO(i915)) + return; + + dss1 = intel_de_read(i915, ICL_PIPE_DSS_CTL1(pipe)); + + pipe_config->splitter.enable = dss1 & SPLITTER_ENABLE; + if (!pipe_config->splitter.enable) + return; + + if (drm_WARN_ON(&i915->drm, !(intel_dss_mso_pipe_mask(i915) & BIT(pipe)))) { + pipe_config->splitter.enable = false; + return; + } + + switch (dss1 & SPLITTER_CONFIGURATION_MASK) { + default: + drm_WARN(&i915->drm, true, + "Invalid splitter configuration, dss1=0x%08x\n", dss1); + fallthrough; + case SPLITTER_CONFIGURATION_2_SEGMENT: + pipe_config->splitter.link_count = 2; + break; + case SPLITTER_CONFIGURATION_4_SEGMENT: + pipe_config->splitter.link_count = 4; + break; + } + + pipe_config->splitter.pixel_overlap = REG_FIELD_GET(OVERLAP_PIXELS_MASK, dss1); +} + +void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_i915_private *i915 = to_i915(crtc->base.dev); + enum pipe pipe = crtc->pipe; + u32 dss1 = 0; + + if (!HAS_MSO(i915)) + return; + + if (crtc_state->splitter.enable) { + dss1 |= SPLITTER_ENABLE; + dss1 |= OVERLAP_PIXELS(crtc_state->splitter.pixel_overlap); + if (crtc_state->splitter.link_count == 2) + dss1 |= SPLITTER_CONFIGURATION_2_SEGMENT; + else + dss1 |= SPLITTER_CONFIGURATION_4_SEGMENT; + } + + intel_de_rmw(i915, ICL_PIPE_DSS_CTL1(pipe), + SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK | + OVERLAP_PIXELS_MASK, dss1); +} diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h new file mode 100644 index 000000000000..69c61543403a --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_dss.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright © 2024 Intel Corporation + */ + +#ifndef __INTEL_DSS_H__ +#define __INTEL_DSS_H__ + +#include "linux/types.h" + +struct drm_i915_private; +struct intel_crtc_state; +struct intel_encoder; + +u8 intel_dss_mso_pipe_mask(struct drm_i915_private *i915); +void intel_dss_mso_get_config(struct intel_encoder *encoder, + struct intel_crtc_state *pipe_config); +void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state); + +#endif /* __INTEL_DSS_H__ */ + diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index b9670ae09a9e..619272783669 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -227,6 +227,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \ i915-display/intel_dsi.o \ i915-display/intel_dsi_dcs_backlight.o \ i915-display/intel_dsi_vbt.o \ + i915-display/intel_dss.o \ i915-display/intel_encoder.o \ i915-display/intel_fb.o \ i915-display/intel_fbc.o \ From patchwork Thu Aug 29 13:18:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783207 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 3F9D4C83F17 for ; Thu, 29 Aug 2024 13:17:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCC6D10E688; Thu, 29 Aug 2024 13:17:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lTUZxiWB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id A870410E688; Thu, 29 Aug 2024 13:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937424; x=1756473424; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=55hQSh2b0AT9LTcXStCMajT99nyLRC1sdIamtcaD4x4=; b=lTUZxiWBBvZKtbT7eUPjO0G/lNriSbBWjp1/BhIXan1CyYATvjPSJpIL CCxedKmfhx4JAxPkl5gFa6KCaU6T+wufxclNlMrTskqUVXsaWPiOeu7N0 pnChEnxDaN450Dc50qBbIkxUIbEQxGTH/GTK1J5+iIZWyVv2rleE+7+ix V2sGn3vF3ymQFbyjBnDy4n9nJqi9cfCShz4mm2pvgmM0AvMOGrYBHR+E1 C+UAiFi6gnmRE2zSqx4dgC5NGPx5YkQtOZQj0OO/vgHxfrc6qkGeUbyIm 5yspEEP5YHAghY/Oa5vsehTfJ9LAblO5D5rG9QKDCcqMSIIKMS3WctgGN A==; X-CSE-ConnectionGUID: d76XKgoTQLS4mz/2FSvztQ== X-CSE-MsgGUID: rLFNSas3RLe7iFi8EmfTHA== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667230" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667230" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:04 -0700 X-CSE-ConnectionGUID: ZIaCY1EhQpmAYp2E6OkDug== X-CSE-MsgGUID: itsKbDUlTiGaDiW3C65S3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261473" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:01 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 04/19] drm/i915/dss: Move to struct intel_display Date: Thu, 29 Aug 2024 18:48:12 +0530 Message-ID: <20240829131828.2350930-5-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use struct intel_display instead of struct drm_i915_private. v2: Use struct intel_display for drm Warns. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_ddi.c | 2 +- drivers/gpu/drm/i915/display/intel_dss.c | 22 ++++++++++++---------- drivers/gpu/drm/i915/display/intel_dss.h | 4 ++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 7cc766043a5b..aa176f4d42c4 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -5115,7 +5115,7 @@ void intel_ddi_init(struct intel_display *display, dig_port->hpd_pulse = intel_dp_hpd_pulse; if (dig_port->dp.mso_link_count) - encoder->pipe_mask = intel_dss_mso_pipe_mask(dev_priv); + encoder->pipe_mask = intel_dss_mso_pipe_mask(display); } /* diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index e774f55f7008..3f7f416eb3fa 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -14,9 +14,11 @@ * Splitter enable for eDP MSO is limited to certain pipes, on certain * platforms. */ -u8 intel_dss_mso_pipe_mask(struct drm_i915_private *i915) +u8 intel_dss_mso_pipe_mask(struct intel_display *display) { - if (DISPLAY_VER(i915) > 20) + struct drm_i915_private *i915 = to_i915(display->drm); + + if (DISPLAY_VER(display) > 20) return ~0; else if (IS_ALDERLAKE_P(i915)) return BIT(PIPE_A) | BIT(PIPE_B); @@ -27,28 +29,28 @@ u8 intel_dss_mso_pipe_mask(struct drm_i915_private *i915) void intel_dss_mso_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) { + struct intel_display *display = to_intel_display(pipe_config); struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); enum pipe pipe = crtc->pipe; u32 dss1; - if (!HAS_MSO(i915)) + if (!HAS_MSO(display)) return; - dss1 = intel_de_read(i915, ICL_PIPE_DSS_CTL1(pipe)); + dss1 = intel_de_read(display, ICL_PIPE_DSS_CTL1(pipe)); pipe_config->splitter.enable = dss1 & SPLITTER_ENABLE; if (!pipe_config->splitter.enable) return; - if (drm_WARN_ON(&i915->drm, !(intel_dss_mso_pipe_mask(i915) & BIT(pipe)))) { + if (drm_WARN_ON(display->drm, !(intel_dss_mso_pipe_mask(display) & BIT(pipe)))) { pipe_config->splitter.enable = false; return; } switch (dss1 & SPLITTER_CONFIGURATION_MASK) { default: - drm_WARN(&i915->drm, true, + drm_WARN(display->drm, true, "Invalid splitter configuration, dss1=0x%08x\n", dss1); fallthrough; case SPLITTER_CONFIGURATION_2_SEGMENT: @@ -64,12 +66,12 @@ void intel_dss_mso_get_config(struct intel_encoder *encoder, void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(crtc_state); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); enum pipe pipe = crtc->pipe; u32 dss1 = 0; - if (!HAS_MSO(i915)) + if (!HAS_MSO(display)) return; if (crtc_state->splitter.enable) { @@ -81,7 +83,7 @@ void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state) dss1 |= SPLITTER_CONFIGURATION_4_SEGMENT; } - intel_de_rmw(i915, ICL_PIPE_DSS_CTL1(pipe), + intel_de_rmw(display, ICL_PIPE_DSS_CTL1(pipe), SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK | OVERLAP_PIXELS_MASK, dss1); } diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h index 69c61543403a..45d076d1e0d8 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.h +++ b/drivers/gpu/drm/i915/display/intel_dss.h @@ -8,11 +8,11 @@ #include "linux/types.h" -struct drm_i915_private; struct intel_crtc_state; +struct intel_display; struct intel_encoder; -u8 intel_dss_mso_pipe_mask(struct drm_i915_private *i915); +u8 intel_dss_mso_pipe_mask(struct intel_display *display); void intel_dss_mso_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config); void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state); From patchwork Thu Aug 29 13:18:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783208 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 A83DEC83F19 for ; Thu, 29 Aug 2024 13:17:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F6BC10E689; Thu, 29 Aug 2024 13:17:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="NtG879Sp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACA4810E689; Thu, 29 Aug 2024 13:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937426; x=1756473426; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y3UTVohc5NJliCoh4wP0Y6xHglXNmkTiN05WtesR0Zw=; b=NtG879Spq7hwaxdGUFX4oDFqOmNBzE2DjCQQs29lQiXSXar/si2zY6Jk wBTxReGjU6YESLqQQ50mULKmiUSqHYbXOz+gVgVkUCKVn+sKG9oxJ/P1o uvtp843IWL/Ly7CDR4SngBvlECh9Y4JJ81eWGS2d0mHy2ZiI2rrPyszG/ pl6O8NTow3D/bNi2PRBQDRGabNDHALv3/JgFhFeyAhhKXf03AS/KTqWqY FD74AhljwKhJCG3GhdteoqFw4ueeKpqI5pVp/EnDLOQa5NzloIttlY3aD JimiPY31hjc8V8wvAUqo5DmRKiASLXpJQjPpRUH5kGO6s6Jbe32UH5S14 g==; X-CSE-ConnectionGUID: S587wLCrTYmabYW+q9v5tw== X-CSE-MsgGUID: 8QklNFONRvOfSOc54RkE2w== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667235" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667235" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:06 -0700 X-CSE-ConnectionGUID: SkAv6j7BSZ6NXBxUR2gdmQ== X-CSE-MsgGUID: k1USgwdmQNWpfBIZB/0Erg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261489" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:03 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 05/19] drm/i915/icl_dsi: Avoid using intel_dsi in configure_dual_link_mode Date: Thu, 29 Aug 2024 18:48:13 +0530 Message-ID: <20240829131828.2350930-6-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" DSS control regs have bits to configure dual_link_mode. Pass dual_link, and pixel_overlap to the configure_dual_link_mode() instead of deriving from intel_dsi. This will make the movement of the function to intel_dss files easier and avoid need of intel_dsi in intel_dss files. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/icl_dsi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 5ad5011e1fee..2f94644f51f3 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -275,10 +275,10 @@ static void dsi_program_swing_and_deemphasis(struct intel_encoder *encoder) } static void configure_dual_link_mode(struct intel_encoder *encoder, - const struct intel_crtc_state *pipe_config) + const struct intel_crtc_state *pipe_config, + u8 dual_link, u8 pixel_overlap) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder); i915_reg_t dss_ctl1_reg, dss_ctl2_reg; u32 dss_ctl1; @@ -296,16 +296,16 @@ static void configure_dual_link_mode(struct intel_encoder *encoder, dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg); dss_ctl1 |= SPLITTER_ENABLE; dss_ctl1 &= ~OVERLAP_PIXELS_MASK; - dss_ctl1 |= OVERLAP_PIXELS(intel_dsi->pixel_overlap); + dss_ctl1 |= OVERLAP_PIXELS(pixel_overlap); - if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) { + if (dual_link == DSI_DUAL_LINK_FRONT_BACK) { const struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode; u16 hactive = adjusted_mode->crtc_hdisplay; u16 dl_buffer_depth; dss_ctl1 &= ~DUAL_LINK_MODE_INTERLEAVE; - dl_buffer_depth = hactive / 2 + intel_dsi->pixel_overlap; + dl_buffer_depth = hactive / 2 + pixel_overlap; if (dl_buffer_depth > MAX_DL_BUFFER_TARGET_DEPTH) drm_err(&dev_priv->drm, @@ -791,7 +791,9 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder, } /* configure stream splitting */ - configure_dual_link_mode(encoder, pipe_config); + configure_dual_link_mode(encoder, pipe_config, + intel_dsi->dual_link, + intel_dsi->pixel_overlap); } for_each_dsi_port(port, intel_dsi->ports) { From patchwork Thu Aug 29 13:18:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783209 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 D09A0C83F16 for ; Thu, 29 Aug 2024 13:17:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7396910E68C; Thu, 29 Aug 2024 13:17:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RBMOjCCz"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A9B310E68B; Thu, 29 Aug 2024 13:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937428; x=1756473428; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GMl0F1lvZAZ5PdqpkMiG2OGc/NO3bk2Rgm2WsaYHvDw=; b=RBMOjCCzTh9gN5m3UKunilbSt3m1SYoFJwEENu1Y4f5gI0HDiwdisfyM o70Oo1qQbC5LEXo5K1E7PziV5uBRMBcL35ekzZo/9xxQCiRazNToZ1/jQ ft4BGKZHCNhcBMMv3shF8y1UXufmxZszarJnUWmwLkLIXUJS8I+NlSQej K+/4gixYmu1A7rQ60eytDjjBeZuRRFIMPWiTBZvMJDIvFN6uaL/R3elUK qPsQM1zgUhpMcLWKFFsShYOWdrihyZsr6GgivaOY3plLBkIqZdfg0nMRN 3I8mfo+onfpDTRNSNLGxkixzfDg9OSIbOLuGSJeXm9srxUX00+i1Owi56 A==; X-CSE-ConnectionGUID: O7bVycxEThGPCpwLQNCj2Q== X-CSE-MsgGUID: 39MnBSWvSlOQgUILB4x/cg== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667244" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667244" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:08 -0700 X-CSE-ConnectionGUID: y2wA9FWsRguippWO90jX6Q== X-CSE-MsgGUID: ytaT+AvtQKC87UgB7W1WkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261509" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:05 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 06/19] drm/i915/icl_dsi: Use intel_display in configure_dual_link_mode Date: Thu, 29 Aug 2024 18:48:14 +0530 Message-ID: <20240829131828.2350930-7-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Replace struct drm_i915_private with struct intel_display in configure_dual_link_mode. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/icl_dsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 2f94644f51f3..79e149d51cb2 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -278,12 +278,12 @@ static void configure_dual_link_mode(struct intel_encoder *encoder, const struct intel_crtc_state *pipe_config, u8 dual_link, u8 pixel_overlap) { - struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); + struct intel_display *display = to_intel_display(encoder); i915_reg_t dss_ctl1_reg, dss_ctl2_reg; u32 dss_ctl1; /* FIXME: Move all DSS handling to intel_vdsc.c */ - if (DISPLAY_VER(dev_priv) >= 12) { + if (DISPLAY_VER(display) >= 12) { struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); dss_ctl1_reg = ICL_PIPE_DSS_CTL1(crtc->pipe); @@ -293,7 +293,7 @@ static void configure_dual_link_mode(struct intel_encoder *encoder, dss_ctl2_reg = DSS_CTL2; } - dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg); + dss_ctl1 = intel_de_read(display, dss_ctl1_reg); dss_ctl1 |= SPLITTER_ENABLE; dss_ctl1 &= ~OVERLAP_PIXELS_MASK; dss_ctl1 |= OVERLAP_PIXELS(pixel_overlap); @@ -308,19 +308,19 @@ static void configure_dual_link_mode(struct intel_encoder *encoder, dl_buffer_depth = hactive / 2 + pixel_overlap; if (dl_buffer_depth > MAX_DL_BUFFER_TARGET_DEPTH) - drm_err(&dev_priv->drm, + drm_err(display->drm, "DL buffer depth exceed max value\n"); dss_ctl1 &= ~LEFT_DL_BUF_TARGET_DEPTH_MASK; dss_ctl1 |= LEFT_DL_BUF_TARGET_DEPTH(dl_buffer_depth); - intel_de_rmw(dev_priv, dss_ctl2_reg, RIGHT_DL_BUF_TARGET_DEPTH_MASK, + intel_de_rmw(display, dss_ctl2_reg, RIGHT_DL_BUF_TARGET_DEPTH_MASK, RIGHT_DL_BUF_TARGET_DEPTH(dl_buffer_depth)); } else { /* Interleave */ dss_ctl1 |= DUAL_LINK_MODE_INTERLEAVE; } - intel_de_write(dev_priv, dss_ctl1_reg, dss_ctl1); + intel_de_write(display, dss_ctl1_reg, dss_ctl1); } /* aka DSI 8X clock */ From patchwork Thu Aug 29 13:18:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783210 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 1F68CC83F15 for ; Thu, 29 Aug 2024 13:17:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C549B10E68D; Thu, 29 Aug 2024 13:17:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OvlFUCSe"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C3AA10E68B; Thu, 29 Aug 2024 13:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937430; x=1756473430; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jeQ63ve7KdsYnhiP1dX+v9zZ8+etWII/T9qrBBDQ7mE=; b=OvlFUCSepN+zgI70ux5C4gRUifSItdE99yA7OT2yjY8tjgja3bBJpY/W Nd8641e7HVHGmXJtnzq35WEuivIrWZbboQlbdlkWjqscL5pm4zjw7NkaT 3eLZq+cEk4u7NxLoVIEO7pp5fg/m+TCoouTzotBIkbB8TYWhRijeeQycI 3txiDBXBN3N5BWjrAVzCNO0lit7oFW36MR0jz53dayg/R845JYeZ6j6vM ky/4LpULn8uYKnvPmDgA9wpN5Pw3vgS7ezgOc/E9OW1UpmX3+os/aedUc wBdmOY7yiesQEWiEl2wdcMLmBlWgct0nOuVLSyrat0tR3Hvz037zAWx35 Q==; X-CSE-ConnectionGUID: yygWIlskTE24PFiubimK0w== X-CSE-MsgGUID: FuuxANR6RRqs4nLV5h8FDw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667246" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667246" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:10 -0700 X-CSE-ConnectionGUID: +oHlQwGxSXGVFiEO8qLTRw== X-CSE-MsgGUID: woBBGiAUQY+aRKgJX9uoCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261527" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:07 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 07/19] drm/i915/icl_dsi: Move helpers to configure dsi dual link to intel_dss Date: Thu, 29 Aug 2024 18:48:15 +0530 Message-ID: <20240829131828.2350930-8-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the function to configure dss_ctl for dual_link dsi to intel_dss files. While at it, use struct intel_display wherever possible. v2: Avoid modifying the code while movement. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/icl_dsi.c | 57 ++---------------------- drivers/gpu/drm/i915/display/intel_dss.c | 50 +++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dss.h | 3 ++ 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 79e149d51cb2..ec880d1cbbee 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -44,7 +44,7 @@ #include "intel_de.h" #include "intel_dsi.h" #include "intel_dsi_vbt.h" -#include "intel_dss_regs.h" +#include "intel_dss.h" #include "intel_panel.h" #include "intel_vdsc.h" #include "skl_scaler.h" @@ -274,55 +274,6 @@ static void dsi_program_swing_and_deemphasis(struct intel_encoder *encoder) } } -static void configure_dual_link_mode(struct intel_encoder *encoder, - const struct intel_crtc_state *pipe_config, - u8 dual_link, u8 pixel_overlap) -{ - struct intel_display *display = to_intel_display(encoder); - i915_reg_t dss_ctl1_reg, dss_ctl2_reg; - u32 dss_ctl1; - - /* FIXME: Move all DSS handling to intel_vdsc.c */ - if (DISPLAY_VER(display) >= 12) { - struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); - - dss_ctl1_reg = ICL_PIPE_DSS_CTL1(crtc->pipe); - dss_ctl2_reg = ICL_PIPE_DSS_CTL2(crtc->pipe); - } else { - dss_ctl1_reg = DSS_CTL1; - dss_ctl2_reg = DSS_CTL2; - } - - dss_ctl1 = intel_de_read(display, dss_ctl1_reg); - dss_ctl1 |= SPLITTER_ENABLE; - dss_ctl1 &= ~OVERLAP_PIXELS_MASK; - dss_ctl1 |= OVERLAP_PIXELS(pixel_overlap); - - if (dual_link == DSI_DUAL_LINK_FRONT_BACK) { - const struct drm_display_mode *adjusted_mode = - &pipe_config->hw.adjusted_mode; - u16 hactive = adjusted_mode->crtc_hdisplay; - u16 dl_buffer_depth; - - dss_ctl1 &= ~DUAL_LINK_MODE_INTERLEAVE; - dl_buffer_depth = hactive / 2 + pixel_overlap; - - if (dl_buffer_depth > MAX_DL_BUFFER_TARGET_DEPTH) - drm_err(display->drm, - "DL buffer depth exceed max value\n"); - - dss_ctl1 &= ~LEFT_DL_BUF_TARGET_DEPTH_MASK; - dss_ctl1 |= LEFT_DL_BUF_TARGET_DEPTH(dl_buffer_depth); - intel_de_rmw(display, dss_ctl2_reg, RIGHT_DL_BUF_TARGET_DEPTH_MASK, - RIGHT_DL_BUF_TARGET_DEPTH(dl_buffer_depth)); - } else { - /* Interleave */ - dss_ctl1 |= DUAL_LINK_MODE_INTERLEAVE; - } - - intel_de_write(display, dss_ctl1_reg, dss_ctl1); -} - /* aka DSI 8X clock */ static int afe_clk(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state) @@ -791,9 +742,9 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder, } /* configure stream splitting */ - configure_dual_link_mode(encoder, pipe_config, - intel_dsi->dual_link, - intel_dsi->pixel_overlap); + intel_dss_dsi_dual_link_mode_configure(encoder, pipe_config, + intel_dsi->dual_link, + intel_dsi->pixel_overlap); } for_each_dsi_port(port, intel_dsi->ports) { diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index 3f7f416eb3fa..969e32143983 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -7,6 +7,7 @@ #include "i915_reg_defs.h" #include "intel_de.h" #include "intel_display_types.h" +#include "intel_dsi.h" #include "intel_dss.h" #include "intel_dss_regs.h" @@ -87,3 +88,52 @@ void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state) SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK | OVERLAP_PIXELS_MASK, dss1); } + +void intel_dss_dsi_dual_link_mode_configure(struct intel_encoder *encoder, + const struct intel_crtc_state *pipe_config, + u8 dual_link, + u8 pixel_overlap) +{ + struct intel_display *display = to_intel_display(encoder); + i915_reg_t dss_ctl1_reg, dss_ctl2_reg; + u32 dss_ctl1; + + if (DISPLAY_VER(display) >= 12) { + struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); + + dss_ctl1_reg = ICL_PIPE_DSS_CTL1(crtc->pipe); + dss_ctl2_reg = ICL_PIPE_DSS_CTL2(crtc->pipe); + } else { + dss_ctl1_reg = DSS_CTL1; + dss_ctl2_reg = DSS_CTL2; + } + + dss_ctl1 = intel_de_read(display, dss_ctl1_reg); + dss_ctl1 |= SPLITTER_ENABLE; + dss_ctl1 &= ~OVERLAP_PIXELS_MASK; + dss_ctl1 |= OVERLAP_PIXELS(pixel_overlap); + + if (dual_link == DSI_DUAL_LINK_FRONT_BACK) { + const struct drm_display_mode *adjusted_mode = + &pipe_config->hw.adjusted_mode; + u16 hactive = adjusted_mode->crtc_hdisplay; + u16 dl_buffer_depth; + + dss_ctl1 &= ~DUAL_LINK_MODE_INTERLEAVE; + dl_buffer_depth = hactive / 2 + pixel_overlap; + + if (dl_buffer_depth > MAX_DL_BUFFER_TARGET_DEPTH) + drm_err(display->drm, + "DL buffer depth exceed max value\n"); + + dss_ctl1 &= ~LEFT_DL_BUF_TARGET_DEPTH_MASK; + dss_ctl1 |= LEFT_DL_BUF_TARGET_DEPTH(dl_buffer_depth); + intel_de_rmw(display, dss_ctl2_reg, RIGHT_DL_BUF_TARGET_DEPTH_MASK, + RIGHT_DL_BUF_TARGET_DEPTH(dl_buffer_depth)); + } else { + /* Interleave */ + dss_ctl1 |= DUAL_LINK_MODE_INTERLEAVE; + } + + intel_de_write(display, dss_ctl1_reg, dss_ctl1); +} diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h index 45d076d1e0d8..91e69f6ab506 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.h +++ b/drivers/gpu/drm/i915/display/intel_dss.h @@ -16,6 +16,9 @@ u8 intel_dss_mso_pipe_mask(struct intel_display *display); void intel_dss_mso_get_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config); void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state); +void intel_dss_dsi_dual_link_mode_configure(struct intel_encoder *encoder, + const struct intel_crtc_state *pipe_config, + u8 dual_link, u8 pixel_overlap); #endif /* __INTEL_DSS_H__ */ From patchwork Thu Aug 29 13:18:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783211 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 2AFE0C83F15 for ; Thu, 29 Aug 2024 13:17:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CAEC810E68F; Thu, 29 Aug 2024 13:17:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="NeBy/ME2"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BCA010E68E; Thu, 29 Aug 2024 13:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937432; x=1756473432; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5utVn4c9xPG98n3AX6UDXA6XyN5eH40/lw/NnMMa1bE=; b=NeBy/ME2VOfW0CKZAHN0VuWkiB5Whu5tr9ybmPRdchMQrTw/0Qyls1ah L1uD+JZtGkCbj1D4SMDmss8EMDIpNOujBU2BGJskEW46AmEWYrbrt9Cbb dCKwaCcm4B20ocBwpvLIfkVYOLpmC1z89EipNw+8E0LAerfDx1c1UZsZO uXOCiAW8Uul52Mv1QHIaYqdAD5V7RJsWXxTMugYrqk4BYBEtQWX/0+/xO 6814kUljO8vWfcfQfG2iH8rc+AI1AKuDWOp4xNfnIZKgiNjkwULZbjMm1 gozYxFBUtKKlj8cEmc24kRWhACUeCRgI/j9HqfWNX/A4MhCkXG3xi2y/W A==; X-CSE-ConnectionGUID: hKxjVTYVSuGMqrmSCNA5qg== X-CSE-MsgGUID: vfjg92uFSLeGU8n/DYsGkw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667249" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667249" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:12 -0700 X-CSE-ConnectionGUID: zKq2fDKsQga0ZBQSt88g1Q== X-CSE-MsgGUID: b5kmy6xhQTmFdexU7ynJ4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261537" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:09 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 08/19] drm/i915/vdsc: Rename helper to check if the pipe supports dsc Date: Thu, 29 Aug 2024 18:48:16 +0530 Message-ID: <20240829131828.2350930-9-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Rename the helper is_pipe_dsc to intel_dsc_is_pipe_dsc to prepare for its future use across multiple files. This change is a preliminary step towards making the function non-static, enhancing its accessibility and reusability. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_vdsc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c index 891346f1f09a..6d60b72a9dfb 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.c +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c @@ -35,7 +35,7 @@ bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state) return true; } -static bool is_pipe_dsc(struct intel_crtc *crtc, enum transcoder cpu_transcoder) +static bool intel_dsc_is_dsc_pipe(struct intel_crtc *crtc, enum transcoder cpu_transcoder) { struct drm_i915_private *i915 = to_i915(crtc->base.dev); @@ -366,7 +366,7 @@ intel_dsc_power_domain(struct intel_crtc *crtc, enum transcoder cpu_transcoder) */ if (DISPLAY_VER(i915) == 12 && !IS_ROCKETLAKE(i915) && pipe == PIPE_A) return POWER_DOMAIN_TRANSCODER_VDSC_PW2; - else if (is_pipe_dsc(crtc, cpu_transcoder)) + else if (intel_dsc_is_dsc_pipe(crtc, cpu_transcoder)) return POWER_DOMAIN_PIPE(pipe); else return POWER_DOMAIN_TRANSCODER_VDSC_PW2; @@ -395,7 +395,7 @@ static void intel_dsc_get_pps_reg(const struct intel_crtc_state *crtc_state, int enum pipe pipe = crtc->pipe; bool pipe_dsc; - pipe_dsc = is_pipe_dsc(crtc, cpu_transcoder); + pipe_dsc = intel_dsc_is_dsc_pipe(crtc, cpu_transcoder); if (dsc_reg_num >= 3) MISSING_CASE(dsc_reg_num); @@ -538,7 +538,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) rc_buf_thresh_dword[i / 4] |= (u32)(vdsc_cfg->rc_buf_thresh[i] << BITS_PER_BYTE * (i % 4)); - if (!is_pipe_dsc(crtc, cpu_transcoder)) { + if (!intel_dsc_is_dsc_pipe(crtc, cpu_transcoder)) { intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_0, rc_buf_thresh_dword[0]); intel_de_write(dev_priv, DSCA_RC_BUF_THRESH_0_UDW, @@ -592,7 +592,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state) RC_MAX_QP_SHIFT) | (vdsc_cfg->rc_range_params[i].range_min_qp << RC_MIN_QP_SHIFT)) << 16 * (i % 2)); - if (!is_pipe_dsc(crtc, cpu_transcoder)) { + if (!intel_dsc_is_dsc_pipe(crtc, cpu_transcoder)) { intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_0, rc_range_params_dword[0]); intel_de_write(dev_priv, DSCA_RC_RANGE_PARAMETERS_0_UDW, @@ -726,13 +726,13 @@ void intel_dsc_dp_pps_write(struct intel_encoder *encoder, static i915_reg_t dss_ctl1_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) { - return is_pipe_dsc(crtc, cpu_transcoder) ? + return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? ICL_PIPE_DSS_CTL1(crtc->pipe) : DSS_CTL1; } static i915_reg_t dss_ctl2_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) { - return is_pipe_dsc(crtc, cpu_transcoder) ? + return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? ICL_PIPE_DSS_CTL2(crtc->pipe) : DSS_CTL2; } From patchwork Thu Aug 29 13:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783212 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 92DF8C83F18 for ; Thu, 29 Aug 2024 13:17:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F375D10E691; Thu, 29 Aug 2024 13:17:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="hwXogFec"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 826F710E690; Thu, 29 Aug 2024 13:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937434; x=1756473434; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZMiQ5SDSJrpTWGi2QW48DAJhaY9vXlGT7o0iMt2YZYI=; b=hwXogFecbQXBW+iAIPU8jF0AAg0aLfhJOuIOR3vcDXb0SkY7L8fWu84X J3uncY6qvOZ6rFXrMrDKmYZqqiuxgBXA0Tr+AStkC0uLM7BsubPwFIOYn C/6/XP4cFPHP5A/6puUadRi8NyjWxxWW41KNqfA0psUQebIfUmTq1N5FL XyPU029bopXMYo6TocxS/EA+YX0tw+ktSY/2qyokMYwgzlu8vZXSOEJys HeAuhESynaZqASc1+LVAL4HScuR/ojYMZuC3ITbUAw39OFUT3uhyB2pY/ axjWEKR1KN3RYnAs8N1ItIW82oZUS+SlKzyT/CWPn2jfJFPFvUS5Zyrwd w==; X-CSE-ConnectionGUID: o2bRhunpSaSof2PdYUGtQA== X-CSE-MsgGUID: uXFTrStZRoeW5npCmTXTKQ== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667254" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667254" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:14 -0700 X-CSE-ConnectionGUID: zZ34gpWnQSOZ7wxLxAYGdA== X-CSE-MsgGUID: klX3CisaQeynKY6x7SCsTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261564" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:11 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 09/19] drm/i915/vdsc: Move all dss stuff in dss files Date: Thu, 29 Aug 2024 18:48:17 +0530 Message-ID: <20240829131828.2350930-10-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move helpers to configure dss for compressed and uncompressed joiner to intel_dss files. While at it, replace struct drm_i915_private to struct intel_display wherever possible. v2: -Move modification to use struct intel_display to another patch. (Jani) -Tweak the name for helper to get_config helper. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 3 +- drivers/gpu/drm/i915/display/intel_dss.c | 80 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dss.h | 5 ++ drivers/gpu/drm/i915/display/intel_vdsc.c | 67 ++-------------- drivers/gpu/drm/i915/display/intel_vdsc.h | 2 +- 5 files changed, 94 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 8bce46bb7f3f..05ffd28cc16a 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -87,6 +87,7 @@ #include "intel_drrs.h" #include "intel_dsb.h" #include "intel_dsi.h" +#include "intel_dss.h" #include "intel_dss_regs.h" #include "intel_dvo.h" #include "intel_fb.h" @@ -1711,7 +1712,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, intel_dsc_enable(pipe_crtc_state); if (DISPLAY_VER(dev_priv) >= 13) - intel_uncompressed_joiner_enable(pipe_crtc_state); + intel_dss_enable_uncompressed_joiner(pipe_crtc_state); intel_set_pipe_src_size(pipe_crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index 969e32143983..b37e9112ab77 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -6,10 +6,12 @@ #include "i915_drv.h" #include "i915_reg_defs.h" #include "intel_de.h" +#include "intel_display_limits.h" #include "intel_display_types.h" #include "intel_dsi.h" #include "intel_dss.h" #include "intel_dss_regs.h" +#include "intel_vdsc.h" /* * Splitter enable for eDP MSO is limited to certain pipes, on certain @@ -137,3 +139,81 @@ void intel_dss_dsi_dual_link_mode_configure(struct intel_encoder *encoder, intel_de_write(display, dss_ctl1_reg, dss_ctl1); } + +static i915_reg_t dss_ctl1_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) +{ + return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? + ICL_PIPE_DSS_CTL1(crtc->pipe) : DSS_CTL1; +} + +static i915_reg_t dss_ctl2_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) +{ + return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? + ICL_PIPE_DSS_CTL2(crtc->pipe) : DSS_CTL2; +} + +void intel_dss_reset(const struct intel_crtc_state *old_crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); + + intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); + intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); +} + +void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); + u32 dss_ctl1_val = 0; + + if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { + if (intel_crtc_is_joiner_secondary(crtc_state)) + dss_ctl1_val |= UNCOMPRESSED_JOINER_SECONDARY; + else + dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY; + + intel_de_write(dev_priv, + dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), + dss_ctl1_val); + } +} + +void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_state, + int vdsc_instances_per_pipe) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); + u32 dss_ctl1_val = 0; + u32 dss_ctl2_val = 0; + + dss_ctl2_val |= LEFT_BRANCH_VDSC_ENABLE; + if (vdsc_instances_per_pipe > 1) { + dss_ctl2_val |= RIGHT_BRANCH_VDSC_ENABLE; + dss_ctl1_val |= JOINER_ENABLE; + } + if (crtc_state->joiner_pipes) { + dss_ctl1_val |= BIG_JOINER_ENABLE; + if (!intel_crtc_is_joiner_secondary(crtc_state)) + dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE; + } + intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); + intel_de_write(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); +} + +void intel_dss_dsc_get_config(struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); + u32 dss_ctl1, dss_ctl2; + + dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder)); + dss_ctl2 = intel_de_read(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder)); + + crtc_state->dsc.compression_enable = dss_ctl2 & LEFT_BRANCH_VDSC_ENABLE; + if (!crtc_state->dsc.compression_enable) + return; + + crtc_state->dsc.dsc_split = (dss_ctl2 & RIGHT_BRANCH_VDSC_ENABLE) && + (dss_ctl1 & JOINER_ENABLE); +} diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h index 91e69f6ab506..cb204db56153 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.h +++ b/drivers/gpu/drm/i915/display/intel_dss.h @@ -19,6 +19,11 @@ void intel_dss_mso_configure(const struct intel_crtc_state *crtc_state); void intel_dss_dsi_dual_link_mode_configure(struct intel_encoder *encoder, const struct intel_crtc_state *pipe_config, u8 dual_link, u8 pixel_overlap); +void intel_dss_reset(const struct intel_crtc_state *old_crtc_state); +void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_state); +void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_state, + int vdsc_instances_per_pipe); +void intel_dss_dsc_get_config(struct intel_crtc_state *crtc_state); #endif /* __INTEL_DSS_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c index 6d60b72a9dfb..7e7c7694e56f 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.c +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c @@ -15,7 +15,7 @@ #include "intel_de.h" #include "intel_display_types.h" #include "intel_dsi.h" -#include "intel_dss_regs.h" +#include "intel_dss.h" #include "intel_qp_tables.h" #include "intel_vdsc.h" #include "intel_vdsc_regs.h" @@ -35,7 +35,7 @@ bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state) return true; } -static bool intel_dsc_is_dsc_pipe(struct intel_crtc *crtc, enum transcoder cpu_transcoder) +bool intel_dsc_is_dsc_pipe(struct intel_crtc *crtc, enum transcoder cpu_transcoder) { struct drm_i915_private *i915 = to_i915(crtc->base.dev); @@ -724,72 +724,23 @@ void intel_dsc_dp_pps_write(struct intel_encoder *encoder, sizeof(dp_dsc_pps_sdp)); } -static i915_reg_t dss_ctl1_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) -{ - return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? - ICL_PIPE_DSS_CTL1(crtc->pipe) : DSS_CTL1; -} - -static i915_reg_t dss_ctl2_reg(struct intel_crtc *crtc, enum transcoder cpu_transcoder) -{ - return intel_dsc_is_dsc_pipe(crtc, cpu_transcoder) ? - ICL_PIPE_DSS_CTL2(crtc->pipe) : DSS_CTL2; -} - -void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); - u32 dss_ctl1_val = 0; - - if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { - if (intel_crtc_is_joiner_secondary(crtc_state)) - dss_ctl1_val |= UNCOMPRESSED_JOINER_SECONDARY; - else - dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY; - - intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); - } -} - void intel_dsc_enable(const struct intel_crtc_state *crtc_state) { - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); - u32 dss_ctl1_val = 0; - u32 dss_ctl2_val = 0; int vdsc_instances_per_pipe = intel_dsc_get_vdsc_per_pipe(crtc_state); if (!crtc_state->dsc.compression_enable) return; intel_dsc_pps_configure(crtc_state); - - dss_ctl2_val |= LEFT_BRANCH_VDSC_ENABLE; - if (vdsc_instances_per_pipe > 1) { - dss_ctl2_val |= RIGHT_BRANCH_VDSC_ENABLE; - dss_ctl1_val |= JOINER_ENABLE; - } - if (crtc_state->joiner_pipes) { - dss_ctl1_val |= BIG_JOINER_ENABLE; - if (!intel_crtc_is_joiner_secondary(crtc_state)) - dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE; - } - intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); - intel_de_write(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); + intel_dss_enable_compressed_joiner(crtc_state, vdsc_instances_per_pipe); } void intel_dsc_disable(const struct intel_crtc_state *old_crtc_state) { - struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); - /* Disable only if either of them is enabled */ if (old_crtc_state->dsc.compression_enable || - old_crtc_state->joiner_pipes) { - intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); - intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); - } + old_crtc_state->joiner_pipes) + intel_dss_reset(old_crtc_state); } static u32 intel_dsc_pps_read(struct intel_crtc_state *crtc_state, int pps, @@ -946,7 +897,6 @@ void intel_dsc_get_config(struct intel_crtc_state *crtc_state) enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; enum intel_display_power_domain power_domain; intel_wakeref_t wakeref; - u32 dss_ctl1, dss_ctl2; if (!intel_dsc_source_support(crtc_state)) return; @@ -957,16 +907,11 @@ void intel_dsc_get_config(struct intel_crtc_state *crtc_state) if (!wakeref) return; - dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc, cpu_transcoder)); - dss_ctl2 = intel_de_read(dev_priv, dss_ctl2_reg(crtc, cpu_transcoder)); + intel_dss_dsc_get_config(crtc_state); - crtc_state->dsc.compression_enable = dss_ctl2 & LEFT_BRANCH_VDSC_ENABLE; if (!crtc_state->dsc.compression_enable) goto out; - crtc_state->dsc.dsc_split = (dss_ctl2 & RIGHT_BRANCH_VDSC_ENABLE) && - (dss_ctl1 & JOINER_ENABLE); - intel_dsc_get_pps_config(crtc_state); out: intel_display_power_put(dev_priv, power_domain, wakeref); diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.h b/drivers/gpu/drm/i915/display/intel_vdsc.h index 290b2e9b3482..345956d0c77e 100644 --- a/drivers/gpu/drm/i915/display/intel_vdsc.h +++ b/drivers/gpu/drm/i915/display/intel_vdsc.h @@ -16,7 +16,6 @@ struct intel_crtc_state; struct intel_encoder; bool intel_dsc_source_support(const struct intel_crtc_state *crtc_state); -void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state); void intel_dsc_enable(const struct intel_crtc_state *crtc_state); void intel_dsc_disable(const struct intel_crtc_state *crtc_state); int intel_dsc_compute_params(struct intel_crtc_state *pipe_config); @@ -31,5 +30,6 @@ void intel_dsc_dp_pps_write(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state); void intel_vdsc_state_dump(struct drm_printer *p, int indent, const struct intel_crtc_state *crtc_state); +bool intel_dsc_is_dsc_pipe(struct intel_crtc *crtc, enum transcoder cpu_transcoder); #endif /* __INTEL_VDSC_H__ */ From patchwork Thu Aug 29 13:18:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783213 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 D0BC0C83F17 for ; Thu, 29 Aug 2024 13:17:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D42310E690; Thu, 29 Aug 2024 13:17:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Ez/w5zwx"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7999710E695; Thu, 29 Aug 2024 13:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937436; x=1756473436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=se4hm+XelaASNCKt5jQijYX0A75nDFCEM9KN5cHIhyk=; b=Ez/w5zwx/45RKSWDEV29NmM7lEZ8DijdLkKmDzFDBIANIVwPuZoDTRfs 7XQnVF99razEYEdhDiJb5WSDqIWZwRnSo8tvVZy1pAazKDkGCNAtFi1eF mMQYUDkPtTDtLvA/N+wWHF0jbQ8wpGHmbLlvMvKJzs8p0q6Y+faiW4AAy 5c4Uurx6WXXTU+jnzma5+C0dEDdApeKmClmBbCfkcAxS2u+EiKCUtexwg 94ExVxwHD9KAd5xRP7nl62oefBLZvNs3MtOBlEyv2pavhHWGXaVccE0It gBLWK/ktBUhRJrwJUxRQbAqwcLJxz9g1/qcRYAxR+VH7spwZGkq3wTSyh g==; X-CSE-ConnectionGUID: bdLpfU8LRc6mcO28wkFcJw== X-CSE-MsgGUID: +Izb33niSf2Fg6QBUds6Sg== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667259" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667259" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:16 -0700 X-CSE-ConnectionGUID: jU2RZMDEQ2udGbJXjcS9SQ== X-CSE-MsgGUID: wM6SgJk2SxmN8YT71XheEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261580" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:13 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 10/19] drm/i915/dss: Use struct intel_display in dss dsc helpers Date: Thu, 29 Aug 2024 18:48:18 +0530 Message-ID: <20240829131828.2350930-11-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Replace struct drm_i915_private with intel_display in the dss dsc helpers. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dss.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index b37e9112ab77..fe55f4b1a9bf 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -154,17 +154,17 @@ static i915_reg_t dss_ctl2_reg(struct intel_crtc *crtc, enum transcoder cpu_tran void intel_dss_reset(const struct intel_crtc_state *old_crtc_state) { + struct intel_display *display = to_intel_display(old_crtc_state); struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); - intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); - intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); + intel_de_write(display, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); + intel_de_write(display, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); } void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(crtc_state); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); u32 dss_ctl1_val = 0; if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { @@ -173,7 +173,7 @@ void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_st else dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY; - intel_de_write(dev_priv, + intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); } @@ -182,8 +182,8 @@ void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_st void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_state, int vdsc_instances_per_pipe) { + struct intel_display *display = to_intel_display(crtc_state); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); u32 dss_ctl1_val = 0; u32 dss_ctl2_val = 0; @@ -197,18 +197,18 @@ void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_stat if (!intel_crtc_is_joiner_secondary(crtc_state)) dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE; } - intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); - intel_de_write(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); + intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); + intel_de_write(display, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); } void intel_dss_dsc_get_config(struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(crtc_state); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); u32 dss_ctl1, dss_ctl2; - dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder)); - dss_ctl2 = intel_de_read(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder)); + dss_ctl1 = intel_de_read(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder)); + dss_ctl2 = intel_de_read(display, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder)); crtc_state->dsc.compression_enable = dss_ctl2 & LEFT_BRANCH_VDSC_ENABLE; if (!crtc_state->dsc.compression_enable) From patchwork Thu Aug 29 13:18:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783215 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 9B660C83F1A for ; Thu, 29 Aug 2024 13:17:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43A0410E699; Thu, 29 Aug 2024 13:17:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="iic/9tDs"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 660DC10E693; Thu, 29 Aug 2024 13:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937438; x=1756473438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gc8KVFAQv+KwDrX26GeMNrzPHUB4d3JJeobacXyJdQA=; b=iic/9tDs72RFywt2qr5Kgj+VdFMKQgCu0FPyMmWuPI2NrAslL/ynUtwa F8JqsmqT9ThXJYiS0ZoBbyU9IwrzykSHCP+RO7GS+h13Nm2KLyvJIziWX twsjU+RsZv9oOIKZ75muUkPF17r6o1NtN5mEJ/8xWBfbwz3RBLvD9oMdn 4tYgx2Gxfj7XFPOatYDr7qovmo/TZ8WjrvlCwOw2/gz9KVyJYCv64OxqH 4HMCOhmw0dxnDRFSYGUiKuwNLTCA+GYT0sNG3bWTNmHb4ZDa08SGIf1dk 5xMmfyDoEOSml75mJpgQNf0xHfdbD2JeoMP5m907y4k0a2kic/U+yAca/ g==; X-CSE-ConnectionGUID: SfW3V7gyTleCZ2RLPSUhxw== X-CSE-MsgGUID: t3vOx4Q1RmqhYAaXTyrMiw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667266" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667266" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:18 -0700 X-CSE-ConnectionGUID: ABAMMkfOTVSmGkUrvqCU7w== X-CSE-MsgGUID: kDcGjc5WSBWecODYPiEz8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261604" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:15 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 11/19] drm/i915/display: Move dss stuff in intel_dss files Date: Thu, 29 Aug 2024 18:48:19 +0530 Message-ID: <20240829131828.2350930-12-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move helper to retrieve the compressed and uncompressed joiner pipes from dss ctl to intel_dss files. v2: Derive intel_display from crtc. (Jani) Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 34 +++----------- drivers/gpu/drm/i915/display/intel_dss.c | 48 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dss.h | 7 +++ 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 05ffd28cc16a..3d7990f8f20f 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -3545,35 +3545,13 @@ static void enabled_joiner_pipes(struct drm_i915_private *dev_priv, for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, crtc, joiner_pipes(dev_priv)) { - enum intel_display_power_domain power_domain; - enum pipe pipe = crtc->pipe; - intel_wakeref_t wakeref; - - power_domain = intel_dsc_power_domain(crtc, (enum transcoder) pipe); - with_intel_display_power_if_enabled(dev_priv, power_domain, wakeref) { - u32 tmp = intel_de_read(dev_priv, ICL_PIPE_DSS_CTL1(pipe)); + intel_dss_get_compressed_joiner_pipes(crtc, + primary_pipes, + secondary_pipes); - if (!(tmp & BIG_JOINER_ENABLE)) - continue; - - if (tmp & PRIMARY_BIG_JOINER_ENABLE) - *primary_pipes |= BIT(pipe); - else - *secondary_pipes |= BIT(pipe); - } - - if (DISPLAY_VER(dev_priv) < 13) - continue; - - power_domain = POWER_DOMAIN_PIPE(pipe); - with_intel_display_power_if_enabled(dev_priv, power_domain, wakeref) { - u32 tmp = intel_de_read(dev_priv, ICL_PIPE_DSS_CTL1(pipe)); - - if (tmp & UNCOMPRESSED_JOINER_PRIMARY) - *primary_pipes |= BIT(pipe); - if (tmp & UNCOMPRESSED_JOINER_SECONDARY) - *secondary_pipes |= BIT(pipe); - } + intel_dss_get_uncompressed_joiner_pipes(crtc, + primary_pipes, + secondary_pipes); } /* Joiner pipes should always be consecutive primary and secondary */ diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index fe55f4b1a9bf..01303feadcef 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -217,3 +217,51 @@ void intel_dss_dsc_get_config(struct intel_crtc_state *crtc_state) crtc_state->dsc.dsc_split = (dss_ctl2 & RIGHT_BRANCH_VDSC_ENABLE) && (dss_ctl1 & JOINER_ENABLE); } + +void intel_dss_get_compressed_joiner_pipes(struct intel_crtc *crtc, + u8 *primary_pipes, + u8 *secondary_pipes) +{ + struct intel_display *display = to_intel_display(crtc); + struct drm_i915_private *i915 = to_i915(display->drm); + enum intel_display_power_domain power_domain; + enum pipe pipe = crtc->pipe; + intel_wakeref_t wakeref; + + power_domain = intel_dsc_power_domain(crtc, (enum transcoder) pipe); + with_intel_display_power_if_enabled(i915, power_domain, wakeref) { + u32 tmp = intel_de_read(display, ICL_PIPE_DSS_CTL1(pipe)); + + if (!(tmp & BIG_JOINER_ENABLE)) + continue; + + if (tmp & PRIMARY_BIG_JOINER_ENABLE) + *primary_pipes |= BIT(pipe); + else + *secondary_pipes |= BIT(pipe); + } +} + +void intel_dss_get_uncompressed_joiner_pipes(struct intel_crtc *crtc, + u8 *primary_pipes, + u8 *secondary_pipes) +{ + struct intel_display *display = to_intel_display(crtc); + struct drm_i915_private *i915 = to_i915(display->drm); + enum intel_display_power_domain power_domain; + enum pipe pipe = crtc->pipe; + intel_wakeref_t wakeref; + + if (DISPLAY_VER(display) < 13) + return; + + power_domain = POWER_DOMAIN_PIPE(pipe); + with_intel_display_power_if_enabled(i915, power_domain, wakeref) { + u32 tmp = intel_de_read(display, ICL_PIPE_DSS_CTL1(pipe)); + + if (tmp & UNCOMPRESSED_JOINER_PRIMARY) + *primary_pipes |= BIT(pipe); + if (tmp & UNCOMPRESSED_JOINER_SECONDARY) + *secondary_pipes |= BIT(pipe); + } +} diff --git a/drivers/gpu/drm/i915/display/intel_dss.h b/drivers/gpu/drm/i915/display/intel_dss.h index cb204db56153..6a74404bd76d 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.h +++ b/drivers/gpu/drm/i915/display/intel_dss.h @@ -11,6 +11,7 @@ struct intel_crtc_state; struct intel_display; struct intel_encoder; +struct intel_crtc; u8 intel_dss_mso_pipe_mask(struct intel_display *display); void intel_dss_mso_get_config(struct intel_encoder *encoder, @@ -24,6 +25,12 @@ void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_st void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_state, int vdsc_instances_per_pipe); void intel_dss_dsc_get_config(struct intel_crtc_state *crtc_state); +void intel_dss_get_compressed_joiner_pipes(struct intel_crtc *crtc, + u8 *primary_pipes, + u8 *secondary_pipes); +void intel_dss_get_uncompressed_joiner_pipes(struct intel_crtc *crtc, + u8 *primary_pipes, + u8 *secondary_pipes); #endif /* __INTEL_DSS_H__ */ From patchwork Thu Aug 29 13:18:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783214 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 4A26FC83F16 for ; Thu, 29 Aug 2024 13:17:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA1F010E695; Thu, 29 Aug 2024 13:17:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lFg2kHE0"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5622910E699; Thu, 29 Aug 2024 13:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937440; x=1756473440; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6YVR7KBXJaDNQ1rIsSeuKXadBfzofukr2UkYNEj+uJ0=; b=lFg2kHE0fc7Ntm8RUjvv0BV6cktcMRrDuM4vuWDxwHDK5RKoI1e8ag44 I/DxIrlh4DamPluzj4PJACUKgFV86ck41RAffCbLxBHWTb3JYHfyBrs5j 4gUf3t+BoYEooUcBKXPeHomY6r6TwQvMoiyrpfCdSdjbCWCV9F0Bg1QJL 9hjgd51E1sV0ixQdpXyE8vLttn7NbdqJp+SE9z+Zb+qKftGSynS9LJ20I gdaKVSEqIrK+/jC4YFRj3xFrQDZyfrwBKLZU1DZ09m6LAHaNOTktrRtmS 6WyiCoydlmga4FJNAwpe88cniZxtEODCBtrO2otX2ddZn+wQbo9w05xDE Q==; X-CSE-ConnectionGUID: QMm8L2NbT1e9PHmDsGAVHA== X-CSE-MsgGUID: 9uRZDf6lRFCYqYRcSV/gmw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667270" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667270" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:20 -0700 X-CSE-ConnectionGUID: lIwC8MdAQFGpWyEKeGYrCQ== X-CSE-MsgGUID: hfC+xpwkTwyP7s5rpBrNaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261642" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:17 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 12/19] drm/i915/display: Rename static functions that use joiner Date: Thu, 29 Aug 2024 18:48:20 +0530 Message-ID: <20240829131828.2350930-13-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" At the moment, many functions that are concerned with joiner have different prefixes. Rename the static functions, to have a prefix 'intel_joiner'. This will make the movement of these helpers to a separate file for pipe joiner. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 56 +++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 3d7990f8f20f..371318f69d1d 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -249,7 +249,7 @@ is_trans_port_sync_mode(const struct intel_crtc_state *crtc_state) is_trans_port_sync_slave(crtc_state); } -static enum pipe joiner_primary_pipe(const struct intel_crtc_state *crtc_state) +static enum pipe intel_joiner_get_primary_pipe(const struct intel_crtc_state *crtc_state) { return ffs(crtc_state->joiner_pipes) - 1; } @@ -257,7 +257,7 @@ static enum pipe joiner_primary_pipe(const struct intel_crtc_state *crtc_state) u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state) { if (crtc_state->joiner_pipes) - return crtc_state->joiner_pipes & ~BIT(joiner_primary_pipe(crtc_state)); + return crtc_state->joiner_pipes & ~BIT(intel_joiner_get_primary_pipe(crtc_state)); else return 0; } @@ -267,7 +267,7 @@ bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state) struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); return crtc_state->joiner_pipes && - crtc->pipe != joiner_primary_pipe(crtc_state); + crtc->pipe != intel_joiner_get_primary_pipe(crtc_state); } bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) @@ -275,10 +275,10 @@ bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); return crtc_state->joiner_pipes && - crtc->pipe == joiner_primary_pipe(crtc_state); + crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); } -static int intel_joiner_num_pipes(const struct intel_crtc_state *crtc_state) +static int intel_joiner_get_num_pipes(const struct intel_crtc_state *crtc_state) { return hweight8(crtc_state->joiner_pipes); } @@ -295,7 +295,7 @@ struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state) struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); if (intel_crtc_is_joiner_secondary(crtc_state)) - return intel_crtc_for_pipe(i915, joiner_primary_pipe(crtc_state)); + return intel_crtc_for_pipe(i915, intel_joiner_get_primary_pipe(crtc_state)); else return to_intel_crtc(crtc_state->uapi.crtc); } @@ -2344,7 +2344,7 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state) static void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, struct drm_display_mode *mode) { - int num_pipes = intel_joiner_num_pipes(crtc_state); + int num_pipes = intel_joiner_get_num_pipes(crtc_state); if (num_pipes < 2) return; @@ -2408,7 +2408,7 @@ static void intel_crtc_readout_derived_state(struct intel_crtc_state *crtc_state drm_mode_copy(mode, pipe_mode); intel_mode_from_crtc_timings(mode, mode); mode->hdisplay = drm_rect_width(&crtc_state->pipe_src) * - (intel_joiner_num_pipes(crtc_state) ?: 1); + (intel_joiner_get_num_pipes(crtc_state) ?: 1); mode->vdisplay = drm_rect_height(&crtc_state->pipe_src); /* Derive per-pipe timings in case joiner is used */ @@ -2428,7 +2428,7 @@ void intel_encoder_get_config(struct intel_encoder *encoder, static void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state) { - int num_pipes = intel_joiner_num_pipes(crtc_state); + int num_pipes = intel_joiner_get_num_pipes(crtc_state); int width, height; if (num_pipes < 2) @@ -2888,14 +2888,14 @@ static void intel_get_transcoder_timings(struct intel_crtc *crtc, static void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state) { struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - int num_pipes = intel_joiner_num_pipes(crtc_state); + int num_pipes = intel_joiner_get_num_pipes(crtc_state); enum pipe primary_pipe, pipe = crtc->pipe; int width; if (num_pipes < 2) return; - primary_pipe = joiner_primary_pipe(crtc_state); + primary_pipe = intel_joiner_get_primary_pipe(crtc_state); width = drm_rect_width(&crtc_state->pipe_src); drm_rect_translate_to(&crtc_state->pipe_src, @@ -3505,7 +3505,7 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc, return ret; } -static u8 joiner_pipes(struct drm_i915_private *i915) +static u8 intel_joiner_supported_pipes(struct drm_i915_private *i915) { u8 pipes; @@ -3535,8 +3535,8 @@ static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, return tmp & TRANS_DDI_FUNC_ENABLE; } -static void enabled_joiner_pipes(struct drm_i915_private *dev_priv, - u8 *primary_pipes, u8 *secondary_pipes) +static void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, + u8 *primary_pipes, u8 *secondary_pipes) { struct intel_crtc *crtc; @@ -3544,7 +3544,7 @@ static void enabled_joiner_pipes(struct drm_i915_private *dev_priv, *secondary_pipes = 0; for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, crtc, - joiner_pipes(dev_priv)) { + intel_joiner_supported_pipes(dev_priv)) { intel_dss_get_compressed_joiner_pipes(crtc, primary_pipes, secondary_pipes); @@ -3560,7 +3560,9 @@ static void enabled_joiner_pipes(struct drm_i915_private *dev_priv, *primary_pipes, *secondary_pipes); } -static enum pipe get_joiner_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes) +static enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, + u8 primary_pipes, + u8 secondary_pipes) { if ((secondary_pipes & BIT(pipe)) == 0) return pipe; @@ -3572,11 +3574,13 @@ static enum pipe get_joiner_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 se return fls(primary_pipes) - 1; } -static u8 get_joiner_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes) +static u8 intel_joiner_find_secondary_pipes(enum pipe pipe, + u8 primary_pipes, + u8 secondary_pipes) { enum pipe primary_pipe, next_primary_pipe; - primary_pipe = get_joiner_primary_pipe(pipe, primary_pipes, secondary_pipes); + primary_pipe = intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes); if ((primary_pipes & BIT(primary_pipe)) == 0) return 0; @@ -3660,10 +3664,10 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) enabled_transcoders |= BIT(cpu_transcoder); /* joiner secondary -> consider the primary pipe's transcoder as well */ - enabled_joiner_pipes(dev_priv, &primary_pipes, &secondary_pipes); + intel_joiner_enabled_pipes(dev_priv, &primary_pipes, &secondary_pipes); if (secondary_pipes & BIT(crtc->pipe)) { cpu_transcoder = (enum transcoder) - get_joiner_primary_pipe(crtc->pipe, primary_pipes, secondary_pipes); + intel_joiner_find_primary_pipe(crtc->pipe, primary_pipes, secondary_pipes); if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder)) enabled_transcoders |= BIT(cpu_transcoder); } @@ -3797,14 +3801,14 @@ static void intel_joiner_get_config(struct intel_crtc_state *crtc_state) u8 primary_pipes, secondary_pipes; enum pipe pipe = crtc->pipe; - enabled_joiner_pipes(i915, &primary_pipes, &secondary_pipes); + intel_joiner_enabled_pipes(i915, &primary_pipes, &secondary_pipes); if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0) return; crtc_state->joiner_pipes = - BIT(get_joiner_primary_pipe(pipe, primary_pipes, secondary_pipes)) | - get_joiner_secondary_pipes(pipe, primary_pipes, secondary_pipes); + BIT(intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes)) | + intel_joiner_find_secondary_pipes(pipe, primary_pipes, secondary_pipes); } static bool hsw_get_pipe_config(struct intel_crtc *crtc, @@ -5987,15 +5991,15 @@ static int intel_atomic_check_joiner(struct intel_atomic_state *state, /* sanity check */ if (drm_WARN_ON(&i915->drm, - primary_crtc->pipe != joiner_primary_pipe(primary_crtc_state))) + primary_crtc->pipe != intel_joiner_get_primary_pipe(primary_crtc_state))) return -EINVAL; - if (primary_crtc_state->joiner_pipes & ~joiner_pipes(i915)) { + if (primary_crtc_state->joiner_pipes & ~intel_joiner_supported_pipes(i915)) { drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] Cannot act as joiner primary " "(need 0x%x as pipes, only 0x%x possible)\n", primary_crtc->base.base.id, primary_crtc->base.name, - primary_crtc_state->joiner_pipes, joiner_pipes(i915)); + primary_crtc_state->joiner_pipes, intel_joiner_supported_pipes(i915)); return -EINVAL; } From patchwork Thu Aug 29 13:18:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783217 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 8F405C83F18 for ; Thu, 29 Aug 2024 13:17:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3844A10E696; Thu, 29 Aug 2024 13:17:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OIK9dQBc"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CF1910E69A; Thu, 29 Aug 2024 13:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937442; x=1756473442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FW7XZVkIDLtCNp0XKkOGIhlYNvCwf6sIPArOSPd9TJQ=; b=OIK9dQBcvMcQ5PluGgIP0azxfFuCnmpj/kvIC3Bk/N9bI+CsC1ITHd/c W3kIaYlh0jVpgtYJOl9s3/R+WyiqMEAtraDQbLB2y4DD1LH6GlvYr7RYp ZSbCdqbOZvvnjhiPSRvbo01ggqgFwuDuXmzADLB0b+A9c7A2NlOsA/3Zu /uvBDsQwNyar6E9ajG//JzWyLAGn2+e8xNhUXZGYfx/BSQiwbc38Xr0+K sRSuPDIc/XLyH44VEz6BCLi1kEdW3fIitP5WHa67N8nZRnwd4LO5NugMn Pm4vP5qxjhhTp/odniVmpKKUZ1MQCcsEAD8D5YJH8s3foO7TcoTATH/8P Q==; X-CSE-ConnectionGUID: atAFz445QNKSAntMI6gx0A== X-CSE-MsgGUID: pfgzBxxLStWGNLPK2Vq2Hw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667273" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667273" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:22 -0700 X-CSE-ConnectionGUID: XJvsHRuhSuu17Ju7DMX6aA== X-CSE-MsgGUID: UfPIyfXQR6GkBPAt1qE/3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261661" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:19 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 13/19] drm/i915/display: Separate out joiner stuff in a new file Date: Thu, 29 Aug 2024 18:48:21 +0530 Message-ID: <20240829131828.2350930-14-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move all the static functions intel_joiner* to the new file intel_joiner.c. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_display.c | 234 +------------------ drivers/gpu/drm/i915/display/intel_display.h | 5 + drivers/gpu/drm/i915/display/intel_joiner.c | 233 ++++++++++++++++++ drivers/gpu/drm/i915/display/intel_joiner.h | 32 +++ drivers/gpu/drm/xe/Makefile | 1 + 6 files changed, 278 insertions(+), 228 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_joiner.c create mode 100644 drivers/gpu/drm/i915/display/intel_joiner.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index e55ce8ba123c..c337385bbe7d 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -333,6 +333,7 @@ i915-y += \ display/intel_encoder.o \ display/intel_gmbus.o \ display/intel_hdmi.o \ + display/intel_joiner.o \ display/intel_lspcon.o \ display/intel_lvds.o \ display/intel_panel.o \ diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 371318f69d1d..49591d108565 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -97,6 +97,7 @@ #include "intel_frontbuffer.h" #include "intel_hdmi.h" #include "intel_hotplug.h" +#include "intel_joiner.h" #include "intel_link_bw.h" #include "intel_lvds.h" #include "intel_lvds_regs.h" @@ -249,11 +250,6 @@ is_trans_port_sync_mode(const struct intel_crtc_state *crtc_state) is_trans_port_sync_slave(crtc_state); } -static enum pipe intel_joiner_get_primary_pipe(const struct intel_crtc_state *crtc_state) -{ - return ffs(crtc_state->joiner_pipes) - 1; -} - u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state) { if (crtc_state->joiner_pipes) @@ -278,11 +274,6 @@ bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); } -static int intel_joiner_get_num_pipes(const struct intel_crtc_state *crtc_state) -{ - return hweight8(crtc_state->joiner_pipes); -} - u8 intel_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state) { struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); @@ -2341,23 +2332,6 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state) ilk_pipe_pixel_rate(crtc_state); } -static void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, - struct drm_display_mode *mode) -{ - int num_pipes = intel_joiner_get_num_pipes(crtc_state); - - if (num_pipes < 2) - return; - - mode->crtc_clock /= num_pipes; - mode->crtc_hdisplay /= num_pipes; - mode->crtc_hblank_start /= num_pipes; - mode->crtc_hblank_end /= num_pipes; - mode->crtc_hsync_start /= num_pipes; - mode->crtc_hsync_end /= num_pipes; - mode->crtc_htotal /= num_pipes; -} - static void intel_splitter_adjust_timings(const struct intel_crtc_state *crtc_state, struct drm_display_mode *mode) { @@ -2426,21 +2400,6 @@ void intel_encoder_get_config(struct intel_encoder *encoder, intel_crtc_readout_derived_state(crtc_state); } -static void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state) -{ - int num_pipes = intel_joiner_get_num_pipes(crtc_state); - int width, height; - - if (num_pipes < 2) - return; - - width = drm_rect_width(&crtc_state->pipe_src); - height = drm_rect_height(&crtc_state->pipe_src); - - drm_rect_init(&crtc_state->pipe_src, 0, 0, - width / num_pipes, height); -} - static int intel_crtc_compute_pipe_src(struct intel_crtc_state *crtc_state) { struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); @@ -2885,23 +2844,6 @@ static void intel_get_transcoder_timings(struct intel_crtc *crtc, TRANS_SET_CONTEXT_LATENCY(dev_priv, cpu_transcoder)); } -static void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - int num_pipes = intel_joiner_get_num_pipes(crtc_state); - enum pipe primary_pipe, pipe = crtc->pipe; - int width; - - if (num_pipes < 2) - return; - - primary_pipe = intel_joiner_get_primary_pipe(crtc_state); - width = drm_rect_width(&crtc_state->pipe_src); - - drm_rect_translate_to(&crtc_state->pipe_src, - (pipe - primary_pipe) * width, 0); -} - static void intel_get_pipe_src_size(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config) { @@ -3505,20 +3447,6 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc, return ret; } -static u8 intel_joiner_supported_pipes(struct drm_i915_private *i915) -{ - u8 pipes; - - if (DISPLAY_VER(i915) >= 12) - pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D); - else if (DISPLAY_VER(i915) >= 11) - pipes = BIT(PIPE_B) | BIT(PIPE_C); - else - pipes = 0; - - return pipes & DISPLAY_RUNTIME_INFO(i915)->pipe_mask; -} - static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, enum transcoder cpu_transcoder) { @@ -3535,66 +3463,6 @@ static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv, return tmp & TRANS_DDI_FUNC_ENABLE; } -static void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, - u8 *primary_pipes, u8 *secondary_pipes) -{ - struct intel_crtc *crtc; - - *primary_pipes = 0; - *secondary_pipes = 0; - - for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, crtc, - intel_joiner_supported_pipes(dev_priv)) { - intel_dss_get_compressed_joiner_pipes(crtc, - primary_pipes, - secondary_pipes); - - intel_dss_get_uncompressed_joiner_pipes(crtc, - primary_pipes, - secondary_pipes); - } - - /* Joiner pipes should always be consecutive primary and secondary */ - drm_WARN(&dev_priv->drm, *secondary_pipes != *primary_pipes << 1, - "Joiner misconfigured (primary pipes 0x%x, secondary pipes 0x%x)\n", - *primary_pipes, *secondary_pipes); -} - -static enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, - u8 primary_pipes, - u8 secondary_pipes) -{ - if ((secondary_pipes & BIT(pipe)) == 0) - return pipe; - - /* ignore everything above our pipe */ - primary_pipes &= ~GENMASK(7, pipe); - - /* highest remaining bit should be our primary pipe */ - return fls(primary_pipes) - 1; -} - -static u8 intel_joiner_find_secondary_pipes(enum pipe pipe, - u8 primary_pipes, - u8 secondary_pipes) -{ - enum pipe primary_pipe, next_primary_pipe; - - primary_pipe = intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes); - - if ((primary_pipes & BIT(primary_pipe)) == 0) - return 0; - - /* ignore our primary pipe and everything below it */ - primary_pipes &= ~GENMASK(primary_pipe, 0); - /* make sure a high bit is set for the ffs() */ - primary_pipes |= BIT(7); - /* lowest remaining bit should be the next primary pipe */ - next_primary_pipe = ffs(primary_pipes) - 1; - - return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe); -} - static u8 hsw_panel_transcoders(struct drm_i915_private *i915) { u8 panel_transcoder_mask = BIT(TRANSCODER_EDP); @@ -3794,23 +3662,6 @@ static bool bxt_get_dsi_transcoder_state(struct intel_crtc *crtc, return transcoder_is_dsi(pipe_config->cpu_transcoder); } -static void intel_joiner_get_config(struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); - u8 primary_pipes, secondary_pipes; - enum pipe pipe = crtc->pipe; - - intel_joiner_enabled_pipes(i915, &primary_pipes, &secondary_pipes); - - if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0) - return; - - crtc_state->joiner_pipes = - BIT(intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes)) | - intel_joiner_find_secondary_pipes(pipe, primary_pipes, secondary_pipes); -} - static bool hsw_get_pipe_config(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config) { @@ -5822,9 +5673,9 @@ static bool active_planes_affects_min_cdclk(struct drm_i915_private *dev_priv) IS_IVYBRIDGE(dev_priv); } -static int intel_crtc_add_joiner_planes(struct intel_atomic_state *state, - struct intel_crtc *crtc, - struct intel_crtc *other) +int intel_crtc_add_joiner_planes(struct intel_atomic_state *state, + struct intel_crtc *crtc, + struct intel_crtc *other) { const struct intel_plane_state __maybe_unused *plane_state; struct intel_plane *plane; @@ -5839,32 +5690,6 @@ static int intel_crtc_add_joiner_planes(struct intel_atomic_state *state, return intel_crtc_add_planes_to_state(state, other, plane_ids); } -static int intel_joiner_add_affected_planes(struct intel_atomic_state *state) -{ - struct drm_i915_private *i915 = to_i915(state->base.dev); - const struct intel_crtc_state *crtc_state; - struct intel_crtc *crtc; - int i; - - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { - struct intel_crtc *other; - - for_each_intel_crtc_in_pipe_mask(&i915->drm, other, - crtc_state->joiner_pipes) { - int ret; - - if (crtc == other) - continue; - - ret = intel_crtc_add_joiner_planes(state, crtc, other); - if (ret) - return ret; - } - } - - return 0; -} - static int intel_atomic_check_planes(struct intel_atomic_state *state) { struct drm_i915_private *dev_priv = to_i915(state->base.dev); @@ -6049,8 +5874,8 @@ static int intel_atomic_check_joiner(struct intel_atomic_state *state, return 0; } -static void kill_joiner_secondaries(struct intel_atomic_state *state, - struct intel_crtc *primary_crtc) +void intel_crtc_kill_joiner_secondaries(struct intel_atomic_state *state, + struct intel_crtc *primary_crtc) { struct drm_i915_private *i915 = to_i915(state->base.dev); struct intel_crtc_state *primary_crtc_state = @@ -6349,53 +6174,6 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct in return 0; } -static int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state) -{ - struct drm_i915_private *i915 = to_i915(state->base.dev); - struct intel_crtc_state *crtc_state; - struct intel_crtc *crtc; - u8 affected_pipes = 0; - u8 modeset_pipes = 0; - int i; - - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { - affected_pipes |= crtc_state->joiner_pipes; - if (intel_crtc_needs_modeset(crtc_state)) - modeset_pipes |= crtc_state->joiner_pipes; - } - - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, affected_pipes) { - crtc_state = intel_atomic_get_crtc_state(&state->base, crtc); - if (IS_ERR(crtc_state)) - return PTR_ERR(crtc_state); - } - - for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, modeset_pipes) { - int ret; - - crtc_state = intel_atomic_get_new_crtc_state(state, crtc); - - crtc_state->uapi.mode_changed = true; - - ret = drm_atomic_add_affected_connectors(&state->base, &crtc->base); - if (ret) - return ret; - - ret = intel_atomic_add_affected_planes(state, crtc); - if (ret) - return ret; - } - - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { - /* Kill old joiner link, we may re-establish afterwards */ - if (intel_crtc_needs_modeset(crtc_state) && - intel_crtc_is_joiner_primary(crtc_state)) - kill_joiner_secondaries(state, crtc); - } - - return 0; -} - static int intel_atomic_check_config(struct intel_atomic_state *state, struct intel_link_bw_limits *limits, enum pipe *failed_pipe) diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index b0cf6ca70952..37d658bfd235 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -583,5 +583,10 @@ bool assert_port_valid(struct drm_i915_private *i915, enum port port); }) bool intel_scanout_needs_vtd_wa(struct drm_i915_private *i915); +int intel_crtc_add_joiner_planes(struct intel_atomic_state *state, + struct intel_crtc *crtc, + struct intel_crtc *other); +void intel_crtc_kill_joiner_secondaries(struct intel_atomic_state *state, + struct intel_crtc *primary_crtc); #endif diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c new file mode 100644 index 000000000000..b24dfdbc9840 --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2024 Intel Corporation + */ + +#include + +#include "i915_drv.h" +#include "intel_atomic.h" +#include "intel_display.h" +#include "intel_display_device.h" +#include "intel_display_types.h" +#include "intel_dss.h" +#include "intel_joiner.h" + +enum pipe intel_joiner_get_primary_pipe(const struct intel_crtc_state *crtc_state) +{ + return ffs(crtc_state->joiner_pipes) - 1; +} + +int intel_joiner_get_num_pipes(const struct intel_crtc_state *crtc_state) +{ + return hweight8(crtc_state->joiner_pipes); +} + +void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, + struct drm_display_mode *mode) +{ + int num_pipes = intel_joiner_get_num_pipes(crtc_state); + + if (num_pipes < 2) + return; + + mode->crtc_clock /= num_pipes; + mode->crtc_hdisplay /= num_pipes; + mode->crtc_hblank_start /= num_pipes; + mode->crtc_hblank_end /= num_pipes; + mode->crtc_hsync_start /= num_pipes; + mode->crtc_hsync_end /= num_pipes; + mode->crtc_htotal /= num_pipes; +} + +void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state) +{ + int num_pipes = intel_joiner_get_num_pipes(crtc_state); + int width, height; + + if (num_pipes < 2) + return; + + width = drm_rect_width(&crtc_state->pipe_src); + height = drm_rect_height(&crtc_state->pipe_src); + + drm_rect_init(&crtc_state->pipe_src, 0, 0, + width / num_pipes, height); +} + +void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + int num_pipes = intel_joiner_get_num_pipes(crtc_state); + enum pipe primary_pipe, pipe = crtc->pipe; + int width; + + if (num_pipes < 2) + return; + + primary_pipe = intel_joiner_get_primary_pipe(crtc_state); + width = drm_rect_width(&crtc_state->pipe_src); + + drm_rect_translate_to(&crtc_state->pipe_src, + (pipe - primary_pipe) * width, 0); +} + +u8 intel_joiner_supported_pipes(struct drm_i915_private *i915) +{ + u8 pipes; + + if (DISPLAY_VER(i915) >= 12) + pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D); + else if (DISPLAY_VER(i915) >= 11) + pipes = BIT(PIPE_B) | BIT(PIPE_C); + else + pipes = 0; + + return pipes & DISPLAY_RUNTIME_INFO(i915)->pipe_mask; +} + +void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, + u8 *primary_pipes, u8 *secondary_pipes) +{ + struct intel_crtc *crtc; + + *primary_pipes = 0; + *secondary_pipes = 0; + + for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, crtc, + intel_joiner_supported_pipes(dev_priv)) { + intel_dss_get_compressed_joiner_pipes(crtc, + primary_pipes, + secondary_pipes); + + intel_dss_get_uncompressed_joiner_pipes(crtc, + primary_pipes, + secondary_pipes); + } + + /* Joiner pipes should always be consecutive primary and secondary */ + drm_WARN(&dev_priv->drm, *secondary_pipes != *primary_pipes << 1, + "Joiner misconfigured (primary pipes 0x%x, secondary pipes 0x%x)\n", + *primary_pipes, *secondary_pipes); +} + +enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes) +{ + if ((secondary_pipes & BIT(pipe)) == 0) + return pipe; + + /* ignore everything above our pipe */ + primary_pipes &= ~GENMASK(7, pipe); + + /* highest remaining bit should be our primary pipe */ + return fls(primary_pipes) - 1; +} + +u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes) +{ + enum pipe primary_pipe, next_primary_pipe; + + primary_pipe = intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes); + + if ((primary_pipes & BIT(primary_pipe)) == 0) + return 0; + + /* ignore our primary pipe and everything below it */ + primary_pipes &= ~GENMASK(primary_pipe, 0); + /* make sure a high bit is set for the ffs() */ + primary_pipes |= BIT(7); + /* lowest remaining bit should be the next primary pipe */ + next_primary_pipe = ffs(primary_pipes) - 1; + + return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe); +} + +void intel_joiner_get_config(struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + struct drm_i915_private *i915 = to_i915(crtc->base.dev); + u8 primary_pipes, secondary_pipes; + enum pipe pipe = crtc->pipe; + + intel_joiner_enabled_pipes(i915, &primary_pipes, &secondary_pipes); + + if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0) + return; + + crtc_state->joiner_pipes = + BIT(intel_joiner_find_primary_pipe(pipe, primary_pipes, secondary_pipes)) | + intel_joiner_find_secondary_pipes(pipe, primary_pipes, secondary_pipes); +} + +int intel_joiner_add_affected_planes(struct intel_atomic_state *state) +{ + struct drm_i915_private *i915 = to_i915(state->base.dev); + const struct intel_crtc_state *crtc_state; + struct intel_crtc *crtc; + int i; + + for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { + struct intel_crtc *other; + + for_each_intel_crtc_in_pipe_mask(&i915->drm, other, + crtc_state->joiner_pipes) { + int ret; + + if (crtc == other) + continue; + + ret = intel_crtc_add_joiner_planes(state, crtc, other); + if (ret) + return ret; + } + } + + return 0; +} + +int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state) +{ + struct drm_i915_private *i915 = to_i915(state->base.dev); + struct intel_crtc_state *crtc_state; + struct intel_crtc *crtc; + u8 affected_pipes = 0; + u8 modeset_pipes = 0; + int i; + + for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { + affected_pipes |= crtc_state->joiner_pipes; + if (intel_crtc_needs_modeset(crtc_state)) + modeset_pipes |= crtc_state->joiner_pipes; + } + + for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, affected_pipes) { + crtc_state = intel_atomic_get_crtc_state(&state->base, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); + } + + for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, modeset_pipes) { + int ret; + + crtc_state = intel_atomic_get_new_crtc_state(state, crtc); + + crtc_state->uapi.mode_changed = true; + + ret = drm_atomic_add_affected_connectors(&state->base, &crtc->base); + if (ret) + return ret; + + ret = intel_atomic_add_affected_planes(state, crtc); + if (ret) + return ret; + } + + for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { + /* Kill old joiner link, we may re-establish afterwards */ + if (intel_crtc_needs_modeset(crtc_state) && + intel_crtc_is_joiner_primary(crtc_state)) + intel_crtc_kill_joiner_secondaries(state, crtc); + } + + return 0; +} diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h new file mode 100644 index 000000000000..3417274de4a2 --- /dev/null +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright © 2024 Intel Corporation + */ + +#ifndef __INTEL_JOINER_H__ +#define __INTEL_JOINER_H__ + +#include "linux/types.h" + +enum pipe; +struct drm_display_mode; +struct drm_i915_private; +struct intel_atomic_state; +struct intel_crtc_state; + +enum pipe intel_joiner_get_primary_pipe(const struct intel_crtc_state *crtc_state); +int intel_joiner_get_num_pipes(const struct intel_crtc_state *crtc_state); +void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, + struct drm_display_mode *mode); +void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state); +void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state); +u8 intel_joiner_supported_pipes(struct drm_i915_private *i915); +void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, + u8 *primary_pipes, u8 *secondary_pipes); +enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes); +u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes); +void intel_joiner_get_config(struct intel_crtc_state *crtc_state); +int intel_joiner_add_affected_planes(struct intel_atomic_state *state); +int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state); + +#endif/* __INTEL_JOINER_H__ */ diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index 619272783669..fc452dcd1088 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -242,6 +242,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \ i915-display/intel_hotplug.o \ i915-display/intel_hotplug_irq.o \ i915-display/intel_hti.o \ + i915-display/intel_joiner.o \ i915-display/intel_link_bw.o \ i915-display/intel_lspcon.o \ i915-display/intel_modeset_lock.o \ From patchwork Thu Aug 29 13:18:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783216 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 CC379C83F16 for ; Thu, 29 Aug 2024 13:17:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CB1C10E69B; Thu, 29 Aug 2024 13:17:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RcoQwYxY"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 42ED610E69D; Thu, 29 Aug 2024 13:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937444; x=1756473444; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ODIIL+lTchTpILdD2KgQ2gnTBBNIcAqhSHex3lSRKCg=; b=RcoQwYxY9RBH0iQx0H8Dm3AsLikFw6E2AEd51w3PaNj9YYVYewPp2G0B jv5cVtOmm9yQerMij6zm83RKrWYACe1yz/sSxJXE7k0xYObPOQawobNpa KhjNL8d31a+VXZC9dw0cp8YQTvtbrwLzISbzv1EP8oROThm433drFD2Sx UyanUOfiB46v9Ije4ngdK0hS9iHJPBwHB9jIFyaRyJy+Dz728HutlTTAP NeSXOhhuaSQrAOdNNAvYGFUbw+/68WaKpEh+dJtCDzdOE9dw/tv9xiBg+ K1zDepXDfg1PbK/V4b1B/iZ4ahikwyM1uJIYrYWUg3KqMvs456GlST+Zf g==; X-CSE-ConnectionGUID: i2351csATE20gwF7viQmOA== X-CSE-MsgGUID: TtzrOSm/RZCWOLI5bqK4uA== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667278" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667278" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:24 -0700 X-CSE-ConnectionGUID: Y1gRaviURhOpDzrCx4V+1Q== X-CSE-MsgGUID: Tr8MFJ0FQxaFepna7WbwZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261687" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:21 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 14/19] drm/i915/display: Move intel_crtc_joined_pipe_mask to intel_joiner Date: Thu, 29 Aug 2024 18:48:22 +0530 Message-ID: <20240829131828.2350930-15-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the helper to get joined pipe mask to intel_joiner.c Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_ddi.c | 9 ++--- drivers/gpu/drm/i915/display/intel_display.c | 35 ++++++++------------ drivers/gpu/drm/i915/display/intel_display.h | 1 - drivers/gpu/drm/i915/display/intel_dp_mst.c | 7 ++-- drivers/gpu/drm/i915/display/intel_joiner.c | 7 ++++ drivers/gpu/drm/i915/display/intel_joiner.h | 1 + 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index aa176f4d42c4..87dbb7733eda 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -66,6 +66,7 @@ #include "intel_hdmi.h" #include "intel_hotplug.h" #include "intel_hti.h" +#include "intel_joiner.h" #include "intel_lspcon.h" #include "intel_mg_phy_regs.h" #include "intel_modeset_lock.h" @@ -3043,7 +3044,7 @@ static void intel_ddi_post_disable_hdmi_or_sst(struct intel_atomic_state *state, struct intel_crtc *pipe_crtc; for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *old_pipe_crtc_state = intel_atomic_get_old_crtc_state(state, pipe_crtc); @@ -3055,7 +3056,7 @@ static void intel_ddi_post_disable_hdmi_or_sst(struct intel_atomic_state *state, intel_ddi_disable_transcoder_func(old_crtc_state); for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *old_pipe_crtc_state = intel_atomic_get_old_crtc_state(state, pipe_crtc); @@ -3319,7 +3320,7 @@ static void intel_enable_ddi(struct intel_atomic_state *state, intel_ddi_wait_for_fec_status(encoder, crtc_state, true); for_each_intel_crtc_in_pipe_mask_reverse(&i915->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -3429,7 +3430,7 @@ void intel_ddi_update_active_dpll(struct intel_atomic_state *state, return; for_each_intel_crtc_in_pipe_mask(&i915->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(crtc_state)) + intel_joiner_crtc_joined_pipe_mask(crtc_state)) intel_update_active_dpll(state, pipe_crtc, encoder); } diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 49591d108565..e1d5178dc4ec 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -274,13 +274,6 @@ bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); } -u8 intel_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - - return BIT(crtc->pipe) | crtc_state->joiner_pipes; -} - struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); @@ -1679,13 +1672,13 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, return; for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) intel_dmc_enable_pipe(dev_priv, pipe_crtc->pipe); intel_encoders_pre_pll_enable(state, crtc); for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -1696,7 +1689,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, intel_encoders_pre_enable(state, crtc); for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -1715,7 +1708,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, hsw_configure_cpu_transcoder(new_crtc_state); for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -1751,7 +1744,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state, intel_encoders_enable(state, crtc); for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); enum pipe hsw_workaround_pipe; @@ -1846,7 +1839,7 @@ static void hsw_crtc_disable(struct intel_atomic_state *state, intel_encoders_post_disable(state, crtc); for_each_intel_crtc_in_pipe_mask(&i915->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *old_pipe_crtc_state = intel_atomic_get_old_crtc_state(state, pipe_crtc); @@ -1856,7 +1849,7 @@ static void hsw_crtc_disable(struct intel_atomic_state *state, intel_encoders_post_pll_disable(state, crtc); for_each_intel_crtc_in_pipe_mask(&i915->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) intel_dmc_disable_pipe(i915, pipe_crtc->pipe); } @@ -6632,7 +6625,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state, return; for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(new_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(new_crtc_state)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -6745,13 +6738,13 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state, * or we race against vblank off. */ for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) intel_crtc_disable_pipe_crc(pipe_crtc); dev_priv->display.funcs.display->crtc_disable(state, crtc); for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *new_pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); @@ -6816,7 +6809,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) intel_old_crtc_state_disables(state, crtc); - disable_pipes &= ~intel_crtc_joined_pipe_mask(old_crtc_state); + disable_pipes &= ~intel_joiner_crtc_joined_pipe_mask(old_crtc_state); } /* Disable everything else left on */ @@ -6829,7 +6822,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) intel_old_crtc_state_disables(state, crtc); - disable_pipes &= ~intel_crtc_joined_pipe_mask(old_crtc_state); + disable_pipes &= ~intel_joiner_crtc_joined_pipe_mask(old_crtc_state); } drm_WARN_ON(&i915->drm, disable_pipes); @@ -6956,7 +6949,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) is_trans_port_sync_master(new_crtc_state)) continue; - modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state); + modeset_pipes &= ~intel_joiner_crtc_joined_pipe_mask(new_crtc_state); intel_enable_crtc(state, crtc); } @@ -6974,7 +6967,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) if (intel_crtc_is_joiner_secondary(new_crtc_state)) continue; - modeset_pipes &= ~intel_crtc_joined_pipe_mask(new_crtc_state); + modeset_pipes &= ~intel_joiner_crtc_joined_pipe_mask(new_crtc_state); intel_enable_crtc(state, crtc); } diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 37d658bfd235..f39bd00d69fb 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -422,7 +422,6 @@ intel_cpu_transcoder_mode_valid(struct drm_i915_private *i915, enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); bool is_trans_port_sync_mode(const struct intel_crtc_state *state); bool is_trans_port_sync_master(const struct intel_crtc_state *state); -u8 intel_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state); bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state); u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 45d2230d1801..8d14bab7c6b1 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -47,6 +47,7 @@ #include "intel_dpio_phy.h" #include "intel_hdcp.h" #include "intel_hotplug.h" +#include "intel_joiner.h" #include "intel_link_bw.h" #include "intel_psr.h" #include "intel_vdsc.h" @@ -1009,7 +1010,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, !intel_dp_mst_is_master_trans(old_crtc_state)); for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *old_pipe_crtc_state = intel_atomic_get_old_crtc_state(state, pipe_crtc); @@ -1034,7 +1035,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, intel_ddi_disable_transcoder_func(old_crtc_state); for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(old_crtc_state)) { + intel_joiner_crtc_joined_pipe_mask(old_crtc_state)) { const struct intel_crtc_state *old_pipe_crtc_state = intel_atomic_get_old_crtc_state(state, pipe_crtc); @@ -1301,7 +1302,7 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state, intel_enable_transcoder(pipe_config); for_each_intel_crtc_in_pipe_mask_reverse(&dev_priv->drm, pipe_crtc, - intel_crtc_joined_pipe_mask(pipe_config)) { + intel_joiner_crtc_joined_pipe_mask(pipe_config)) { const struct intel_crtc_state *pipe_crtc_state = intel_atomic_get_new_crtc_state(state, pipe_crtc); diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index b24dfdbc9840..e6dfed812564 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -231,3 +231,10 @@ int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state) return 0; } + +u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + + return BIT(crtc->pipe) | crtc_state->joiner_pipes; +} diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index 3417274de4a2..f8c0cd27536c 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -28,5 +28,6 @@ u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 second void intel_joiner_get_config(struct intel_crtc_state *crtc_state); int intel_joiner_add_affected_planes(struct intel_atomic_state *state); int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state); +u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); #endif/* __INTEL_JOINER_H__ */ From patchwork Thu Aug 29 13:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783218 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 893AAC83F1A for ; Thu, 29 Aug 2024 13:17:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 317E010E6A2; Thu, 29 Aug 2024 13:17:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lBrMTr6U"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35F3810E69C; Thu, 29 Aug 2024 13:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937446; x=1756473446; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/UBYnHdpQuGpoDI3ffQ+SXbFLwNmVqy8EH8GNzOy58w=; b=lBrMTr6UqqtJa9jtRmbZwEXTzpnMAlcsBy+A27BQwFF50iqZGWNfEzi7 wY1e7gqNuWIZfzreFFS0mNZM2hHt/YhB68Uif2d+eOFA2qQw4yjrYaBzD lLEssaR4C0Cd9q7vMfEcijA8MfYBzW0QsSIqUEsQoiTa2WjNz/hcEKTOb Ulwzvt7oiL3Ia5YDiHw3s1U3YRyZONgTZqjcaekSmR4joCa2lyahrkfIX dNxzJuiGe0bF2+P3cd4KCF/WHNGmj46EOVB+tElrLE/uSNEuTFxgQnvSg lmN3OqAGSMvBsSvpnDRsm+1xOaKjmEYeEctBvpIvH+ya239VAgTpjZUsK g==; X-CSE-ConnectionGUID: XKehXmbETHGqDRK4nEDT+w== X-CSE-MsgGUID: 5BjR09bBSNyqkV1l85Usmg== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667282" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667282" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:26 -0700 X-CSE-ConnectionGUID: TQT8QyHFRu6V0vkzucMlpg== X-CSE-MsgGUID: vEVWHoqRQxWIj3mi2g725A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261708" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:23 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 15/19] drm/i915/display: Move helpers for primary joiner to intel_joiner Date: Thu, 29 Aug 2024 18:48:23 +0530 Message-ID: <20240829131828.2350930-16-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move helpers to get/check primary joiner pipes to intel_joiner. Rename them to align with other intel_joiner helpers. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_crtc_state_dump.c | 3 ++- drivers/gpu/drm/i915/display/intel_display.c | 8 -------- drivers/gpu/drm/i915/display/intel_display.h | 1 - drivers/gpu/drm/i915/display/intel_joiner.c | 10 +++++++++- drivers/gpu/drm/i915/display/intel_joiner.h | 1 + 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 705ec5ad385c..606fa069c93c 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -10,6 +10,7 @@ #include "intel_crtc_state_dump.h" #include "intel_display_types.h" #include "intel_hdmi.h" +#include "intel_joiner.h" #include "intel_vdsc.h" #include "intel_vrr.h" @@ -225,7 +226,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, drm_printf(&p, "joiner: %s, pipes: 0x%x\n", intel_crtc_is_joiner_secondary(pipe_config) ? "secondary" : - intel_crtc_is_joiner_primary(pipe_config) ? "primary" : "no", + intel_joiner_crtc_is_joiner_primary(pipe_config) ? "primary" : "no", pipe_config->joiner_pipes); drm_printf(&p, "splitter: %s, link count %d, overlap %d\n", diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index e1d5178dc4ec..3bee34575fc3 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -266,14 +266,6 @@ bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state) crtc->pipe != intel_joiner_get_primary_pipe(crtc_state); } -bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - - return crtc_state->joiner_pipes && - crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); -} - struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index f39bd00d69fb..5167ddee2d39 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -423,7 +423,6 @@ enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); bool is_trans_port_sync_mode(const struct intel_crtc_state *state); bool is_trans_port_sync_master(const struct intel_crtc_state *state); bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state); -bool intel_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state); u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state); struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state); bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index e6dfed812564..d36df20f811f 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -225,7 +225,7 @@ int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state) for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { /* Kill old joiner link, we may re-establish afterwards */ if (intel_crtc_needs_modeset(crtc_state) && - intel_crtc_is_joiner_primary(crtc_state)) + intel_joiner_crtc_is_joiner_primary(crtc_state)) intel_crtc_kill_joiner_secondaries(state, crtc); } @@ -238,3 +238,11 @@ u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state) return BIT(crtc->pipe) | crtc_state->joiner_pipes; } + +bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + + return crtc_state->joiner_pipes && + crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); +} diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index f8c0cd27536c..4f19d623558a 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -29,5 +29,6 @@ void intel_joiner_get_config(struct intel_crtc_state *crtc_state); int intel_joiner_add_affected_planes(struct intel_atomic_state *state); int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state); u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); +bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state); #endif/* __INTEL_JOINER_H__ */ From patchwork Thu Aug 29 13:18:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783219 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 0BBD8C83F16 for ; Thu, 29 Aug 2024 13:17:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A790C10E6A0; Thu, 29 Aug 2024 13:17:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="OfmjwR+f"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 673C610E6A0; Thu, 29 Aug 2024 13:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937448; x=1756473448; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jl5lRpTt8BFntdDbRzy/yKzB/bkMAaCTF0i3O7kH5PE=; b=OfmjwR+fRdBxf7KZE9SsA//79bd61GusTNc8rRUa7DAAFWJcLWZcsKpw 5Zwk+ReGf0rubGG26mYmsJwieK5LvgQCS5RvnQYIroVD6yJ5V29bd2DpV OdKuCrs5oxD3uWMEroYkrcYUqvIDikMuNn9u6kuYvpmP9A6DuRo1CkT/1 M72eH7kQyjd1JYZP3sAAdJNaMevvPMZMNRhE/Tn+/cXochB06apCEfFC9 dD42GKFhvWIqiRHUWQ86WCIWUXae8hsA2RTIn60Ted2fSPxrannpmRs8P wQVpBPAXQAvVBNBNJ1fC8PNNHn5ICekrWLpN3kTiSba3J3VLDqiRZ4TqZ A==; X-CSE-ConnectionGUID: YUJ3RzRdQ0GYb8+eqbbaLA== X-CSE-MsgGUID: t3W+t4r8TpqaF5P6mX946Q== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667293" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667293" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:28 -0700 X-CSE-ConnectionGUID: hOvLu0B/SGWPJLMyrHyZ2Q== X-CSE-MsgGUID: mOEAd32vQZ+SZJ7sIk7/5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261726" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:25 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 16/19] drm/i915/display: Move intel_crtc_is_joiner_secondary to intel_joiner Date: Thu, 29 Aug 2024 18:48:24 +0530 Message-ID: <20240829131828.2350930-17-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the helper to check secondary joiner pipes to intel_joiner. Signed-off-by: Ankit Nautiyal --- .../gpu/drm/i915/display/intel_atomic_plane.c | 3 +- .../drm/i915/display/intel_crtc_state_dump.c | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 30 +++++++------------ drivers/gpu/drm/i915/display/intel_display.h | 1 - .../drm/i915/display/intel_display_debugfs.c | 3 +- drivers/gpu/drm/i915/display/intel_drrs.c | 5 ++-- drivers/gpu/drm/i915/display/intel_dss.c | 5 ++-- drivers/gpu/drm/i915/display/intel_joiner.c | 8 +++++ drivers/gpu/drm/i915/display/intel_joiner.h | 1 + .../drm/i915/display/intel_modeset_setup.c | 9 +++--- 10 files changed, 36 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c index e979786aa5cf..478205b88502 100644 --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c @@ -49,6 +49,7 @@ #include "intel_display_types.h" #include "intel_fb.h" #include "intel_fb_pin.h" +#include "intel_joiner.h" #include "skl_scaler.h" #include "skl_watermark.h" @@ -722,7 +723,7 @@ int intel_plane_atomic_check(struct intel_atomic_state *state, struct intel_crtc_state *new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc); - if (new_crtc_state && intel_crtc_is_joiner_secondary(new_crtc_state)) { + if (new_crtc_state && intel_joiner_crtc_is_joiner_secondary(new_crtc_state)) { struct intel_crtc *primary_crtc = intel_primary_crtc(new_crtc_state); struct intel_plane *primary_crtc_plane = diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index 606fa069c93c..269c97343c72 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -225,7 +225,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, pipe_config->sync_mode_slaves_mask); drm_printf(&p, "joiner: %s, pipes: 0x%x\n", - intel_crtc_is_joiner_secondary(pipe_config) ? "secondary" : + intel_joiner_crtc_is_joiner_secondary(pipe_config) ? "secondary" : intel_joiner_crtc_is_joiner_primary(pipe_config) ? "primary" : "no", pipe_config->joiner_pipes); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 3bee34575fc3..64e43e1e8d4c 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -258,19 +258,11 @@ u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state) return 0; } -bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state) -{ - struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - - return crtc_state->joiner_pipes && - crtc->pipe != intel_joiner_get_primary_pipe(crtc_state); -} - struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); - if (intel_crtc_is_joiner_secondary(crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(crtc_state)) return intel_crtc_for_pipe(i915, intel_joiner_get_primary_pipe(crtc_state)); else return to_intel_crtc(crtc_state->uapi.crtc); @@ -4311,7 +4303,7 @@ intel_crtc_copy_uapi_to_hw_state_nomodeset(struct intel_atomic_state *state, struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc); - WARN_ON(intel_crtc_is_joiner_secondary(crtc_state)); + WARN_ON(intel_joiner_crtc_is_joiner_secondary(crtc_state)); drm_property_replace_blob(&crtc_state->hw.degamma_lut, crtc_state->uapi.degamma_lut); @@ -4328,7 +4320,7 @@ intel_crtc_copy_uapi_to_hw_state_modeset(struct intel_atomic_state *state, struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc); - WARN_ON(intel_crtc_is_joiner_secondary(crtc_state)); + WARN_ON(intel_joiner_crtc_is_joiner_secondary(crtc_state)); crtc_state->hw.enable = crtc_state->uapi.enable; crtc_state->hw.active = crtc_state->uapi.active; @@ -6181,14 +6173,14 @@ static int intel_atomic_check_config(struct intel_atomic_state *state, for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { if (!intel_crtc_needs_modeset(new_crtc_state)) { - if (intel_crtc_is_joiner_secondary(new_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(new_crtc_state)) copy_joiner_crtc_state_nomodeset(state, crtc); else intel_crtc_copy_uapi_to_hw_state_nomodeset(state, crtc); continue; } - if (drm_WARN_ON(&i915->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) + if (drm_WARN_ON(&i915->drm, intel_joiner_crtc_is_joiner_secondary(new_crtc_state))) continue; ret = intel_crtc_prepare_cleared_state(state, crtc); @@ -6207,7 +6199,7 @@ static int intel_atomic_check_config(struct intel_atomic_state *state, if (!intel_crtc_needs_modeset(new_crtc_state)) continue; - if (drm_WARN_ON(&i915->drm, intel_crtc_is_joiner_secondary(new_crtc_state))) + if (drm_WARN_ON(&i915->drm, intel_joiner_crtc_is_joiner_secondary(new_crtc_state))) continue; if (!new_crtc_state->hw.enable) @@ -6318,7 +6310,7 @@ int intel_atomic_check(struct drm_device *dev, if (!intel_crtc_needs_modeset(new_crtc_state)) continue; - if (intel_crtc_is_joiner_secondary(new_crtc_state)) { + if (intel_joiner_crtc_is_joiner_secondary(new_crtc_state)) { drm_WARN_ON(&dev_priv->drm, new_crtc_state->uapi.enable); continue; } @@ -6787,7 +6779,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; - if (intel_crtc_is_joiner_secondary(old_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(old_crtc_state)) continue; /* In case of Transcoder port Sync master slave CRTCs can be @@ -6809,7 +6801,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state) if ((disable_pipes & BIT(crtc->pipe)) == 0) continue; - if (intel_crtc_is_joiner_secondary(old_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(old_crtc_state)) continue; intel_old_crtc_state_disables(state, crtc); @@ -6934,7 +6926,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) if ((modeset_pipes & BIT(pipe)) == 0) continue; - if (intel_crtc_is_joiner_secondary(new_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(new_crtc_state)) continue; if (intel_dp_mst_is_slave_trans(new_crtc_state) || @@ -6956,7 +6948,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state) if ((modeset_pipes & BIT(pipe)) == 0) continue; - if (intel_crtc_is_joiner_secondary(new_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(new_crtc_state)) continue; modeset_pipes &= ~intel_joiner_crtc_joined_pipe_mask(new_crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 5167ddee2d39..4ca0bcbc8d89 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -422,7 +422,6 @@ intel_cpu_transcoder_mode_valid(struct drm_i915_private *i915, enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); bool is_trans_port_sync_mode(const struct intel_crtc_state *state); bool is_trans_port_sync_master(const struct intel_crtc_state *state); -bool intel_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state); u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state); struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state); bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 0cf0b4223513..3271fc120752 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -32,6 +32,7 @@ #include "intel_hdcp.h" #include "intel_hdmi.h" #include "intel_hotplug.h" +#include "intel_joiner.h" #include "intel_panel.h" #include "intel_pps.h" #include "intel_psr.h" @@ -581,7 +582,7 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc) if (crtc_state->joiner_pipes) seq_printf(m, "\tLinked to 0x%x pipes as a %s\n", crtc_state->joiner_pipes, - intel_crtc_is_joiner_secondary(crtc_state) ? "slave" : "master"); + intel_joiner_crtc_is_joiner_secondary(crtc_state) ? "slave" : "master"); intel_vdsc_state_dump(&p, 1, crtc_state); diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c index 3ca29afa5422..b80014b66ff4 100644 --- a/drivers/gpu/drm/i915/display/intel_drrs.c +++ b/drivers/gpu/drm/i915/display/intel_drrs.c @@ -10,6 +10,7 @@ #include "intel_display_types.h" #include "intel_drrs.h" #include "intel_frontbuffer.h" +#include "intel_joiner.h" #include "intel_panel.h" /** @@ -157,7 +158,7 @@ void intel_drrs_activate(const struct intel_crtc_state *crtc_state) if (!crtc_state->hw.active) return; - if (intel_crtc_is_joiner_secondary(crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(crtc_state)) return; mutex_lock(&crtc->drrs.mutex); @@ -189,7 +190,7 @@ void intel_drrs_deactivate(const struct intel_crtc_state *old_crtc_state) if (!old_crtc_state->hw.active) return; - if (intel_crtc_is_joiner_secondary(old_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(old_crtc_state)) return; mutex_lock(&crtc->drrs.mutex); diff --git a/drivers/gpu/drm/i915/display/intel_dss.c b/drivers/gpu/drm/i915/display/intel_dss.c index 01303feadcef..6029e9a16655 100644 --- a/drivers/gpu/drm/i915/display/intel_dss.c +++ b/drivers/gpu/drm/i915/display/intel_dss.c @@ -11,6 +11,7 @@ #include "intel_dsi.h" #include "intel_dss.h" #include "intel_dss_regs.h" +#include "intel_joiner.h" #include "intel_vdsc.h" /* @@ -168,7 +169,7 @@ void intel_dss_enable_uncompressed_joiner(const struct intel_crtc_state *crtc_st u32 dss_ctl1_val = 0; if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { - if (intel_crtc_is_joiner_secondary(crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(crtc_state)) dss_ctl1_val |= UNCOMPRESSED_JOINER_SECONDARY; else dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY; @@ -194,7 +195,7 @@ void intel_dss_enable_compressed_joiner(const struct intel_crtc_state *crtc_stat } if (crtc_state->joiner_pipes) { dss_ctl1_val |= BIG_JOINER_ENABLE; - if (!intel_crtc_is_joiner_secondary(crtc_state)) + if (!intel_joiner_crtc_is_joiner_secondary(crtc_state)) dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE; } intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index d36df20f811f..f7acd2de8ffb 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -246,3 +246,11 @@ bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_sta return crtc_state->joiner_pipes && crtc->pipe == intel_joiner_get_primary_pipe(crtc_state); } + +bool intel_joiner_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state) +{ + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); + + return crtc_state->joiner_pipes && + crtc->pipe != intel_joiner_get_primary_pipe(crtc_state); +} diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index 4f19d623558a..b3266ebf8922 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -30,5 +30,6 @@ int intel_joiner_add_affected_planes(struct intel_atomic_state *state); int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state); u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state); +bool intel_joiner_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state); #endif/* __INTEL_JOINER_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c index 6f85f5352455..c8bc10f48995 100644 --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c @@ -25,6 +25,7 @@ #include "intel_dmc.h" #include "intel_fifo_underrun.h" #include "intel_modeset_setup.h" +#include "intel_joiner.h" #include "intel_pch_display.h" #include "intel_pmdemand.h" #include "intel_tc.h" @@ -204,7 +205,7 @@ static u8 get_transcoder_pipes(struct drm_i915_private *i915, if (temp_crtc_state->cpu_transcoder == INVALID_TRANSCODER) continue; - if (intel_crtc_is_joiner_secondary(temp_crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(temp_crtc_state)) continue; if (transcoder_mask & BIT(temp_crtc_state->cpu_transcoder)) @@ -326,7 +327,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_i915_private static void intel_crtc_copy_hw_to_uapi_state(struct intel_crtc_state *crtc_state) { - if (intel_crtc_is_joiner_secondary(crtc_state)) + if (intel_joiner_crtc_is_joiner_secondary(crtc_state)) return; crtc_state->uapi.enable = crtc_state->hw.enable; @@ -474,7 +475,7 @@ static bool intel_sanitize_crtc(struct intel_crtc *crtc, } if (!crtc_state->hw.active || - intel_crtc_is_joiner_secondary(crtc_state)) + intel_joiner_crtc_is_joiner_secondary(crtc_state)) return false; needs_link_reset = intel_crtc_needs_link_reset(crtc); @@ -733,7 +734,7 @@ static void intel_modeset_readout_hw_state(struct drm_i915_private *i915) struct intel_crtc *secondary_crtc; /* encoder should read be linked to joiner primary */ - WARN_ON(intel_crtc_is_joiner_secondary(crtc_state)); + WARN_ON(intel_joiner_crtc_is_joiner_secondary(crtc_state)); for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, intel_crtc_joiner_secondary_pipes(crtc_state)) { From patchwork Thu Aug 29 13:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783220 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 44498C83F17 for ; Thu, 29 Aug 2024 13:17:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED04110E69C; Thu, 29 Aug 2024 13:17:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HQ9EvWPz"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1865010E6A1; Thu, 29 Aug 2024 13:17: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=1724937450; x=1756473450; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zeHeuT07avFcUEeYKykfLHqme/O0nzhjkcirBrfjk5g=; b=HQ9EvWPz3dJlk6itaoiX7g4jUZawGAWAqVkL4w+peI8Fr4yMc6SUDjk0 OGZiQbN+niojw2aTfMLv83eRUcWxpLd7KnJyGJ4JwISret8D9P6Rmz713 RFsu9jtApigzD4TVtAnwdW2J7M0QnWRaWljEMAyG6lBhfOD+JQJxChCAX MAsWntzlyiRHr0lMTL6cqgBuCBjo2hio4+ZTno+nZkyEGdmuYoZBcicUX mQ2K6ASmsWmufTFijJ1Knq4hkzO/FmJq+o/C0/GNnHtjSzlpibqKV2OiR oQXEVeXA9zZZCtn/lFivQFaLEY/gEbHHTlDY6/wIE8jNTTsciRLlwfX/O Q==; X-CSE-ConnectionGUID: RGTkA47hT2uc4Bd7ozaJ9Q== X-CSE-MsgGUID: yGoWy4KMRVm6WH5b/vre/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667299" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667299" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:29 -0700 X-CSE-ConnectionGUID: +MCOsK8CRnGI+c2UxsXgnw== X-CSE-MsgGUID: SOYq31BaS6Cdii0+++zMSA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261753" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:27 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 17/19] drm/i915/display: Move intel_crtc_joiner_secondary_pipes to intel_joiner Date: Thu, 29 Aug 2024 18:48:25 +0530 Message-ID: <20240829131828.2350930-18-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Move the helper to get secondary joiner pipes to intel_joiner. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 12 ++---------- drivers/gpu/drm/i915/display/intel_display.h | 1 - drivers/gpu/drm/i915/display/intel_joiner.c | 8 ++++++++ drivers/gpu/drm/i915/display/intel_joiner.h | 1 + drivers/gpu/drm/i915/display/intel_modeset_setup.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 64e43e1e8d4c..894ca4abe187 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -250,14 +250,6 @@ is_trans_port_sync_mode(const struct intel_crtc_state *crtc_state) is_trans_port_sync_slave(crtc_state); } -u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state) -{ - if (crtc_state->joiner_pipes) - return crtc_state->joiner_pipes & ~BIT(intel_joiner_get_primary_pipe(crtc_state)); - else - return 0; -} - struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); @@ -5806,7 +5798,7 @@ static int intel_atomic_check_joiner(struct intel_atomic_state *state, } for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, - intel_crtc_joiner_secondary_pipes(primary_crtc_state)) { + intel_joiner_crtc_joiner_secondary_pipes(primary_crtc_state)) { struct intel_crtc_state *secondary_crtc_state; int ret; @@ -5860,7 +5852,7 @@ void intel_crtc_kill_joiner_secondaries(struct intel_atomic_state *state, struct intel_crtc *secondary_crtc; for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, - intel_crtc_joiner_secondary_pipes(primary_crtc_state)) { + intel_joiner_crtc_joiner_secondary_pipes(primary_crtc_state)) { struct intel_crtc_state *secondary_crtc_state = intel_atomic_get_new_crtc_state(state, secondary_crtc); diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index 4ca0bcbc8d89..270125387d0c 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -422,7 +422,6 @@ intel_cpu_transcoder_mode_valid(struct drm_i915_private *i915, enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port); bool is_trans_port_sync_mode(const struct intel_crtc_state *state); bool is_trans_port_sync_master(const struct intel_crtc_state *state); -u8 intel_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state); struct intel_crtc *intel_primary_crtc(const struct intel_crtc_state *crtc_state); bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state); bool intel_pipe_config_compare(const struct intel_crtc_state *current_config, diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index f7acd2de8ffb..0899cf51a825 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -254,3 +254,11 @@ bool intel_joiner_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_s return crtc_state->joiner_pipes && crtc->pipe != intel_joiner_get_primary_pipe(crtc_state); } + +u8 intel_joiner_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state) +{ + if (crtc_state->joiner_pipes) + return crtc_state->joiner_pipes & ~BIT(intel_joiner_get_primary_pipe(crtc_state)); + else + return 0; +} diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index b3266ebf8922..cae9971c44f6 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -31,5 +31,6 @@ int intel_joiner_add_affected_crtcs(struct intel_atomic_state *state); u8 intel_joiner_crtc_joined_pipe_mask(const struct intel_crtc_state *crtc_state); bool intel_joiner_crtc_is_joiner_primary(const struct intel_crtc_state *crtc_state); bool intel_joiner_crtc_is_joiner_secondary(const struct intel_crtc_state *crtc_state); +u8 intel_joiner_crtc_joiner_secondary_pipes(const struct intel_crtc_state *crtc_state); #endif/* __INTEL_JOINER_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c index c8bc10f48995..802b160d3040 100644 --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c @@ -69,7 +69,7 @@ static void intel_crtc_disable_noatomic_begin(struct intel_crtc *crtc, /* Everything's already locked, -EDEADLK can't happen. */ for_each_intel_crtc_in_pipe_mask(&i915->drm, temp_crtc, BIT(pipe) | - intel_crtc_joiner_secondary_pipes(crtc_state)) { + intel_joiner_crtc_joiner_secondary_pipes(crtc_state)) { struct intel_crtc_state *temp_crtc_state = intel_atomic_get_crtc_state(state, temp_crtc); int ret; @@ -258,7 +258,7 @@ static u8 get_joiner_secondary_pipes(struct drm_i915_private *i915, u8 primary_p struct intel_crtc_state *primary_crtc_state = to_intel_crtc_state(primary_crtc->base.state); - pipes |= intel_crtc_joiner_secondary_pipes(primary_crtc_state); + pipes |= intel_joiner_crtc_joiner_secondary_pipes(primary_crtc_state); } return pipes; @@ -737,7 +737,7 @@ static void intel_modeset_readout_hw_state(struct drm_i915_private *i915) WARN_ON(intel_joiner_crtc_is_joiner_secondary(crtc_state)); for_each_intel_crtc_in_pipe_mask(&i915->drm, secondary_crtc, - intel_crtc_joiner_secondary_pipes(crtc_state)) { + intel_joiner_crtc_joiner_secondary_pipes(crtc_state)) { struct intel_crtc_state *secondary_crtc_state; secondary_crtc_state = to_intel_crtc_state(secondary_crtc->base.state); From patchwork Thu Aug 29 13:18:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783221 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 BE2EEC83F16 for ; Thu, 29 Aug 2024 13:17:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DFD210E6A3; Thu, 29 Aug 2024 13:17:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="jI5kHmwM"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D19910E6A3; Thu, 29 Aug 2024 13:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937452; x=1756473452; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q0qwqHPxSW97xXDWRpNrCe+wuFos2CpUV/k3swINIAw=; b=jI5kHmwM/KAJf4zKU6nr1WflaYpxKHPzeNb41TczepB6D7efDm3NSQjZ lEnQApeahm5IBVC+tTUI2UvrO6kYp/StO4Lhm7rA+zt0dDsGuxA1/ogl3 mgPTsMgwjq79XcXRiv1y/iB6VoO76hC8RK4fDqUkvHq0I9Z2IhHlEDs/M kgugsYfGoxHjLjTYAEaKnup8Q+77DHIzQ6y0EZ8FvGWQdgPVYLzWwmti9 XoDtXvcgJCVdHJol8MYXIiMI8CsGOfrOazwXpvV4p8GR9qW1y4tJ6N2ju CPu+tHPU81Y/ufS1eU9uPJZXk9AqpqCfePWCXO3HPCGSJqxF9Xv7+3Uaa w==; X-CSE-ConnectionGUID: llrZKtryQY6WpKW3zjnpBQ== X-CSE-MsgGUID: kVX1ddMdQWum4abZLyjFTQ== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667302" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667302" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:32 -0700 X-CSE-ConnectionGUID: 9cuZ+N1vSLabUS/GJq2tpw== X-CSE-MsgGUID: qGipe7RSSy2Fzrs3PJWXog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261787" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:29 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 18/19] drm/i915/joiner: Use struct intel_display in intel_joiner_enabled_pipes Date: Thu, 29 Aug 2024 18:48:26 +0530 Message-ID: <20240829131828.2350930-19-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Replace struct drm_i915_private with struct intel_display in the helper intel_joiner_enabled_pipes and its callers. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 3 ++- drivers/gpu/drm/i915/display/intel_joiner.c | 13 +++++++------ drivers/gpu/drm/i915/display/intel_joiner.h | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 894ca4abe187..abcb45d492b1 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -3444,6 +3444,7 @@ static u8 hsw_panel_transcoders(struct drm_i915_private *i915) static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) { + struct intel_display *display = to_intel_display(crtc); struct drm_device *dev = crtc->base.dev; struct drm_i915_private *dev_priv = to_i915(dev); u8 panel_transcoder_mask = hsw_panel_transcoders(dev_priv); @@ -3501,7 +3502,7 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc) enabled_transcoders |= BIT(cpu_transcoder); /* joiner secondary -> consider the primary pipe's transcoder as well */ - intel_joiner_enabled_pipes(dev_priv, &primary_pipes, &secondary_pipes); + intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes); if (secondary_pipes & BIT(crtc->pipe)) { cpu_transcoder = (enum transcoder) intel_joiner_find_primary_pipe(crtc->pipe, primary_pipes, secondary_pipes); diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index 0899cf51a825..2c7477914f74 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -86,16 +86,17 @@ u8 intel_joiner_supported_pipes(struct drm_i915_private *i915) return pipes & DISPLAY_RUNTIME_INFO(i915)->pipe_mask; } -void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, +void intel_joiner_enabled_pipes(struct intel_display *display, u8 *primary_pipes, u8 *secondary_pipes) { + struct drm_i915_private *i915 = to_i915(display->drm); struct intel_crtc *crtc; *primary_pipes = 0; *secondary_pipes = 0; - for_each_intel_crtc_in_pipe_mask(&dev_priv->drm, crtc, - intel_joiner_supported_pipes(dev_priv)) { + for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, + intel_joiner_supported_pipes(i915)) { intel_dss_get_compressed_joiner_pipes(crtc, primary_pipes, secondary_pipes); @@ -106,7 +107,7 @@ void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, } /* Joiner pipes should always be consecutive primary and secondary */ - drm_WARN(&dev_priv->drm, *secondary_pipes != *primary_pipes << 1, + drm_WARN(display->drm, *secondary_pipes != *primary_pipes << 1, "Joiner misconfigured (primary pipes 0x%x, secondary pipes 0x%x)\n", *primary_pipes, *secondary_pipes); } @@ -144,12 +145,12 @@ u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 second void intel_joiner_get_config(struct intel_crtc_state *crtc_state) { + struct intel_display *display = to_intel_display(crtc_state); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); - struct drm_i915_private *i915 = to_i915(crtc->base.dev); u8 primary_pipes, secondary_pipes; enum pipe pipe = crtc->pipe; - intel_joiner_enabled_pipes(i915, &primary_pipes, &secondary_pipes); + intel_joiner_enabled_pipes(display, &primary_pipes, &secondary_pipes); if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0) return; diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index cae9971c44f6..49cb2d78f4c8 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -13,6 +13,7 @@ struct drm_display_mode; struct drm_i915_private; struct intel_atomic_state; struct intel_crtc_state; +struct intel_display; enum pipe intel_joiner_get_primary_pipe(const struct intel_crtc_state *crtc_state); int intel_joiner_get_num_pipes(const struct intel_crtc_state *crtc_state); @@ -21,7 +22,7 @@ void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state); void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state); u8 intel_joiner_supported_pipes(struct drm_i915_private *i915); -void intel_joiner_enabled_pipes(struct drm_i915_private *dev_priv, +void intel_joiner_enabled_pipes(struct intel_display *display, u8 *primary_pipes, u8 *secondary_pipes); enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes); u8 intel_joiner_find_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes); From patchwork Thu Aug 29 13:18:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13783222 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 E42D2C83F17 for ; Thu, 29 Aug 2024 13:17:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E1D010E6A9; Thu, 29 Aug 2024 13:17:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kPUXBWsf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 349C110E6A5; Thu, 29 Aug 2024 13:17:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724937454; x=1756473454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lyi43s8ve9VX+tfsyIWzcybeKcTELwFNEHqHMQtgHwk=; b=kPUXBWsfJntJH0NPYErIiH8G9TClqixd1JMAr4E93wwXmKUxZc4EY6Ww aFDJJpKVpGFGu4fYsfwiUgxsh2WeUTCHTf1LEqc+vA/pWNZXOHv9o6C9c q6nH5kTE6n+7i5SVaK6QfHqBXWfktj8pL3Cpj3vYQYn7Suu21HDA/QUYX dTn+Wmh3zcNRQYbPK+6KHLXbzIGLmv/GGQXr7l6WiN/Fk9kexNdlnySUb clH4Wr266f5t3zgq3P7xp3Sjzm1C4iHL3iycy14m1Nn6ZvuBFyxVJ7JXF PCuLDDWMuhvQxaoLz7JoBSGEMVd8sRill3PXF9Sk6mdDDtkBgmDjaEVZo A==; X-CSE-ConnectionGUID: jVHE7fV0Q0+DkNbgt0WInA== X-CSE-MsgGUID: CjbqlSt7TgaGhQQ/4LF8Vw== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="23667303" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="23667303" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:34 -0700 X-CSE-ConnectionGUID: xadM+AWQTxWDIwcxNpXmtQ== X-CSE-MsgGUID: 2vjZ4AHySkOwaPQF++g0mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63261827" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2024 06:17:31 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: jani.nikula@linux.intel.com, suraj.kandpal@intel.com, ville.syrjala@linux.intel.com Subject: [PATCH 19/19] drm/i915/joiner: Use struct intel_display in intel_joiner_supported_pipes Date: Thu, 29 Aug 2024 18:48:27 +0530 Message-ID: <20240829131828.2350930-20-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> References: <20240829131828.2350930-1-ankit.k.nautiyal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Replace struct drm_i915_private with struct intel_display in the helper intel_joiner_supported_pipes and its callers. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_display.c | 6 ++++-- drivers/gpu/drm/i915/display/intel_joiner.c | 10 +++++----- drivers/gpu/drm/i915/display/intel_joiner.h | 3 +-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index abcb45d492b1..58593f5c3191 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -5776,6 +5776,7 @@ static bool intel_pipes_need_modeset(struct intel_atomic_state *state, static int intel_atomic_check_joiner(struct intel_atomic_state *state, struct intel_crtc *primary_crtc) { + struct intel_display *display = to_intel_display(primary_crtc); struct drm_i915_private *i915 = to_i915(state->base.dev); struct intel_crtc_state *primary_crtc_state = intel_atomic_get_new_crtc_state(state, primary_crtc); @@ -5789,12 +5790,13 @@ static int intel_atomic_check_joiner(struct intel_atomic_state *state, primary_crtc->pipe != intel_joiner_get_primary_pipe(primary_crtc_state))) return -EINVAL; - if (primary_crtc_state->joiner_pipes & ~intel_joiner_supported_pipes(i915)) { + if (primary_crtc_state->joiner_pipes & ~intel_joiner_supported_pipes(display)) { drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] Cannot act as joiner primary " "(need 0x%x as pipes, only 0x%x possible)\n", primary_crtc->base.base.id, primary_crtc->base.name, - primary_crtc_state->joiner_pipes, intel_joiner_supported_pipes(i915)); + primary_crtc_state->joiner_pipes, + intel_joiner_supported_pipes(display)); return -EINVAL; } diff --git a/drivers/gpu/drm/i915/display/intel_joiner.c b/drivers/gpu/drm/i915/display/intel_joiner.c index 2c7477914f74..32cd0ab4e707 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.c +++ b/drivers/gpu/drm/i915/display/intel_joiner.c @@ -72,18 +72,18 @@ void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state) (pipe - primary_pipe) * width, 0); } -u8 intel_joiner_supported_pipes(struct drm_i915_private *i915) +u8 intel_joiner_supported_pipes(struct intel_display *display) { u8 pipes; - if (DISPLAY_VER(i915) >= 12) + if (DISPLAY_VER(display) >= 12) pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D); - else if (DISPLAY_VER(i915) >= 11) + else if (DISPLAY_VER(display) >= 11) pipes = BIT(PIPE_B) | BIT(PIPE_C); else pipes = 0; - return pipes & DISPLAY_RUNTIME_INFO(i915)->pipe_mask; + return pipes & DISPLAY_RUNTIME_INFO(display)->pipe_mask; } void intel_joiner_enabled_pipes(struct intel_display *display, @@ -96,7 +96,7 @@ void intel_joiner_enabled_pipes(struct intel_display *display, *secondary_pipes = 0; for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, - intel_joiner_supported_pipes(i915)) { + intel_joiner_supported_pipes(display)) { intel_dss_get_compressed_joiner_pipes(crtc, primary_pipes, secondary_pipes); diff --git a/drivers/gpu/drm/i915/display/intel_joiner.h b/drivers/gpu/drm/i915/display/intel_joiner.h index 49cb2d78f4c8..698f8e55f8ea 100644 --- a/drivers/gpu/drm/i915/display/intel_joiner.h +++ b/drivers/gpu/drm/i915/display/intel_joiner.h @@ -10,7 +10,6 @@ enum pipe; struct drm_display_mode; -struct drm_i915_private; struct intel_atomic_state; struct intel_crtc_state; struct intel_display; @@ -21,7 +20,7 @@ void intel_joiner_adjust_timings(const struct intel_crtc_state *crtc_state, struct drm_display_mode *mode); void intel_joiner_compute_pipe_src(struct intel_crtc_state *crtc_state); void intel_joiner_adjust_pipe_src(struct intel_crtc_state *crtc_state); -u8 intel_joiner_supported_pipes(struct drm_i915_private *i915); +u8 intel_joiner_supported_pipes(struct intel_display *display); void intel_joiner_enabled_pipes(struct intel_display *display, u8 *primary_pipes, u8 *secondary_pipes); enum pipe intel_joiner_find_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes);