[Intel-gfx] [PATCH 1/3] drm/i915/gtt: pde entry encoding is identical

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 4 15:54:30 UTC 2019


Quoting Mika Kuoppala (2019-07-04 16:44:05)
> +#define set_pd_entry(pd, pde, to)  ({                             \
> +       __write_pd_entry((pd), (pde), px_base(to), gen8_pde_encode); \
> +       atomic_inc(&(pd)->used);                                   \

inc before write so that you have a nice onion with clear.

> +})
> +
> +#define clear_pd_entry(pd, pde, to) ({                              \

You want to pull the GEM_BUG_ON here so that is tightly coupled with the
atomic_dec -- it's an underflow check.

> +       __write_pd_entry((pd), (pde), px_base(to), gen8_pde_encode); \
> +       atomic_dec(&pd->used);                                       \
> +})

I would have preferred these as inlines (even if means "passing" an
extra arg), but let's see what the next two patches bring.
-Chris


More information about the Intel-gfx mailing list