Commit 3f36b937 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: Do not put big intel_crtc_state on the stack

Having this on stack triggers the -Wframe-larger-than=1024 and
is not nice to put such big things on the kernel stack anyway.

This required a little bit of refactoring to handle the new
failure path from vlv_force_pll_on.

v2: Corrected some whitespace.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: John Harrison <john.c.harrison@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1453217117-26125-1-git-send-email-tvrtko.ursulin@linux.intel.com
parent bf220452
...@@ -7600,26 +7600,34 @@ static void chv_prepare_pll(struct intel_crtc *crtc, ...@@ -7600,26 +7600,34 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
* in cases where we need the PLL enabled even when @pipe is not going to * in cases where we need the PLL enabled even when @pipe is not going to
* be enabled. * be enabled.
*/ */
void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
const struct dpll *dpll) const struct dpll *dpll)
{ {
struct intel_crtc *crtc = struct intel_crtc *crtc =
to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
struct intel_crtc_state pipe_config = { struct intel_crtc_state *pipe_config;
.base.crtc = &crtc->base,
.pixel_multiplier = 1, pipe_config = kzalloc(sizeof(*pipe_config), GFP_KERNEL);
.dpll = *dpll, if (!pipe_config)
}; return -ENOMEM;
pipe_config->base.crtc = &crtc->base;
pipe_config->pixel_multiplier = 1;
pipe_config->dpll = *dpll;
if (IS_CHERRYVIEW(dev)) { if (IS_CHERRYVIEW(dev)) {
chv_compute_dpll(crtc, &pipe_config); chv_compute_dpll(crtc, pipe_config);
chv_prepare_pll(crtc, &pipe_config); chv_prepare_pll(crtc, pipe_config);
chv_enable_pll(crtc, &pipe_config); chv_enable_pll(crtc, pipe_config);
} else { } else {
vlv_compute_dpll(crtc, &pipe_config); vlv_compute_dpll(crtc, pipe_config);
vlv_prepare_pll(crtc, &pipe_config); vlv_prepare_pll(crtc, pipe_config);
vlv_enable_pll(crtc, &pipe_config); vlv_enable_pll(crtc, pipe_config);
} }
kfree(pipe_config);
return 0;
} }
/** /**
...@@ -10793,7 +10801,7 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, ...@@ -10793,7 +10801,7 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
struct drm_display_mode *mode; struct drm_display_mode *mode;
struct intel_crtc_state pipe_config; struct intel_crtc_state *pipe_config;
int htot = I915_READ(HTOTAL(cpu_transcoder)); int htot = I915_READ(HTOTAL(cpu_transcoder));
int hsync = I915_READ(HSYNC(cpu_transcoder)); int hsync = I915_READ(HSYNC(cpu_transcoder));
int vtot = I915_READ(VTOTAL(cpu_transcoder)); int vtot = I915_READ(VTOTAL(cpu_transcoder));
...@@ -10804,6 +10812,12 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, ...@@ -10804,6 +10812,12 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
if (!mode) if (!mode)
return NULL; return NULL;
pipe_config = kzalloc(sizeof(*pipe_config), GFP_KERNEL);
if (!pipe_config) {
kfree(mode);
return NULL;
}
/* /*
* Construct a pipe_config sufficient for getting the clock info * Construct a pipe_config sufficient for getting the clock info
* back out of crtc_clock_get. * back out of crtc_clock_get.
...@@ -10811,14 +10825,14 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, ...@@ -10811,14 +10825,14 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
* Note, if LVDS ever uses a non-1 pixel multiplier, we'll need * Note, if LVDS ever uses a non-1 pixel multiplier, we'll need
* to use a real value here instead. * to use a real value here instead.
*/ */
pipe_config.cpu_transcoder = (enum transcoder) pipe; pipe_config->cpu_transcoder = (enum transcoder) pipe;
pipe_config.pixel_multiplier = 1; pipe_config->pixel_multiplier = 1;
pipe_config.dpll_hw_state.dpll = I915_READ(DPLL(pipe)); pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(pipe));
pipe_config.dpll_hw_state.fp0 = I915_READ(FP0(pipe)); pipe_config->dpll_hw_state.fp0 = I915_READ(FP0(pipe));
pipe_config.dpll_hw_state.fp1 = I915_READ(FP1(pipe)); pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(pipe));
i9xx_crtc_clock_get(intel_crtc, &pipe_config); i9xx_crtc_clock_get(intel_crtc, pipe_config);
mode->clock = pipe_config.port_clock / pipe_config.pixel_multiplier; mode->clock = pipe_config->port_clock / pipe_config->pixel_multiplier;
mode->hdisplay = (htot & 0xffff) + 1; mode->hdisplay = (htot & 0xffff) + 1;
mode->htotal = ((htot & 0xffff0000) >> 16) + 1; mode->htotal = ((htot & 0xffff0000) >> 16) + 1;
mode->hsync_start = (hsync & 0xffff) + 1; mode->hsync_start = (hsync & 0xffff) + 1;
...@@ -10830,6 +10844,8 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, ...@@ -10830,6 +10844,8 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
drm_mode_set_name(mode); drm_mode_set_name(mode);
kfree(pipe_config);
return mode; return mode;
} }
......
...@@ -335,8 +335,12 @@ vlv_power_sequencer_kick(struct intel_dp *intel_dp) ...@@ -335,8 +335,12 @@ vlv_power_sequencer_kick(struct intel_dp *intel_dp)
release_cl_override = IS_CHERRYVIEW(dev) && release_cl_override = IS_CHERRYVIEW(dev) &&
!chv_phy_powergate_ch(dev_priv, phy, ch, true); !chv_phy_powergate_ch(dev_priv, phy, ch, true);
vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev) ? if (vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev) ?
&chv_dpll[0].dpll : &vlv_dpll[0].dpll); &chv_dpll[0].dpll : &vlv_dpll[0].dpll)) {
DRM_ERROR("Failed to force on pll for pipe %c!\n",
pipe_name(pipe));
return;
}
} }
/* /*
......
...@@ -1154,8 +1154,8 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv, ...@@ -1154,8 +1154,8 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc, struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
struct intel_crtc_state *state); struct intel_crtc_state *state);
void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
const struct dpll *dpll); const struct dpll *dpll);
void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe); void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe);
/* modesetting asserts */ /* modesetting asserts */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment