drm/i915: Fix dynamic allocation of physical handles
A single object may be referenced by multiple registers fundamentally breaking the static allotment of ids in the current design. When the object is used the second time, the physical address of the first assignment is relinquished and a second one granted. However, the hardware is still reading (and possibly writing) to the old physical address now returned to the system. Eventually hilarity will ensue, but in the short term, it just means that cursors are broken when using more than one pipe. v2: Fix up leak of pci handle when handling an error during attachment, and avoid a double kmap/kunmap. (Ville) Rebase against -fixes. v3: And fix the error handling added in v2 (Ville) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77351 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: stable@vger.kernel.org Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:

committed by
Jani Nikula

parent
c7208164e6
commit
00731155a7
@@ -7825,14 +7825,12 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
addr = i915_gem_obj_ggtt_offset(obj);
|
||||
} else {
|
||||
int align = IS_I830(dev) ? 16 * 1024 : 256;
|
||||
ret = i915_gem_attach_phys_object(dev, obj,
|
||||
(intel_crtc->pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1,
|
||||
align);
|
||||
ret = i915_gem_object_attach_phys(obj, align);
|
||||
if (ret) {
|
||||
DRM_DEBUG_KMS("failed to attach phys object\n");
|
||||
goto fail_locked;
|
||||
}
|
||||
addr = obj->phys_obj->handle->busaddr;
|
||||
addr = obj->phys_handle->busaddr;
|
||||
}
|
||||
|
||||
if (IS_GEN2(dev))
|
||||
@@ -7840,10 +7838,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
|
||||
finish:
|
||||
if (intel_crtc->cursor_bo) {
|
||||
if (INTEL_INFO(dev)->cursor_needs_physical) {
|
||||
if (intel_crtc->cursor_bo != obj)
|
||||
i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
|
||||
} else
|
||||
if (!INTEL_INFO(dev)->cursor_needs_physical)
|
||||
i915_gem_object_unpin_from_display_plane(intel_crtc->cursor_bo);
|
||||
drm_gem_object_unreference(&intel_crtc->cursor_bo->base);
|
||||
}
|
||||
|
Reference in New Issue
Block a user