Re: [PATCH 15/16] drm/i915: Repack fence tiling mode and stride into a single integer

Chris Wilson
2016-08-04T11:41:57Z

On Thu, Aug 04, 2016 at 02:17:22PM +0300, Joonas Lahtinen wrote:
> On ma, 2016-08-01 at 19:22 +0100, Chris Wilson wrote:
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2215,13 +2215,10 @@ struct drm_i915_gem_object {
> >
> >   atomic_t frontbuffer_bits;
> >
> > - /**
> > -  * Current tiling mode for the object.
> > -  */
> > - unsigned int tiling_mode;
> > -
> >   /** Current tiling stride for the object, if it's tiled. */
> > - uint32_t stride;
> > + unsigned int tiling_and_stride;
> > +#define TILING_MASK 0x3
>
> No magics and add appropriate BUILD_BUG_ON too when stuffing bits
> inside same variable.
>
> #define TILING_MASK (BIT(31 - __builtin_clz(I915_TILING_LAST)) -1)

#define FENCE_MINIMUM_STRIDE 128
#define TILING_MASK (FENCE_MINIMUM_STRIDE-1)
#define STRIDE_MASK ~TILING_MASK

Presumably you can't complain about the hw being full of magic numbers?
-Chris

--
Chris Wilson, Intel Open Source Technology Centre