Skip to content

Commit 4d291c4

Browse files
committed
drm/i915: Use per-plane VT-d guard numbers
Bspec lists different VT-d guard numbers (the number of dummy padding PTEs) for different platforms and plane types. Use those instead of just assuming the max glk+ number for everything. This could avoid a bit of overhead on older platforms due to reduced padding, and it makes it easier to cross check with the spec. Note that VLV/CHV do not document this w/a at all, so not sure if it's actually needed or not. Nor do we actually know how much padding is required if it is needed. For now use the same 128 PTEs that we use for snb-bdw primary planes. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250122151755.6928-5-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
1 parent 44a34de commit 4d291c4

File tree

6 files changed

+41
-4
lines changed

6 files changed

+41
-4
lines changed

drivers/gpu/drm/i915/display/i9xx_plane.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
958958
else
959959
plane->min_alignment = i9xx_plane_min_alignment;
960960

961+
/* FIXME undocumented for VLV/CHV so not sure what's actually needed */
962+
if (intel_scanout_needs_vtd_wa(dev_priv))
963+
plane->vtd_guard = 128;
964+
961965
if (IS_I830(dev_priv) || IS_I845G(dev_priv)) {
962966
plane->update_arm = i830_plane_update_arm;
963967
} else {

drivers/gpu/drm/i915/display/intel_cursor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,9 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
10191019
else
10201020
cursor->min_alignment = i9xx_cursor_min_alignment;
10211021

1022+
if (intel_scanout_needs_vtd_wa(dev_priv))
1023+
cursor->vtd_guard = 2;
1024+
10221025
cursor->update_arm = i9xx_cursor_update_arm;
10231026
cursor->disable_arm = i9xx_cursor_disable_arm;
10241027
cursor->get_hw_state = i9xx_cursor_get_hw_state;

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ struct intel_framebuffer {
144144
struct i915_address_space *dpt_vm;
145145

146146
unsigned int min_alignment;
147+
unsigned int vtd_guard;
147148
};
148149

149150
enum intel_hotplug_state {
@@ -1448,6 +1449,7 @@ struct intel_plane {
14481449
enum plane_id id;
14491450
enum pipe pipe;
14501451
bool need_async_flip_toggle_wa;
1452+
u8 vtd_guard;
14511453
u32 frontbuffer_bit;
14521454

14531455
struct {

drivers/gpu/drm/i915/display/intel_fb.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,22 @@ static unsigned int intel_fb_min_alignment(const struct drm_framebuffer *fb)
16601660
return min_alignment;
16611661
}
16621662

1663+
static unsigned int intel_fb_vtd_guard(const struct drm_framebuffer *fb)
1664+
{
1665+
struct drm_i915_private *i915 = to_i915(fb->dev);
1666+
struct intel_plane *plane;
1667+
unsigned int vtd_guard = 0;
1668+
1669+
for_each_intel_plane(&i915->drm, plane) {
1670+
if (!drm_plane_has_format(&plane->base, fb->format->format, fb->modifier))
1671+
continue;
1672+
1673+
vtd_guard = max_t(unsigned int, vtd_guard, plane->vtd_guard);
1674+
}
1675+
1676+
return vtd_guard;
1677+
}
1678+
16631679
int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb)
16641680
{
16651681
struct drm_gem_object *obj = intel_fb_bo(&fb->base);
@@ -1757,6 +1773,7 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *
17571773
}
17581774

17591775
fb->min_alignment = intel_fb_min_alignment(&fb->base);
1776+
fb->vtd_guard = intel_fb_vtd_guard(&fb->base);
17601777

17611778
return 0;
17621779
}
@@ -1765,15 +1782,13 @@ unsigned int intel_fb_view_vtd_guard(const struct drm_framebuffer *fb,
17651782
const struct intel_fb_view *view,
17661783
unsigned int rotation)
17671784
{
1768-
struct drm_i915_private *i915 = to_i915(fb->dev);
17691785
unsigned int vtd_guard;
17701786
int color_plane;
17711787

1772-
if (!intel_scanout_needs_vtd_wa(i915))
1788+
vtd_guard = to_intel_framebuffer(fb)->vtd_guard;
1789+
if (!vtd_guard)
17731790
return 0;
17741791

1775-
vtd_guard = 168;
1776-
17771792
for (color_plane = 0; color_plane < fb->format->num_planes; color_plane++) {
17781793
unsigned int stride, tile;
17791794

drivers/gpu/drm/i915/display/intel_sprite.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,10 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
16091609
plane->min_alignment = vlv_plane_min_alignment;
16101610
plane->min_cdclk = vlv_plane_min_cdclk;
16111611

1612+
/* FIXME undocumented for VLV/CHV so not sure what's actually needed */
1613+
if (intel_scanout_needs_vtd_wa(dev_priv))
1614+
plane->vtd_guard = 128;
1615+
16121616
if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
16131617
formats = chv_pipe_b_sprite_formats;
16141618
num_formats = ARRAY_SIZE(chv_pipe_b_sprite_formats);
@@ -1635,6 +1639,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
16351639

16361640
plane->min_alignment = g4x_sprite_min_alignment;
16371641

1642+
if (intel_scanout_needs_vtd_wa(dev_priv))
1643+
plane->vtd_guard = 64;
1644+
16381645
formats = snb_sprite_formats;
16391646
num_formats = ARRAY_SIZE(snb_sprite_formats);
16401647

@@ -1649,6 +1656,9 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
16491656
plane->min_alignment = g4x_sprite_min_alignment;
16501657
plane->min_cdclk = g4x_sprite_min_cdclk;
16511658

1659+
if (intel_scanout_needs_vtd_wa(dev_priv))
1660+
plane->vtd_guard = 64;
1661+
16521662
if (IS_SANDYBRIDGE(dev_priv)) {
16531663
formats = snb_sprite_formats;
16541664
num_formats = ARRAY_SIZE(snb_sprite_formats);

drivers/gpu/drm/i915/display/skl_universal_plane.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
27502750
else
27512751
plane->min_alignment = skl_plane_min_alignment;
27522752

2753+
if (intel_scanout_needs_vtd_wa(dev_priv))
2754+
plane->vtd_guard = DISPLAY_VER(dev_priv) >= 10 ? 168 : 136;
2755+
27532756
if (DISPLAY_VER(dev_priv) >= 11) {
27542757
plane->update_noarm = icl_plane_update_noarm;
27552758
plane->update_arm = icl_plane_update_arm;

0 commit comments

Comments
 (0)