Skip to content

Commit a7d1b3f

Browse files
committed
drm/i915: Store the pipe pixel rate in the crtc state
Rather than recomputing the pipe pixel rate on demand everywhere, let's just stick the precomputed value into the crtc state. v2: Rebase due to min_pixclk[] code movement Document the new pixel_rate struct member (Ander) Combine vlv/chv with bdw+ in intel_modeset_readout_hw_state() v3: Fix typos in commit message (David) Cc: Ander Conselvan De Oliveira <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Reviewed-by: Ander Conselvan de Oliveira <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fb51ff4 commit a7d1b3f

File tree

4 files changed

+42
-17
lines changed

4 files changed

+42
-17
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7184,7 +7184,7 @@ static bool pipe_config_supports_ips(struct drm_i915_private *dev_priv,
71847184
*
71857185
* Should measure whether using a lower cdclk w/o IPS
71867186
*/
7187-
return ilk_pipe_pixel_rate(pipe_config) <=
7187+
return pipe_config->pixel_rate <=
71887188
dev_priv->max_cdclk_freq * 95 / 100;
71897189
}
71907190

@@ -7208,6 +7208,19 @@ static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
72087208
(crtc->pipe == PIPE_A || IS_I915G(dev_priv));
72097209
}
72107210

7211+
static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
7212+
{
7213+
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
7214+
7215+
if (HAS_GMCH_DISPLAY(dev_priv))
7216+
/* FIXME calculate proper pipe pixel rate for GMCH pfit */
7217+
crtc_state->pixel_rate =
7218+
crtc_state->base.adjusted_mode.crtc_clock;
7219+
else
7220+
crtc_state->pixel_rate =
7221+
ilk_pipe_pixel_rate(crtc_state);
7222+
}
7223+
72117224
static int intel_crtc_compute_config(struct intel_crtc *crtc,
72127225
struct intel_crtc_state *pipe_config)
72137226
{
@@ -7254,6 +7267,8 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
72547267
adjusted_mode->crtc_hsync_start == adjusted_mode->crtc_hdisplay)
72557268
return -EINVAL;
72567269

7270+
intel_crtc_compute_pixel_rate(pipe_config);
7271+
72577272
if (HAS_IPS(dev_priv))
72587273
hsw_compute_ips_config(crtc, pipe_config);
72597274

@@ -10322,7 +10337,7 @@ static int ilk_max_pixel_rate(struct drm_atomic_state *state)
1032210337
continue;
1032310338
}
1032410339

10325-
pixel_rate = ilk_pipe_pixel_rate(crtc_state);
10340+
pixel_rate = crtc_state->pixel_rate;
1032610341

1032710342
if (IS_BROADWELL(dev_priv) || IS_GEN9(dev_priv))
1032810343
pixel_rate = bdw_adjust_min_pipe_pixel_rate(crtc_state,
@@ -12832,9 +12847,10 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
1283212847
DRM_DEBUG_KMS("adjusted mode:\n");
1283312848
drm_mode_debug_printmodeline(&pipe_config->base.adjusted_mode);
1283412849
intel_dump_crtc_timings(&pipe_config->base.adjusted_mode);
12835-
DRM_DEBUG_KMS("port clock: %d, pipe src size: %dx%d\n",
12850+
DRM_DEBUG_KMS("port clock: %d, pipe src size: %dx%d, pixel rate %d\n",
1283612851
pipe_config->port_clock,
12837-
pipe_config->pipe_src_w, pipe_config->pipe_src_h);
12852+
pipe_config->pipe_src_w, pipe_config->pipe_src_h,
12853+
pipe_config->pixel_rate);
1283812854

1283912855
if (INTEL_GEN(dev_priv) >= 9)
1284012856
DRM_DEBUG_KMS("num_scalers: %d, scaler_users: 0x%x, scaler_id: %d\n",
@@ -13410,6 +13426,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
1341013426
}
1341113427

1341213428
PIPE_CONF_CHECK_I(scaler_state.scaler_id);
13429+
PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate);
1341313430
}
1341413431

