aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2008-12-30 05:31:46 -0500
committerDave Airlie <airlied@linux.ie>2009-01-16 03:45:06 -0500
commit71acb5eb8d95b371f4cdd88a47f3c83c870d1c8f (patch)
tree36c370582e69cd61f2f088c31808fc02c6c86f1a /drivers/gpu/drm/i915/intel_display.c
parente285f3cd2c376d2336f9a383241a98266363c7d4 (diff)
drm/i915: add support for physical memory objects
This is an initial patch to do support for objects which needs physical contiguous main ram, cursors and overlay registers on older chipsets. These objects are bound on cursor bin, like pinning, and we copy the data to/from the backing store object into the real one on attach/detach. notes: possible over the top in attach/detach operations. no overlay support yet. Signed-off-by: Dave Airlie <airlied@redhat.com>
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