drm/i915: Wrap plane update/disable hook calls
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 6 Feb 2019 20:49:10 +0000 (22:49 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 Feb 2019 18:59:22 +0000 (20:59 +0200)
Wrap the .update_plane()/.update_slave()/.disable_plane() vfunc
calls into helpers which also take care to emit the appropriate
tracepoint.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190206204910.13965-4-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h

index 1c3c1eeafd1a01c1df4a31a5816a9e522deff41e..021b94b78862f1f9249ec677e5cbf984f327eddb 100644 (file)
@@ -217,6 +217,35 @@ skl_next_plane_to_commit(struct intel_atomic_state *state,
        return NULL;
 }
 
+void intel_update_plane(struct intel_plane *plane,
+                       const struct intel_crtc_state *crtc_state,
+                       const struct intel_plane_state *plane_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+
+       trace_intel_update_plane(&plane->base, crtc);
+       plane->update_plane(plane, crtc_state, plane_state);
+}
+
+void intel_update_slave(struct intel_plane *plane,
+                       const struct intel_crtc_state *crtc_state,
+                       const struct intel_plane_state *plane_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+
+       trace_intel_update_plane(&plane->base, crtc);
+       plane->update_slave(plane, crtc_state, plane_state);
+}
+
+void intel_disable_plane(struct intel_plane *plane,
+                        const struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+
+       trace_intel_disable_plane(&plane->base, crtc);
+       plane->disable_plane(plane, crtc_state);
+}
+
 void skl_update_planes_on_crtc(struct intel_atomic_state *state,
                               struct intel_crtc *crtc)
 {
@@ -241,8 +270,7 @@ void skl_update_planes_on_crtc(struct intel_atomic_state *state,
                        intel_atomic_get_new_plane_state(state, plane);
 
                if (new_plane_state->base.visible) {
-                       trace_intel_update_plane(&plane->base, crtc);
-                       plane->update_plane(plane, new_crtc_state, new_plane_state);
+                       intel_update_plane(plane, new_crtc_state, new_plane_state);
                } else if (new_plane_state->slave) {
                        struct intel_plane *master =
                                new_plane_state->linked_plane;
@@ -259,11 +287,9 @@ void skl_update_planes_on_crtc(struct intel_atomic_state *state,
                        new_plane_state =
                                intel_atomic_get_new_plane_state(state, master);
 
-                       trace_intel_update_plane(&plane->base, crtc);
-                       plane->update_slave(plane, new_crtc_state, new_plane_state);
+                       intel_update_slave(plane, new_crtc_state, new_plane_state);
                } else {
-                       trace_intel_disable_plane(&plane->base, crtc);
-                       plane->disable_plane(plane, new_crtc_state);
+                       intel_disable_plane(plane, new_crtc_state);
                }
        }
 }
@@ -283,13 +309,10 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
                    !(update_mask & BIT(plane->id)))
                        continue;
 
-               if (new_plane_state->base.visible) {
-                       trace_intel_update_plane(&plane->base, crtc);
-                       plane->update_plane(plane, new_crtc_state, new_plane_state);
-               } else {
-                       trace_intel_disable_plane(&plane->base, crtc);
-                       plane->disable_plane(plane, new_crtc_state);
-               }
+               if (new_plane_state->base.visible)
+                       intel_update_plane(plane, new_crtc_state, new_plane_state);
+               else
+                       intel_disable_plane(plane, new_crtc_state);
        }
 }
 
index 975769680db4eaf26fae0eb271bf04095b296752..4f66f578b857205712649aeb4de66d03e265486d 100644 (file)
@@ -2820,8 +2820,7 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc,
        if (plane->id == PLANE_PRIMARY)
                intel_pre_disable_primary_noatomic(&crtc->base);
 
-       trace_intel_disable_plane(&plane->base, crtc);
-       plane->disable_plane(plane, crtc_state);
+       intel_disable_plane(plane, crtc_state);
 }
 
 static void
@@ -5589,8 +5588,7 @@ static void intel_crtc_disable_planes(struct intel_atomic_state *state,
                    !(update_mask & BIT(plane->id)))
                        continue;
 
-               trace_intel_disable_plane(&plane->base, crtc);
-               plane->disable_plane(plane, new_crtc_state);
+               intel_disable_plane(plane, new_crtc_state);
 
                if (old_plane_state->base.visible)
                        fb_bits |= plane->frontbuffer_bit;
@@ -14091,14 +14089,11 @@ intel_legacy_cursor_update(struct drm_plane *plane,
         */
        crtc_state->active_planes = new_crtc_state->active_planes;
 
-       if (plane->state->visible) {
-               trace_intel_update_plane(plane, to_intel_crtc(crtc));
-               intel_plane->update_plane(intel_plane, crtc_state,
-                                         to_intel_plane_state(plane->state));
-       } else {
-               trace_intel_disable_plane(plane, to_intel_crtc(crtc));
-               intel_plane->disable_plane(intel_plane, crtc_state);
-       }
+       if (plane->state->visible)
+               intel_update_plane(intel_plane, crtc_state,
+                                  to_intel_plane_state(plane->state));
+       else
+               intel_disable_plane(intel_plane, crtc_state);
 
        intel_plane_unpin_fb(to_intel_plane_state(old_plane_state));
 
index 48e89db23c5b7b272df7c692071a90a12d0bdd06..b4e29b823b04d82b032922dadf9c18ae50ca9f85 100644 (file)
@@ -2378,6 +2378,14 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
                               struct intel_crtc_state *crtc_state);
 
 /* intel_atomic_plane.c */
+void intel_update_plane(struct intel_plane *plane,
+                       const struct intel_crtc_state *crtc_state,
+                       const struct intel_plane_state *plane_state);
+void intel_update_slave(struct intel_plane *plane,
+                       const struct intel_crtc_state *crtc_state,
+                       const struct intel_plane_state *plane_state);
+void intel_disable_plane(struct intel_plane *plane,
+                        const struct intel_crtc_state *crtc_state);
 struct intel_plane *intel_plane_alloc(void);
 void intel_plane_free(struct intel_plane *plane);
 struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);