Skip to content

Commit 7ed3100

Browse files
committed
drm/i915: Preallocate the debug power domain wakerefs array
Since the current size of intel_display_power_domain_set struct is close to 1kB, it's better to use preallocated memory for it. The only user of the intel_display_power_get/put_in_set() allocating the struct on stack is hsw_get_pipe_config(), so we can avoid potential stack overallocations by moving the struct here to the preallocated intel_crtc struct (hsw_get_pipe_config() is non-reentrant wrt. each CRTC). This patch replaces https://lore.kernel.org/intel-gfx/[email protected]/T/#md3f6cdf17fcd Suggested-by: Ville Syrjälä <[email protected]> Cc: Ville Syrjälä <[email protected]> Cc: Jani Nikula <[email protected]> Signed-off-by: Imre Deak <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 10b85f0 commit 7ed3100

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,20 +4051,19 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
40514051
struct intel_crtc_state *pipe_config)
40524052
{
40534053
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
4054-
struct intel_display_power_domain_set power_domain_set = { };
40554054
bool active;
40564055
u32 tmp;
40574056

4058-
if (!intel_display_power_get_in_set_if_enabled(dev_priv, &power_domain_set,
4057+
if (!intel_display_power_get_in_set_if_enabled(dev_priv, &crtc->hw_readout_power_domains,
40594058
POWER_DOMAIN_PIPE(crtc->pipe)))
40604059
return false;
40614060

40624061
pipe_config->shared_dpll = NULL;
40634062

4064-
active = hsw_get_transcoder_state(crtc, pipe_config, &power_domain_set);
4063+
active = hsw_get_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains);
40654064

40664065
if ((IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) &&
4067-
bxt_get_dsi_transcoder_state(crtc, pipe_config, &power_domain_set)) {
4066+
bxt_get_dsi_transcoder_state(crtc, pipe_config, &crtc->hw_readout_power_domains)) {
40684067
drm_WARN_ON(&dev_priv->drm, active);
40694068
active = true;
40704069
}
@@ -4123,7 +4122,7 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
41234122
pipe_config->ips_linetime =
41244123
REG_FIELD_GET(HSW_IPS_LINETIME_MASK, tmp);
41254124

4126-
if (intel_display_power_get_in_set_if_enabled(dev_priv, &power_domain_set,
4125+
if (intel_display_power_get_in_set_if_enabled(dev_priv, &crtc->hw_readout_power_domains,
41274126
POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe))) {
41284127
if (DISPLAY_VER(dev_priv) >= 9)
41294128
skl_get_pfit_config(pipe_config);
@@ -4154,7 +4153,7 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
41544153
}
41554154

41564155
out:
4157-
intel_display_power_put_all_in_set(dev_priv, &power_domain_set);
4156+
intel_display_power_put_all_in_set(dev_priv, &crtc->hw_readout_power_domains);
41584157

41594158
return active;
41604159
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,7 @@ struct intel_crtc {
13751375
u16 vmax_vblank_start;
13761376

13771377
struct intel_display_power_domain_set enabled_power_domains;
1378+
struct intel_display_power_domain_set hw_readout_power_domains;
13781379
struct intel_overlay *overlay;
13791380

13801381
struct intel_crtc_state *config;

0 commit comments

Comments
 (0)