Skip to content
  • Andi Shyti's avatar
    lib/i915: add gem_engine_topology library and for_each loop definition · 17c77e7b
    Andi Shyti authored
    
    
    The gem_engine_topology library is a set of functions that
    interface with the query and getparam/setparam ioctls.
    
    The library's access point is the 'intel_init_engine_list()'
    function that, everytime is called, generates the list of active
    engines and returns them in a 'struct intel_engine_data'. The
    structure contains only the engines that are actively present in
    the GPU.
    
    The function can work in both the cases that the query and
    getparam ioctls are implemented or not by the running kernel. In
    case they are implemented, a query is made to the driver to fetch
    the list of active engines. In case they are not implemented, the
    list is taken from the 'intel_execution_engines2' array and
    stored only after checking their presence.
    
    The gem_engine_topology library provides some iteration helpers:
    
     - intel_get_current_engine(): provides the current engine in the
       iteration.
    
     - intel_get_current_physical_engine(): provides the current
       physical engine, if the current engine is a virtual engine,
       it moves forward until it finds a physical engine.
    
     - intel_next_engine() it just increments the counter so that it
       points to the next engine.
    
    Extend the 'for_each_engine_class_instance' so that it can loop
    using the new 'intel_init_engine_list()' and rename it to
    'for_each_context_engine'.
    
    Move '__for_each_engine_class_instance' to gem_engine_topology.h
    and rename it to '__for_each_static_engine'.
    
    Update accordingly tests/perf_pmu.c to use correctly the new
    for_each loops.
    
    Signed-off-by: default avatarAndi Shyti <andi.shyti@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    17c77e7b