diff mbox series

[03/15] drm/i915: Make intel_crtc_disable_planes() use active planes mask.

Message ID 20180919135644.14182-4-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gen11: Implement planar format support. | expand

Commit Message

Maarten Lankhorst Sept. 19, 2018, 1:56 p.m. UTC
This will only disable planes we actually had marked as visible in
crtc_state->visible_planes and cleans up intel_crtc_disable_plane()
slightly.

This is also useful for when we start enabling NV12 support, in which
we will make the separate Y plane visible, but ignore the Y plane's state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 29 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 15 deletions(-)

Comments

Matt Roper Sept. 20, 2018, 12:13 a.m. UTC | #1
On Wed, Sep 19, 2018 at 03:56:32PM +0200, Maarten Lankhorst wrote:
> This will only disable planes we actually had marked as visible in
> crtc_state->visible_planes and cleans up intel_crtc_disable_plane()
> slightly.
> 
> This is also useful for when we start enabling NV12 support, in which
> we will make the separate Y plane visible, but ignore the Y plane's state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 29 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 7a7ff1d76031..f7982f18b8fe 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5402,24 +5402,23 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
>  		intel_update_watermarks(crtc);
>  }
>  
> -static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask)
> +static void intel_crtc_disable_planes(struct intel_crtc *crtc, unsigned plane_mask)
>  {
> -	struct drm_device *dev = crtc->dev;
> -	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> -	struct drm_plane *p;
> -	int pipe = intel_crtc->pipe;
> +	struct drm_device *dev = crtc->base.dev;
> +	struct intel_plane *plane;
> +	unsigned fb_bits = 0;
>  
> -	intel_crtc_dpms_overlay_disable(intel_crtc);
> +	intel_crtc_dpms_overlay_disable(crtc);
>  
> -	drm_for_each_plane_mask(p, dev, plane_mask)
> -		to_intel_plane(p)->disable_plane(to_intel_plane(p), intel_crtc);
> +	for_each_intel_plane_on_crtc(dev, crtc, plane) {
> +		if (plane_mask & BIT(plane->id)) {
> +			plane->disable_plane(plane, crtc);
>  
> -	/*
> -	 * FIXME: Once we grow proper nuclear flip support out of this we need
> -	 * to compute the mask of flip planes precisely. For the time being
> -	 * consider this a flip to a NULL plane.
> -	 */
> -	intel_frontbuffer_flip(to_i915(dev), INTEL_FRONTBUFFER_ALL_MASK(pipe));
> +			fb_bits |= plane->frontbuffer_bit;
> +		}
> +	}
> +
> +	intel_frontbuffer_flip(to_i915(dev), fb_bits);
>  }
>  
>  static void intel_encoders_pre_pll_enable(struct drm_crtc *crtc,
> @@ -12697,7 +12696,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
>  		intel_pre_plane_update(old_intel_crtc_state, new_intel_crtc_state);
>  
>  		if (old_crtc_state->active) {
> -			intel_crtc_disable_planes(crtc, old_crtc_state->plane_mask);
> +			intel_crtc_disable_planes(intel_crtc, old_intel_crtc_state->active_planes);
>  
>  			/*
>  			 * We need to disable pipe CRC before disabling the pipe,
> -- 
> 2.18.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7a7ff1d76031..f7982f18b8fe 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5402,24 +5402,23 @@  static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
 		intel_update_watermarks(crtc);
 }
 
-static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask)
+static void intel_crtc_disable_planes(struct intel_crtc *crtc, unsigned plane_mask)
 {
-	struct drm_device *dev = crtc->dev;
-	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	struct drm_plane *p;
-	int pipe = intel_crtc->pipe;
+	struct drm_device *dev = crtc->base.dev;
+	struct intel_plane *plane;
+	unsigned fb_bits = 0;
 
-	intel_crtc_dpms_overlay_disable(intel_crtc);
+	intel_crtc_dpms_overlay_disable(crtc);
 
-	drm_for_each_plane_mask(p, dev, plane_mask)
-		to_intel_plane(p)->disable_plane(to_intel_plane(p), intel_crtc);
+	for_each_intel_plane_on_crtc(dev, crtc, plane) {
+		if (plane_mask & BIT(plane->id)) {
+			plane->disable_plane(plane, crtc);
 
-	/*
-	 * FIXME: Once we grow proper nuclear flip support out of this we need
-	 * to compute the mask of flip planes precisely. For the time being
-	 * consider this a flip to a NULL plane.
-	 */
-	intel_frontbuffer_flip(to_i915(dev), INTEL_FRONTBUFFER_ALL_MASK(pipe));
+			fb_bits |= plane->frontbuffer_bit;
+		}
+	}
+
+	intel_frontbuffer_flip(to_i915(dev), fb_bits);
 }
 
 static void intel_encoders_pre_pll_enable(struct drm_crtc *crtc,
@@ -12697,7 +12696,7 @@  static void intel_atomic_commit_tail(struct drm_atomic_state *state)
 		intel_pre_plane_update(old_intel_crtc_state, new_intel_crtc_state);
 
 		if (old_crtc_state->active) {
-			intel_crtc_disable_planes(crtc, old_crtc_state->plane_mask);
+			intel_crtc_disable_planes(intel_crtc, old_intel_crtc_state->active_planes);
 
 			/*
 			 * We need to disable pipe CRC before disabling the pipe,