[Intel-gfx] [PATCH] drm/i915: Avoid clearing the base drm_crtc_state

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Mar 7 13:00:27 UTC 2017


On Mon, Mar 06, 2017 at 09:05:47PM +0000, Chris Wilson wrote:
> 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.

I posted a patch for that once but I never finished it. In the end I was
even thinking of having both const and non-const to_foo() macros.

If someone wants to continue my work I pushed it here:
git://github.com/vsyrjala/linux.git kms_obj_base_0_2

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list