aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2014-07-09 19:22:10 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-07-10 02:50:51 -0400
commit4c34574fd9e6f3ed34ebe67fbabb0fef0b0754e3 (patch)
treef7fccdcd3124638c4796905c2c8499954bf2b262
parent03872064f77f4beb61d1afc22adf62da47cf087b (diff)
drm/i915: Add missing locking to primary plane handlers
intel_primary_plane_{setplane,disable} were lacking struct_mutex locking around their GEM operations. Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reported-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 34286c695bcf..0029d4398866 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11400,9 +11400,11 @@ intel_primary_plane_disable(struct drm_plane *plane)
11400 intel_disable_primary_hw_plane(dev_priv, intel_plane->plane, 11400 intel_disable_primary_hw_plane(dev_priv, intel_plane->plane,
11401 intel_plane->pipe); 11401 intel_plane->pipe);
11402disable_unpin: 11402disable_unpin:
11403 mutex_lock(&dev->struct_mutex);
11403 i915_gem_track_fb(intel_fb_obj(plane->fb), NULL, 11404 i915_gem_track_fb(intel_fb_obj(plane->fb), NULL,
11404 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe)); 11405 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
11405 intel_unpin_fb_obj(intel_fb_obj(plane->fb)); 11406 intel_unpin_fb_obj(intel_fb_obj(plane->fb));
11407 mutex_unlock(&dev->struct_mutex);
11406 plane->fb = NULL; 11408 plane->fb = NULL;
11407 11409
11408 return 0; 11410 return 0;
@@ -11459,6 +11461,8 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11459 * turn on the display with all planes setup as desired. 11461 * turn on the display with all planes setup as desired.
11460 */ 11462 */
11461 if (!crtc->enabled) { 11463 if (!crtc->enabled) {
11464 mutex_lock(&dev->struct_mutex);
11465
11462 /* 11466 /*
11463 * If we already called setplane while the crtc was disabled, 11467 * If we already called setplane while the crtc was disabled,
11464 * we may have an fb pinned; unpin it. 11468 * we may have an fb pinned; unpin it.
@@ -11470,7 +11474,10 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11470 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe)); 11474 INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
11471 11475
11472 /* Pin and return without programming hardware */ 11476 /* Pin and return without programming hardware */
11473 return intel_pin_and_fence_fb_obj(dev, obj, NULL); 11477 ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
11478 mutex_unlock(&dev->struct_mutex);
11479
11480 return ret;
11474 } 11481 }
11475 11482
11476 intel_crtc_wait_for_pending_flips(crtc); 11483 intel_crtc_wait_for_pending_flips(crtc);
@@ -11482,14 +11489,18 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11482 * because plane->fb still gets set and pinned. 11489 * because plane->fb still gets set and pinned.
11483 */ 11490 */
11484 if (!visible) { 11491 if (!visible) {
11492 mutex_lock(&dev->struct_mutex);
11493
11485 /* 11494 /*
11486 * Try to pin the new fb first so that we can bail out if we 11495 * Try to pin the new fb first so that we can bail out if we
11487 * fail. 11496 * fail.
11488 */ 11497 */
11489 if (plane->fb != fb) { 11498 if (plane->fb != fb) {
11490 ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); 11499 ret = intel_pin_and_fence_fb_obj(dev, obj, NULL);
11491 if (ret) 11500 if (ret) {
11501 mutex_unlock(&dev->struct_mutex);
11492 return ret; 11502 return ret;
11503 }
11493 } 11504 }
11494 11505
11495 i915_gem_track_fb(old_obj, obj, 11506 i915_gem_track_fb(old_obj, obj,
@@ -11505,6 +11516,8 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,
11505 if (plane->fb) 11516 if (plane->fb)
11506 intel_unpin_fb_obj(old_obj); 11517 intel_unpin_fb_obj(old_obj);
11507 11518
11519 mutex_unlock(&dev->struct_mutex);
11520
11508 return 0; 11521 return 0;
11509 } 11522 }
11510 11523