Commit d2fa80a5 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Avoid clearing the base drm_crtc_state

To prevent having to preserve the drm_crtc_state as we clear the
intel_crtc_state, only memset our extended state.

Fixes:
drivers/gpu/drm/i915/intel_display.c: In function ‘clear_intel_crtc_state’:
drivers/gpu/drm/i915/intel_display.c:11301:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

v2: Add a comment and BUILD_BUG_ON to explain the memset()
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303154644.6709-1-chris@chris-wilson.co.ukReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent aebfd1d3
...@@ -11272,7 +11272,6 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state) ...@@ -11272,7 +11272,6 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(crtc_state->base.crtc->dev); to_i915(crtc_state->base.crtc->dev);
struct drm_crtc_state tmp_state;
struct intel_crtc_scaler_state scaler_state; struct intel_crtc_scaler_state scaler_state;
struct intel_dpll_hw_state dpll_hw_state; struct intel_dpll_hw_state dpll_hw_state;
struct intel_shared_dpll *shared_dpll; struct intel_shared_dpll *shared_dpll;
...@@ -11284,7 +11283,6 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state) ...@@ -11284,7 +11283,6 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
* fixed, so that the crtc_state can be safely duplicated. For now, * fixed, so that the crtc_state can be safely duplicated. For now,
* only fields that are know to not cause problems are preserved. */ * only fields that are know to not cause problems are preserved. */
tmp_state = crtc_state->base;
scaler_state = crtc_state->scaler_state; scaler_state = crtc_state->scaler_state;
shared_dpll = crtc_state->shared_dpll; shared_dpll = crtc_state->shared_dpll;
dpll_hw_state = crtc_state->dpll_hw_state; dpll_hw_state = crtc_state->dpll_hw_state;
...@@ -11292,9 +11290,11 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state) ...@@ -11292,9 +11290,11 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
wm_state = crtc_state->wm; wm_state = crtc_state->wm;
memset(crtc_state, 0, sizeof *crtc_state); /* Keep base drm_crtc_state intact, only clear our extended struct */
BUILD_BUG_ON(offsetof(struct intel_crtc_state, base));
memset(&crtc_state->base + 1, 0,
sizeof(*crtc_state) - sizeof(crtc_state->base));
crtc_state->base = tmp_state;
crtc_state->scaler_state = scaler_state; crtc_state->scaler_state = scaler_state;
crtc_state->shared_dpll = shared_dpll; crtc_state->shared_dpll = shared_dpll;
crtc_state->dpll_hw_state = dpll_hw_state; crtc_state->dpll_hw_state = dpll_hw_state;
......
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