aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/intel_display.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ac92799fa8a1..94c7c098c4ff 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1043,18 +1043,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1043 } 1043 }
1044 1044
1045 /* we only need to pin inside GTT if cursor is non-phy */ 1045 /* we only need to pin inside GTT if cursor is non-phy */
1046 mutex_lock(&dev->struct_mutex);
1046 if (!dev_priv->cursor_needs_physical) { 1047 if (!dev_priv->cursor_needs_physical) {
1047 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1048 ret = i915_gem_object_pin(bo, PAGE_SIZE);
1048 if (ret) { 1049 if (ret) {
1049 DRM_ERROR("failed to pin cursor bo\n"); 1050 DRM_ERROR("failed to pin cursor bo\n");
1050 goto fail; 1051 goto fail_locked;
1051 } 1052 }
1052 addr = obj_priv->gtt_offset; 1053 addr = obj_priv->gtt_offset;
1053 } else { 1054 } else {
1054 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); 1055 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
1055 if (ret) { 1056 if (ret) {
1056 DRM_ERROR("failed to attach phys object\n"); 1057 DRM_ERROR("failed to attach phys object\n");
1057 goto fail; 1058 goto fail_locked;
1058 } 1059 }
1059 addr = obj_priv->phys_obj->handle->busaddr; 1060 addr = obj_priv->phys_obj->handle->busaddr;
1060 } 1061 }
@@ -1074,10 +1075,9 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1074 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); 1075 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
1075 } else 1076 } else
1076 i915_gem_object_unpin(intel_crtc->cursor_bo); 1077 i915_gem_object_unpin(intel_crtc->cursor_bo);
1077 mutex_lock(&dev->struct_mutex);
1078 drm_gem_object_unreference(intel_crtc->cursor_bo); 1078 drm_gem_object_unreference(intel_crtc->cursor_bo);
1079 mutex_unlock(&dev->struct_mutex);
1080 } 1079 }
1080 mutex_unlock(&dev->struct_mutex);
1081 1081
1082 intel_crtc->cursor_addr = addr; 1082 intel_crtc->cursor_addr = addr;
1083 intel_crtc->cursor_bo = bo; 1083 intel_crtc->cursor_bo = bo;
@@ -1085,6 +1085,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1085 return 0; 1085 return 0;
1086fail: 1086fail:
1087 mutex_lock(&dev->struct_mutex); 1087 mutex_lock(&dev->struct_mutex);
1088fail_locked:
1088 drm_gem_object_unreference(bo); 1089 drm_gem_object_unreference(bo);
1089 mutex_unlock(&dev->struct_mutex); 1090 mutex_unlock(&dev->struct_mutex);
1090 return ret; 1091 return ret;