From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 10/11] drm/i915: Factor out call_with_modeset_ctx()
Date: Fri, 28 Apr 2023 17:32:44 +0300 [thread overview]
Message-ID: <ZEvZDP5vxENwuJmk@intel.com> (raw)
In-Reply-To: <20230426165305.2049341-11-imre.deak@intel.com>
On Wed, Apr 26, 2023 at 07:53:04PM +0300, Imre Deak wrote:
> Factor out a helper to call a function with the atomic locks held,
> required by a follow-up patch resetting an active DP link.
>
> No functional changes.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_ddi.c | 53 ++++++++++++++----------
> 1 file changed, 31 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 29e4bfab46358..0c8bc32f293b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4370,35 +4370,18 @@ static int intel_hdmi_reset_link(struct intel_encoder *encoder,
> return modeset_pipe(&crtc->base, ctx);
> }
>
> -static enum intel_hotplug_state
> -intel_ddi_hotplug(struct intel_encoder *encoder,
> - struct intel_connector *connector)
> +static void call_with_modeset_ctx(int (*fn)(struct intel_encoder *encoder,
> + struct drm_modeset_acquire_ctx *ctx),
> + struct intel_encoder *encoder)
> {
> struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> - struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> - struct intel_dp *intel_dp = &dig_port->dp;
> - enum phy phy = intel_port_to_phy(i915, encoder->port);
> - bool is_tc = intel_phy_is_tc(i915, phy);
> struct drm_modeset_acquire_ctx ctx;
> - enum intel_hotplug_state state;
> int ret;
>
> - if (intel_dp->compliance.test_active &&
> - intel_dp->compliance.test_type == DP_TEST_LINK_PHY_TEST_PATTERN) {
> - intel_dp_phy_test(encoder);
> - /* just do the PHY test and nothing else */
> - return INTEL_HOTPLUG_UNCHANGED;
> - }
> -
> - state = intel_encoder_hotplug(encoder, connector);
> -
> drm_modeset_acquire_init(&ctx, 0);
>
> for (;;) {
> - if (connector->base.connector_type == DRM_MODE_CONNECTOR_HDMIA)
> - ret = intel_hdmi_reset_link(encoder, &ctx);
> - else
> - ret = intel_dp_retrain_link(encoder, &ctx);
> + ret = fn(encoder, &ctx);
>
> if (ret == -EDEADLK) {
> drm_modeset_backoff(&ctx);
> @@ -4410,8 +4393,34 @@ intel_ddi_hotplug(struct intel_encoder *encoder,
>
> drm_modeset_drop_locks(&ctx);
> drm_modeset_acquire_fini(&ctx);
> - drm_WARN(encoder->base.dev, ret,
> + drm_WARN(&i915->drm, ret,
> "Acquiring modeset locks failed with %i\n", ret);
> +}
Seems pretty much a less general version of
https://patchwork.freedesktop.org/series/92607/
Unfortuantely that died in the bikeshed.
Maybe we should look into doing something like that
just for i915 initially...
> +
> +static enum intel_hotplug_state
> +intel_ddi_hotplug(struct intel_encoder *encoder,
> + struct intel_connector *connector)
> +{
> + struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> + struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> + struct intel_dp *intel_dp = &dig_port->dp;
> + enum phy phy = intel_port_to_phy(i915, encoder->port);
> + bool is_tc = intel_phy_is_tc(i915, phy);
> + enum intel_hotplug_state state;
> +
> + if (intel_dp->compliance.test_active &&
> + intel_dp->compliance.test_type == DP_TEST_LINK_PHY_TEST_PATTERN) {
> + intel_dp_phy_test(encoder);
> + /* just do the PHY test and nothing else */
> + return INTEL_HOTPLUG_UNCHANGED;
> + }
> +
> + state = intel_encoder_hotplug(encoder, connector);
> +
> + if (connector->base.connector_type == DRM_MODE_CONNECTOR_HDMIA)
> + call_with_modeset_ctx(intel_hdmi_reset_link, encoder);
> + else
> + call_with_modeset_ctx(intel_dp_retrain_link, encoder);
>
> /*
> * Unpowered type-c dongles can take some time to boot and be
> --
> 2.37.2
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-04-28 14:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 16:52 [Intel-gfx] [PATCH 00/11] drm/i915/tc: Add a workaround for an IOM/TCSS firmware hang issue Imre Deak
2023-04-26 16:52 ` [Intel-gfx] [PATCH 01/11] drm/i915: Fix PIPEDMC disabling for a bigjoiner configuration Imre Deak
2023-04-26 16:52 ` [Intel-gfx] [PATCH 02/11] drm/i915: Make the CRTC wrt. CSC state consistent during sanitize-disabling Imre Deak
2023-04-26 17:48 ` Ville Syrjälä
2023-04-26 19:51 ` Imre Deak
2023-04-26 16:52 ` [Intel-gfx] [PATCH 03/11] drm/i915: Update connector atomic state before crtc sanitize-disabling Imre Deak
2023-04-26 16:52 ` [Intel-gfx] [PATCH 04/11] drm/i915: Factor out set_encoder_for_connector() Imre Deak
2023-04-26 16:52 ` [Intel-gfx] [PATCH 05/11] drm/i915: Add support for disabling any CRTCs during HW readout/sanitization Imre Deak
2023-04-28 14:02 ` Ville Syrjälä
2023-04-28 17:22 ` Imre Deak
2023-04-28 17:47 ` Imre Deak
2023-04-29 7:50 ` Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 06/11] drm/i915/dp: Add link training debug and error printing helpers Imre Deak
2023-04-28 14:21 ` Ville Syrjälä
2023-04-28 19:30 ` Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 07/11] drm/i915/dp: Convert link training error to debug message on disconnected sink Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 08/11] drm/i915/dp: Prevent link training fallback on disconnected port Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 09/11] drm/i915/dp: Factor out intel_dp_get_active_pipes() Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 10/11] drm/i915: Factor out call_with_modeset_ctx() Imre Deak
2023-04-28 14:32 ` Ville Syrjälä [this message]
2023-04-28 18:34 ` Imre Deak
2023-04-26 16:53 ` [Intel-gfx] [PATCH 11/11] drm/i915/tc: Reset TypeC PHYs left enabled in DP-alt mode after the sink disconnects Imre Deak
2023-04-26 19:37 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/tc: Add a workaround for an IOM/TCSS firmware hang issue Patchwork
2023-04-26 19:52 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-04-26 22:09 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEvZDP5vxENwuJmk@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.