From: Matt Roper Date: Wed, 9 Jul 2014 23:22:10 +0000 (-0700) Subject: drm/i915: Add missing locking to primary plane handlers X-Git-Tag: firefly_0821_release~176^2~3450^2~49^2~28 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4c34574fd9e6f3ed34ebe67fbabb0fef0b0754e3;p=firefly-linux-kernel-4.4.55.git 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 Reported-by: Damien Lespiau Signed-off-by: Daniel Vetter --- 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) 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; @@ -11459,6 +11461,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. @@ -11470,7 +11474,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); @@ -11482,14 +11489,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, @@ -11505,6 +11516,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; }