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>
This commit is contained in:
@@ -1020,17 +1020,23 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (dev_priv->cursor_needs_physical) {
|
||||
addr = dev->agp->base + obj_priv->gtt_offset;
|
||||
} else {
|
||||
/* we only need to pin inside GTT if cursor is non-phy */
|
||||
if (!dev_priv->cursor_needs_physical) {
|
||||
ret = i915_gem_object_pin(bo, PAGE_SIZE);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to pin cursor bo\n");
|
||||
drm_gem_object_unreference(bo);
|
||||
return ret;
|
||||
}
|
||||
addr = obj_priv->gtt_offset;
|
||||
}
|
||||
|
||||
ret = i915_gem_object_pin(bo, PAGE_SIZE);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to pin cursor bo\n");
|
||||
drm_gem_object_unreference(bo);
|
||||
return ret;
|
||||
} else {
|
||||
ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to attach phys object\n");
|
||||
drm_gem_object_unreference(bo);
|
||||
return ret;
|
||||
}
|
||||
addr = obj_priv->phys_obj->handle->busaddr;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
@@ -1043,7 +1049,11 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
I915_WRITE(base, addr);
|
||||
|
||||
if (intel_crtc->cursor_bo) {
|
||||
i915_gem_object_unpin(intel_crtc->cursor_bo);
|
||||
if (dev_priv->cursor_needs_physical) {
|
||||
if (intel_crtc->cursor_bo != bo)
|
||||
i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
|
||||
} else
|
||||
i915_gem_object_unpin(intel_crtc->cursor_bo);
|
||||
drm_gem_object_unreference(intel_crtc->cursor_bo);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user