Lines Matching defs:obj
18 struct drm_i915_gem_object *obj;
21 static void __do_clflush(struct drm_i915_gem_object *obj)
23 GEM_BUG_ON(!i915_gem_object_has_pages(obj));
24 drm_clflush_sg(obj->mm.pages);
26 i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
33 __do_clflush(clflush->obj);
40 i915_gem_object_unpin_pages(clflush->obj);
41 i915_gem_object_put(clflush->obj);
50 static struct clflush *clflush_work_create(struct drm_i915_gem_object *obj)
54 GEM_BUG_ON(!obj->cache_dirty);
60 if (__i915_gem_object_get_pages(obj) < 0) {
66 clflush->obj = i915_gem_object_get(obj); /* obj <-> clflush cycle */
71 bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
74 struct drm_i915_private *i915 = to_i915(obj->base.dev);
77 assert_object_held(obj);
80 WARN_ON_ONCE(obj->cache_dirty);
91 if (!i915_gem_object_has_struct_page(obj)) {
92 obj->cache_dirty = false;
105 obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ)
108 trace_i915_gem_object_clflush(obj);
112 dma_resv_reserve_fences(obj->base.resv, 1) == 0)
113 clflush = clflush_work_create(obj);
116 obj->base.resv, true,
119 dma_resv_add_fence(obj->base.resv, &clflush->base.dma,
129 obj->cache_dirty = false;
130 } else if (obj->mm.pages) {
131 __do_clflush(obj);
132 obj->cache_dirty = false;
134 GEM_BUG_ON(obj->write_domain != I915_GEM_DOMAIN_CPU);