aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4372acff5a01..114a7a1a8740 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1020,17 +1020,23 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1020 return -ENOMEM; 1020 return -ENOMEM;
1021 } 1021 }
1022 1022
1023 if (dev_priv->cursor_needs_physical) { 1023 /* we only need to pin inside GTT if cursor is non-phy */
1024 addr = dev->agp->base + obj_priv->gtt_offset; 1024 if (!dev_priv->cursor_needs_physical) {
1025 } else { 1025 ret = i915_gem_object_pin(bo, PAGE_SIZE);
1026 if (ret) {
1027 DRM_ERROR("failed to pin cursor bo\n");
1028 drm_gem_object_unreference(bo);
1029 return ret;
1030 }
1026 addr = obj_priv->gtt_offset; 1031 addr = obj_priv->gtt_offset;
1027 } 1032 } else {
1028 1033 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
1029 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1034 if (ret) {
1030 if (ret) { 1035 DRM_ERROR("failed to attach phys object\n");
1031 DRM_ERROR("failed to pin cursor bo\n"); 1036 drm_gem_object_unreference(bo);
1032 drm_gem_object_unreference(bo); 1037 return ret;
1033 return ret; 1038 }
1039 addr = obj_priv->phys_obj->handle->busaddr;
1034 } 1040 }
1035 1041
1036 temp = 0; 1042 temp = 0;
@@ -1043,7 +1049,11 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
1043 I915_WRITE(base, addr); 1049 I915_WRITE(base, addr);
1044 1050
1045 if (intel_crtc->cursor_bo) { 1051 if (intel_crtc->cursor_bo) {
1046 i915_gem_object_unpin(intel_crtc->cursor_bo); 1052 if (dev_priv->cursor_needs_physical) {
1053 if (intel_crtc->cursor_bo != bo)
1054 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
1055 } else
1056 i915_gem_object_unpin(intel_crtc->cursor_bo);
1047 drm_gem_object_unreference(intel_crtc->cursor_bo); 1057 drm_gem_object_unreference(intel_crtc->cursor_bo);
1048 } 1058 }
1049 1059