[2/6] drm/i915: Clear old hw.fb & co. from slave plane's state
diff mbox series

Message ID 20200110183228.8199-2-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/6] drm/i915: Make a copy of the ggtt view for slave plane
Related show

Commit Message

Ville Syrjala Jan. 10, 2020, 6:32 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's do the intel_plane_copy_uapi_to_hw_state() before we bail out
due to both old and new uapi.crtc being NULL. This will drop the
reference to the old hw.fb for planes that are transitioning from
being a slave plane to simply being disabled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 ++----
 drivers/gpu/drm/i915/display/intel_display.c      | 2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Maarten Lankhorst Jan. 22, 2020, 2:44 p.m. UTC | #1
Op 10-01-2020 om 19:32 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Let's do the intel_plane_copy_uapi_to_hw_state() before we bail out
> due to both old and new uapi.crtc being NULL. This will drop the
> reference to the old hw.fb for planes that are transitioning from
> being a slave plane to simply being disabled.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 6 ++----
>  drivers/gpu/drm/i915/display/intel_display.c      | 2 ++
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 3e97af682b1b..7c69b053005b 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -225,12 +225,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
>  					struct intel_plane_state *new_plane_state)
>  {
>  	struct intel_plane *plane = to_intel_plane(new_plane_state->uapi.plane);
> -	const struct drm_framebuffer *fb;
> +	const struct drm_framebuffer *fb = new_plane_state->hw.fb;
>  	int ret;
>  
> -	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
> -	fb = new_plane_state->hw.fb;
> -
>  	new_crtc_state->active_planes &= ~BIT(plane->id);
>  	new_crtc_state->nv12_planes &= ~BIT(plane->id);
>  	new_crtc_state->c8_planes &= ~BIT(plane->id);
> @@ -292,6 +289,7 @@ int intel_plane_atomic_check(struct intel_atomic_state *state,
>  	const struct intel_crtc_state *old_crtc_state;
>  	struct intel_crtc_state *new_crtc_state;
>  
> +	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
>  	new_plane_state->uapi.visible = false;
>  	if (!crtc)
>  		return 0;
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index fafb67689dee..0a1f2564dea0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16038,6 +16038,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
>  	new_plane_state->uapi.crtc_w = crtc_w;
>  	new_plane_state->uapi.crtc_h = crtc_h;
>  
> +	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
> +
>  	ret = intel_plane_atomic_check_with_state(crtc_state, new_crtc_state,
>  						  old_plane_state, new_plane_state);
>  	if (ret)

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 3e97af682b1b..7c69b053005b 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -225,12 +225,9 @@  int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
 					struct intel_plane_state *new_plane_state)
 {
 	struct intel_plane *plane = to_intel_plane(new_plane_state->uapi.plane);
-	const struct drm_framebuffer *fb;
+	const struct drm_framebuffer *fb = new_plane_state->hw.fb;
 	int ret;
 
-	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
-	fb = new_plane_state->hw.fb;
-
 	new_crtc_state->active_planes &= ~BIT(plane->id);
 	new_crtc_state->nv12_planes &= ~BIT(plane->id);
 	new_crtc_state->c8_planes &= ~BIT(plane->id);
@@ -292,6 +289,7 @@  int intel_plane_atomic_check(struct intel_atomic_state *state,
 	const struct intel_crtc_state *old_crtc_state;
 	struct intel_crtc_state *new_crtc_state;
 
+	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
 	new_plane_state->uapi.visible = false;
 	if (!crtc)
 		return 0;
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index fafb67689dee..0a1f2564dea0 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16038,6 +16038,8 @@  intel_legacy_cursor_update(struct drm_plane *_plane,
 	new_plane_state->uapi.crtc_w = crtc_w;
 	new_plane_state->uapi.crtc_h = crtc_h;
 
+	intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
+
 	ret = intel_plane_atomic_check_with_state(crtc_state, new_crtc_state,
 						  old_plane_state, new_plane_state);
 	if (ret)