1341513432
/* BDW+ don't expose a synchronous way to read the state */
@@ -13701,6 +13718,8 @@ verify_crtc_state(struct drm_crtc *crtc,
1370113718
}
1370213719
}
1370313720

13721+
intel_crtc_compute_pixel_rate(pipe_config);
13722+
1370413723
if (!new_crtc_state->active)
1370513724
return;
1370613725

@@ -17177,10 +17196,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
1717717196
*/
1717817197
crtc_state->base.mode.private_flags = I915_MODE_FLAG_INHERITED;
1717917198

17180-
if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
17181-
pixclk = ilk_pipe_pixel_rate(crtc_state);
17182-
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
17183-
pixclk = crtc_state->base.adjusted_mode.crtc_clock;
17199+
intel_crtc_compute_pixel_rate(crtc_state);
17200+
17201+
if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv) ||
17202+
IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
17203+
pixclk = crtc_state->pixel_rate;
1718417204
else
1718517205
WARN_ON(dev_priv->display.modeset_calc_cdclk);
1718617206

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ struct intel_crtc_state {
544544
* and get clipped at the edges. */
545545
int pipe_src_w, pipe_src_h;
546546

547+
/*
548+
* Pipe pixel rate, adjusted for
549+
* panel fitter/pipe scaler downscaling.
550+
*/
551+
unsigned int pixel_rate;
552+
547553
/* Whether to set up the PCH/FDI. Note that we never allow sharing
548554
* between pch encoders and cpu encoders. */
549555
bool has_pch_encoder;

drivers/gpu/drm/i915/intel_fbc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,7 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
742742

743743
cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags;
744744
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
745-
cache->crtc.hsw_bdw_pixel_rate =
746-
ilk_pipe_pixel_rate(crtc_state);
745+
cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate;
747746

748747
cache->plane.rotation = plane_state->base.rotation;
749748
cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16;

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,12 +1820,12 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,
18201820

18211821
cpp = pstate->base.fb->format->cpp[0];
18221822

1823-
method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
1823+
method1 = ilk_wm_method1(cstate->pixel_rate, cpp, mem_value);
18241824

18251825
if (!is_lp)
18261826
return method1;
18271827

1828-
method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
1828+
method2 = ilk_wm_method2(cstate->pixel_rate,
18291829
cstate->base.adjusted_mode.crtc_htotal,
18301830
drm_rect_width(&pstate->base.dst),
18311831
cpp, mem_value);
@@ -1849,8 +1849,8 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate,
18491849

18501850
cpp = pstate->base.fb->format->cpp[0];
18511851

1852-
method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
1853-
method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
1852+
method1 = ilk_wm_method1(cstate->pixel_rate, cpp, mem_value);
1853+
method2 = ilk_wm_method2(cstate->pixel_rate,
18541854
cstate->base.adjusted_mode.crtc_htotal,
18551855
drm_rect_width(&pstate->base.dst),
18561856
cpp, mem_value);
@@ -1876,7 +1876,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
18761876
if (!cstate->base.active)
18771877
return 0;
18781878

1879-
return ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
1879+
return ilk_wm_method2(cstate->pixel_rate,
18801880
cstate->base.adjusted_mode.crtc_htotal,
18811881
width, cpp, mem_value);
18821882
}
@@ -3559,7 +3559,7 @@ static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cst
35593559
* Adjusted plane pixel rate is just the pipe's adjusted pixel rate
35603560
* with additional adjustments for plane-specific scaling.
35613561
*/
3562-
adjusted_pixel_rate = ilk_pipe_pixel_rate(cstate);
3562+
adjusted_pixel_rate = cstate->pixel_rate;
35633563
downscale_amount = skl_plane_downscale_amount(pstate);
35643564

35653565
pixel_rate = adjusted_pixel_rate * downscale_amount >> 16;
@@ -3787,7 +3787,7 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
37873787
if (!cstate->base.active)
37883788
return 0;
37893789

3790-
pixel_rate = ilk_pipe_pixel_rate(cstate);
3790+
pixel_rate = cstate->pixel_rate;
37913791

37923792
if (WARN_ON(pixel_rate == 0))
37933793
return 0;

0 commit comments

Comments
 (0)