All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/6] Revert "drm/atomic-helper: Fix leak in disable_all"
Date: Wed, 21 Mar 2018 09:25:06 +0100	[thread overview]
Message-ID: <20180321082506.GY14155@phenom.ffwll.local> (raw)
In-Reply-To: <20180320191757.23869-1-ville.syrjala@linux.intel.com>

On Tue, Mar 20, 2018 at 09:17:52PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently we're leaking fbs on load detect on account of nothing setting
> up plane->old_fb for the drm_atomic_clean_old_fb() call in
> drm_atomic_helper_commit_duplicated_state(). Removing the
> drm_atomic_clean_old_fb() call seems like the right call to me here.
> This does mean we end up leaking something via
> drm_atomic_helper_shutdown() though, but we'll fix that up in a
> different way.
> 
> This reverts commit 49d70aeaeca8f62b72b7712ecd1e29619a445866.

So the reason I went this way and not what you're suggesting in this patch
series is that i915 is the one and only driver noodling around with load
detect and gpu reset that needs this.

Imo it'd be better to fix up our load detect code to also set the old_fb
stuff up correctly, and add at least a long-term task to todo.rst to get
rid of all this. Inflicting a new parameter on all the other drives (like
you do in patch 2) is imo the wrong way round - we have 31 other atomic
drivers than i915.ko.
-Daniel

> 
> Cc: martin.peres@free.fr
> Cc: chris@chris-wilson.co.uk
> Cc: Dave Airlie <airlied@gmail.com> (v1)
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index c35654591c12..c48f187d08de 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2914,7 +2914,6 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
> -	unsigned plane_mask = 0;
>  	int ret, i;
>  
>  	state = drm_atomic_state_alloc(dev);
> @@ -2957,14 +2956,10 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  			goto free;
>  
>  		drm_atomic_set_fb_for_plane(plane_state, NULL);
> -		plane_mask |= BIT(drm_plane_index(plane));
> -		plane->old_fb = plane->fb;
>  	}
>  
>  	ret = drm_atomic_commit(state);
>  free:
> -	if (plane_mask)
> -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
>  	drm_atomic_state_put(state);
>  	return ret;
>  }
> @@ -3095,16 +3090,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  	struct drm_connector_state *new_conn_state;
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *new_crtc_state;
> -	unsigned plane_mask = 0;
> -	struct drm_device *dev = state->dev;
> -	int ret;
>  
>  	state->acquire_ctx = ctx;
>  
> -	for_each_new_plane_in_state(state, plane, new_plane_state, i) {
> -		plane_mask |= BIT(drm_plane_index(plane));
> +	for_each_new_plane_in_state(state, plane, new_plane_state, i)
>  		state->planes[i].old_state = plane->state;
> -	}
>  
>  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
>  		state->crtcs[i].old_state = crtc->state;
> @@ -3112,11 +3102,7 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  	for_each_new_connector_in_state(state, connector, new_conn_state, i)
>  		state->connectors[i].old_state = connector->state;
>  
> -	ret = drm_atomic_commit(state);
> -	if (plane_mask)
> -		drm_atomic_clean_old_fb(dev, plane_mask, ret);
> -
> -	return ret;
> +	return drm_atomic_commit(state);
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);
>  
> -- 
> 2.16.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-03-21  8:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 19:17 [PATCH 1/6] Revert "drm/atomic-helper: Fix leak in disable_all" Ville Syrjala
2018-03-20 19:17 ` [PATCH 2/6] drm/atomic-helper: Make drm_atomic_helper_disable_all() update the plane->fb pointers Ville Syrjala
2018-03-20 19:17 ` [PATCH 3/6] drm: Clear crtc->primary->crtc when disabling the crtc via setcrtc() Ville Syrjala
2018-03-20 19:17 ` [PATCH 4/6] drm/atomic-helper: WARN if legacy plane fb pointers are bogus when committing duplicated state Ville Syrjala
2018-03-20 19:17 ` [PATCH 5/6] drm/i915: Restore planes after load detection Ville Syrjala
2018-03-20 19:17 ` [PATCH 6/6] drm/i915: Make force_load_detect effective even w/ DMI quirks/hotplug Ville Syrjala
2018-03-20 19:44 ` ✓ Fi.CI.BAT: success for series starting with [1/6] Revert "drm/atomic-helper: Fix leak in disable_all" Patchwork
2018-03-21  2:30 ` ✓ Fi.CI.IGT: " Patchwork
2018-03-21  8:25 ` Daniel Vetter [this message]
2018-03-21 12:25   ` [PATCH 1/6] " Ville Syrjälä

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=20180321082506.GY14155@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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.