Re: [Mesa-dev] [PATCH] anv/entrypoints: Only generate entrypoints for supported features

2017-02-16 Thread Tapani Pälli



On 02/14/2017 10:23 PM, Jason Ekstrand wrote:

On Feb 14, 2017 11:13 AM, "Emil Velikov" mailto:emil.l.veli...@gmail.com>> wrote:

On 14 February 2017 at 18:26, Jason Ekstrand mailto:ja...@jlekstrand.net>> wrote:
> This changes the way anv_entrypoints_gen.py works from generating a
> table containing every single entrypoint in the XML to just the ones
> that we actually need.  There's no reason for us to burn entrypoint
> table space on a bunch of NV extensions we never plan to implement.

JFYI: Tapani mentioned that the conversion to XML 'magically' got
things working on Android-ia.
Might be worth checking if the latter requires (and/or uses ?) some
other extensions/entry points.


I have no idea what's going on with android.  If they need another
entrypoint or two, it should be easy enough to AF them to the whitelist.


Yeah, I'll check how this changes things when next rebase for us 
happens. Currently I have (bit experimental) patch in generator script 
to add some entrypoints, just like vkCreateDmaBufImageINTEL is added.


// Tapani
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/entrypoints: Only generate entrypoints for supported features

2017-02-14 Thread Jason Ekstrand
On Feb 14, 2017 11:13 AM, "Emil Velikov"  wrote:

On 14 February 2017 at 18:26, Jason Ekstrand  wrote:
> This changes the way anv_entrypoints_gen.py works from generating a
> table containing every single entrypoint in the XML to just the ones
> that we actually need.  There's no reason for us to burn entrypoint
> table space on a bunch of NV extensions we never plan to implement.

JFYI: Tapani mentioned that the conversion to XML 'magically' got
things working on Android-ia.
Might be worth checking if the latter requires (and/or uses ?) some
other extensions/entry points.


I have no idea what's going on with android.  If they need another
entrypoint or two, it should be easy enough to AF them to the whitelist.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/entrypoints: Only generate entrypoints for supported features

2017-02-14 Thread Emil Velikov
On 14 February 2017 at 18:26, Jason Ekstrand  wrote:
> This changes the way anv_entrypoints_gen.py works from generating a
> table containing every single entrypoint in the XML to just the ones
> that we actually need.  There's no reason for us to burn entrypoint
> table space on a bunch of NV extensions we never plan to implement.

JFYI: Tapani mentioned that the conversion to XML 'magically' got
things working on Android-ia.
Might be worth checking if the latter requires (and/or uses ?) some
other extensions/entry points.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv/entrypoints: Only generate entrypoints for supported features

2017-02-14 Thread Lionel Landwerlin

Reviewed-by: Lionel Landwerlin 

Thanks!

On 14/02/17 18:26, Jason Ekstrand wrote:

This changes the way anv_entrypoints_gen.py works from generating a
table containing every single entrypoint in the XML to just the ones
that we actually need.  There's no reason for us to burn entrypoint
table space on a bunch of NV extensions we never plan to implement.
---
  src/intel/vulkan/anv_entrypoints_gen.py | 44 ++---
  1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 0eb523d..93511ec 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -25,6 +25,20 @@
  import sys
  import xml.etree.ElementTree as ET
  
+max_api_version = 1.0

+
+supported_extensions = [
+   'VK_KHR_get_physical_device_properties2',
+   'VK_KHR_maintenance1',
+   'VK_KHR_sampler_mirror_clamp_to_edge',
+   'VK_KHR_shader_draw_parameters',
+   'VK_KHR_surface',
+   'VK_KHR_swapchain',
+   'VK_KHR_wayland_surface',
+   'VK_KHR_xcb_surface',
+   'VK_KHR_xlib_surface',
+]
+
  # We generate a static hash table for entry point lookup
  # (vkGetProcAddress). We use a linear congruential generator for our hash
  # function and a power-of-two size table. The prime numbers are determined
@@ -66,10 +80,32 @@ elif (sys.argv[1] == "code"):
  # Extract the entry points from the registry
  def get_entrypoints(doc, entrypoints_to_defines):
  entrypoints = []
-commands = doc.findall('./commands/command')
-for i, command in enumerate(commands):
+
+enabled_commands = set()
+for feature in doc.findall('./feature'):
+assert feature.attrib['api'] == 'vulkan'
+if float(feature.attrib['number']) > max_api_version:
+continue
+
+for command in feature.findall('./require/command'):
+enabled_commands.add(command.attrib['name'])
+
+for extension in doc.findall('.extensions/extension'):
+if extension.attrib['name'] not in supported_extensions:
+continue
+
+assert extension.attrib['supported'] == 'vulkan'
+for command in extension.findall('./require/command'):
+enabled_commands.add(command.attrib['name'])
+
+index = 0
+for command in doc.findall('./commands/command'):
  type = command.find('./proto/type').text
  fullname = command.find('./proto/name').text
+
+if fullname not in enabled_commands:
+continue
+
  shortname = fullname[2:]
  params = map(lambda p: "".join(p.itertext()), 
command.findall('./param'))
  params = ', '.join(params)
@@ -77,7 +113,9 @@ def get_entrypoints(doc, entrypoints_to_defines):
  guard = entrypoints_to_defines[fullname]
  else:
  guard = None
-entrypoints.append((type, shortname, params, i, hash(fullname), guard))
+entrypoints.append((type, shortname, params, index, hash(fullname), 
guard))
+index += 1
+
  return entrypoints
  
  # Maps entry points to extension defines



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev