[5/6] drm/i915: Balance prepare_fb/cleanup_fb
diff mbox series

Message ID 20200110183228.8199-5-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 Syrjälä Jan. 10, 2020, 6:32 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

intel_prepare_plane_fb() bails early if there is no fb (or rather
no obj, which is the same thing). intel_cleanup_plane_fb() does not.
This means the steps performed by intel_cleanup_plane_fb() aren't
balanced with with what was done intel_prepare_plane_fb() if there
is no fb for the plane. These hooks get called for every plane in
the state regardless of whether they have an fb or not.

Add a matching null obj check to intel_cleanup_plane_fb() to restore
the balance.

Note that intel_cleanup_plane_fb() has sufficient protections
already in place that the imbalance doesn't cause any real problems.
But having things be in balance seems nicer anyway, and might help
avoid some surprises in the future.

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

Comments

Chris Wilson Jan. 10, 2020, 6:42 p.m. UTC | #1
Quoting Ville Syrjala (2020-01-10 18:32:27)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> intel_prepare_plane_fb() bails early if there is no fb (or rather
> no obj, which is the same thing). intel_cleanup_plane_fb() does not.
> This means the steps performed by intel_cleanup_plane_fb() aren't
> balanced with with what was done intel_prepare_plane_fb() if there
> is no fb for the plane. These hooks get called for every plane in
> the state regardless of whether they have an fb or not.
> 
> Add a matching null obj check to intel_cleanup_plane_fb() to restore
> the balance.
> 
> Note that intel_cleanup_plane_fb() has sufficient protections
> already in place that the imbalance doesn't cause any real problems.
> But having things be in balance seems nicer anyway, and might help
> avoid some surprises in the future.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 27b43822344b..f79a6376bbf0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -15868,6 +15868,10 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
>         struct intel_atomic_state *state =
>                 to_intel_atomic_state(old_plane_state->uapi.state);
>         struct drm_i915_private *dev_priv = to_i915(plane->dev);
> +       struct drm_i915_gem_object *obj = intel_fb_obj(old_plane_state->hw.fb);
> +
> +       if (!obj)
> +               return;
>  
>         if (state->rps_interactive) {
>                 intel_rps_mark_interactive(&dev_priv->gt.rps, false);

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 27b43822344b..f79a6376bbf0 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -15868,6 +15868,10 @@  intel_cleanup_plane_fb(struct drm_plane *plane,
 	struct intel_atomic_state *state =
 		to_intel_atomic_state(old_plane_state->uapi.state);
 	struct drm_i915_private *dev_priv = to_i915(plane->dev);
+	struct drm_i915_gem_object *obj = intel_fb_obj(old_plane_state->hw.fb);
+
+	if (!obj)
+		return;
 
 	if (state->rps_interactive) {
 		intel_rps_mark_interactive(&dev_priv->gt.rps, false);