From patchwork Mon Jun 17 17:03:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13701094 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 9F1E3C2BA18 for ; Mon, 17 Jun 2024 17:03:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01AC310E473; Mon, 17 Jun 2024 17:03:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cvb1bfcl"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 353BB10E132; Mon, 17 Jun 2024 17:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718643828; x=1750179828; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=ib++IxhRn1LM0P5YkxZo8rZErDHl6wSQEfA/QiB35zQ=; b=cvb1bfclZ09LleY6BQiwd83YHRVoCrYMikEuQ4p6WpVpXajQx7KaogBG o3A9xAU8zFjotLNx3gYZT39Mb2l19vP8orJixu0Skd45oi6pByOzkY7lc 92NEwInk0MWxIodJjwtzyL3+3mXaMJLouyq8p5SW+omL57eNOaBi5vTr5 hJX8XqZ38kc/1d8oB94TS01MCMddz/TKd4Sp1u+znNgFfaV9aiLKquYo8 neeh2F3rj/dpgYHg6vn/PYbMtAaq9Xaz/1mCsNimE/VVLksngb1igPwlX FRe+lsRqG0Brd3R1bx8T8bLKmAsa6Bjsll4fSCKMDor0p3OZfXyzJHfhm g==; X-CSE-ConnectionGUID: bff+FJ9qR8SqrK43XYc90Q== X-CSE-MsgGUID: KRZqhdcBTDuu4Ljq00P52A== X-IronPort-AV: E=McAfee;i="6700,10204,11106"; a="32951782" X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="32951782" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:48 -0700 X-CSE-ConnectionGUID: kMwX4GgrTg6VTJMIby7Ekw== X-CSE-MsgGUID: VPBu2LyUTfukxxvYqSfzdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="45690918" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:46 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Subject: [PATCH 1/3] drm/i915: Move encoder suspend/shutdown helpers to intel_encoder.c Date: Mon, 17 Jun 2024 20:03:54 +0300 Message-ID: <20240617170356.4000251-1-imre.deak@intel.com> X-Mailer: git-send-email 2.43.3 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 encoder suspend/shutdown helpers to intel_encoder.c, this being the logical place for encoder functions. This also allows sharing the above helpers with the xe driver, done in a follow-up patch. While at it rename the functions using the usual intel_encoder prefix and in the functions rename the dev_priv parameter to i915. Signed-off-by: Imre Deak Reviewed-by: Rodrigo Vivi Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_encoder.c | 44 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_encoder.h | 5 ++ drivers/gpu/drm/i915/i915_driver.c | 51 ++------------------ 3 files changed, 53 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_encoder.c b/drivers/gpu/drm/i915/display/intel_encoder.c index dee55f56960fc..8a1dccb893a37 100644 --- a/drivers/gpu/drm/i915/display/intel_encoder.c +++ b/drivers/gpu/drm/i915/display/intel_encoder.c @@ -37,3 +37,47 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela mod_delayed_work(i915->unordered_wq, &encoder->link_check_work, msecs_to_jiffies(delay_ms)); } + +void intel_encoder_suspend_all(struct drm_i915_private *i915) +{ + struct intel_encoder *encoder; + + if (!HAS_DISPLAY(i915)) + return; + + /* + * TODO: check and remove holding the modeset locks if none of + * the encoders depends on this. + */ + drm_modeset_lock_all(&i915->drm); + for_each_intel_encoder(&i915->drm, encoder) + if (encoder->suspend) + encoder->suspend(encoder); + drm_modeset_unlock_all(&i915->drm); + + for_each_intel_encoder(&i915->drm, encoder) + if (encoder->suspend_complete) + encoder->suspend_complete(encoder); +} + +void intel_encoder_shutdown_all(struct drm_i915_private *i915) +{ + struct intel_encoder *encoder; + + if (!HAS_DISPLAY(i915)) + return; + + /* + * TODO: check and remove holding the modeset locks if none of + * the encoders depends on this. + */ + drm_modeset_lock_all(&i915->drm); + for_each_intel_encoder(&i915->drm, encoder) + if (encoder->shutdown) + encoder->shutdown(encoder); + drm_modeset_unlock_all(&i915->drm); + + for_each_intel_encoder(&i915->drm, encoder) + if (encoder->shutdown_complete) + encoder->shutdown_complete(encoder); +} diff --git a/drivers/gpu/drm/i915/display/intel_encoder.h b/drivers/gpu/drm/i915/display/intel_encoder.h index 2cda054e2b152..e6cd74576f78e 100644 --- a/drivers/gpu/drm/i915/display/intel_encoder.h +++ b/drivers/gpu/drm/i915/display/intel_encoder.h @@ -6,6 +6,8 @@ #ifndef __INTEL_ENCODER_H__ #define __INTEL_ENCODER_H__ +struct drm_i915_private; + struct intel_encoder; void intel_encoder_link_check_init(struct intel_encoder *encoder, @@ -13,4 +15,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder, void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms); void intel_encoder_link_check_flush_work(struct intel_encoder *encoder); +void intel_encoder_suspend_all(struct drm_i915_private *i915); +void intel_encoder_shutdown_all(struct drm_i915_private *i915); + #endif /* __INTEL_ENCODER_H__ */ diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c index 161b21eff6943..e9e38ed246f66 100644 --- a/drivers/gpu/drm/i915/i915_driver.c +++ b/drivers/gpu/drm/i915/i915_driver.c @@ -53,6 +53,7 @@ #include "display/intel_dmc.h" #include "display/intel_dp.h" #include "display/intel_dpt.h" +#include "display/intel_encoder.h" #include "display/intel_fbdev.h" #include "display/intel_hotplug.h" #include "display/intel_overlay.h" @@ -933,50 +934,6 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file) i915_gem_flush_free_objects(to_i915(dev)); } -static void intel_suspend_encoders(struct drm_i915_private *dev_priv) -{ - struct intel_encoder *encoder; - - if (!HAS_DISPLAY(dev_priv)) - return; - - /* - * TODO: check and remove holding the modeset locks if none of - * the encoders depends on this. - */ - drm_modeset_lock_all(&dev_priv->drm); - for_each_intel_encoder(&dev_priv->drm, encoder) - if (encoder->suspend) - encoder->suspend(encoder); - drm_modeset_unlock_all(&dev_priv->drm); - - for_each_intel_encoder(&dev_priv->drm, encoder) - if (encoder->suspend_complete) - encoder->suspend_complete(encoder); -} - -static void intel_shutdown_encoders(struct drm_i915_private *dev_priv) -{ - struct intel_encoder *encoder; - - if (!HAS_DISPLAY(dev_priv)) - return; - - /* - * TODO: check and remove holding the modeset locks if none of - * the encoders depends on this. - */ - drm_modeset_lock_all(&dev_priv->drm); - for_each_intel_encoder(&dev_priv->drm, encoder) - if (encoder->shutdown) - encoder->shutdown(encoder); - drm_modeset_unlock_all(&dev_priv->drm); - - for_each_intel_encoder(&dev_priv->drm, encoder) - if (encoder->shutdown_complete) - encoder->shutdown_complete(encoder); -} - void i915_driver_shutdown(struct drm_i915_private *i915) { disable_rpm_wakeref_asserts(&i915->runtime_pm); @@ -999,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915) if (HAS_DISPLAY(i915)) intel_display_driver_suspend_access(i915); - intel_suspend_encoders(i915); - intel_shutdown_encoders(i915); + intel_encoder_suspend_all(i915); + intel_encoder_shutdown_all(i915); intel_dmc_suspend(i915); @@ -1083,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev) if (HAS_DISPLAY(dev_priv)) intel_display_driver_suspend_access(dev_priv); - intel_suspend_encoders(dev_priv); + intel_encoder_suspend_all(dev_priv); /* Must be called before GGTT is suspended. */ intel_dpt_suspend(dev_priv); From patchwork Mon Jun 17 17:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13701093 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 76C60C27C79 for ; Mon, 17 Jun 2024 17:03:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7FD810E46D; Mon, 17 Jun 2024 17:03:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kFUadu96"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF0FA10E132; Mon, 17 Jun 2024 17:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718643829; x=1750179829; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=X2VJLxzfCWjvSoH1aXqbuwRTQlHK+b7m9DPJ3MrnhkM=; b=kFUadu9630QsUoJjgYGISkaDJriFY9R+7YALh8QpVugrqemiZNdbhUfY rhvt/hqNif2o1OhtQ6QKVvfVpyVG1VVfuyG4muE5jnFjRXx/wxlAjUa6V yP0JxbTnMKrgbE9rUewXRQIIkszkV5jfFvCs1+QQBUx5b4TviqxFjN0DZ ev8gNqwpu/PHxIoTFkxFPTKGpDxWqCZgvBBvI4D50/U2V3wM4Zu+WlPaC TjRldGOlpNo6qh2SMkAyVc8qb6muDv3+yP+ZhZeiK9njVhSlWs1jPT+Ie vFeHwmALsO5FXmAUlQsT4v7f0aTVetqCBUHnlLOBLJy8pHdHfhpO7cbyv w==; X-CSE-ConnectionGUID: LyellDxHSaWixzxM7/rlgw== X-CSE-MsgGUID: fkWYizeYRKa9o0FgxXdk4g== X-IronPort-AV: E=McAfee;i="6700,10204,11106"; a="32951785" X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="32951785" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:49 -0700 X-CSE-ConnectionGUID: GN9Qq/UjSIqx5PIfMZ16RQ== X-CSE-MsgGUID: Jw/WGwE6RWCoHaIcCWKAdw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="45690933" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:47 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Subject: [PATCH 2/3] drm/i915: Pass intel_display to the encoder suspend/shutdown helpers Date: Mon, 17 Jun 2024 20:03:55 +0300 Message-ID: <20240617170356.4000251-2-imre.deak@intel.com> X-Mailer: git-send-email 2.43.3 In-Reply-To: <20240617170356.4000251-1-imre.deak@intel.com> References: <20240617170356.4000251-1-imre.deak@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" Pass intel_display to the encoder suspend/shutdown helpers instead of drm_i915_private for better isolation. This assumes that HAS_DISPLAY() will also take an intel_display parameter in the future (or that the HAS_DISPLAY() check will be moved to a caller of these functions). Signed-off-by: Imre Deak Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/display/intel_encoder.c | 22 +++++++++++--------- drivers/gpu/drm/i915/display/intel_encoder.h | 7 +++---- drivers/gpu/drm/i915/i915_driver.c | 6 +++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_encoder.c b/drivers/gpu/drm/i915/display/intel_encoder.c index 8a1dccb893a37..8e73d18a522d4 100644 --- a/drivers/gpu/drm/i915/display/intel_encoder.c +++ b/drivers/gpu/drm/i915/display/intel_encoder.c @@ -38,8 +38,9 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela &encoder->link_check_work, msecs_to_jiffies(delay_ms)); } -void intel_encoder_suspend_all(struct drm_i915_private *i915) +void intel_encoder_suspend_all(struct intel_display *display) { + struct drm_i915_private *i915 = to_i915(display->drm); struct intel_encoder *encoder; if (!HAS_DISPLAY(i915)) @@ -49,19 +50,20 @@ void intel_encoder_suspend_all(struct drm_i915_private *i915) * TODO: check and remove holding the modeset locks if none of * the encoders depends on this. */ - drm_modeset_lock_all(&i915->drm); - for_each_intel_encoder(&i915->drm, encoder) + drm_modeset_lock_all(display->drm); + for_each_intel_encoder(display->drm, encoder) if (encoder->suspend) encoder->suspend(encoder); - drm_modeset_unlock_all(&i915->drm); + drm_modeset_unlock_all(display->drm); - for_each_intel_encoder(&i915->drm, encoder) + for_each_intel_encoder(display->drm, encoder) if (encoder->suspend_complete) encoder->suspend_complete(encoder); } -void intel_encoder_shutdown_all(struct drm_i915_private *i915) +void intel_encoder_shutdown_all(struct intel_display *display) { + struct drm_i915_private *i915 = to_i915(display->drm); struct intel_encoder *encoder; if (!HAS_DISPLAY(i915)) @@ -71,13 +73,13 @@ void intel_encoder_shutdown_all(struct drm_i915_private *i915) * TODO: check and remove holding the modeset locks if none of * the encoders depends on this. */ - drm_modeset_lock_all(&i915->drm); - for_each_intel_encoder(&i915->drm, encoder) + drm_modeset_lock_all(display->drm); + for_each_intel_encoder(display->drm, encoder) if (encoder->shutdown) encoder->shutdown(encoder); - drm_modeset_unlock_all(&i915->drm); + drm_modeset_unlock_all(display->drm); - for_each_intel_encoder(&i915->drm, encoder) + for_each_intel_encoder(display->drm, encoder) if (encoder->shutdown_complete) encoder->shutdown_complete(encoder); } diff --git a/drivers/gpu/drm/i915/display/intel_encoder.h b/drivers/gpu/drm/i915/display/intel_encoder.h index e6cd74576f78e..3fa5589f0b1ce 100644 --- a/drivers/gpu/drm/i915/display/intel_encoder.h +++ b/drivers/gpu/drm/i915/display/intel_encoder.h @@ -6,8 +6,7 @@ #ifndef __INTEL_ENCODER_H__ #define __INTEL_ENCODER_H__ -struct drm_i915_private; - +struct intel_display; struct intel_encoder; void intel_encoder_link_check_init(struct intel_encoder *encoder, @@ -15,7 +14,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder, void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms); void intel_encoder_link_check_flush_work(struct intel_encoder *encoder); -void intel_encoder_suspend_all(struct drm_i915_private *i915); -void intel_encoder_shutdown_all(struct drm_i915_private *i915); +void intel_encoder_suspend_all(struct intel_display *display); +void intel_encoder_shutdown_all(struct intel_display *display); #endif /* __INTEL_ENCODER_H__ */ diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c index e9e38ed246f66..fb8e9c2fcea53 100644 --- a/drivers/gpu/drm/i915/i915_driver.c +++ b/drivers/gpu/drm/i915/i915_driver.c @@ -956,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915) if (HAS_DISPLAY(i915)) intel_display_driver_suspend_access(i915); - intel_encoder_suspend_all(i915); - intel_encoder_shutdown_all(i915); + intel_encoder_suspend_all(&i915->display); + intel_encoder_shutdown_all(&i915->display); intel_dmc_suspend(i915); @@ -1040,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev) if (HAS_DISPLAY(dev_priv)) intel_display_driver_suspend_access(dev_priv); - intel_encoder_suspend_all(dev_priv); + intel_encoder_suspend_all(&dev_priv->display); /* Must be called before GGTT is suspended. */ intel_dpt_suspend(dev_priv); From patchwork Mon Jun 17 17:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 13701095 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 7B88DC2BB9A for ; Mon, 17 Jun 2024 17:03:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B66FA10E471; Mon, 17 Jun 2024 17:03:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ZO24A1Ti"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id D516210E471; Mon, 17 Jun 2024 17:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718643830; x=1750179830; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=A4bLPR+CpHzChW5Tz87YnQ4c1xt2GXD+ettaLJP5jHI=; b=ZO24A1Ti2ITHKvxpK8GoAbvXUZkDmE/52YGNOYVPCLxpXuRpfjhHYcp9 KLMUSLm965mmloTLqvEuyLTeNRy2sYV3Qb2uJZeOas6vslWnFup85oc42 h3pLyIdnOXydmV/d0noEeGDP0mwqGILHyPNxCPVBGrYJqF5uECihy6Jrl XEZmbRDZGgWY3M7QBIr8aIxSW71UqMp2meZCBZWDmqEh3NHqrGmpPtjx7 XkQF811FwQyhlmsgIKH69Ce2FYbX7m7jVq0Jz73de57ad6XWqalt3tlMk 4lrMlftxztKFl6jmeGD3f4hbN+4gaYJhjqedy6tDCfxKfe6Orq5Xdahs3 w==; X-CSE-ConnectionGUID: hbb7fhhkQx+Qgqm7MwCgSA== X-CSE-MsgGUID: dZLEDLZFRaa1Brr8WjlUwQ== X-IronPort-AV: E=McAfee;i="6700,10204,11106"; a="32951786" X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="32951786" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:50 -0700 X-CSE-ConnectionGUID: exFwygazS0uKEOQX1JwaZA== X-CSE-MsgGUID: Cof/49EsTWO5wys7hN95nQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,245,1712646000"; d="scan'208";a="45690949" Received: from ideak-desk.fi.intel.com ([10.237.72.78]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2024 10:03:49 -0700 From: Imre Deak To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Subject: [PATCH 3/3] drm/xe: Use the encoder suspend helper also used by the i915 driver Date: Mon, 17 Jun 2024 20:03:56 +0300 Message-ID: <20240617170356.4000251-3-imre.deak@intel.com> X-Mailer: git-send-email 2.43.3 In-Reply-To: <20240617170356.4000251-1-imre.deak@intel.com> References: <20240617170356.4000251-1-imre.deak@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 the suspend encoders helper which is also used by the i915 driver. This fixes an issue in the xe driver where the encoder suspend_complete() hook is not called and was an overlook when this hook was added in Commit b61fad5f7e5d ("drm/i915/tc: Call TypeC port flush_work/cleanup without modeset locks held") for i915, but not added to the xe driver (which was still in a separate source tree at the above point). Signed-off-by: Imre Deak Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/xe/display/xe_display.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c index 78cccbe289475..8b83dcff72e17 100644 --- a/drivers/gpu/drm/xe/display/xe_display.c +++ b/drivers/gpu/drm/xe/display/xe_display.c @@ -23,6 +23,7 @@ #include "intel_display_types.h" #include "intel_dmc.h" #include "intel_dp.h" +#include "intel_encoder.h" #include "intel_fbdev.h" #include "intel_hdcp.h" #include "intel_hotplug.h" @@ -270,21 +271,6 @@ void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt) gen11_de_irq_postinstall(xe); } -static void intel_suspend_encoders(struct xe_device *xe) -{ - struct drm_device *dev = &xe->drm; - struct intel_encoder *encoder; - - if (has_display(xe)) - return; - - drm_modeset_lock_all(dev); - for_each_intel_encoder(dev, encoder) - if (encoder->suspend) - encoder->suspend(encoder); - drm_modeset_unlock_all(dev); -} - static bool suspend_to_idle(void) { #if IS_ENABLED(CONFIG_ACPI_SLEEP) @@ -315,7 +301,7 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime) intel_hpd_cancel_work(xe); - intel_suspend_encoders(xe); + intel_encoder_suspend_all(&xe->display); intel_opregion_suspend(xe, s2idle ? PCI_D1 : PCI_D3cold);