From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [RFC PATCH 2/3] drm/i915: Change locking for struct_mutex.
Date: Mon, 14 Sep 2015 13:18:16 +0200 [thread overview]
Message-ID: <1442229497-26311-3-git-send-email-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1442229497-26311-1-git-send-email-maarten.lankhorst@linux.intel.com>
Only acquire the struct_mutex once, and interruptibly.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/i915/intel_display.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0730c71aa279..f7e27b539c03 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13004,8 +13004,13 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
return ret;
}
+ ret = i915_mutex_lock_interruptible(dev);
+ if (ret)
+ return ret;
+
ret = drm_atomic_helper_prepare_planes(dev, state);
+ mutex_unlock(&dev->struct_mutex);
return ret;
}
@@ -13106,7 +13111,10 @@ static int intel_atomic_commit(struct drm_device *dev,
/* FIXME: add subpixel order */
drm_atomic_helper_wait_for_vblanks(dev, state);
+
+ mutex_lock(&dev->struct_mutex);
drm_atomic_helper_cleanup_planes(dev, state);
+ mutex_unlock(&dev->struct_mutex);
if (any_ms)
intel_modeset_check_state(dev, state);
@@ -13293,10 +13301,6 @@ intel_prepare_plane_fb(struct drm_plane *plane,
if (!obj && !old_obj)
return 0;
- ret = i915_mutex_lock_interruptible(dev);
- if (ret)
- return ret;
-
if (old_obj) {
struct drm_crtc_state *crtc_state =
drm_atomic_get_existing_crtc_state(new_state->state, plane->state->crtc);
@@ -13317,7 +13321,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
/* Swallow -EIO errors to allow updates during hw lockup. */
if (ret && ret != -EIO)
- goto out;
+ return ret;
}
if (!obj) {
@@ -13335,9 +13339,6 @@ intel_prepare_plane_fb(struct drm_plane *plane,
if (ret == 0)
i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
-out:
- mutex_unlock(&dev->struct_mutex);
-
return ret;
}
@@ -13360,7 +13361,6 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
if (!obj && !old_obj)
return;
- mutex_lock(&dev->struct_mutex);
if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
!INTEL_INFO(dev)->cursor_needs_physical))
intel_unpin_fb_obj(old_state->fb, old_state);
@@ -13369,7 +13369,6 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
(obj && !(obj->frontbuffer_bits & intel_plane->frontbuffer_bit)))
i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
- mutex_unlock(&dev->struct_mutex);
}
int
--
2.1.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-09-14 11:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 11:18 [RFC PATCH 0/3] Interruptible pinning for atomic commit Maarten Lankhorst
2015-09-14 11:18 ` [RFC PATCH 1/3] drm/i915: Make wait_for_flips interruptible Maarten Lankhorst
2015-09-14 11:18 ` Maarten Lankhorst [this message]
2015-09-14 11:18 ` [RFC PATCH 3/3] drm/i915: Wait for object idle without locks in atomic_commit Maarten Lankhorst
2015-09-14 11:20 ` [PATCH 0.5/2] drm/i915: Make prepare_plane_fb fully interruptible Maarten Lankhorst
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=1442229497-26311-3-git-send-email-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox