Commit 22d54ab6 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Move for_each_engine* out of i915_drv.h

Iterators operate on struct intel_gt so lets move it to intel_gt.h in
order to make i915_drv.h less of a dumping ground for stuff.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: default avatarJani Nikula <jani.nikula@linux.intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231102093248.362659-2-tvrtko.ursulin@linux.intel.com
parent 15c28f0f
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "i915_request.h" #include "i915_request.h"
#include "intel_engine_types.h" #include "intel_engine_types.h"
#include "intel_wakeref.h" #include "intel_wakeref.h"
#include "intel_gt.h"
#include "intel_gt_pm.h" #include "intel_gt_pm.h"
static inline bool static inline bool
......
...@@ -167,6 +167,20 @@ void intel_gt_release_all(struct drm_i915_private *i915); ...@@ -167,6 +167,20 @@ void intel_gt_release_all(struct drm_i915_private *i915);
(id__)++) \ (id__)++) \
for_each_if(((gt__) = (i915__)->gt[(id__)])) for_each_if(((gt__) = (i915__)->gt[(id__)]))
/* Simple iterator over all initialised engines */
#define for_each_engine(engine__, gt__, id__) \
for ((id__) = 0; \
(id__) < I915_NUM_ENGINES; \
(id__)++) \
for_each_if ((engine__) = (gt__)->engine[(id__)])
/* Iterator over subset of engines selected by mask */
#define for_each_engine_masked(engine__, gt__, mask__, tmp__) \
for ((tmp__) = (mask__) & (gt__)->info.engine_mask; \
(tmp__) ? \
((engine__) = (gt__)->engine[__mask_next_bit(tmp__)]), 1 : \
0;)
void intel_gt_info_print(const struct intel_gt_info *info, void intel_gt_info_print(const struct intel_gt_info *info,
struct drm_printer *p); struct drm_printer *p);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include <drm/drm_print.h> #include <drm/drm_print.h>
#include "i915_drv.h" /* for_each_engine! */
#include "intel_engine.h" #include "intel_engine.h"
#include "intel_gt.h"
#include "intel_gt_debugfs.h" #include "intel_gt_debugfs.h"
#include "intel_gt_engines_debugfs.h" #include "intel_gt_engines_debugfs.h"
......
...@@ -381,20 +381,6 @@ static inline struct intel_gt *to_gt(const struct drm_i915_private *i915) ...@@ -381,20 +381,6 @@ static inline struct intel_gt *to_gt(const struct drm_i915_private *i915)
return i915->gt[0]; return i915->gt[0];
} }
/* Simple iterator over all initialised engines */
#define for_each_engine(engine__, gt__, id__) \
for ((id__) = 0; \
(id__) < I915_NUM_ENGINES; \
(id__)++) \
for_each_if ((engine__) = (gt__)->engine[(id__)])
/* Iterator over subset of engines selected by mask */
#define for_each_engine_masked(engine__, gt__, mask__, tmp__) \
for ((tmp__) = (mask__) & (gt__)->info.engine_mask; \
(tmp__) ? \
((engine__) = (gt__)->engine[__mask_next_bit(tmp__)]), 1 : \
0;)
#define rb_to_uabi_engine(rb) \ #define rb_to_uabi_engine(rb) \
rb_entry_safe(rb, struct intel_engine_cs, uabi_node) rb_entry_safe(rb, struct intel_engine_cs, uabi_node)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "../i915_selftest.h" #include "../i915_selftest.h"
#include "gt/intel_gt.h"
static int intel_fw_table_check(const struct intel_forcewake_range *ranges, static int intel_fw_table_check(const struct intel_forcewake_range *ranges,
unsigned int num_ranges, unsigned int num_ranges,
bool is_watertight) bool is_watertight)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment