[Intel-gfx] [PATCH 6/9] drm/i915: Allocate context objects from stolen
Chris Wilson
chris at chris-wilson.co.uk
Thu Aug 8 15:41:08 CEST 2013
Once again, the CPU PAT bits are irrelevant when considering the GPU
cacheing, and context objects are never accessed from the CPU or
directly by userspace making them another ideal candidate to allocate
from stolen memory.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_context.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index a57d49a..498f8a0 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -141,6 +141,7 @@ create_hw_context(struct drm_device *dev,
struct drm_i915_file_private *file_priv)
{
struct drm_i915_private *dev_priv = dev->dev_private;
+ const int size = dev_priv->hw_context_size;
struct i915_hw_context *ctx;
int ret;
@@ -149,7 +150,9 @@ create_hw_context(struct drm_device *dev,
return ERR_PTR(-ENOMEM);
kref_init(&ctx->ref);
- ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size);
+ ctx->obj = i915_gem_object_create_stolen(dev, size);
+ if (ctx->obj == NULL)
+ ctx->obj = i915_gem_alloc_object(dev, size);
if (ctx->obj == NULL) {
kfree(ctx);
DRM_DEBUG_DRIVER("Context object allocated failed\n");
--
1.8.4.rc1
More information about the Intel-gfx
mailing list