From: Daniel Vetter <daniel@ffwll.ch>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Add missing locking to primary plane handlers
Date: Thu, 10 Jul 2014 08:52:25 +0200 [thread overview]
Message-ID: <20140710065225.GC17271@phenom.ffwll.local> (raw)
In-Reply-To: <1404948131-12448-1-git-send-email-matthew.d.roper@intel.com>
On Wed, Jul 09, 2014 at 04:22:10PM -0700, Matt Roper wrote:
> intel_primary_plane_{setplane,disable} were lacking struct_mutex locking
> around their GEM operations.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Both merged with a reported-by: Damien added to this one here. Btw have
you checked that your primary plane tests hit this with the new WARN_ONs?
I'm missing the Testcase: tag ;-)
-Daniel
> ---
> drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5a50ff9..6b25068 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11389,9 +11389,11 @@ intel_primary_plane_disable(struct drm_plane *plane)
> intel_disable_primary_hw_plane(dev_priv, intel_plane->plane,
> intel_plane->pipe);
> disable_unpin:
> + mutex_lock(&dev->struct_mutex);
> i915_gem_track_fb(intel_fb_obj(plane->fb), NULL,
> INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
> intel_unpin_fb_obj(intel_fb_obj(plane->fb));
> + mutex_unlock(&dev->struct_mutex);
> plane->fb = NULL;
>
> return 0;
> @@ -11448,6 +11450,8 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> * turn on the display with all planes setup as desired.
> */
> if (!crtc->enabled) {
> + mutex_lock(&dev->struct_mutex);
> +
> /*
> * If we already called setplane while the crtc was disabled,
> * we may have an fb pinned; unpin it.
> @@ -11459,7 +11463,10 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
>
> /* Pin and return without programming hardware */
> - return intel_pin_and_fence_fb_obj(dev, obj, NULL);
> + ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
> + mutex_unlock(&dev->struct_mutex);
> +
> + return ret;
> }
>
> intel_crtc_wait_for_pending_flips(crtc);
> @@ -11471,14 +11478,18 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> * because plane->fb still gets set and pinned.
> */
> if (!visible) {
> + mutex_lock(&dev->struct_mutex);
> +
> /*
> * Try to pin the new fb first so that we can bail out if we
> * fail.
> */
> if (plane->fb != fb) {
> ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
> - if (ret)
> + if (ret) {
> + mutex_unlock(&dev->struct_mutex);
> return ret;
> + }
> }
>
> i915_gem_track_fb(old_obj, obj,
> @@ -11494,6 +11505,8 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
> if (plane->fb)
> intel_unpin_fb_obj(old_obj);
>
> + mutex_unlock(&dev->struct_mutex);
> +
> return 0;
> }
>
> --
> 1.8.5.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
prev parent reply other threads:[~2014-07-10 6:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 23:22 [PATCH 1/2] drm/i915: Add missing locking to primary plane handlers Matt Roper
2014-07-09 23:22 ` [PATCH 2/2] drm/i915: Add a couple WARN()'s to catch missing locks Matt Roper
2014-07-10 6:52 ` Daniel Vetter [this message]
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=20140710065225.GC17271@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox