[Mesa-dev] [PATCH v2 10/24] mapi/new: use the static_data offsets in the new generator

Erik Faye-Lund erik.faye-lund at collabora.com
Fri Dec 14 14:40:17 UTC 2018


Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>

On Fri, 2018-12-14 at 14:04 +0000, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Otherwise the incorrect ones will be used, effectively breaking the
> ABI.
> 
> Note: some entries in static_data.py list a suffixed API, while (for
> ES*
> at least) we expect the one w/o suffix.
> 
> v2:
>  - rework path handling (Dylan)
>  - use else if chain (Erik)
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/mapi/new/genCommon.py | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mapi/new/genCommon.py b/src/mapi/new/genCommon.py
> index ec48d522c05..bfcf6ed3eea 100644
> --- a/src/mapi/new/genCommon.py
> +++ b/src/mapi/new/genCommon.py
> @@ -30,6 +30,11 @@ import re
>  import sys
>  import xml.etree.cElementTree as etree
>  
> +import os
> +GLAPI = os.path.join(os.path.dirname(__file__), "..", "glapi",
> "gen")
> +sys.path.insert(0, GLAPI)
> +import static_data
> +
>  MAPI_TABLE_NUM_DYNAMIC = 4096
>  
>  _LIBRARY_FEATURE_NAMES = {
> @@ -68,11 +73,24 @@ def getFunctionsFromRoots(roots):
>      # Sort the function list by name.
>      functions = sorted(functions, key=lambda f: f.name)
>  
> +    # Lookup for fixed offset/slot functions and use it if
> available.
>      # Assign a slot number to each function. This isn't strictly
> necessary,
>      # since you can just look at the index in the list, but it makes
> it easier
>      # to include the slot when formatting output.
> +
> +    next_slot = 0
>      for i in range(len(functions)):
> -        functions[i] = functions[i]._replace(slot=i)
> +        name = functions[i].name[2:]
> +
> +        if name in static_data.offsets:
> +            functions[i] =
> functions[i]._replace(slot=static_data.offsets[name])
> +        elif not name.endswith("ARB") and name + "ARB" in
> static_data.offsets:
> +            functions[i] =
> functions[i]._replace(slot=static_data.offsets[name + "ARB"])
> +        elif not name.endswith("EXT") and name + "EXT" in
> static_data.offsets:
> +            functions[i] =
> functions[i]._replace(slot=static_data.offsets[name + "EXT"])
> +        else:
> +            functions[i] = functions[i]._replace(slot=next_slot)
> +            next_slot += 1
>  
>      # Sort the function list by slot.... to simplify the diff
>      functions = sorted(functions, key=lambda f: f.slot)



More information about the mesa-dev mailing list