From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 6/9] drm/i915: Allocate context objects from stolen Date: Sat, 10 Aug 2013 11:25:46 +0200 Message-ID: <20130810092546.GI31670@phenom.ffwll.local> References: <1375969271-4331-1-git-send-email-chris@chris-wilson.co.uk> <1375969271-4331-6-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id A27EFE5DEF for ; Sat, 10 Aug 2013 02:25:39 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id e52so2545379eek.30 for ; Sat, 10 Aug 2013 02:25:38 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1375969271-4331-6-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 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@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