Mesa (master): anv/entrypoints: Save off the entire devinfo rather than a pointer

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Oct 7 04:16:00 UTC 2016


Module: Mesa
Branch: master
Commit: 82b4f1c47b1d6ca326dbd863253d89337f565309
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=82b4f1c47b1d6ca326dbd863253d89337f565309

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Oct  6 17:16:51 2016 -0700

anv/entrypoints: Save off the entire devinfo rather than a pointer

Since the gen_device_info structs are no longer just constant memory, a
pointer to one is not a pointer to something in the .data section so we
shouldn't be storing it in a static variable.  Instead, we should just
store the entire device_info structure.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/intel/vulkan/anv_entrypoints_gen.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index b026495..aeaeb1d 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -214,22 +214,22 @@ for layer in [ "anv", "gen7", "gen75", "gen8", "gen9" ]:
     print "};\n"
 
 print """
-static const struct gen_device_info *dispatch_devinfo;
+static struct gen_device_info dispatch_devinfo;
 
 void
 anv_set_dispatch_devinfo(const struct gen_device_info *devinfo)
 {
-   dispatch_devinfo = devinfo;
+   dispatch_devinfo = *devinfo;
 }
 
 void * __attribute__ ((noinline))
 anv_resolve_entrypoint(uint32_t index)
 {
-   if (dispatch_devinfo == NULL) {
+   if (dispatch_devinfo.gen == 0) {
       return anv_layer.entrypoints[index];
    }
 
-   switch (dispatch_devinfo->gen) {
+   switch (dispatch_devinfo.gen) {
    case 9:
       if (gen9_layer.entrypoints[index])
          return gen9_layer.entrypoints[index];
@@ -239,7 +239,7 @@ anv_resolve_entrypoint(uint32_t index)
          return gen8_layer.entrypoints[index];
       /* fall through */
    case 7:
-      if (dispatch_devinfo->is_haswell && gen75_layer.entrypoints[index])
+      if (dispatch_devinfo.is_haswell && gen75_layer.entrypoints[index])
          return gen75_layer.entrypoints[index];
 
       if (gen7_layer.entrypoints[index])




More information about the mesa-commit mailing list