public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ben Widawsky <ben@bwidawsk.net>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/25] drm/i915: add context information to objects
Date: Thu, 14 Jun 2012 00:01:22 +0200	[thread overview]
Message-ID: <20120613220122.GR4829@phenom.ffwll.local> (raw)
In-Reply-To: <1338846185-10571-5-git-send-email-ben@bwidawsk.net>

On Mon, Jun 04, 2012 at 02:42:44PM -0700, Ben Widawsky wrote:
> Daniel originally shot this patch down as being a layering violation. In
> fact, over time I've come to agree with him on this.
> 
> However, it is handy for debug information, and after the below commit,
> I need some way to be able to not lazily bind objects to the gtt for
> contexts.
> 
> commit 0ebb98299357e1dbeeea470eec29241263c8f244
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Wed Feb 15 23:50:24 2012 +0100
> 
>     drm/i915: enable lazy global-gtt binding
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

That is imo a really neat layering violation in the following patch. I'll
shot down both patches. Just call i915_gem_gtt_bind_object right before
using the object - object_bind_to_gtt only allocates the gtt area.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.h         |    5 +++++
>  drivers/gpu/drm/i915/i915_gem.c         |    1 +
>  drivers/gpu/drm/i915/i915_gem_context.c |    6 +++++-
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f543679..9b309aa 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -993,6 +993,11 @@ struct drm_i915_gem_object {
>  	 * reaches 0, dev_priv->pending_flip_queue will be woken up.
>  	 */
>  	atomic_t pending_flip;
> +
> +	/**
> +	 * >= 0 if this object is the object for a context.
> +	 */
> +	int context_id;
>  };
>  
>  #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 28f00dc..2142e9c 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3439,6 +3439,7 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
>  	obj->madv = I915_MADV_WILLNEED;
>  	/* Avoid an unnecessary call to unbind on the first bind. */
>  	obj->map_and_fenceable = true;
> +	obj->context_id = -1;
>  
>  	return obj;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 2aca002..bf57123 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -162,7 +162,7 @@ create_hw_context(struct drm_device *dev,
>  
>  	/* Default context will never have a file_priv */
>  	if (file_priv == NULL)
> -		return 0;
> +		goto out;
>  
>  	(*ctx_out)->file_priv = file_priv;
>  
> @@ -183,6 +183,8 @@ again:
>  	else if (ret)
>  		goto err_out;
>  
> +out:
> +	(*ctx_out)->obj->context_id = (*ctx_out)->id;
>  	return 0;
>  
>  err_out:
> @@ -214,6 +216,8 @@ static int create_default_context(struct drm_i915_private *dev_priv)
>  	 * default context.
>  	 */
>  	ctx = dev_priv->ring[RCS].default_context;
> +	ctx->id = DEFAULT_CONTEXT_ID;
> +	ctx->obj->context_id = DEFAULT_CONTEXT_ID;
>  	ret = i915_gem_object_pin(ctx->obj, CONTEXT_ALIGN, false);
>  	if (ret) {
>  		do_destroy(ctx);
> -- 
> 1.7.10.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

  reply	other threads:[~2012-06-13 22:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04 21:42 [PATCH 00/25] i915 HW context support Ben Widawsky
2012-06-04 21:42 ` [PATCH 01/25] drm/i915: CXT_SIZE register offsets added Ben Widawsky
2012-06-04 21:42 ` [PATCH 02/25 v2] drm/i915: preliminary context support Ben Widawsky
2012-06-05 12:23   ` Ville Syrjälä
2012-06-05 16:30     ` Ben Widawsky
2012-06-04 21:42 ` [PATCH 03/25 v2] drm/i915: context basic create & destroy Ben Widawsky
2012-06-13 23:27   ` Ben Widawsky
2012-06-04 21:42 ` [PATCH 04/25] drm/i915: add context information to objects Ben Widawsky
2012-06-13 22:01   ` Daniel Vetter [this message]
2012-06-13 23:26     ` Ben Widawsky
2012-06-04 21:42 ` [PATCH 05/25] drm/i915: always bind context objects immediately Ben Widawsky
2012-06-04 21:42 ` [PATCH 06/25 v3] drm/i915: context switch implementation Ben Widawsky
2012-06-04 21:42 ` [PATCH 07/25] drm/i915: context trace events Ben Widawsky
2012-06-13 22:23   ` Daniel Vetter
2012-06-13 23:27     ` Ben Widawsky
2012-06-04 21:42 ` [PATCH 08/25] drm/i915: Ivybridge MI_ARB_ON_OFF context w/a Ben Widawsky
2012-06-04 21:42 ` [PATCH 09/25] drm/i915: PIPE_CONTROL_TLB_INVALIDATE Ben Widawsky
2012-06-04 21:42 ` [PATCH 10/25 v2] drm/i915: possibly invalidate TLB before context switch Ben Widawsky
2012-06-04 21:42 ` [PATCH 11/25] drm/i915: use the default context Ben Widawsky
2012-06-04 21:42 ` [PATCH 12/25] drm/i915: add ccid to error state Ben Widawsky
2012-06-04 21:42 ` [PATCH 13/25 v3] drm/i915: switch to default context on idle Ben Widawsky
2012-06-04 21:42 ` [PATCH 14/25 v3] drm/i915/context: create & destroy ioctls Ben Widawsky
2012-06-04 21:42 ` [PATCH 15/25 v2] drm/i915/context: switch contexts with execbuf2 Ben Widawsky
2012-06-04 21:42 ` [PATCH 16/25] drm/i915: reset the GPU on context fini Ben Widawsky
2012-06-04 21:42 ` [PATCH 17/25] intel: wait render placeholder Ben Widawsky
2012-06-04 21:42 ` [PATCH 18/25] intel: Merge updated kernel header Ben Widawsky
2012-06-04 21:42 ` [PATCH 19/25] intel/context: Add drm_intel_context type Ben Widawsky
2012-06-04 21:43 ` [PATCH 20/25] intel/context: new execbuf interface for contexts Ben Widawsky
2012-06-04 21:43 ` [PATCH 21/25] intel: add decoding of MI_SET_CONTEXT Ben Widawsky
2012-06-04 21:43 ` [PATCH 22/25] context: libdrm wrappers Ben Widawsky
2012-06-04 21:43 ` [PATCH 23/25] context: update for new execbuf2 element Ben Widawsky
2012-06-04 21:43 ` [PATCH 24/25] contexts: basic test coverage Ben Widawsky
2012-06-13 23:30   ` Daniel Vetter
2012-06-14  3:13   ` [PATCH] " Ben Widawsky
2012-06-04 21:43 ` [PATCH 25/25] i965: hw context support Ben Widawsky
2012-06-04 23:01   ` Paul Berry
2012-06-04 23:10     ` [Intel-gfx] " Ben Widawsky
2012-06-05  5:53 ` [PATCH 00/25] i915 HW " Dave Airlie
2012-06-05  7:08   ` [Mesa-dev] " Kenneth Graunke
2012-06-05 16:32     ` Ben Widawsky
2012-06-05 23:37 ` Kenneth Graunke
2012-06-07 16:17   ` Ben Widawsky
2012-06-14 16:04 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120613220122.GR4829@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox