[Mesa-stable] [PATCH 2/2] anv/entrypoints: Rework #if guards

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 10 20:14:15 UTC 2016


On 10 June 2016 at 20:57, Jason Ekstrand <jason at jlekstrand.net> wrote:
> This reworks the #if guards a bit.  When Emil originally wrote them, he
> just guarded everything.  However, part of what anv_entrypoints_gen.py
> generates is a hash table for looking up entrypoints based on their name.
> This table *cannot* get out of sync between C and python regardless of
> preprocessor flags.  In order to prevent this, this commit makes us use
> void pointers in the dispatch table for those entrypoints which aren't
> available.  This means that the dispatch table size and entry order is
> constant and it should never get out-of-sync with the python.
>
Double-checking that I've for this right:
So this moves the guard per function and ensures that all entries and
thus the hash table and lookup is always at the same place. Regardless
if we'll ever hit the non-supported platforms' entry points.

I'm thinking about an alternative solution, not sure if it's going to
work/fly. Forward declare the specific types (in case we're building
w/o said platform) and drop the guards around the functions and don't
change the function signature/return type.

It should be possible (from a very quick look) since all the platform
specifics arguments are pointers to the specific types.
I think that may be better solution, but regardless if you opt for it or not
Acked-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-stable mailing list