All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH] drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler
Date: Mon, 21 Sep 2020 05:50:17 +0200	[thread overview]
Message-ID: <20200921035017.6868-1-zbigniew.kempczynski@intel.com> (raw)

On !llc platforms when buffer is mapped with WB using GEM_MMAP_OFFSET
pagefault handler clears its dirty flag. This has consequences
buffer is not flushed on exec before moving to render domain.
So make sure we keep dirty flag for buffers mapped to write until
it leaves cpu domain.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index 3d69e51f3e4d..3f61a5ccbdd5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -239,6 +239,7 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 	struct i915_mmap_offset *mmo = area->vm_private_data;
 	struct drm_i915_gem_object *obj = mmo->obj;
 	resource_size_t iomap;
+	u16 prev_write_domain;
 	int err;
 
 	/* Sanity check that we allow writing into this object */
@@ -246,6 +247,8 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 		     area->vm_flags & VM_WRITE))
 		return VM_FAULT_SIGBUS;
 
+	prev_write_domain = obj->write_domain;
+
 	err = i915_gem_object_pin_pages(obj);
 	if (err)
 		goto out;
@@ -268,6 +271,10 @@ static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 
 	i915_gem_object_unpin_pages(obj);
 
+	/* On !llc we need to flush before moving to render domain */
+	if (!obj->cache_coherent && prev_write_domain == I915_GEM_DOMAIN_CPU)
+		obj->cache_dirty = true;
+
 out:
 	return i915_error_to_vmf_fault(err);
 }
-- 
2.26.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2020-09-21  3:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21  3:50 Zbigniew Kempczyński [this message]
2020-09-21  3:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler Patchwork
2020-09-21  4:22 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-09-21  5:20 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler (rev2) Patchwork
2020-09-21  5:44 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-21  6:55 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-09-21  7:21   ` Zbigniew Kempczyński
2020-09-21  8:54 ` [Intel-gfx] [PATCH] drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler Chris Wilson

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=20200921035017.6868-1-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.