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@xxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx