From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/gem: Track ggtt writes from userspace on the bound vma
Date: Tue, 19 Nov 2019 16:55:27 +0200 [thread overview]
Message-ID: <871ru3ykyo.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20191119112515.2766748-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> When userspace writes into the GTT itself, it is supposed to call
> set-domain to let the kernel keep track and so manage the CPU/GPU
> caches. As we track writes on the individual i915_vma, we should also be
> sure to mark them as dirty.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_domain.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> index e2af63af67ad..9aebcf263191 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> @@ -149,9 +149,17 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
> GEM_BUG_ON((obj->write_domain & ~I915_GEM_DOMAIN_GTT) != 0);
> obj->read_domains |= I915_GEM_DOMAIN_GTT;
> if (write) {
> + struct i915_vma *vma;
> +
> obj->read_domains = I915_GEM_DOMAIN_GTT;
> obj->write_domain = I915_GEM_DOMAIN_GTT;
> obj->mm.dirty = true;
> +
> + spin_lock(&obj->vma.lock);
> + for_each_ggtt_vma(vma, obj)
> + if (i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
> + i915_vma_set_ggtt_write(vma);
> + spin_unlock(&obj->vma.lock);
> }
>
> i915_gem_object_unpin_pages(obj);
> --
> 2.24.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gem: Track ggtt writes from userspace on the bound vma
Date: Tue, 19 Nov 2019 16:55:27 +0200 [thread overview]
Message-ID: <871ru3ykyo.fsf@gaia.fi.intel.com> (raw)
Message-ID: <20191119145527.rzRj9MDzTky109dJxqTL8iFw7wO6JHNNqUSSjByE7Uk@z> (raw)
In-Reply-To: <20191119112515.2766748-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> When userspace writes into the GTT itself, it is supposed to call
> set-domain to let the kernel keep track and so manage the CPU/GPU
> caches. As we track writes on the individual i915_vma, we should also be
> sure to mark them as dirty.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_domain.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> index e2af63af67ad..9aebcf263191 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
> @@ -149,9 +149,17 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
> GEM_BUG_ON((obj->write_domain & ~I915_GEM_DOMAIN_GTT) != 0);
> obj->read_domains |= I915_GEM_DOMAIN_GTT;
> if (write) {
> + struct i915_vma *vma;
> +
> obj->read_domains = I915_GEM_DOMAIN_GTT;
> obj->write_domain = I915_GEM_DOMAIN_GTT;
> obj->mm.dirty = true;
> +
> + spin_lock(&obj->vma.lock);
> + for_each_ggtt_vma(vma, obj)
> + if (i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
> + i915_vma_set_ggtt_write(vma);
> + spin_unlock(&obj->vma.lock);
> }
>
> i915_gem_object_unpin_pages(obj);
> --
> 2.24.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-11-19 14:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 11:25 [PATCH] drm/i915/gem: Track ggtt writes from userspace on the bound vma Chris Wilson
2019-11-19 11:25 ` [Intel-gfx] " Chris Wilson
2019-11-19 12:38 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-11-19 12:38 ` [Intel-gfx] " Patchwork
2019-11-19 14:55 ` Mika Kuoppala [this message]
2019-11-19 14:55 ` [Intel-gfx] [PATCH] " Mika Kuoppala
2019-11-19 18:40 ` ✓ Fi.CI.IGT: success for " Patchwork
2019-11-19 18:40 ` [Intel-gfx] " Patchwork
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=871ru3ykyo.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--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