]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915: Use the disable callback for disabling planes.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 21 Apr 2015 14:12:52 +0000 (17:12 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 8 May 2015 11:03:52 +0000 (13:03 +0200)
This allows disabling all planes affecting a crtc without caring what type it is.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_display.c

index 8136005d2c6e5324af1ec13c7440f70621705e3d..87fe4f7d5ce5424dc1b0126f66068916e9660f88 100644 (file)
@@ -238,6 +238,11 @@ enum hpd_pin {
 #define for_each_crtc(dev, crtc) \
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
 
+#define for_each_intel_plane(dev, intel_plane) \
+       list_for_each_entry(intel_plane,                        \
+                           &dev->mode_config.plane_list,       \
+                           base.head)
+
 #define for_each_intel_crtc(dev, intel_crtc) \
        list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
 
index 7c0beef7f3ef0c026c358bc79df7562a980cbdc2..a08cb14f076c4a465c9ff7879435e5cff5739631 100644 (file)
@@ -2254,32 +2254,6 @@ static void intel_enable_primary_hw_plane(struct drm_plane *plane,
                intel_wait_for_vblank(dev, intel_crtc->pipe);
 }
 
-/**
- * intel_disable_primary_hw_plane - disable the primary hardware plane
- * @plane: plane to be disabled
- * @crtc: crtc for the plane
- *
- * Disable @plane on @crtc, making sure that the pipe is running first.
- */
-static void intel_disable_primary_hw_plane(struct drm_plane *plane,
-                                          struct drm_crtc *crtc)
-{
-       struct drm_device *dev = plane->dev;
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
-       if (WARN_ON(!intel_crtc->active))
-               return;
-
-       if (!intel_crtc->primary_enabled)
-               return;
-
-       intel_crtc->primary_enabled = false;
-
-       dev_priv->display.update_primary_plane(crtc, plane->fb,
-                                              crtc->x, crtc->y);
-}
-
 static bool need_vtd_wa(struct drm_device *dev)
 {
 #ifdef CONFIG_INTEL_IOMMU
@@ -4645,38 +4619,6 @@ static void intel_enable_sprite_planes(struct drm_crtc *crtc)
        }
 }
 
-/*
- * Disable a plane internally without actually modifying the plane's state.
- * This will allow us to easily restore the plane later by just reprogramming
- * its state.
- */
-static void disable_plane_internal(struct drm_plane *plane)
-{
-       struct intel_plane *intel_plane = to_intel_plane(plane);
-       struct drm_plane_state *state =
-               plane->funcs->atomic_duplicate_state(plane);
-       struct intel_plane_state *intel_state = to_intel_plane_state(state);
-
-       intel_state->visible = false;
-       intel_plane->commit_plane(plane, intel_state);
-
-       intel_plane_destroy_state(plane, state);
-}
-
-static void intel_disable_sprite_planes(struct drm_crtc *crtc)
-{
-       struct drm_device *dev = crtc->dev;
-       enum pipe pipe = to_intel_crtc(crtc)->pipe;
-       struct drm_plane *plane;
-       struct intel_plane *intel_plane;
-
-       drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
-               intel_plane = to_intel_plane(plane);
-               if (plane->fb && intel_plane->pipe == pipe)
-                       disable_plane_internal(plane);
-       }
-}
-
 void hsw_enable_ips(struct intel_crtc *crtc)
 {
        struct drm_device *dev = crtc->base.dev;
@@ -4830,6 +4772,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
        struct drm_device *dev = crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       struct intel_plane *intel_plane;
        int pipe = intel_crtc->pipe;
 
        intel_crtc_wait_for_pending_flips(crtc);
@@ -4840,9 +4783,15 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
        hsw_disable_ips(intel_crtc);
 
        intel_crtc_dpms_overlay(intel_crtc, false);
-       intel_crtc_update_cursor(crtc, false);
-       intel_disable_sprite_planes(crtc);
-       intel_disable_primary_hw_plane(crtc->primary, crtc);
+       intel_crtc->primary_enabled = false;
+       for_each_intel_plane(dev, intel_plane) {
+               if (intel_plane->pipe == pipe) {
+                       struct drm_crtc *from = intel_plane->base.crtc;
+
+                       intel_plane->disable_plane(&intel_plane->base,
+                                                  from ?: crtc, true);
+               }
+       }
 
        /*
         * FIXME: Once we grow proper nuclear flip support out of this we need
@@ -13357,24 +13306,14 @@ intel_commit_primary_plane(struct drm_plane *plane,
        crtc->y = src->y1 >> 16;
 
        if (intel_crtc->active) {
-               if (state->visible) {
+               intel_crtc->primary_enabled = state->visible;
+
+               if (state->visible)
                        /* FIXME: kill this fastboot hack */
                        intel_update_pipe_size(intel_crtc);
 
-                       intel_crtc->primary_enabled = true;
-
-                       dev_priv->display.update_primary_plane(crtc, plane->fb,
-                                       crtc->x, crtc->y);
-               } else {
-                       /*
-                        * If clipping results in a non-visible primary plane,
-                        * we'll disable the primary plane.  Note that this is
-                        * a bit different than what happens if userspace
-                        * explicitly disables the plane by passing fb=0
-                        * because plane->fb still gets set and pinned.
-                        */
-                       intel_disable_primary_hw_plane(plane, crtc);
-               }
+               dev_priv->display.update_primary_plane(crtc, plane->fb,
+                                                      crtc->x, crtc->y);
        }
 }