aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-08-18 12:17:06 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2016-08-18 17:36:56 -0400
commit2efb813d5388e18255c54afac77bd91acd586908 (patch)
tree170d5d22c05d5ed2614d4afdcb606e0f6e42dad0
parent821188778b9be2050d45490c4b2b009d51f041e0 (diff)
drm/i915: Fallback to using unmappable memory for scanout
The existing ABI says that scanouts are pinned into the mappable region so that legacy clients (e.g. old Xorg or plymouthd) can write directly into the scanout through a GTT mapping. However if the surface does not fit into the mappable region, we are better off just trying to fit it anywhere and hoping for the best. (Any userspace that is capable of using ginormous scanouts is also likely not to rely on pure GTT updates.) With the partial vma fault support, we are no longer restricted to only using scanouts that we can pin (though it is still preferred for performance reasons and for powersaving features like FBC). v2: Skip fence pinning when not mappable. v3: Add a comment to explain the possible ramifications of not being able to use fences for unmappable scanouts. v4: Rebase to skip over some local patches v5: Rebase to defer until after we have unmappable GTT fault support Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Deepak S <deepak.s@linux.intel.com> Cc: Damien Lespiau <damien.lespiau@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Jani Nikula <jani.nikula@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20160818161718.27187-27-chris@chris-wilson.co.uk
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c14
-rw-r--r--drivers/gpu/drm/i915/intel_fbc.c4
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a13290a8ba30..69a994bd6afd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3581,11 +3581,17 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
3581 3581
3582 /* As the user may map the buffer once pinned in the display plane 3582 /* As the user may map the buffer once pinned in the display plane
3583 * (e.g. libkms for the bootup splash), we have to ensure that we 3583 * (e.g. libkms for the bootup splash), we have to ensure that we
3584 * always use map_and_fenceable for all scanout buffers. 3584 * always use map_and_fenceable for all scanout buffers. However,
3585 * it may simply be too big to fit into mappable, in which case
3586 * put it anyway and hope that userspace can cope (but always first
3587 * try to preserve the existing ABI).
3585 */ 3588 */
3586 vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, 3589 vma = ERR_PTR(-ENOSPC);
3587 view->type == I915_GGTT_VIEW_NORMAL ? 3590 if (view->type == I915_GGTT_VIEW_NORMAL)
3588 PIN_MAPPABLE : 0); 3591 vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment,
3592 PIN_MAPPABLE | PIN_NONBLOCK);
3593 if (IS_ERR(vma))
3594 vma = i915_gem_object_ggtt_pin(obj, view, 0, alignment, 0);
3589 if (IS_ERR(vma)) 3595 if (IS_ERR(vma))
3590 goto err_unpin_display; 3596 goto err_unpin_display;
3591 3597
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 40bf2e4c804d..37415f96f906 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -776,6 +776,10 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
776 776
777 /* The use of a CPU fence is mandatory in order to detect writes 777 /* The use of a CPU fence is mandatory in order to detect writes
778 * by the CPU to the scanout and trigger updates to the FBC. 778 * by the CPU to the scanout and trigger updates to the FBC.
779 *
780 * Note that is possible for a tiled surface to be unmappable (and
781 * so have no fence associated with it) due to aperture constaints
782 * at the time of pinning.
779 */ 783 */
780 if (cache->fb.tiling_mode != I915_TILING_X || 784 if (cache->fb.tiling_mode != I915_TILING_X ||
781 cache->fb.fence_reg == I915_FENCE_REG_NONE) { 785 cache->fb.fence_reg == I915_FENCE_REG_NONE) {