From 6ef1bd4fa57b36efc7919773fd26c36fd43d2ea9 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 1 May 2017 16:48:12 -0700 Subject: [PATCH] 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 --- 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 86d1a76..0a61818 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 878ec19..90c9bde 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 2f4eb47..868815c 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 4b248c2..6e012e4 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; -- 2.7.4