Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/gem: Make i915_gem_object_flush_write_domain() static

flush_write_domain() is only used within the GEM domain management code,
so move it to i915_gem_domain.c and drop the export.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210119144912.12653-5-chris@chris-wilson.co.uk

+52 -57
+52 -6
drivers/gpu/drm/i915/gem/i915_gem_domain.c
··· 5 5 */ 6 6 7 7 #include "display/intel_frontbuffer.h" 8 + #include "gt/intel_gt.h" 8 9 9 10 #include "i915_drv.h" 10 11 #include "i915_gem_clflush.h" ··· 16 15 #include "i915_gem_lmem.h" 17 16 #include "i915_gem_mman.h" 18 17 18 + static bool gpu_write_needs_clflush(struct drm_i915_gem_object *obj) 19 + { 20 + return !(obj->cache_level == I915_CACHE_NONE || 21 + obj->cache_level == I915_CACHE_WT); 22 + } 23 + 24 + static void 25 + flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains) 26 + { 27 + struct i915_vma *vma; 28 + 29 + assert_object_held(obj); 30 + 31 + if (!(obj->write_domain & flush_domains)) 32 + return; 33 + 34 + switch (obj->write_domain) { 35 + case I915_GEM_DOMAIN_GTT: 36 + spin_lock(&obj->vma.lock); 37 + for_each_ggtt_vma(vma, obj) { 38 + if (i915_vma_unset_ggtt_write(vma)) 39 + intel_gt_flush_ggtt_writes(vma->vm->gt); 40 + } 41 + spin_unlock(&obj->vma.lock); 42 + 43 + i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU); 44 + break; 45 + 46 + case I915_GEM_DOMAIN_WC: 47 + wmb(); 48 + break; 49 + 50 + case I915_GEM_DOMAIN_CPU: 51 + i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC); 52 + break; 53 + 54 + case I915_GEM_DOMAIN_RENDER: 55 + if (gpu_write_needs_clflush(obj)) 56 + obj->cache_dirty = true; 57 + break; 58 + } 59 + 60 + obj->write_domain = 0; 61 + } 62 + 19 63 static void __i915_gem_object_flush_for_display(struct drm_i915_gem_object *obj) 20 64 { 21 65 /* 22 66 * We manually flush the CPU domain so that we can override and 23 67 * force the flush for the display, and perform it asyncrhonously. 24 68 */ 25 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 69 + flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 26 70 if (obj->cache_dirty) 27 71 i915_gem_clflush_object(obj, I915_CLFLUSH_FORCE); 28 72 obj->write_domain = 0; ··· 126 80 if (ret) 127 81 return ret; 128 82 129 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_WC); 83 + flush_write_domain(obj, ~I915_GEM_DOMAIN_WC); 130 84 131 85 /* Serialise direct access to this object with the barriers for 132 86 * coherent writes from the GPU, by effectively invalidating the ··· 187 141 if (ret) 188 142 return ret; 189 143 190 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_GTT); 144 + flush_write_domain(obj, ~I915_GEM_DOMAIN_GTT); 191 145 192 146 /* Serialise direct access to this object with the barriers for 193 147 * coherent writes from the GPU, by effectively invalidating the ··· 497 451 if (ret) 498 452 return ret; 499 453 500 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 454 + flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 501 455 502 456 /* Flush the CPU cache if it's still invalid. */ 503 457 if ((obj->read_domains & I915_GEM_DOMAIN_CPU) == 0) { ··· 665 619 goto out; 666 620 } 667 621 668 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 622 + flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 669 623 670 624 /* If we're not in the cpu read domain, set ourself into the gtt 671 625 * read domain and manually flush cachelines (if required). This ··· 716 670 goto out; 717 671 } 718 672 719 - i915_gem_object_flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 673 + flush_write_domain(obj, ~I915_GEM_DOMAIN_CPU); 720 674 721 675 /* If we're not in the cpu write domain, set ourself into the 722 676 * gtt write domain and manually flush cachelines (as required).
-47
drivers/gpu/drm/i915/gem/i915_gem_object.c
··· 25 25 #include <linux/sched/mm.h> 26 26 27 27 #include "display/intel_frontbuffer.h" 28 - #include "gt/intel_gt.h" 29 28 #include "i915_drv.h" 30 29 #include "i915_gem_clflush.h" 31 30 #include "i915_gem_context.h" ··· 310 311 */ 311 312 if (llist_add(&obj->freed, &i915->mm.free_list)) 312 313 queue_work(i915->wq, &i915->mm.free_work); 313 - } 314 - 315 - static bool gpu_write_needs_clflush(struct drm_i915_gem_object *obj) 316 - { 317 - return !(obj->cache_level == I915_CACHE_NONE || 318 - obj->cache_level == I915_CACHE_WT); 319 - } 320 - 321 - void 322 - i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj, 323 - unsigned int flush_domains) 324 - { 325 - struct i915_vma *vma; 326 - 327 - assert_object_held(obj); 328 - 329 - if (!(obj->write_domain & flush_domains)) 330 - return; 331 - 332 - switch (obj->write_domain) { 333 - case I915_GEM_DOMAIN_GTT: 334 - spin_lock(&obj->vma.lock); 335 - for_each_ggtt_vma(vma, obj) { 336 - if (i915_vma_unset_ggtt_write(vma)) 337 - intel_gt_flush_ggtt_writes(vma->vm->gt); 338 - } 339 - spin_unlock(&obj->vma.lock); 340 - 341 - i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU); 342 - break; 343 - 344 - case I915_GEM_DOMAIN_WC: 345 - wmb(); 346 - break; 347 - 348 - case I915_GEM_DOMAIN_CPU: 349 - i915_gem_clflush_object(obj, I915_CLFLUSH_SYNC); 350 - break; 351 - 352 - case I915_GEM_DOMAIN_RENDER: 353 - if (gpu_write_needs_clflush(obj)) 354 - obj->cache_dirty = true; 355 - break; 356 - } 357 - 358 - obj->write_domain = 0; 359 314 } 360 315 361 316 void __i915_gem_object_flush_frontbuffer(struct drm_i915_gem_object *obj,
-4
drivers/gpu/drm/i915/gem/i915_gem_object.h
··· 427 427 428 428 void __i915_gem_object_release_map(struct drm_i915_gem_object *obj); 429 429 430 - void 431 - i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj, 432 - unsigned int flush_domains); 433 - 434 430 int i915_gem_object_prepare_read(struct drm_i915_gem_object *obj, 435 431 unsigned int *needs_clflush); 436 432 int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj,