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

Mika Kuoppala mika.kuoppala at linux.intel.com
Thu Jul 4 16:03:08 UTC 2019


Chris Wilson <chris at chris-wilson.co.uk> writes:

> 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.

I think I tried that but found out that when we free the ppgtt,
we want to be fast and don't care about the counts matching.

Well, that could be made to match tho. I will take a look.

-Mika

>
>> +       __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