Skip to content

Commit 1937f3f

Browse files
vsyrjalatursulin
authored andcommitted
drm/i915: Treat SAGV block time 0 as SAGV disabled
For modern platforms the spec explicitly states that a SAGV block time of zero means that SAGV is not supported. Let's extend that to all platforms. Supposedly there should be no systems where this isn't true, and it'll allow us to: - use the same code regardless of older vs. newer platform - wm latencies already treat 0 as disabled, so this fits well with other related code - make it a bit more clear when SAGV is used vs. not - avoid overflows from adding U32_MAX with a u16 wm0 latency value which could cause us to miscalculate the SAGV watermarks on tgl+ Cc: stable@vger.kernel.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220309164948.10671-2-ville.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> (cherry picked from commit d8f5855) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
1 parent 9cddf03 commit 1937f3f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,8 +3698,7 @@ skl_setup_sagv_block_time(struct drm_i915_private *dev_priv)
36983698
MISSING_CASE(DISPLAY_VER(dev_priv));
36993699
}
37003700

3701-
/* Default to an unusable block time */
3702-
dev_priv->sagv_block_time_us = -1;
3701+
dev_priv->sagv_block_time_us = 0;
37033702
}
37043703

37053704
/*
@@ -5645,7 +5644,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
56455644
result->min_ddb_alloc = max(min_ddb_alloc, blocks) + 1;
56465645
result->enable = true;
56475646

5648-
if (DISPLAY_VER(dev_priv) < 12)
5647+
if (DISPLAY_VER(dev_priv) < 12 && dev_priv->sagv_block_time_us)
56495648
result->can_sagv = latency >= dev_priv->sagv_block_time_us;
56505649
}
56515650

@@ -5678,7 +5677,10 @@ static void tgl_compute_sagv_wm(const struct intel_crtc_state *crtc_state,
56785677
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
56795678
struct skl_wm_level *sagv_wm = &plane_wm->sagv.wm0;
56805679
struct skl_wm_level *levels = plane_wm->wm;
5681-
unsigned int latency = dev_priv->wm.skl_latency[0] + dev_priv->sagv_block_time_us;
5680+
unsigned int latency = 0;
5681+
5682+
if (dev_priv->sagv_block_time_us)
5683+
latency = dev_priv->sagv_block_time_us + dev_priv->wm.skl_latency[0];
56825684

56835685
skl_compute_plane_wm(crtc_state, plane, 0, latency,
56845686
wm_params, &levels[0],

0 commit comments

Comments
 (0)