aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2a5351df46da..28f91df2604d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3351,17 +3351,20 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
3351 return 0; 3351 return 0;
3352} 3352}
3353 3353
3354static bool i915_gem_valid_gtt_space(struct drm_device *dev, 3354static bool i915_gem_valid_gtt_space(struct i915_vma *vma,
3355 struct drm_mm_node *gtt_space,
3356 unsigned long cache_level) 3355 unsigned long cache_level)
3357{ 3356{
3357 struct drm_mm_node *gtt_space = &vma->node;
3358 struct drm_mm_node *other; 3358 struct drm_mm_node *other;
3359 3359
3360 /* On non-LLC machines we have to be careful when putting differing 3360 /*
3361 * types of snoopable memory together to avoid the prefetcher 3361 * On some machines we have to be careful when putting differing types
3362 * crossing memory domains and dying. 3362 * of snoopable memory together to avoid the prefetcher crossing memory
3363 * domains and dying. During vm initialisation, we decide whether or not
3364 * these constraints apply and set the drm_mm.color_adjust
3365 * appropriately.
3363 */ 3366 */
3364 if (HAS_LLC(dev)) 3367 if (vma->vm->mm.color_adjust == NULL)
3365 return true; 3368 return true;
3366 3369
3367 if (!drm_mm_node_allocated(gtt_space)) 3370 if (!drm_mm_node_allocated(gtt_space))
@@ -3499,8 +3502,7 @@ search_free:
3499 3502
3500 goto err_free_vma; 3503 goto err_free_vma;
3501 } 3504 }
3502 if (WARN_ON(!i915_gem_valid_gtt_space(dev, &vma->node, 3505 if (WARN_ON(!i915_gem_valid_gtt_space(vma, obj->cache_level))) {
3503 obj->cache_level))) {
3504 ret = -EINVAL; 3506 ret = -EINVAL;
3505 goto err_remove_node; 3507 goto err_remove_node;
3506 } 3508 }
@@ -3710,7 +3712,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
3710 } 3712 }
3711 3713
3712 list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) { 3714 list_for_each_entry_safe(vma, next, &obj->vma_list, vma_link) {
3713 if (!i915_gem_valid_gtt_space(dev, &vma->node, cache_level)) { 3715 if (!i915_gem_valid_gtt_space(vma, cache_level)) {
3714 ret = i915_vma_unbind(vma); 3716 ret = i915_vma_unbind(vma);
3715 if (ret) 3717 if (ret)
3716 return ret; 3718 return ret;