diff mbox series

[05/24] drm/i915: Use intel_plane_state in prepare and cleanup plane_fb

Message ID 20191004113514.17064-6-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Enable bigjoiner support, second approach. | expand

Commit Message

Maarten Lankhorst Oct. 4, 2019, 11:34 a.m. UTC
We need to look at the hw fb in the plane split, so replace all the places
that use drm_plane_state with intel_plane_state.

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

Comments

Ville Syrjala Oct. 4, 2019, 1:23 p.m. UTC | #1
On Fri, Oct 04, 2019 at 01:34:55PM +0200, Maarten Lankhorst wrote:
> We need to look at the hw fb in the plane split, so replace all the places
> that use drm_plane_state with intel_plane_state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 28 +++++++++++---------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 9e34be48c770..b5ed097d6a59 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14380,12 +14380,14 @@ static void fb_obj_bump_render_priority(struct drm_i915_gem_object *obj)
>   */
>  int
>  intel_prepare_plane_fb(struct drm_plane *plane,
> -		       struct drm_plane_state *new_state)
> +		       struct drm_plane_state *_new_plane_state)
>  {
> +	struct intel_plane_state *new_plane_state =
> +		to_intel_plane_state(_new_plane_state);
>  	struct intel_atomic_state *intel_state =
> -		to_intel_atomic_state(new_state->state);
> +		to_intel_atomic_state(new_plane_state->base.state);
>  	struct drm_i915_private *dev_priv = to_i915(plane->dev);
> -	struct drm_framebuffer *fb = new_state->fb;
> +	struct drm_framebuffer *fb = new_plane_state->base.fb;
>  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
>  	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
>  	int ret;
> @@ -14416,9 +14418,9 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  		}
>  	}
>  
> -	if (new_state->fence) { /* explicit fencing */
> +	if (new_plane_state->base.fence) { /* explicit fencing */
>  		ret = i915_sw_fence_await_dma_fence(&intel_state->commit_ready,
> -						    new_state->fence,
> +						    new_plane_state->base.fence,
>  						    I915_FENCE_TIMEOUT,
>  						    GFP_KERNEL);
>  		if (ret < 0)
> @@ -14438,7 +14440,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  		return ret;
>  	}
>  
> -	ret = intel_plane_pin_fb(to_intel_plane_state(new_state));
> +	ret = intel_plane_pin_fb(new_plane_state);
>  
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  	i915_gem_object_unpin_pages(obj);
> @@ -14448,7 +14450,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  	fb_obj_bump_render_priority(obj);
>  	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB);
>  
> -	if (!new_state->fence) { /* implicit fencing */
> +	if (!new_plane_state->base.fence) { /* implicit fencing */
>  		struct dma_fence *fence;
>  
>  		ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
> @@ -14460,11 +14462,11 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  
>  		fence = dma_resv_get_excl_rcu(obj->base.resv);
>  		if (fence) {
> -			add_rps_boost_after_vblank(new_state->crtc, fence);
> +			add_rps_boost_after_vblank(new_plane_state->base.crtc, fence);
>  			dma_fence_put(fence);
>  		}
>  	} else {
> -		add_rps_boost_after_vblank(new_state->crtc, new_state->fence);
> +		add_rps_boost_after_vblank(new_plane_state->base.crtc, new_plane_state->base.fence);
>  	}
>  
>  	/*
> @@ -14494,10 +14496,12 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>   */
>  void
>  intel_cleanup_plane_fb(struct drm_plane *plane,
> -		       struct drm_plane_state *old_state)
> +		       struct drm_plane_state *_old_plane_state)
>  {
> +	struct intel_plane_state *old_plane_state =
> +		to_intel_plane_state(_old_plane_state);
>  	struct intel_atomic_state *intel_state =
> -		to_intel_atomic_state(old_state->state);
> +		to_intel_atomic_state(old_plane_state->base.state);
>  	struct drm_i915_private *dev_priv = to_i915(plane->dev);
>  
>  	if (intel_state->rps_interactive) {
> @@ -14507,7 +14511,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
>  
>  	/* Should only be called after a successful intel_prepare_plane_fb()! */
>  	mutex_lock(&dev_priv->drm.struct_mutex);
> -	intel_plane_unpin_fb(to_intel_plane_state(old_state));
> +	intel_plane_unpin_fb(old_plane_state);
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  }
>  
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Matt Roper Oct. 7, 2019, 7:37 p.m. UTC | #2
On Fri, Oct 04, 2019 at 01:34:55PM +0200, Maarten Lankhorst wrote:
> We need to look at the hw fb in the plane split, so replace all the places
> that use drm_plane_state with intel_plane_state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 28 +++++++++++---------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 9e34be48c770..b5ed097d6a59 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14380,12 +14380,14 @@ static void fb_obj_bump_render_priority(struct drm_i915_gem_object *obj)
>   */
>  int
>  intel_prepare_plane_fb(struct drm_plane *plane,
> -		       struct drm_plane_state *new_state)
> +		       struct drm_plane_state *_new_plane_state)
>  {
> +	struct intel_plane_state *new_plane_state =
> +		to_intel_plane_state(_new_plane_state);
>  	struct intel_atomic_state *intel_state =
> -		to_intel_atomic_state(new_state->state);
> +		to_intel_atomic_state(new_plane_state->base.state);
>  	struct drm_i915_private *dev_priv = to_i915(plane->dev);
> -	struct drm_framebuffer *fb = new_state->fb;
> +	struct drm_framebuffer *fb = new_plane_state->base.fb;
>  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
>  	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
>  	int ret;
> @@ -14416,9 +14418,9 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  		}
>  	}
>  
> -	if (new_state->fence) { /* explicit fencing */
> +	if (new_plane_state->base.fence) { /* explicit fencing */
>  		ret = i915_sw_fence_await_dma_fence(&intel_state->commit_ready,
> -						    new_state->fence,
> +						    new_plane_state->base.fence,
>  						    I915_FENCE_TIMEOUT,
>  						    GFP_KERNEL);
>  		if (ret < 0)
> @@ -14438,7 +14440,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  		return ret;
>  	}
>  
> -	ret = intel_plane_pin_fb(to_intel_plane_state(new_state));
> +	ret = intel_plane_pin_fb(new_plane_state);
>  
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  	i915_gem_object_unpin_pages(obj);
> @@ -14448,7 +14450,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  	fb_obj_bump_render_priority(obj);
>  	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB);
>  
> -	if (!new_state->fence) { /* implicit fencing */
> +	if (!new_plane_state->base.fence) { /* implicit fencing */
>  		struct dma_fence *fence;
>  
>  		ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
> @@ -14460,11 +14462,11 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  
>  		fence = dma_resv_get_excl_rcu(obj->base.resv);
>  		if (fence) {
> -			add_rps_boost_after_vblank(new_state->crtc, fence);
> +			add_rps_boost_after_vblank(new_plane_state->base.crtc, fence);
>  			dma_fence_put(fence);
>  		}
>  	} else {
> -		add_rps_boost_after_vblank(new_state->crtc, new_state->fence);
> +		add_rps_boost_after_vblank(new_plane_state->base.crtc, new_plane_state->base.fence);

The two changes in this hunk require line wraps now to stay <80 chars.

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

>  	}
>  
>  	/*
> @@ -14494,10 +14496,12 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>   */
>  void
>  intel_cleanup_plane_fb(struct drm_plane *plane,
> -		       struct drm_plane_state *old_state)
> +		       struct drm_plane_state *_old_plane_state)
>  {
> +	struct intel_plane_state *old_plane_state =
> +		to_intel_plane_state(_old_plane_state);
>  	struct intel_atomic_state *intel_state =
> -		to_intel_atomic_state(old_state->state);
> +		to_intel_atomic_state(old_plane_state->base.state);
>  	struct drm_i915_private *dev_priv = to_i915(plane->dev);
>  
>  	if (intel_state->rps_interactive) {
> @@ -14507,7 +14511,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
>  
>  	/* Should only be called after a successful intel_prepare_plane_fb()! */
>  	mutex_lock(&dev_priv->drm.struct_mutex);
> -	intel_plane_unpin_fb(to_intel_plane_state(old_state));
> +	intel_plane_unpin_fb(old_plane_state);
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  }
>  
> -- 
> 2.23.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/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 9e34be48c770..b5ed097d6a59 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14380,12 +14380,14 @@  static void fb_obj_bump_render_priority(struct drm_i915_gem_object *obj)
  */
 int
 intel_prepare_plane_fb(struct drm_plane *plane,
-		       struct drm_plane_state *new_state)
+		       struct drm_plane_state *_new_plane_state)
 {
+	struct intel_plane_state *new_plane_state =
+		to_intel_plane_state(_new_plane_state);
 	struct intel_atomic_state *intel_state =
-		to_intel_atomic_state(new_state->state);
+		to_intel_atomic_state(new_plane_state->base.state);
 	struct drm_i915_private *dev_priv = to_i915(plane->dev);
-	struct drm_framebuffer *fb = new_state->fb;
+	struct drm_framebuffer *fb = new_plane_state->base.fb;
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
 	int ret;
@@ -14416,9 +14418,9 @@  intel_prepare_plane_fb(struct drm_plane *plane,
 		}
 	}
 
