[Intel-gfx] [PATCH 6/9] drm/i915: Allocate context objects from stolen

Daniel Vetter daniel at ffwll.ch
Sat Aug 10 11:25:46 CEST 2013


On Thu, Aug 08, 2013 at 02:41:08PM +0100, Chris Wilson wrote:
> 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>

I think this will break hibernate, since over hibernate stolen get some
garbage. And userspace (and the gpu) probably don't expect garbage when
trying to restore a hw context.
-Daniel

> ---
>  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
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list