Re: [PATCH v2 15/17] drm/gma500: Stop using mode->private_flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 09, 2020 at 10:49:52PM +0300, Ville Syrjälä wrote:
> On Tue, Apr 07, 2020 at 09:35:37PM +0200, Sam Ravnborg wrote:
> > On Tue, Apr 07, 2020 at 10:08:00PM +0300, Ville Syrjälä wrote:
> > > On Tue, Apr 07, 2020 at 08:56:53PM +0200, Sam Ravnborg wrote:
> > > > Hi Ville.
> > > > 
> > > > On Fri, Apr 03, 2020 at 11:40:06PM +0300, Ville Syrjala wrote:
> > > > > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> > > > > 
> > > > > gma500 only uses mode->private_flags to convey the sdvo pixel
> > > > > multiplier from the encoder .mode_fixup() hook to the encoder
> > > > > .mode_set() hook. Those always seems get called as a pair so
> > > > > let's just stuff the pixel multiplier into the encoder itself
> > > > > as there are no state objects we could use in this non-atomic
> > > > > driver.
> > > > > 
> > > > > Paves the way for nuking mode->private_flag.
> > > > Nice little clean-up. One comment below.
> > > > 
> > > > 	Sam
> > > > > 
> > > > > Cc: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>
> > > > > CC: Sam Ravnborg <sam@xxxxxxxxxxxx>
> > > > > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> > > > > Cc: Emil Velikov <emil.l.velikov@xxxxxxxxx>
> > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> > > > > ---
> > > > >  drivers/gpu/drm/gma500/psb_intel_drv.h  | 19 -------------------
> > > > >  drivers/gpu/drm/gma500/psb_intel_sdvo.c | 11 ++++++-----
> > > > >  2 files changed, 6 insertions(+), 24 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
> > > > > index fb601983cef0..3dd5718c3e31 100644
> > > > > --- a/drivers/gpu/drm/gma500/psb_intel_drv.h
> > > > > +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
> > > > > @@ -56,25 +56,6 @@
> > > > >  #define INTEL_OUTPUT_DISPLAYPORT 9
> > > > >  #define INTEL_OUTPUT_EDP 10
> > > > >  
> > > > > -#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
> > > > > -#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
> > > > > -
> > > > > -static inline void
> > > > > -psb_intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
> > > > > -				int multiplier)
> > > > > -{
> > > > > -	mode->clock *= multiplier;
> > > > > -	mode->private_flags |= multiplier;
> > > > > -}
> > > > > -
> > > > > -static inline int
> > > > > -psb_intel_mode_get_pixel_multiplier(const struct drm_display_mode *mode)
> > > > > -{
> > > > > -	return (mode->private_flags & INTEL_MODE_PIXEL_MULTIPLIER_MASK)
> > > > > -	       >> INTEL_MODE_PIXEL_MULTIPLIER_SHIFT;
> > > > > -}
> > > > > -
> > > > > -
> > > > >  /*
> > > > >   * Hold information useally put on the device driver privates here,
> > > > >   * since it needs to be shared across multiple of devices drivers privates.
> > > > > diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > > > > index 264d7ad004b4..9e88a37f55e9 100644
> > > > > --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > > > > +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> > > > > @@ -132,6 +132,8 @@ struct psb_intel_sdvo {
> > > > >  	/* DDC bus used by this SDVO encoder */
> > > > >  	uint8_t ddc_bus;
> > > > >  
> > > > > +	u8 pixel_multiplier;
> > > > > +
> > > > 
> > > > There is really no good reason to use an u8 here.
> > > 
> > > Wastes less space.
> > 
> > When there is a good reason - use the size limited variants.
> > But in this use case there is no reason to space optimize it.
> 
> IMO when it's stuffed into a structure there's no reason not to
> optimize it. At some point it all starts to add up.
> 
> At least i915 suffers a lot from bloated structures (dev_priv
> and atomic state structs being the prime examples) where we
> could probably shave dozens if not hundreds of bytes if
> everything just used the smallest type possible. In fact
> this series does shave dozens of bytes from the crtc state
> alone.

Make that hundreds of bytes actually. I think we have three or more
copies of drm_display_mode embedded in there and this series shrinks
each one by 80 bytes (iirc).

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux