• Matthew Auld's avatar
    drm/xe/buddy: add visible tracking · 793e6612
    Matthew Auld authored
    Replace the allocation code with the i915 version. This simplifies the
    code a little, and importantly we get the accounting at the mgr level,
    which is useful for debug (and maybe userspace), plus per resource
    tracking so we can easily check if a resource is using one or pages in
    the mappable part of vram (useful for eviction), or if the resource is
    completely within the mappable portion (useful for checking if the
    resource can be safely CPU mapped).
    
    v2: Fix missing PAGE_SHIFT
    v3: (Gwan-gyeong Mun)
      - Fix incorrect usage of ilog2(mm.chunk_size).
      - Fix calculation when checking for impossible allocation sizes, also
        check much earlier.
    v4: (Gwan-gyeong Mun)
      - Fix calculation when extending the [fpfn, lpfn] range due to the
        roundup_pow_of_two().
    v5: (Gwan-gyeong Mun)
      - Move the check for running out of mappable VRAM to before doing any of
        the roundup_pow_of_two().
    v6: (Jani)
      - Stop abusing BUG_ON(). We can easily just use WARN_ON() here and
        return a proper error to the caller, which is much nicer if we ever
        trigger these.
    Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
    Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Lucas De Marchi <lucas.demarchi@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Reviewed-by: default avatarGwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    793e6612
xe_ttm_vram_mgr.h 1.1 KB