anv: Stop setting BO flags in bo_init_new
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 17 May 2017 18:31:02 +0000 (11:31 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 May 2017 23:46:38 +0000 (16:46 -0700)
The idea behind doing this was to make it easier to set various flags.
However, we have enough custom flag settings floating around the driver
that this is more of a nuisance than a help.  This commit has the
following functional changes:

 1) The workaround_bo created in anv_CreateDevice loses both flags.
    This shouldn't matter because it's very small and entirely internal
    to the driver.

 2) The bo created in anv_CreateDmaBufImageINTEL loses the
    EXEC_OBJECT_ASYNC flag.  In retrospect, it never should have gotten
    EXEC_OBJECT_ASYNC in the first place.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_allocator.c
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_queue.c
src/intel/vulkan/genX_query.c

index b767542aa5bf21223069ce9dbf6acdd80527b6ce..d637867ab9ac179f318c214346dc46b95cec44ec 100644 (file)
@@ -1025,6 +1025,12 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo, uint32_t size)
    if (result != VK_SUCCESS)
       return result;
 
+   if (pool->device->instance->physicalDevice.supports_48bit_addresses)
+      new_bo.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+
+   if (pool->device->instance->physicalDevice.has_exec_async)
+      new_bo.flags |= EXEC_OBJECT_ASYNC;
+
    assert(new_bo.size == pow2_size);
 
    new_bo.map = anv_gem_mmap(pool->device, new_bo.gem_handle, 0, pow2_size, 0);
@@ -1154,7 +1160,10 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
     *
     * so nothing will ever touch the top page.
     */
-   bo->bo.flags &= ~EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+   assert(!(bo->bo.flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS));
+
+   if (device->instance->physicalDevice.has_exec_async)
+      bo->bo.flags |= EXEC_OBJECT_ASYNC;
 
    /* Set the exists last because it may be read by other threads */
    __sync_synchronize();
@@ -1309,12 +1318,6 @@ anv_bo_cache_import(struct anv_device *device,
 
       anv_bo_init(&bo->bo, gem_handle, size);
 
-      if (device->instance->physicalDevice.supports_48bit_addresses)
-         bo->bo.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
-
-      if (device->instance->physicalDevice.has_exec_async)
-         bo->bo.flags |= EXEC_OBJECT_ASYNC;
-
       _mesa_hash_table_insert(cache->bo_map, (void *)(uintptr_t)gem_handle, bo);
    }
 
index b0ccbbb59d66fc631369233967532c4b394aa01e..9444ff8b6d2e4a60f76d805d893671155b5a81c7 100644 (file)
@@ -1453,12 +1453,6 @@ anv_bo_init_new(struct anv_bo *bo, struct anv_device *device, uint64_t size)
 
    anv_bo_init(bo, gem_handle, size);
 
-   if (device->instance->physicalDevice.supports_48bit_addresses)
-      bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
-
-   if (device->instance->physicalDevice.has_exec_async)
-      bo->flags |= EXEC_OBJECT_ASYNC;
-
    return VK_SUCCESS;
 }
 
@@ -1536,6 +1530,12 @@ VkResult anv_AllocateMemory(
          goto fail;
    }
 
+   if (pdevice->supports_48bit_addresses)
+      mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+
+   if (pdevice->has_exec_async)
+      mem->bo->flags |= EXEC_OBJECT_ASYNC;
+
    *pMem = anv_device_memory_to_handle(mem);
 
    return VK_SUCCESS;
index 94c34c5d5aff835b69ac4e462322e7817feec4fd..be7fd31008106db4e7244942d8b2215a578db4eb 100644 (file)
@@ -553,7 +553,7 @@ VkResult anv_CreateSemaphore(
       /* If we're going to use this as a fence, we need to *not* have the
        * EXEC_OBJECT_ASYNC bit set.
        */
-      semaphore->permanent.bo->flags &= ~EXEC_OBJECT_ASYNC;
+      assert(!(semaphore->permanent.bo->flags & EXEC_OBJECT_ASYNC));
    } else {
       assert(!"Unknown handle type");
       vk_free2(&device->alloc, pAllocator, semaphore);
@@ -644,7 +644,7 @@ VkResult anv_ImportSemaphoreFdKHX(
       /* If we're going to use this as a fence, we need to *not* have the
        * EXEC_OBJECT_ASYNC bit set.
        */
-      bo->flags &= ~EXEC_OBJECT_ASYNC;
+      assert(!(bo->flags & EXEC_OBJECT_ASYNC));
 
       anv_semaphore_impl_cleanup(device, &semaphore->permanent);
 
index 22de3c3363b74bef3a05bacd8a5ada346b2f878f..5102412e8f9e68f231739f6cc2cc5435444f4115 100644 (file)
@@ -39,6 +39,7 @@ VkResult genX(CreateQueryPool)(
     VkQueryPool*                                pQueryPool)
 {
    ANV_FROM_HANDLE(anv_device, device, _device);
+   const struct anv_physical_device *pdevice = &device->instance->physicalDevice;
    struct anv_query_pool *pool;
    VkResult result;
 
@@ -90,6 +91,12 @@ VkResult genX(CreateQueryPool)(
    if (result != VK_SUCCESS)
       goto fail;
 
+   if (pdevice->supports_48bit_addresses)
+      pool->bo.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+
+   if (pdevice->has_exec_async)
+      pool->bo.flags |= EXEC_OBJECT_ASYNC;
+
    /* For query pools, we set the caching mode to I915_CACHING_CACHED.  On LLC
     * platforms, this does nothing.  On non-LLC platforms, this means snooping
     * which comes at a slight cost.  However, the buffers aren't big, won't be