Mesa (master): anv/tests: Create a dummy instance as well as device

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue May 2 14:19:05 UTC 2017


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon May  1 16:48:12 2017 -0700

anv/tests: Create a dummy instance as well as device

This fixes crashes caused by 35e626bd0e59e7ce9fd97ccef66b2468c09206a4
which made us start referencing the instance in the allocators.  With
this commit, the tests now happily pass again.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100877
Tested-by: Vinson Lee <vlee at freedesktop.org>

---

 src/intel/vulkan/tests/block_pool_no_free.c        | 5 ++++-
 src/intel/vulkan/tests/state_pool.c                | 5 ++++-
 src/intel/vulkan/tests/state_pool_free_list_only.c | 5 ++++-
 src/intel/vulkan/tests/state_pool_no_free.c        | 5 ++++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/tests/block_pool_no_free.c b/src/intel/vulkan/tests/block_pool_no_free.c
index 86d1a76151..0a61818e42 100644
--- a/src/intel/vulkan/tests/block_pool_no_free.c
+++ b/src/intel/vulkan/tests/block_pool_no_free.c
@@ -107,7 +107,10 @@ static void validate_monotonic(uint32_t **blocks)
 
 static void run_test()
 {
-   struct anv_device device;
+   struct anv_instance instance;
+   struct anv_device device = {
+      .instance = &instance,
+   };
    struct anv_block_pool pool;
 
    pthread_mutex_init(&device.mutex, NULL);
diff --git a/src/intel/vulkan/tests/state_pool.c b/src/intel/vulkan/tests/state_pool.c
index 878ec19a59..90c9bdea51 100644
--- a/src/intel/vulkan/tests/state_pool.c
+++ b/src/intel/vulkan/tests/state_pool.c
@@ -34,7 +34,10 @@
 
 int main(int argc, char **argv)
 {
-   struct anv_device device;
+   struct anv_instance instance;
+   struct anv_device device = {
+      .instance = &instance,
+   };
    struct anv_block_pool block_pool;
    struct anv_state_pool state_pool;
 
diff --git a/src/intel/vulkan/tests/state_pool_free_list_only.c b/src/intel/vulkan/tests/state_pool_free_list_only.c
index 2f4eb47fe4..868815cf93 100644
--- a/src/intel/vulkan/tests/state_pool_free_list_only.c
+++ b/src/intel/vulkan/tests/state_pool_free_list_only.c
@@ -33,7 +33,10 @@
 
 int main(int argc, char **argv)
 {
-   struct anv_device device;
+   struct anv_instance instance;
+   struct anv_device device = {
+      .instance = &instance,
+   };
    struct anv_block_pool block_pool;
    struct anv_state_pool state_pool;
 
diff --git a/src/intel/vulkan/tests/state_pool_no_free.c b/src/intel/vulkan/tests/state_pool_no_free.c
index 4b248c2ee6..6e012e4683 100644
--- a/src/intel/vulkan/tests/state_pool_no_free.c
+++ b/src/intel/vulkan/tests/state_pool_no_free.c
@@ -54,7 +54,10 @@ static void *alloc_states(void *_job)
 
 static void run_test()
 {
-   struct anv_device device;
+   struct anv_instance instance;
+   struct anv_device device = {
+      .instance = &instance,
+   };
    struct anv_block_pool block_pool;
    struct anv_state_pool state_pool;
 




More information about the mesa-commit mailing list