Commit 3727d55e authored by Jesse Barnes's avatar Jesse Barnes Committed by Daniel Vetter

drm/i915: allow stolen, pre-allocated objects to avoid GTT allocation v2

In some cases, we may not need GTT address space allocated to a stolen
object, so allow passing -1 to the preallocated function to indicate as
much.

v2: remove BUG_ON(gtt_offset & 4095) now that -1 is allowed (Ville)
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent c9cddffc
...@@ -339,7 +339,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, ...@@ -339,7 +339,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
/* KISS and expect everything to be page-aligned */ /* KISS and expect everything to be page-aligned */
BUG_ON(stolen_offset & 4095); BUG_ON(stolen_offset & 4095);
BUG_ON(gtt_offset & 4095);
BUG_ON(size & 4095); BUG_ON(size & 4095);
if (WARN_ON(size == 0)) if (WARN_ON(size == 0))
...@@ -360,6 +359,10 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, ...@@ -360,6 +359,10 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
return NULL; return NULL;
} }
/* Some objects just need physical mem from stolen space */
if (gtt_offset == -1)
return obj;
/* To simplify the initialisation sequence between KMS and GTT, /* To simplify the initialisation sequence between KMS and GTT,
* we allow construction of the stolen object prior to * we allow construction of the stolen object prior to
* setting up the GTT space. The actual reservation will occur * setting up the GTT space. The actual reservation will occur
......
...@@ -2881,7 +2881,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) ...@@ -2881,7 +2881,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_base; pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_base;
pctx = i915_gem_object_create_stolen_for_preallocated(dev_priv->dev, pctx = i915_gem_object_create_stolen_for_preallocated(dev_priv->dev,
pcbr_offset, pcbr_offset,
pcbr_offset, -1,
pctx_size); pctx_size);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment