From: Daniel Vetter <daniel@ffwll.ch>
To: Ben Widawsky <ben@bwidawsk.net>
Cc: Intel GFX <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 19/29] drm/i915: turn bound_ggtt checks to bound_any
Date: Tue, 6 Aug 2013 20:43:42 +0200 [thread overview]
Message-ID: <20130806184342.GD22035@phenom.ffwll.local> (raw)
In-Reply-To: <1375315222-4785-20-git-send-email-ben@bwidawsk.net>
On Wed, Jul 31, 2013 at 05:00:12PM -0700, Ben Widawsky wrote:
> In some places, we want to know if an object is bound in any address
> space, and not just the global GTT. This often applies when there is a
> single global resource (object, pages, etc.)
>
> function | reason
> --------------------------------------------------
> i915_gem_object_is_inactive | global object
> i915_gem_object_put_pages | object's pages
> 915_gem_object_unpin | global object
> i915_gem_execbuffer_unreserve_object | temporary until we plumb vma
> pread/pread | object's domain
pread/pwrite isn't about the object's domain at all, but purely about
synchronizing for outstanding rendering. Replacing the call to
set_to_gtt_domain with a wait_rendering would imo improve code
readability. Furthermore we could pimp pread to only block for outstanding
writes and not for reads.
Since you're not the first one to trip over this: Can I volunteer you for
a follow-up patch to fix this?
Otherwise patch looks good.
-Daniel
>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 12 ++++++------
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 1013105..d4d6444 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -122,7 +122,7 @@ int i915_mutex_lock_interruptible(struct drm_device *dev)
> static inline bool
> i915_gem_object_is_inactive(struct drm_i915_gem_object *obj)
> {
> - return i915_gem_obj_ggtt_bound(obj) && !obj->active;
> + return i915_gem_obj_bound_any(obj) && !obj->active;
> }
>
> int
> @@ -408,7 +408,7 @@ i915_gem_shmem_pread(struct drm_device *dev,
> * anyway again before the next pread happens. */
> if (obj->cache_level == I915_CACHE_NONE)
> needs_clflush = 1;
> - if (i915_gem_obj_ggtt_bound(obj)) {
> + if (i915_gem_obj_bound_any(obj)) {
> ret = i915_gem_object_set_to_gtt_domain(obj, false);
> if (ret)
> return ret;
> @@ -725,7 +725,7 @@ i915_gem_shmem_pwrite(struct drm_device *dev,
> * right away and we therefore have to clflush anyway. */
> if (obj->cache_level == I915_CACHE_NONE)
> needs_clflush_after = 1;
> - if (i915_gem_obj_ggtt_bound(obj)) {
> + if (i915_gem_obj_bound_any(obj)) {
> ret = i915_gem_object_set_to_gtt_domain(obj, true);
> if (ret)
> return ret;
> @@ -1659,7 +1659,7 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
> if (obj->pages_pin_count)
> return -EBUSY;
>
> - BUG_ON(i915_gem_obj_ggtt_bound(obj));
> + BUG_ON(i915_gem_obj_bound_any(obj));
>
> /* ->put_pages might need to allocate memory for the bit17 swizzle
> * array, hence protect them from being reaped by removing them from gtt
> @@ -3301,7 +3301,7 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
> int ret;
>
> /* Not valid to be called on unbound objects. */
> - if (!i915_gem_obj_ggtt_bound(obj))
> + if (!i915_gem_obj_bound_any(obj))
> return -EINVAL;
>
> if (obj->base.write_domain == I915_GEM_DOMAIN_GTT)
> @@ -3725,7 +3725,7 @@ void
> i915_gem_object_unpin(struct drm_i915_gem_object *obj)
> {
> BUG_ON(obj->pin_count == 0);
> - BUG_ON(!i915_gem_obj_ggtt_bound(obj));
> + BUG_ON(!i915_gem_obj_bound_any(obj));
>
> if (--obj->pin_count == 0)
> obj->pin_mappable = false;
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 5e68f1e..64dc6b5 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -466,7 +466,7 @@ i915_gem_execbuffer_unreserve_object(struct drm_i915_gem_object *obj)
> {
> struct drm_i915_gem_exec_object2 *entry;
>
> - if (!i915_gem_obj_ggtt_bound(obj))
> + if (!i915_gem_obj_bound_any(obj))
> return;
>
> entry = obj->exec_entry;
> --
> 1.8.3.4
>
> _______________________________________________
> 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
next prev parent reply other threads:[~2013-08-06 18:43 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 23:59 [PATCH 00/29] Completion of i915 VMAs v2 Ben Widawsky
2013-07-31 23:59 ` [PATCH 01/29] drm/i915: Create an init vm Ben Widawsky
2013-07-31 23:59 ` [PATCH 02/29] drm/i915: Rework drop caches for checkpatch Ben Widawsky
2013-08-03 11:32 ` Chris Wilson
2013-08-03 22:10 ` Ben Widawsky
2013-07-31 23:59 ` [PATCH 03/29] drm/i915: Make proper functions for VMs Ben Widawsky
2013-07-31 23:59 ` [PATCH 04/29] drm/i915: Use bound list for inactive shrink Ben Widawsky
2013-07-31 23:59 ` [PATCH 05/29] drm/i915: Add VM to pin Ben Widawsky
2013-07-31 23:59 ` [PATCH 06/29] drm/i915: Use ggtt_vm to save some typing Ben Widawsky
2013-08-01 0:00 ` [PATCH 07/29] drm/i915: Update describe_obj Ben Widawsky
2013-08-01 0:00 ` [PATCH 08/29] drm/i915: Rework __i915_gem_shrink Ben Widawsky
2013-08-05 8:59 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 09/29] drm/i915: thread address space through execbuf Ben Widawsky
2013-08-05 9:39 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 10/29] drm/i915: make caching operate on all address spaces Ben Widawsky
2013-08-05 9:41 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 11/29] drm/i915: BUG_ON put_pages later Ben Widawsky
2013-08-05 9:42 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 12/29] drm/i915: make reset&hangcheck code VM aware Ben Widawsky
2013-08-01 0:00 ` [PATCH 13/29] drm/i915: clear domains for all objects on reset Ben Widawsky
2013-08-03 10:59 ` Chris Wilson
2013-08-03 22:24 ` Ben Widawsky
2013-08-05 9:52 ` Daniel Vetter
2013-08-05 16:46 ` [PATCH 13/29] drm/i915: eliminate dead domain clearing " Ben Widawsky
2013-08-05 17:13 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 14/29] drm/i915: Restore PDEs on gtt restore Ben Widawsky
2013-08-06 18:14 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 15/29] drm/i915: Improve VMA comments Ben Widawsky
2013-08-01 0:00 ` [PATCH 16/29] drm/i915: Cleanup more of VMA in destroy Ben Widawsky
2013-08-01 0:00 ` [PATCH 17/29] drm/i915: plumb VM into bind/unbind code Ben Widawsky
2013-08-06 18:29 ` Daniel Vetter
2013-08-06 18:54 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 18/29] drm/i915: Use new bind/unbind in eviction code Ben Widawsky
2013-08-06 18:39 ` Daniel Vetter
2013-08-06 21:27 ` Ben Widawsky
2013-08-06 21:29 ` Daniel Vetter
2013-08-06 22:57 ` Ben Widawsky
2013-08-06 22:59 ` Daniel Vetter
2013-08-06 23:25 ` Ben Widawsky
2013-08-06 23:44 ` Daniel Vetter
2013-08-07 18:24 ` Ben Widawsky
2013-08-01 0:00 ` [PATCH 19/29] drm/i915: turn bound_ggtt checks to bound_any Ben Widawsky
2013-08-03 11:03 ` Chris Wilson
2013-08-03 22:26 ` Ben Widawsky
2013-08-06 18:43 ` Daniel Vetter [this message]
2013-08-06 21:29 ` Ben Widawsky
2013-08-01 0:00 ` [PATCH 20/29] drm/i915: Fix up map and fenceable for VMA Ben Widawsky
2013-08-06 19:11 ` Daniel Vetter
2013-08-07 18:37 ` Ben Widawsky
2013-08-07 20:32 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 21/29] drm/i915: mm_list is per VMA Ben Widawsky
2013-08-06 19:38 ` Daniel Vetter
2013-08-07 0:28 ` Ben Widawsky
2013-08-07 20:52 ` Daniel Vetter
2013-08-08 4:32 ` Ben Widawsky
2013-08-08 6:46 ` Daniel Vetter
2013-08-08 18:10 ` Ben Widawsky
2013-08-01 0:00 ` [PATCH 22/29] drm/i915: Update error capture for VMs Ben Widawsky
2013-08-01 0:00 ` [PATCH 23/29] drm/i915: Add vma to list at creation Ben Widawsky
2013-08-01 0:00 ` [PATCH 24/29] drm/i915: create vmas at execbuf Ben Widawsky
2013-08-07 20:52 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 25/29] drm/i915: Convert execbuf code to use vmas Ben Widawsky
2013-08-06 20:43 ` Daniel Vetter
2013-08-06 20:45 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 26/29] drm/i915: Convert active API to VMA Ben Widawsky
2013-08-06 20:47 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 27/29] drm/i915: Add bind/unbind object functions to VM Ben Widawsky
2013-08-01 0:00 ` [PATCH 28/29] drm/i915: Use the new vm [un]bind functions Ben Widawsky
2013-08-06 20:58 ` Daniel Vetter
2013-08-01 0:00 ` [PATCH 29/29] drm/i915: eliminate vm->insert_entries() Ben Widawsky
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=20130806184342.GD22035@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