anv/tests: Create a dummy instance as well as device
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 May 2017 23:48:12 +0000 (16:48 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 2 May 2017 00:06:40 +0000 (17:06 -0700)
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@freedesktop.org>
src/intel/vulkan/tests/block_pool_no_free.c
src/intel/vulkan/tests/state_pool.c
src/intel/vulkan/tests/state_pool_free_list_only.c
src/intel/vulkan/tests/state_pool_no_free.c

index 86d1a76151f6c648d280336effaeea2b49ce0f42..0a61818e42cc1818ee8d53c626cfef3c0abf935d 100644 (file)
@@ -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);
index 878ec19a595fee01a02607856a7bacaf56a81a1c..90c9bdea514cebcceb3a1f7aa41ee2c51ea0e2e0 100644 (file)
 
 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;
 
index 2f4eb47fe45e2234e9ae64a6d99c65b26080351c..868815cf933ee38c4268c6400b52ca9a29a34f21 100644 (file)
 
 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;
 
index 4b248c2ee66b9ff7bb93918324c3671ca8b17217..6e012e468343bd1efb18cde4317c23eb87cdff7b 100644 (file)
@@ -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;