Re: [PATCH 1/2] drm/i915: Use anonymous union/struct to save space taken by latency values

Ville Syrjälä
2014-09-10T17:33:35Z

On Fri, Sep 05, 2014 at 01:53:11PM +0100, Damien Lespiau wrote:
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

I think I'll punt on reviewing this for now. I need to go through
the other skl wm stuff first, and then I probaly need to stare at the
result a bit before I can think about unification.

> ---
> drivers/gpu/drm/i915/i915_drv.h | 38 +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0baf7f3..8471d12 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1730,23 +1730,27 @@ struct drm_i915_private {
> struct vlv_s0ix_state vlv_s0ix_state;
>
> struct {
> - /*
> - * Raw watermark latency values:
> - * in 0.1us units for WM0,
> - * in 0.5us units for WM1+.
> - */
> - /* primary */
> - uint16_t pri_latency[5];
> - /* sprite */
> - uint16_t spr_latency[5];
> - /* cursor */
> - uint16_t cur_latency[5];
> - /*
> - * Raw watermark memory latency values
> - * for SKL for all 8 levels
> - * in 1us units.
> - */
> - uint16_t skl_latency[8];
> + union {
> + /*
> + * Raw watermark latency values:
> + * in 0.1us units for WM0,
> + * in 0.5us units for WM1+.
> + */
> + struct {
> + /* primary */
> + uint16_t pri_latency[5];
> + /* sprite */
> + uint16_t spr_latency[5];
> + /* cursor */
> + uint16_t cur_latency[5];
> + };
> +
> + /*
> + * Raw watermark memory latency values for SKL for all
> + * 8 levels. In 1us units.
> + */
> + uint16_t skl_latency[8];
> + };
>
> /*
> * The skl_wm_values structure is a bit too big for stack
> --
> 1.8.3.1

--
Ville Syrjälä
Intel OTC