Skip to content

Commit 117f5bb

Browse files
vsyrjalajlahtine-intel
authored andcommitted
drm/i915: Don't skip ddb allocation if data_rate==0
data_rate==0 no longer means a plane is disabled, it could also mean we want to use the minimum ddb allocation for it. Hence we can't bail out early during ddb allocation or else we'll simply forget to allocate any ddb for such planes. Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Fixes: 6a4d8cc ("drm/i915: Don't allocate extra ddb during async flip for DG2") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220214105532.13049-2-ville.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> (cherry picked from commit 6475e10) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
1 parent 4fe4ed0 commit 117f5bb

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5145,12 +5145,15 @@ skl_allocate_plane_ddb(struct skl_plane_ddb_iter *iter,
51455145
const struct skl_wm_level *wm,
51465146
u64 data_rate)
51475147
{
5148-
u16 extra;
5148+
u16 extra = 0;
51495149

5150-
extra = min_t(u16, iter->size,
5151-
DIV64_U64_ROUND_UP(iter->size * data_rate, iter->data_rate));
5152-
iter->size -= extra;
5153-
iter->data_rate -= data_rate;
5150+
if (data_rate) {
5151+
extra = min_t(u16, iter->size,
5152+
DIV64_U64_ROUND_UP(iter->size * data_rate,
5153+
iter->data_rate));
5154+
iter->size -= extra;
5155+
iter->data_rate -= data_rate;
5156+
}
51545157

51555158
return wm->min_ddb_alloc + extra;
51565159
}
@@ -5193,9 +5196,6 @@ skl_crtc_allocate_plane_ddb(struct intel_atomic_state *state,
51935196
skl_ddb_entry_init(&crtc_state->wm.skl.plane_ddb_y[PLANE_CURSOR],
51945197
alloc->end - iter.total[PLANE_CURSOR], alloc->end);
51955198

5196-
if (iter.data_rate == 0)
5197-
return 0;
5198-
51995199
/*
52005200
* Find the highest watermark level for which we can satisfy the block
52015201
* requirement of active planes.
@@ -5234,6 +5234,10 @@ skl_crtc_allocate_plane_ddb(struct intel_atomic_state *state,
52345234
return -EINVAL;
52355235
}
52365236

5237+
/* avoid the WARN later when we don't allocate any extra DDB */
5238+
if (iter.data_rate == 0)
5239+
iter.size = 0;
5240+
52375241
/*
52385242
* Grant each plane the blocks it requires at the highest achievable
52395243
* watermark level, plus an extra share of the leftover blocks
@@ -5246,20 +5250,10 @@ skl_crtc_allocate_plane_ddb(struct intel_atomic_state *state,
52465250
if (plane_id == PLANE_CURSOR)
52475251
continue;
52485252

5249-
/*
5250-
* We've accounted for all active planes; remaining planes are
5251-
* all disabled.
5252-
*/
5253-
if (iter.data_rate == 0)
5254-
break;
5255-
52565253
iter.total[plane_id] =
52575254
skl_allocate_plane_ddb(&iter, &wm->wm[level],
52585255
crtc_state->plane_data_rate[plane_id]);
52595256

5260-
if (iter.data_rate == 0)
5261-
break;
5262-
52635257
iter.uv_total[plane_id] =
52645258
skl_allocate_plane_ddb(&iter, &wm->uv_wm[level],
52655259
crtc_state->uv_plane_data_rate[plane_id]);

0 commit comments

Comments
 (0)