public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 06/12] drm/xe/fb: Extract xe_dpt_size()
Date: Wed, 08 Apr 2026 11:47:59 +0300	[thread overview]
Message-ID: <6c2020b26cb953ee922a15710112a5afe7ef5927@intel.com> (raw)
In-Reply-To: <20260407155053.32156-7-ville.syrjala@linux.intel.com>

On Tue, 07 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Declutter the xe fb pinning code by extracting the DPT size
> calculation into its own function.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/xe/display/xe_fb_pin.c | 30 +++++++++++++++-----------
>  1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> index 72efafb189f7..9873904a950d 100644
> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> @@ -139,6 +139,22 @@ write_dpt_remapped(struct xe_bo *bo,
>  	}
>  }
>  
> +static unsigned int xe_dpt_size(struct drm_gem_object *obj,
> +				const struct i915_gtt_view *view)
> +{
> +	unsigned int pages;
> +	int pte_size = 8;
> +
> +	if (view->type == I915_GTT_VIEW_NORMAL)
> +		pages = obj->size / XE_PAGE_SIZE;
> +	else if (view->type == I915_GTT_VIEW_REMAPPED)
> +		pages = intel_remapped_info_size(&view->remapped);
> +	else
> +		pages = intel_rotation_info_size(&view->rotated);
> +
> +	return ALIGN(pages * pte_size, XE_PAGE_SIZE);
> +}
> +
>  static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
>  			       const struct i915_gtt_view *view,
>  			       struct i915_vma *vma,
> @@ -149,17 +165,7 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
>  	struct xe_ggtt *ggtt = tile0->mem.ggtt;
>  	struct drm_gem_object *obj = intel_fb_bo(&fb->base);
>  	struct xe_bo *bo = gem_to_xe_bo(obj), *dpt;
> -	u32 dpt_size, size = bo->ttm.base.size;
> -
> -	if (view->type == I915_GTT_VIEW_NORMAL)
> -		dpt_size = ALIGN(size / XE_PAGE_SIZE * 8, XE_PAGE_SIZE);
> -	else if (view->type == I915_GTT_VIEW_REMAPPED)
> -		dpt_size = ALIGN(intel_remapped_info_size(&view->remapped) * 8,
> -				 XE_PAGE_SIZE);
> -	else
> -		/* display uses 4K tiles instead of bytes here, convert to entries.. */
> -		dpt_size = ALIGN(intel_rotation_info_size(&view->rotated) * 8,
> -				 XE_PAGE_SIZE);
> +	u32 dpt_size = xe_dpt_size(obj, view);
>  
>  	if (IS_DGFX(xe))
>  		dpt = xe_bo_create_pin_map_at_novm(xe, tile0,
> @@ -193,7 +199,7 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
>  		u64 pte = xe_ggtt_encode_pte_flags(ggtt, bo, xe->pat.idx[XE_CACHE_NONE]);
>  		u32 x;
>  
> -		for (x = 0; x < size / XE_PAGE_SIZE; x++) {
> +		for (x = 0; x < obj->size / XE_PAGE_SIZE; x++) {
>  			u64 addr = xe_bo_addr(bo, x * XE_PAGE_SIZE, XE_PAGE_SIZE);
>  
>  			iosys_map_wr(&dpt->vmap, x * 8, u64, pte | addr);

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-04-08  8:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 15:50 [PATCH 00/12] drm/i915/fb: Prep work for more generic remapping support Ville Syrjala
2026-04-07 15:50 ` [PATCH 01/12] drm/i915/fb: Nuke intel_tile_row_size() Ville Syrjala
2026-04-08  8:42   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 02/12] drm/i915/fb: Make intel_fb_needs_pot_stride_remap() static Ville Syrjala
2026-04-08  8:43   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 03/12] drm/i915/fb: Reject per-plane remapping with DPT Ville Syrjala
2026-04-08  8:43   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 04/12] drm/xe/fb: Use the correct gtt view for remapped FBs Ville Syrjala
2026-04-08  8:44   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 05/12] drm/xe/fb: Remove weird VMA end alignemnt Ville Syrjala
2026-04-08  8:45   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 06/12] drm/xe/fb: Extract xe_dpt_size() Ville Syrjala
2026-04-08  8:47   ` Jani Nikula [this message]
2026-04-07 15:50 ` [PATCH 07/12] drm/i915/vma: Add helpers to check GTT view type Ville Syrjala
2026-04-08  8:50   ` Jani Nikula
2026-04-08  9:11     ` Jani Nikula
2026-04-07 15:50 ` [PATCH 08/12] drm/xe/fb: Use i915_gtt_view_is_*() Ville Syrjala
2026-04-08  8:52   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 09/12] drm/i915/fb: " Ville Syrjala
2026-04-08  8:53   ` Jani Nikula
2026-04-07 15:50 ` [PATCH 10/12] drm/i915/selftests: Eliminate duplicate vma size check Ville Syrjala
2026-04-08  9:01   ` Jani Nikula
2026-04-08 11:28     ` Ville Syrjälä
2026-04-07 15:50 ` [PATCH 11/12] drm/i915/selftests: Use i915_gtt_view_is_*() Ville Syrjala
2026-04-08  9:03   ` Jani Nikula
2026-04-08  9:04     ` Jani Nikula
2026-04-07 15:50 ` [PATCH 12/12] drm/i915/fb: Use intel_fb_needs_pot_stride_remap() in intel_fb_view_init() Ville Syrjala
2026-04-08  9:09   ` Jani Nikula
2026-04-07 15:57 ` ✗ CI.checkpatch: warning for drm/i915/fb: Prep work for more generic remapping support Patchwork
2026-04-07 15:58 ` ✓ CI.KUnit: success " Patchwork
2026-04-07 16:37 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-07 19:34 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-10 11:25 ` [PATCH 00/12] " Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c2020b26cb953ee922a15710112a5afe7ef5927@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox