Skip to content

Commit 7953849

Browse files
matt-auldjnikula
authored andcommitted
drm/i915: tweak the ordering in cpu_write_needs_clflush
For imported dma-buf objects we leave the object as cache_coherent = 0 across all platforms, which is reasonable given that have no clue what the memory underneath is, and its not like the driver can ever manually clflush the pages anyway (like with i915_gem_clflush_object) for such objects. However on discrete we choose to treat cache_dirty = true as a programmer error, leading to a warning. The simplest fix looks to be to just change the ordering in cpu_write_needs_clflush to prevent ever setting cache_dirty for dma-buf objects on discrete. Fixes: d028a76 ("drm/i915/dmabuf: Fix prime_mmap to work when using LMEM") Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5266 Signed-off-by: Matthew Auld <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Gwan-gyeong Mun <[email protected]> Reviewed-by: Gwan-gyeong Mun <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 563aaf4) Signed-off-by: Jani Nikula <[email protected]>
1 parent 7d23a80 commit 7953849

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/i915/gem/i915_gem_domain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ bool i915_gem_cpu_write_needs_clflush(struct drm_i915_gem_object *obj)
3535
if (obj->cache_dirty)
3636
return false;
3737

38-
if (!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE))
39-
return true;
40-
4138
if (IS_DGFX(i915))
4239
return false;
4340

41+
if (!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE))
42+
return true;
43+
4444
/* Currently in use by HW (display engine)? Keep flushed. */
4545
return i915_gem_object_is_framebuffer(obj);
4646
}

0 commit comments

Comments
 (0)