Move cursor fast path plane state update into helper
function. The target hw.crtc is passed as a parameter
so a later patch can reuse the helper for joiner
secondary pipes, where hw.crtc points at the secondary
being programmed while uapi.crtc stays on the primary.

v4: Drop uapi.crtc assignment from the helper. [Chaitanya]

Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Nemesa Garg <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_cursor.c | 39 ++++++++++++++-------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c 
b/drivers/gpu/drm/i915/display/intel_cursor.c
index af7fc1f888c4..632f7a0a5a63 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -841,6 +841,29 @@ intel_cursor_joiner_commits_idle(struct intel_display 
*display,
        return true;
 }
 
+static void
+intel_cursor_fastpath_update_plane_state(struct intel_plane_state *plane_state,
+                                        struct drm_framebuffer *fb,
+                                        struct intel_crtc *hw_crtc,
+                                        int crtc_x, int crtc_y,
+                                        unsigned int crtc_w, unsigned int 
crtc_h,
+                                        u32 src_x, u32 src_y,
+                                        u32 src_w, u32 src_h)
+{
+       drm_atomic_set_fb_for_plane(&plane_state->uapi, fb);
+
+       plane_state->uapi.src_x = src_x;
+       plane_state->uapi.src_y = src_y;
+       plane_state->uapi.src_w = src_w;
+       plane_state->uapi.src_h = src_h;
+       plane_state->uapi.crtc_x = crtc_x;
+       plane_state->uapi.crtc_y = crtc_y;
+       plane_state->uapi.crtc_w = crtc_w;
+       plane_state->uapi.crtc_h = crtc_h;
+
+       intel_plane_copy_uapi_to_hw_state(NULL, plane_state, plane_state, 
hw_crtc);
+}
+
 static int
 intel_legacy_cursor_update(struct drm_plane *_plane,
                           struct drm_crtc *_crtc,
@@ -916,18 +939,10 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
                goto out_free;
        }
 
-       drm_atomic_set_fb_for_plane(&new_plane_state->uapi, fb);
-
-       new_plane_state->uapi.src_x = src_x;
-       new_plane_state->uapi.src_y = src_y;
-       new_plane_state->uapi.src_w = src_w;
-       new_plane_state->uapi.src_h = src_h;
-       new_plane_state->uapi.crtc_x = crtc_x;
-       new_plane_state->uapi.crtc_y = crtc_y;
-       new_plane_state->uapi.crtc_w = crtc_w;
-       new_plane_state->uapi.crtc_h = crtc_h;
-
-       intel_plane_copy_uapi_to_hw_state(NULL, new_plane_state, 
new_plane_state, crtc);
+       intel_cursor_fastpath_update_plane_state(new_plane_state, fb,
+                                                crtc,
+                                                crtc_x, crtc_y, crtc_w, crtc_h,
+                                                src_x, src_y, src_w, src_h);
 
        ret = intel_plane_atomic_check_with_state(crtc_state, new_crtc_state,
                                                  old_plane_state, 
new_plane_state);
-- 
2.25.1

Reply via email to