-	if (new_state->fence) { /* explicit fencing */
+	if (new_plane_state->base.fence) { /* explicit fencing */
 		ret = i915_sw_fence_await_dma_fence(&intel_state->commit_ready,
-						    new_state->fence,
+						    new_plane_state->base.fence,
 						    I915_FENCE_TIMEOUT,
 						    GFP_KERNEL);
 		if (ret < 0)
@@ -14438,7 +14440,7 @@  intel_prepare_plane_fb(struct drm_plane *plane,
 		return ret;
 	}
 
-	ret = intel_plane_pin_fb(to_intel_plane_state(new_state));
+	ret = intel_plane_pin_fb(new_plane_state);
 
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 	i915_gem_object_unpin_pages(obj);
@@ -14448,7 +14450,7 @@  intel_prepare_plane_fb(struct drm_plane *plane,
 	fb_obj_bump_render_priority(obj);
 	intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB);
 
-	if (!new_state->fence) { /* implicit fencing */
+	if (!new_plane_state->base.fence) { /* implicit fencing */
 		struct dma_fence *fence;
 
 		ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
@@ -14460,11 +14462,11 @@  intel_prepare_plane_fb(struct drm_plane *plane,
 
 		fence = dma_resv_get_excl_rcu(obj->base.resv);
 		if (fence) {
-			add_rps_boost_after_vblank(new_state->crtc, fence);
+			add_rps_boost_after_vblank(new_plane_state->base.crtc, fence);
 			dma_fence_put(fence);
 		}
 	} else {
-		add_rps_boost_after_vblank(new_state->crtc, new_state->fence);
+		add_rps_boost_after_vblank(new_plane_state->base.crtc, new_plane_state->base.fence);
 	}
 
 	/*
@@ -14494,10 +14496,12 @@  intel_prepare_plane_fb(struct drm_plane *plane,
  */
 void
 intel_cleanup_plane_fb(struct drm_plane *plane,
-		       struct drm_plane_state *old_state)
+		       struct drm_plane_state *_old_plane_state)
 {
+	struct intel_plane_state *old_plane_state =
+		to_intel_plane_state(_old_plane_state);
 	struct intel_atomic_state *intel_state =
-		to_intel_atomic_state(old_state->state);
+		to_intel_atomic_state(old_plane_state->base.state);
 	struct drm_i915_private *dev_priv = to_i915(plane->dev);
 
 	if (intel_state->rps_interactive) {
@@ -14507,7 +14511,7 @@  intel_cleanup_plane_fb(struct drm_plane *plane,
 
 	/* Should only be called after a successful intel_prepare_plane_fb()! */
 	mutex_lock(&dev_priv->drm.struct_mutex);
-	intel_plane_unpin_fb(to_intel_plane_state(old_state));
+	intel_plane_unpin_fb(old_plane_state);
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 }