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 1/5] drm/i915: Move VT-d alignment into plane->min_alignment()
Date: Mon, 27 Jan 2025 11:50:34 +0200 [thread overview]
Message-ID: <878qqwbn6d.fsf@intel.com> (raw)
In-Reply-To: <20250122151755.6928-2-ville.syrjala@linux.intel.com>
On Wed, 22 Jan 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Currently we don't account for the VT-d alignment w/a in
> plane->min_alignment() which means that panning inside a larger
> framebuffer can still cause the plane SURF to be misaligned.
> Fix the issue by moving the VT-d alignment w/a into
> plane->min_alignment() itself (for the affected platforms).
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/i9xx_plane.c | 10 ++++++++++
> drivers/gpu/drm/i915/display/intel_cursor.c | 5 +++++
> drivers/gpu/drm/i915/display/intel_fb_pin.c | 8 --------
> drivers/gpu/drm/i915/display/intel_sprite.c | 5 +++++
> drivers/gpu/drm/i915/display/skl_universal_plane.c | 4 ++++
> 5 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c
> index ed171fbf8720..19cc34babef3 100644
> --- a/drivers/gpu/drm/i915/display/i9xx_plane.c
> +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
> @@ -780,9 +780,14 @@ unsigned int vlv_plane_min_alignment(struct intel_plane *plane,
> const struct drm_framebuffer *fb,
> int color_plane)
> {
> + struct drm_i915_private *i915 = to_i915(plane->base.dev);
> +
> if (intel_plane_can_async_flip(plane, fb->modifier))
> return 256 * 1024;
>
> + if (intel_scanout_needs_vtd_wa(i915))
> + return 256 * 1024;
Nitpick, would be great to convert intel_scanout_needs_vtd_wa() to
struct intel_display first, so we wouldn't have to introduce so many new
struct drm_i915_private uses.
BR,
Jani.
> +
> switch (fb->modifier) {
> case I915_FORMAT_MOD_X_TILED:
> return 4 * 1024;
> @@ -798,9 +803,14 @@ static unsigned int g4x_primary_min_alignment(struct intel_plane *plane,
> const struct drm_framebuffer *fb,
> int color_plane)
> {
> + struct drm_i915_private *i915 = to_i915(plane->base.dev);
> +
> if (intel_plane_can_async_flip(plane, fb->modifier))
> return 256 * 1024;
>
> + if (intel_scanout_needs_vtd_wa(i915))
> + return 256 * 1024;
> +
> switch (fb->modifier) {
> case I915_FORMAT_MOD_X_TILED:
> case DRM_FORMAT_MOD_LINEAR:
> diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
> index ae7243ad6e0c..9157825e370b 100644
> --- a/drivers/gpu/drm/i915/display/intel_cursor.c
> +++ b/drivers/gpu/drm/i915/display/intel_cursor.c
> @@ -372,6 +372,11 @@ static unsigned int i9xx_cursor_min_alignment(struct intel_plane *plane,
> const struct drm_framebuffer *fb,
> int color_plane)
> {
> + struct drm_i915_private *i915 = to_i915(plane->base.dev);
> +
> + if (intel_scanout_needs_vtd_wa(i915))
> + return 256 * 1024;
> +
> return 4 * 1024; /* physical for i915/i945 */
> }
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> index dd3ac7f98dfc..2b9ad46eaef7 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c
> @@ -126,14 +126,6 @@ intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
> if (drm_WARN_ON(dev, alignment && !is_power_of_2(alignment)))
> return ERR_PTR(-EINVAL);
>
> - /* Note that the w/a also requires 64 PTE of padding following the
> - * bo. We currently fill all unused PTE with the shadow page and so
> - * we should always have valid PTE following the scanout preventing
> - * the VT-d warning.
> - */
> - if (intel_scanout_needs_vtd_wa(dev_priv) && alignment < 256 * 1024)
> - alignment = 256 * 1024;
> -
> /*
> * Global gtt pte registers are special registers which actually forward
> * writes to a chunk of system memory. Which means that there is no risk
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> index 13996d7059ad..d63e71fe469e 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -980,6 +980,11 @@ static unsigned int g4x_sprite_min_alignment(struct intel_plane *plane,
> const struct drm_framebuffer *fb,
> int color_plane)
> {
> + struct drm_i915_private *i915 = to_i915(plane->base.dev);
> +
> + if (intel_scanout_needs_vtd_wa(i915))
> + return 256 * 1024;
> +
> return 4 * 1024;
> }
>
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 450dd8c64e0c..5cec2df0baca 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -649,6 +649,10 @@ static u32 skl_plane_min_alignment(struct intel_plane *plane,
> if (color_plane != 0)
> return 4 * 1024;
>
> + /*
> + * VT-d needs at least 256k alignment,
> + * but that's already covered below.
> + */
> switch (fb->modifier) {
> case DRM_FORMAT_MOD_LINEAR:
> case I915_FORMAT_MOD_X_TILED:
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-01-27 9:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 15:17 [PATCH 0/5] drm/i915: Improve the display VT-d workarounds Ville Syrjala
2025-01-22 15:17 ` [PATCH 1/5] drm/i915: Move VT-d alignment into plane->min_alignment() Ville Syrjala
2025-01-27 9:50 ` Jani Nikula [this message]
2025-01-27 16:44 ` Ville Syrjälä
2025-01-27 17:27 ` Ville Syrjälä
2025-01-28 9:46 ` Jani Nikula
2025-01-28 16:56 ` Ville Syrjälä
2025-01-22 15:17 ` [PATCH 2/5] drm/i915: Use more optimal VTd alignment for planes Ville Syrjala
2025-01-22 15:17 ` [PATCH 3/5] drm/i915: Calculate the VT-d guard size in the display code Ville Syrjala
2025-01-22 15:17 ` [PATCH 4/5] drm/i915: Use per-plane VT-d guard numbers Ville Syrjala
2025-01-22 15:17 ` [PATCH 5/5] drm/i915/fbdev: Use fb->normal_view.gtt Ville Syrjala
2025-01-22 15:49 ` ✓ CI.Patch_applied: success for drm/i915: Improve the display VT-d workarounds Patchwork
2025-01-22 15:49 ` ✓ CI.checkpatch: " Patchwork
2025-01-22 15:50 ` ✓ CI.KUnit: " Patchwork
2025-01-22 16:07 ` ✓ CI.Build: " Patchwork
2025-01-22 16:09 ` ✓ CI.Hooks: " Patchwork
2025-01-22 16:10 ` ✗ CI.checksparse: warning " Patchwork
2025-01-22 16:37 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-23 4:16 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-04 11:25 ` [PATCH 0/5] " Jani Nikula
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=878qqwbn6d.fsf@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