drm/i915/ttm: tweak priority hint selection
authorjsg <jsg@openbsd.org>
Thu, 24 Feb 2022 13:06:39 +0000 (13:06 +0000)
committerjsg <jsg@openbsd.org>
Thu, 24 Feb 2022 13:06:39 +0000 (13:06 +0000)
From Matthew Auld
79bdf56cc55d103f2a276318fd973a296a110b95 in linux 5.15.y/5.15.25
0bdc0a0699929c814a8aecd55d2accb8c11beae2 in mainline linux

sys/dev/pci/drm/i915/gem/i915_gem_ttm.c

index 2d5be62..94c6584 100644 (file)
@@ -774,11 +774,9 @@ static void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj)
        if (obj->mm.madv != I915_MADV_WILLNEED) {
                bo->priority = I915_TTM_PRIO_PURGE;
        } else if (!i915_gem_object_has_pages(obj)) {
-               if (bo->priority < I915_TTM_PRIO_HAS_PAGES)
-                       bo->priority = I915_TTM_PRIO_HAS_PAGES;
+               bo->priority = I915_TTM_PRIO_NO_PAGES;
        } else {
-               if (bo->priority > I915_TTM_PRIO_NO_PAGES)
-                       bo->priority = I915_TTM_PRIO_NO_PAGES;
+               bo->priority = I915_TTM_PRIO_HAS_PAGES;
        }
 
        ttm_bo_move_to_lru_tail(bo, bo->resource, NULL);