All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Explicitly cleanup initial_plane_config
Date: Tue, 12 Nov 2019 17:20:52 +0200	[thread overview]
Message-ID: <20191112152052.GQ1208@intel.com> (raw)
In-Reply-To: <20191112143643.21821-1-chris@chris-wilson.co.uk>

On Tue, Nov 12, 2019 at 02:36:42PM +0000, Chris Wilson wrote:
> I am about to stuff more objects into the plane_config and would like to
> have it clean up after itself. Move the current framebuffer release into
> a common function so it can be extended with the new object with
> relative ease.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 5f3340554149..f571c6575c62 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3241,8 +3241,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  		goto valid_fb;
>  	}
>  
> -	kfree(plane_config->fb);
> -
>  	/*
>  	 * Failed to alloc the obj, check to see if we should share
>  	 * an fb with another CRTC instead
> @@ -3262,7 +3260,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  
>  		if (intel_plane_ggtt_offset(state) == plane_config->base) {
>  			fb = state->hw.fb;
> -			drm_framebuffer_get(fb);
>  			goto valid_fb;
>  		}
>  	}
> @@ -3295,7 +3292,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  			  intel_crtc->pipe, PTR_ERR(intel_state->vma));
>  
>  		intel_state->vma = NULL;
> -		drm_framebuffer_put(fb);
>  		return;
>  	}
>  
> @@ -3317,7 +3313,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  	if (plane_config->tiling)
>  		dev_priv->preserve_bios_swizzle = true;
>  
> -	plane_state->fb = fb;

This stuff looks wrong. We still want the plane state to point at the
fb.

Ideally I'd like to nuke the plane_config thing entirely and just read
everything directly into the plane_states(s), but that's probably a
bunch of actual work so not going to happen soon.

>  	plane_state->crtc = &intel_crtc->base;
>  	intel_plane_copy_uapi_to_hw_state(intel_state, intel_state);
>  
> @@ -16952,6 +16947,19 @@ static void intel_mode_config_init(struct drm_i915_private *i915)
>  	}
>  }
>  
> +static void plane_config_fini(struct intel_initial_plane_config *plane_config)
> +{
> +	if (plane_config->fb) {
> +		struct drm_framebuffer *fb = &plane_config->fb->base;
> +
> +		/* We may only have the stub and not a full framebuffer */
> +		if (drm_framebuffer_read_refcount(fb))
> +			drm_framebuffer_put(fb);
> +		else
> +			kfree(fb);
> +	}
> +}
> +
>  int intel_modeset_init(struct drm_i915_private *i915)
>  {
>  	struct drm_device *dev = &i915->drm;
> @@ -17036,6 +17044,8 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  		 * just get the first one.
>  		 */
>  		intel_find_initial_plane_obj(crtc, &plane_config);
> +
> +		plane_config_fini(&plane_config);
>  	}
>  
>  	/*
> -- 
> 2.24.0

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915: Explicitly cleanup initial_plane_config
Date: Tue, 12 Nov 2019 17:20:52 +0200	[thread overview]
Message-ID: <20191112152052.GQ1208@intel.com> (raw)
Message-ID: <20191112152052.GvGS_kFuGcdxEeODnBvqVO8-mkF1TYVrmz3LMqpwfqk@z> (raw)
In-Reply-To: <20191112143643.21821-1-chris@chris-wilson.co.uk>

On Tue, Nov 12, 2019 at 02:36:42PM +0000, Chris Wilson wrote:
> I am about to stuff more objects into the plane_config and would like to
> have it clean up after itself. Move the current framebuffer release into
> a common function so it can be extended with the new object with
> relative ease.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 5f3340554149..f571c6575c62 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3241,8 +3241,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  		goto valid_fb;
>  	}
>  
> -	kfree(plane_config->fb);
> -
>  	/*
>  	 * Failed to alloc the obj, check to see if we should share
>  	 * an fb with another CRTC instead
> @@ -3262,7 +3260,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  
>  		if (intel_plane_ggtt_offset(state) == plane_config->base) {
>  			fb = state->hw.fb;
> -			drm_framebuffer_get(fb);
>  			goto valid_fb;
>  		}
>  	}
> @@ -3295,7 +3292,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  			  intel_crtc->pipe, PTR_ERR(intel_state->vma));
>  
>  		intel_state->vma = NULL;
> -		drm_framebuffer_put(fb);
>  		return;
>  	}
>  
> @@ -3317,7 +3313,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  	if (plane_config->tiling)
>  		dev_priv->preserve_bios_swizzle = true;
>  
> -	plane_state->fb = fb;

This stuff looks wrong. We still want the plane state to point at the
fb.

Ideally I'd like to nuke the plane_config thing entirely and just read
everything directly into the plane_states(s), but that's probably a
bunch of actual work so not going to happen soon.

>  	plane_state->crtc = &intel_crtc->base;
>  	intel_plane_copy_uapi_to_hw_state(intel_state, intel_state);
>  
> @@ -16952,6 +16947,19 @@ static void intel_mode_config_init(struct drm_i915_private *i915)
>  	}
>  }
>  
> +static void plane_config_fini(struct intel_initial_plane_config *plane_config)
> +{
> +	if (plane_config->fb) {
> +		struct drm_framebuffer *fb = &plane_config->fb->base;
> +
> +		/* We may only have the stub and not a full framebuffer */
> +		if (drm_framebuffer_read_refcount(fb))
> +			drm_framebuffer_put(fb);
> +		else
> +			kfree(fb);
> +	}
> +}
> +
>  int intel_modeset_init(struct drm_i915_private *i915)
>  {
>  	struct drm_device *dev = &i915->drm;
> @@ -17036,6 +17044,8 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  		 * just get the first one.
>  		 */
>  		intel_find_initial_plane_obj(crtc, &plane_config);
> +
> +		plane_config_fini(&plane_config);
>  	}
>  
>  	/*
> -- 
> 2.24.0

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-11-12 15:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 14:36 [PATCH 1/2] drm/i915: Explicitly cleanup initial_plane_config Chris Wilson
2019-11-12 14:36 ` [Intel-gfx] " Chris Wilson
2019-11-12 14:36 ` [PATCH 2/2] drm/i915/display: Be explicit in handling the preallocated vma Chris Wilson
2019-11-12 14:36   ` [Intel-gfx] " Chris Wilson
2019-11-12 15:20 ` Ville Syrjälä [this message]
2019-11-12 15:20   ` [Intel-gfx] [PATCH 1/2] drm/i915: Explicitly cleanup initial_plane_config Ville Syrjälä
2019-11-12 15:28   ` Chris Wilson
2019-11-12 15:28     ` [Intel-gfx] " Chris Wilson
2019-11-12 18:43 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2019-11-12 18:43   ` [Intel-gfx] " Patchwork
2019-11-13  4:30 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-11-13  4:30   ` [Intel-gfx] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191112152052.GQ1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.