Re: [PATCH 07/12] drm/i915/vma: Add helpers to check GTT view type

Jani Nikula
2026-04-08T08:50:43Z

On Tue, 07 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> I915_GTT_VIEW_ROTATED is going away and being replaced by just
> I915_GTT_VIEW_REMAPPED, so we're going to need another way to
> determine if the view is rotated or not (since width/height
> will need to be swapped when operating on the destination
> coordinate space). Provide small helper functions to hide
> such implementation details from most of the code using GTT views.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Funny, I think I have these helpers in a branch somewhere too. :)

It's still not clear to me where we'll end up with this, since the file
is in i915 and used directly from xe core too, which is something we
want to get rid of. But seems like iterative improvement, so let's roll
with this.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
> drivers/gpu/drm/i915/i915_gtt_view_types.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gtt_view_types.h b/drivers/gpu/drm/i915/i915_gtt_view_types.h
> index c084f67bc880..9c4f38db32ff 100644
> --- a/drivers/gpu/drm/i915/i915_gtt_view_types.h
> +++ b/drivers/gpu/drm/i915/i915_gtt_view_types.h
> @@ -56,4 +56,19 @@ struct i915_gtt_view {
> };
> };
>
> +static inline bool i915_gtt_view_is_normal(const struct i915_gtt_view *view)
> +{
> + return view->type == I915_GTT_VIEW_NORMAL;
> +}
> +
> +static inline bool i915_gtt_view_is_remapped(const struct i915_gtt_view *view)
> +{
> + return view->type == I915_GTT_VIEW_REMAPPED;
> +}
> +
> +static inline bool i915_gtt_view_is_rotated(const struct i915_gtt_view *view)
> +{
> + return view->type == I915_GTT_VIEW_ROTATED;
> +}
> +
> #endif /* __I915_GTT_VIEW_TYPES_H__ */

--
Jani Nikula, Intel