Skip to content

Commit 4822cb8

Browse files
committed
drm/i915/bw: relocate intel_can_enable_sagv() and rename to intel_bw_can_enable_sagv()
Prefer only looking at struct intel_bw_state internals inside intel_bw.c. To that effect, move intel_can_enable_sagv() there, and rename to intel_bw_can_enable_sagv() to have consistent naming. Reviewed-by: Imre Deak <imre.deak@intel.com> Link: https://lore.kernel.org/r/dd6e3857bd1343c07a36826e99c1c04f7dd5ddb5.1750847509.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent e17643d commit 4822cb8

4 files changed

Lines changed: 21 additions & 22 deletions

File tree

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ static int mtl_find_qgv_points(struct intel_display *display,
10011001
* for qgv peak bw in PM Demand request. So assign UINT_MAX if SAGV is
10021002
* not enabled. PM Demand code will clamp the value for the register
10031003
*/
1004-
if (!intel_can_enable_sagv(display, new_bw_state)) {
1004+
if (!intel_bw_can_enable_sagv(display, new_bw_state)) {
10051005
new_bw_state->qgv_point_peakbw = U16_MAX;
10061006
drm_dbg_kms(display->drm, "No SAGV, use UINT_MAX as peak bw.");
10071007
return 0;
@@ -1114,7 +1114,7 @@ static int icl_find_qgv_points(struct intel_display *display,
11141114
* we can't enable SAGV due to the increased memory latency it may
11151115
* cause.
11161116
*/
1117-
if (!intel_can_enable_sagv(display, new_bw_state)) {
1117+
if (!intel_bw_can_enable_sagv(display, new_bw_state)) {
11181118
qgv_points = icl_max_bw_qgv_point_mask(display, num_active_planes);
11191119
drm_dbg_kms(display->drm, "No SAGV, using single QGV point mask 0x%x\n",
11201120
qgv_points);
@@ -1481,8 +1481,8 @@ static int intel_bw_check_sagv_mask(struct intel_atomic_state *state)
14811481
if (!new_bw_state)
14821482
return 0;
14831483

1484-
if (intel_can_enable_sagv(display, new_bw_state) !=
1485-
intel_can_enable_sagv(display, old_bw_state)) {
1484+
if (intel_bw_can_enable_sagv(display, new_bw_state) !=
1485+
intel_bw_can_enable_sagv(display, old_bw_state)) {
14861486
ret = intel_atomic_serialize_global_state(&new_bw_state->base);
14871487
if (ret)
14881488
return ret;
@@ -1528,8 +1528,8 @@ int intel_bw_atomic_check(struct intel_atomic_state *state, bool any_ms)
15281528
new_bw_state = intel_atomic_get_new_bw_state(state);
15291529

15301530
if (new_bw_state &&
1531-
intel_can_enable_sagv(display, old_bw_state) !=
1532-
intel_can_enable_sagv(display, new_bw_state))
1531+
intel_bw_can_enable_sagv(display, old_bw_state) !=
1532+
intel_bw_can_enable_sagv(display, new_bw_state))
15331533
changed = true;
15341534

15351535
/*
@@ -1665,3 +1665,13 @@ bool intel_bw_pmdemand_needs_update(struct intel_atomic_state *state)
16651665

16661666
return false;
16671667
}
1668+
1669+
bool intel_bw_can_enable_sagv(struct intel_display *display,
1670+
const struct intel_bw_state *bw_state)
1671+
{
1672+
if (DISPLAY_VER(display) < 11 &&
1673+
bw_state->active_pipes && !is_power_of_2(bw_state->active_pipes))
1674+
return false;
1675+
1676+
return bw_state->pipe_sagv_reject == 0;
1677+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ void intel_bw_update_hw_state(struct intel_display *display);
7777
void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc);
7878

7979
bool intel_bw_pmdemand_needs_update(struct intel_atomic_state *state);
80+
bool intel_bw_can_enable_sagv(struct intel_display *display,
81+
const struct intel_bw_state *bw_state);
8082

8183
#endif /* __INTEL_BW_H__ */

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static void skl_sagv_pre_plane_update(struct intel_atomic_state *state)
248248
if (!new_bw_state)
249249
return;
250250

251-
if (!intel_can_enable_sagv(display, new_bw_state))
251+
if (!intel_bw_can_enable_sagv(display, new_bw_state))
252252
skl_sagv_disable(display);
253253
}
254254

@@ -261,7 +261,7 @@ static void skl_sagv_post_plane_update(struct intel_atomic_state *state)
261261
if (!new_bw_state)
262262
return;
263263

264-
if (intel_can_enable_sagv(display, new_bw_state))
264+
if (intel_bw_can_enable_sagv(display, new_bw_state))
265265
skl_sagv_enable(display);
266266
}
267267

@@ -462,16 +462,6 @@ bool intel_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state)
462462
return skl_crtc_can_enable_sagv(crtc_state);
463463
}
464464

465-
bool intel_can_enable_sagv(struct intel_display *display,
466-
const struct intel_bw_state *bw_state)
467-
{
468-
if (DISPLAY_VER(display) < 11 &&
469-
bw_state->active_pipes && !is_power_of_2(bw_state->active_pipes))
470-
return false;
471-
472-
return bw_state->pipe_sagv_reject == 0;
473-
}
474-
475465
static u16 skl_ddb_entry_init(struct skl_ddb_entry *entry,
476466
u16 start, u16 end)
477467
{
@@ -3035,7 +3025,7 @@ skl_compute_wm(struct intel_atomic_state *state)
30353025
* drm_atomic_check_only() gets upset if we pull more crtcs
30363026
* into the state, so we have to calculate this based on the
30373027
* individual intel_crtc_can_enable_sagv() rather than
3038-
* the overall intel_can_enable_sagv(). Otherwise the
3028+
* the overall intel_bw_can_enable_sagv(). Otherwise the
30393029
* crtcs not included in the commit would not switch to the
30403030
* SAGV watermarks when we are about to enable SAGV, and that
30413031
* would lead to underruns. This does mean extra power draw

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
enum plane_id;
1212
struct intel_atomic_state;
13-
struct intel_bw_state;
1413
struct intel_crtc;
1514
struct intel_crtc_state;
1615
struct intel_dbuf_state;
@@ -26,8 +25,6 @@ u8 intel_enabled_dbuf_slices_mask(struct intel_display *display);
2625
void intel_sagv_pre_plane_update(struct intel_atomic_state *state);
2726
void intel_sagv_post_plane_update(struct intel_atomic_state *state);
2827
bool intel_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state);
29-
bool intel_can_enable_sagv(struct intel_display *display,
30-
const struct intel_bw_state *bw_state);
3128
bool intel_has_sagv(struct intel_display *display);
3229

3330
u32 skl_ddb_dbuf_slice_mask(struct intel_display *display,

0 commit comments

Comments
 (0)