[PATCH 021/108] drm/i915/display: Factor out a helper to modeset a pipe with atomic state

Imre Deak
2026-04-28T12:53:28Z

Factor out a helper modesetting a pipe that accepts an existing atomic
state. This prepares for a follow-up change that needs to allocate its
own atomic state.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 30 ++++++++++++++------
drivers/gpu/drm/i915/display/intel_display.h | 3 ++
2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 674a4ece6d0f9..560b057ec163d 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5629,18 +5629,15 @@ int intel_modeset_all_pipes_late(struct intel_atomic_state *state,
return 0;
}

-int intel_modeset_commit_pipes(struct intel_display *display,
- u8 pipe_mask,
- struct drm_modeset_acquire_ctx *ctx)
+int intel_modeset_commit_pipes_for_atomic_state(struct intel_atomic_state *intel_state,
+ u8 pipe_mask,
+ struct drm_modeset_acquire_ctx *ctx)
{
- struct drm_atomic_state *state;
+ struct drm_atomic_state *state = &intel_state->base;
+ struct intel_display *display = to_intel_display(intel_state);
struct intel_crtc *crtc;
int ret;

- state = drm_atomic_state_alloc(display->drm);
- if (!state)
- return -ENOMEM;
-
state->acquire_ctx = ctx;
to_intel_atomic_state(state)->internal = true;

@@ -5658,6 +5655,23 @@ int intel_modeset_commit_pipes(struct intel_display *display,

ret = drm_atomic_commit(state);
out:
+ return ret;
+}
+
+int intel_modeset_commit_pipes(struct intel_display *display,
+ u8 pipe_mask,
+ struct drm_modeset_acquire_ctx *ctx)
+{
+ struct drm_atomic_state *state;
+ int ret;
+
+ state = drm_atomic_state_alloc(display->drm);
+ if (!state)
+ return -ENOMEM;
+
+ ret = intel_modeset_commit_pipes_for_atomic_state(to_intel_atomic_state(state),
+ pipe_mask, ctx);
+
drm_atomic_state_put(state);

return ret;
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 1e76a455d7c43..79e42bfd15e70 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -478,6 +478,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_for_atomic_state(struct intel_atomic_state *state,
+ u8 pipe_mask,
+ struct drm_modeset_acquire_ctx *ctx);
int intel_modeset_commit_pipes(struct intel_display *display,
u8 pipe_mask,
struct drm_modeset_acquire_ctx *ctx);
--
2.49.1