anv/device: Set device->info sooner in CreateDevice
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 28 Dec 2015 21:26:49 +0000 (13:26 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 28 Dec 2015 21:29:01 +0000 (13:29 -0800)
anv_block_pool_init calls anv_block_pool_grow which checks
device->info.has_llc to see if it needs to set caching parameters.
If we don't set device->info early enough, this reads an undefined value
which is probably 0 and not what we want on llc platforms.

Found with valgrind.

src/vulkan/anv_device.c

index 0043bea5d13d6f8dc1feed548563f5fbd2dcca1e..90a0061dbf8e88ab695cbd81432f502cea40ff26 100644 (file)
@@ -706,6 +706,9 @@ VkResult anv_CreateDevice(
    if (device->context_id == -1)
       goto fail_fd;
 
+   device->info = *physical_device->info;
+   device->isl_dev = physical_device->isl_dev;
+
    pthread_mutex_init(&device->mutex, NULL);
 
    anv_bo_pool_init(&device->batch_bo_pool, device, ANV_CMD_BUFFER_BATCH_SIZE);
@@ -725,9 +728,6 @@ VkResult anv_CreateDevice(
 
    anv_block_pool_init(&device->scratch_block_pool, device, 0x10000);
 
-   device->info = *physical_device->info;
-   device->isl_dev = physical_device->isl_dev;
-
    anv_queue_init(device, &device->queue);
 
    anv_device_init_meta(device);