Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	intel-xe@lists.freedesktop.org
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	lucas.demarchi@intel.com,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH 1/2] drm/xe/display: Move dpt allocation to helper
Date: Mon, 03 Feb 2025 15:07:08 +0200	[thread overview]
Message-ID: <87o6zj6utf.fsf@intel.com> (raw)
In-Reply-To: <20250114180403.896587-1-juhapekka.heikkila@gmail.com>

On Tue, 14 Jan 2025, Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> wrote:
> Simplify __xe_pin_fb_vma_dpt() by moving dpt allocation into helper.
> This also fixes bug where dpt could have been allocated from system
> memory when on dgfx.

Cc: Rodrigo, Lucas, Maarten

Should this be merged via drm-intel or drm-xe?

>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  drivers/gpu/drm/xe/display/xe_fb_pin.c | 67 +++++++++++++++++---------
>  1 file changed, 43 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> index 9fa51b84737c..c28885316986 100644
> --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
> +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
> @@ -77,6 +77,47 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
>  	*dpt_ofs = ALIGN(*dpt_ofs, 4096);
>  }
>  
> +static struct xe_bo *xe_alloc_dpt_bo(struct xe_device *xe,
> +				     struct xe_tile *tile0, u64 size,
> +				     u64 physical_alignment)
> +{
> +	struct xe_bo *dpt;
> +
> +	/*
> +	 * If DGFX: try VRAM0 only
> +	 */
> +	if (IS_DGFX(xe)) {
> +		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> +						      size, ~0ull,
> +						      ttm_bo_type_kernel,
> +						      XE_BO_FLAG_VRAM0 |
> +						      XE_BO_FLAG_GGTT |
> +						      XE_BO_FLAG_PAGETABLE,
> +						      physical_alignment);
> +	} else {
> +		/*
> +		 * For IGFX: first try STOLEN. on fail try SYSTEM.
> +		 */
> +		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> +						      size, ~0ull,
> +						      ttm_bo_type_kernel,
> +						      XE_BO_FLAG_STOLEN |
> +						      XE_BO_FLAG_GGTT |
> +						      XE_BO_FLAG_PAGETABLE,
> +						      physical_alignment);
> +		if (IS_ERR(dpt)) {
> +			dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> +							      size, ~0ull,
> +							      ttm_bo_type_kernel,
> +							      XE_BO_FLAG_SYSTEM |
> +							      XE_BO_FLAG_GGTT |
> +							      XE_BO_FLAG_PAGETABLE,
> +							      physical_alignment);
> +		}
> +	}
> +	return dpt;
> +}
> +
>  static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
>  			       const struct i915_gtt_view *view,
>  			       struct i915_vma *vma,
> @@ -99,30 +140,8 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
>  		dpt_size = ALIGN(intel_rotation_info_size(&view->rotated) * 8,
>  				 XE_PAGE_SIZE);
>  
> -	if (IS_DGFX(xe))
> -		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> -						      dpt_size, ~0ull,
> -						      ttm_bo_type_kernel,
> -						      XE_BO_FLAG_VRAM0 |
> -						      XE_BO_FLAG_GGTT |
> -						      XE_BO_FLAG_PAGETABLE,
> -						      physical_alignment);
> -	else
> -		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> -						      dpt_size,  ~0ull,
> -						      ttm_bo_type_kernel,
> -						      XE_BO_FLAG_STOLEN |
> -						      XE_BO_FLAG_GGTT |
> -						      XE_BO_FLAG_PAGETABLE,
> -						      physical_alignment);
> -	if (IS_ERR(dpt))
> -		dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
> -						      dpt_size,  ~0ull,
> -						      ttm_bo_type_kernel,
> -						      XE_BO_FLAG_SYSTEM |
> -						      XE_BO_FLAG_GGTT |
> -						      XE_BO_FLAG_PAGETABLE,
> -						      physical_alignment);
> +	dpt = xe_alloc_dpt_bo(xe, tile0, dpt_size, physical_alignment);
> +
>  	if (IS_ERR(dpt))
>  		return PTR_ERR(dpt);

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-02-03 13:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 18:04 [PATCH 1/2] drm/xe/display: Move dpt allocation to helper Juha-Pekka Heikkila
2025-01-14 18:04 ` [PATCH 2/2] drm/xe/display: Unify display page table mapping Juha-Pekka Heikkila
2025-01-14 19:56   ` Cavitt, Jonathan
2025-02-04 11:25   ` Tvrtko Ursulin
2025-02-04 11:38     ` Tvrtko Ursulin
2025-02-04 12:10       ` Juha-Pekka Heikkilä
2025-02-04 12:31         ` Tvrtko Ursulin
2025-02-04 13:11           ` Juha-Pekka Heikkilä
2025-02-04 18:05             ` Tvrtko Ursulin
2025-02-07 14:33               ` Juha-Pekka Heikkilä
2025-02-11 11:22                 ` Tvrtko Ursulin
2025-01-14 19:22 ` [PATCH 1/2] drm/xe/display: Move dpt allocation to helper Cavitt, Jonathan
2025-01-15 10:19   ` Maarten Lankhorst
2025-01-15 15:09     ` Cavitt, Jonathan
2025-01-15 15:26       ` Cavitt, Jonathan
2025-01-16 15:33         ` Juha-Pekka Heikkilä
2025-01-14 19:39 ` ✓ CI.Patch_applied: success for series starting with [1/2] " Patchwork
2025-01-14 19:39 ` ✓ CI.checkpatch: " Patchwork
2025-01-14 19:40 ` ✓ CI.KUnit: " Patchwork
2025-01-14 19:58 ` ✓ CI.Build: " Patchwork
2025-01-14 20:01 ` ✓ CI.Hooks: " Patchwork
2025-01-14 20:02 ` ✓ CI.checksparse: " Patchwork
2025-01-14 20:28 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-14 23:24 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-03 13:07 ` Jani Nikula [this message]
2025-02-03 15:36   ` [PATCH 1/2] " Lucas De Marchi
2025-02-04 10:37     ` Jani Nikula
2025-02-04 14:59       ` Lucas De Marchi
2025-02-04 15:11         ` Jani Nikula
2025-02-04 16:07           ` Tvrtko Ursulin
  -- strict thread matches above, loose matches on Subject: below --
2025-05-13 14:14 Juha-Pekka Heikkila

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=87o6zj6utf.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.com \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=rodrigo.vivi@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