Skip to content
  • Jerome Glisse's avatar
    drm/ttm: Rework validation & memory space allocation (V3) · ca262a99
    Jerome Glisse authored
    
    
    This change allow driver to pass sorted memory placement,
    from most prefered placement to least prefered placement.
    In order to avoid long function prototype a structure is
    used to gather memory placement informations such as range
    restriction (if you need a buffer to be in given range).
    Range restriction is determined by fpfn & lpfn which are
    the first page and last page number btw which allocation
    can happen. If those fields are set to 0 ttm will assume
    buffer can be put anywhere in the address space (thus it
    avoids putting a burden on the driver to always properly
    set those fields).
    
    This patch also factor few functions like evicting first
    entry of lru list or getting a memory space. This avoid
    code duplication.
    
    V2: Change API to use placement flags and array instead
        of packing placement order into a quadword.
    V3: Make sure we set the appropriate mem.placement flag
        when validating or allocation memory space.
    
    [Pending Thomas Hellstrom further review but okay
    from preliminary review so far].
    
    Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    ca262a99