From: Ville Syrjälä <[email protected]>

Pull the i915 specific bits of the overlay cleanup into
a separate function (i915_overlay_cleanup()) to accommodate
the upcoming parent vs. display driver split.

For now we'll also have to pass in the overlay struct, but
that will disappear once the i915 vs. display split is completed.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_overlay.c | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
b/drivers/gpu/drm/i915/display/intel_overlay.c
index 5683bddf33b4..9b5ae3f4f5bd 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -1490,23 +1490,29 @@ bool intel_overlay_available(struct intel_display 
*display)
        return display->overlay;
 }
 
-void intel_overlay_cleanup(struct intel_display *display)
+static void i915_overlay_cleanup(struct drm_device *drm,
+                                struct intel_overlay *overlay)
 {
-       struct intel_overlay *overlay;
-
-       overlay = fetch_and_zero(&display->overlay);
-       if (!overlay)
-               return;
-
        /*
         * The bo's should be free'd by the generic code already.
         * Furthermore modesetting teardown happens beforehand so the
         * hardware should be off already.
         */
-       drm_WARN_ON(display->drm, i915_overlay_is_active(display->drm));
+       drm_WARN_ON(drm, i915_overlay_is_active(drm));
 
        i915_gem_object_put(overlay->reg_bo);
        i915_active_fini(&overlay->last_flip);
+}
+
+void intel_overlay_cleanup(struct intel_display *display)
+{
+       struct intel_overlay *overlay;
+
+       overlay = fetch_and_zero(&display->overlay);
+       if (!overlay)
+               return;
+
+       i915_overlay_cleanup(display->drm, overlay);
 
        kfree(overlay);
 }
-- 
2.52.0

Reply via email to