anv/allocator: Embed the block_pool in the state_pool

Now that the state stream is allocating off of the state pool, there's
no reason why we need the block pool to be separate.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
This commit is contained in:
Jason Ekstrand
2017-04-24 08:50:23 -07:00
parent bb2a3f0df8
commit d3ed72e2c2
11 changed files with 66 additions and 86 deletions
+1 -4
View File
@@ -38,14 +38,12 @@ int main(int argc, char **argv)
struct anv_device device = {
.instance = &instance,
};
struct anv_block_pool block_pool;
struct anv_state_pool state_pool;
pthread_mutex_init(&device.mutex, NULL);
for (unsigned i = 0; i < NUM_RUNS; i++) {
anv_block_pool_init(&block_pool, &device, 4096);
anv_state_pool_init(&state_pool, &block_pool, 256);
anv_state_pool_init(&state_pool, &device, 256);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
@@ -53,7 +51,6 @@ int main(int argc, char **argv)
run_state_pool_test(&state_pool);
anv_state_pool_finish(&state_pool);
anv_block_pool_finish(&block_pool);
}
pthread_mutex_destroy(&device.mutex);
@@ -37,12 +37,10 @@ int main(int argc, char **argv)
struct anv_device device = {
.instance = &instance,
};
struct anv_block_pool block_pool;
struct anv_state_pool state_pool;
pthread_mutex_init(&device.mutex, NULL);
anv_block_pool_init(&block_pool, &device, 4096);
anv_state_pool_init(&state_pool, &block_pool, 4096);
anv_state_pool_init(&state_pool, &device, 4096);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
@@ -64,6 +62,5 @@ int main(int argc, char **argv)
run_state_pool_test(&state_pool);
anv_state_pool_finish(&state_pool);
anv_block_pool_finish(&block_pool);
pthread_mutex_destroy(&device.mutex);
}
+1 -4
View File
@@ -58,12 +58,10 @@ static void run_test()
struct anv_device device = {
.instance = &instance,
};
struct anv_block_pool block_pool;
struct anv_state_pool state_pool;
pthread_mutex_init(&device.mutex, NULL);
anv_block_pool_init(&block_pool, &device, 4096);
anv_state_pool_init(&state_pool, &block_pool, 64);
anv_state_pool_init(&state_pool, &device, 64);
pthread_barrier_init(&barrier, NULL, NUM_THREADS);
@@ -109,7 +107,6 @@ static void run_test()
}
anv_state_pool_finish(&state_pool);
anv_block_pool_finish(&block_pool);
pthread_mutex_destroy(&device.mutex);
}