]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/i915: Factor out function to modeset commit a set of pipes
authorImre Deak <imre.deak@intel.com>
Mon, 10 Jun 2024 16:49:17 +0000 (19:49 +0300)
committerImre Deak <imre.deak@intel.com>
Thu, 13 Jun 2024 18:26:49 +0000 (21:26 +0300)
Factor out a function to modeset commit a set of pipes, which a later
patch will reuse for DP link retraining.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240610164933.2947366-6-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h

index ba7d0a706a20058afe73c518494efb310846318a..4e033e4066b19c1ea3fb6f7c34e202d933c444e5 100644 (file)
@@ -4453,35 +4453,6 @@ intel_ddi_init_dp_connector(struct intel_digital_port *dig_port)
        return connector;
 }
 
-static int modeset_pipe(struct drm_crtc *crtc,
-                       struct drm_modeset_acquire_ctx *ctx)
-{
-       struct drm_atomic_state *state;
-       struct drm_crtc_state *crtc_state;
-       int ret;
-
-       state = drm_atomic_state_alloc(crtc->dev);
-       if (!state)
-               return -ENOMEM;
-
-       state->acquire_ctx = ctx;
-       to_intel_atomic_state(state)->internal = true;
-
-       crtc_state = drm_atomic_get_crtc_state(state, crtc);
-       if (IS_ERR(crtc_state)) {
-               ret = PTR_ERR(crtc_state);
-               goto out;
-       }
-
-       crtc_state->connectors_changed = true;
-
-       ret = drm_atomic_commit(state);
-out:
-       drm_atomic_state_put(state);
-
-       return ret;
-}
-
 static int intel_hdmi_reset_link(struct intel_encoder *encoder,
                                 struct drm_modeset_acquire_ctx *ctx)
 {
@@ -4551,7 +4522,7 @@ static int intel_hdmi_reset_link(struct intel_encoder *encoder,
         * would be perfectly happy if were to just reconfigure
         * the SCDC settings on the fly.
         */
-       return modeset_pipe(&crtc->base, ctx);
+       return intel_modeset_commit_pipes(dev_priv, BIT(crtc->pipe), ctx);
 }
 
 static enum intel_hotplug_state
index 77220254e8b83dd005ef5dd7ad0c92247a489842..7bc4f3de691e02deb61dcc7521b13055a34d78fb 100644 (file)
@@ -5631,6 +5631,40 @@ int intel_modeset_all_pipes_late(struct intel_atomic_state *state,
        return 0;
 }
 
+int intel_modeset_commit_pipes(struct drm_i915_private *i915,
+                              u8 pipe_mask,
+                              struct drm_modeset_acquire_ctx *ctx)
+{
+       struct drm_atomic_state *state;
+       struct intel_crtc *crtc;
+       int ret;
+
+       state = drm_atomic_state_alloc(&i915->drm);
+       if (!state)
+               return -ENOMEM;
+
+       state->acquire_ctx = ctx;
+       to_intel_atomic_state(state)->internal = true;
+
+       for_each_intel_crtc_in_pipe_mask(&i915->drm, crtc, pipe_mask) {
+               struct intel_crtc_state *crtc_state =
+                       intel_atomic_get_crtc_state(state, crtc);
+
+               if (IS_ERR(crtc_state)) {
+                       ret = PTR_ERR(crtc_state);
+                       goto out;
+               }
+
+               crtc_state->uapi.connectors_changed = true;
+       }
+
+       ret = drm_atomic_commit(state);
+out:
+       drm_atomic_state_put(state);
+
+       return ret;
+}
+
 /*
  * This implements the workaround described in the "notes" section of the mode
  * set sequence documentation. When going from no pipes or single pipe to
index 48454cf219065bfd77443ede311de91120bd29ba..b0cf6ca70952e1e4cd27840cc4555d6bdf625d3b 100644 (file)
@@ -537,6 +537,9 @@ int intel_modeset_pipes_in_mask_early(struct intel_atomic_state *state,
                                      const char *reason, u8 pipe_mask);
 int intel_modeset_all_pipes_late(struct intel_atomic_state *state,
                                 const char *reason);
+int intel_modeset_commit_pipes(struct drm_i915_private *i915,
+                              u8 pipe_mask,
+                              struct drm_modeset_acquire_ctx *ctx);
 void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state,
                                          struct intel_power_domain_mask *old_domains);
 void intel_modeset_put_crtc_power_domains(struct intel_crtc *crtc,