[Intel-gfx] [PATCH] drm/i915: Avoid clearing the base drm_crtc_state
Chris Wilson
chris at chris-wilson.co.uk
Mon Mar 6 21:05:47 UTC 2017
On Mon, Mar 06, 2017 at 06:46:16PM +0100, Daniel Vetter wrote:
> On Fri, Mar 03, 2017 at 03:46:44PM +0000, Chris Wilson wrote:
> > @@ -11289,9 +11287,9 @@ clear_intel_crtc_state(struct intel_crtc_state *crtc_state)
> > if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
> > wm_state = crtc_state->wm;
> >
> > - memset(crtc_state, 0, sizeof *crtc_state);
> > + memset(&crtc_state->base + 1, 0,
> > + sizeof(*crtc_state) - sizeof(crtc_state->base));
>
> Maybe add a comment like /* Only clear our part of the overall struct. */
> or similar, since this is not entirely obvious what's going on. Also
>
> COMPILE_BUG_ON(offsetof(struct intel_crtc_state, base) != 0);
>
> maybe? Anyway, I'll let you decide on both, either way:
I thought we had the BUILD_BUG_ON already -- the NULL correspondance is
widely used. I did one version with it, then thought that it would be
better in to_intel_crtc_state() and so left it out.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list