drm/xe/stolen: convert compat stolen macros to inline functions

Improve type safety. Allows getting rid of a __maybe_unused annotation
too.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/1ec1fa59e0e54da49a1ec4fd1d535288066db502.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2025-09-24 19:43:32 +03:00
parent 511d2d70df
commit b6500640ac
2 changed files with 34 additions and 9 deletions

View File

@ -797,7 +797,7 @@ static u64 intel_fbc_cfb_base_max(struct intel_display *display)
static u64 intel_fbc_stolen_end(struct intel_display *display)
{
struct drm_i915_private __maybe_unused *i915 = to_i915(display->drm);
struct drm_i915_private *i915 = to_i915(display->drm);
u64 end;
/* The FBC hardware for BDW/SKL doesn't have access to the stolen

View File

@ -62,8 +62,15 @@ static inline void i915_gem_stolen_remove_node(struct xe_device *xe,
node->bo = NULL;
}
#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
#define i915_gem_stolen_node_allocated(node) (!!((node)->bo))
static inline bool i915_gem_stolen_initialized(struct xe_device *xe)
{
return ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
}
static inline bool i915_gem_stolen_node_allocated(const struct intel_stolen_node *node)
{
return node->bo;
}
static inline u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node)
{
@ -74,12 +81,30 @@ static inline u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node)
}
/* Used for < gen4. These are not supported by Xe */
#define i915_gem_stolen_area_address(xe) (!WARN_ON(1))
/* Used for gen9 specific WA. Gen9 is not supported by Xe */
#define i915_gem_stolen_area_size(xe) (!WARN_ON(1))
static inline u64 i915_gem_stolen_area_address(const struct xe_device *xe)
{
WARN_ON(1);
#define i915_gem_stolen_node_address(xe, node) (xe_ttm_stolen_gpu_offset(xe) + \
i915_gem_stolen_node_offset(node))
#define i915_gem_stolen_node_size(node) ((u64)((node)->bo->ttm.base.size))
return 0;
}
/* Used for gen9 specific WA. Gen9 is not supported by Xe */
static inline u64 i915_gem_stolen_area_size(const struct xe_device *xe)
{
WARN_ON(1);
return 0;
}
static inline u64 i915_gem_stolen_node_address(struct xe_device *xe,
struct intel_stolen_node *node)
{
return xe_ttm_stolen_gpu_offset(xe) + i915_gem_stolen_node_offset(node);
}
static inline u64 i915_gem_stolen_node_size(const struct intel_stolen_node *node)
{
return node->bo->ttm.base.size;
}
#endif