nv50/ir: silence unsupported TGSI_PROPERTY_CS_FIXED_BLOCK_*
[mesa.git] / src / intel / vulkan / anv_device.c
index bcd7a9e3c0d6d9cb020b751c07c09cc9cd45cf4a..02b96ca3d691f3ca380478c1ffb728d77f381e05 100644 (file)
@@ -99,6 +99,17 @@ anv_physical_device_init(struct anv_physical_device *device,
       goto fail;
    }
 
+   device->cmd_parser_version = -1;
+   if (device->info->gen == 7) {
+      device->cmd_parser_version =
+         anv_gem_get_param(fd, I915_PARAM_CMD_PARSER_VERSION);
+      if (device->cmd_parser_version == -1) {
+         result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+                            "failed to get command parser version");
+         goto fail;
+      }
+   }
+
    if (anv_gem_get_aperture(fd, &device->aperture_size) == -1) {
       result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
                          "failed to get aperture size: %m");
@@ -159,11 +170,13 @@ static const VkExtensionProperties global_extensions[] = {
       .extensionName = VK_KHR_SURFACE_EXTENSION_NAME,
       .specVersion = 25,
    },
+#ifdef VK_USE_PLATFORM_XCB_KHR
    {
       .extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME,
       .specVersion = 5,
    },
-#ifdef HAVE_WAYLAND_PLATFORM
+#endif
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
    {
       .extensionName = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
       .specVersion = 4,
@@ -223,7 +236,7 @@ VkResult anv_CreateInstance(
    }
 
    if (VK_MAKE_VERSION(1, 0, 0) > client_version ||
-       client_version > VK_MAKE_VERSION(1, 0, 3)) {
+       client_version > VK_MAKE_VERSION(1, 0, 0xfff)) {
       return vk_errorf(VK_ERROR_INCOMPATIBLE_DRIVER,
                        "Client requested version %d.%d.%d",
                        VK_VERSION_MAJOR(client_version),
@@ -369,12 +382,12 @@ void anv_GetPhysicalDeviceFeatures(
       .alphaToOne                               = true,
       .multiViewport                            = true,
       .samplerAnisotropy                        = false, /* FINISHME */
-      .textureCompressionETC2                   = true,
-      .textureCompressionASTC_LDR               = true,
+      .textureCompressionETC2                   = pdevice->info->gen >= 8 ||
+                                                  pdevice->info->is_baytrail,
+      .textureCompressionASTC_LDR               = false, /* FINISHME */
       .textureCompressionBC                     = true,
       .occlusionQueryPrecise                    = true,
       .pipelineStatisticsQuery                  = false,
-      .vertexPipelineStoresAndAtomics           = pdevice->info->gen >= 8,
       .fragmentStoresAndAtomics                 = true,
       .shaderTessellationAndGeometryPointSize   = true,
       .shaderImageGatherExtended                = true,
@@ -395,6 +408,11 @@ void anv_GetPhysicalDeviceFeatures(
       .variableMultisampleRate                  = false,
       .inheritedQueries                         = false,
    };
+
+   /* We can't do image stores in vec4 shaders */
+   pFeatures->vertexPipelineStoresAndAtomics =
+      pdevice->compiler->scalar_stage[MESA_SHADER_VERTEX] &&
+      pdevice->compiler->scalar_stage[MESA_SHADER_GEOMETRY];
 }
 
 void
@@ -532,7 +550,7 @@ void anv_GetPhysicalDeviceProperties(
    };
 
    *pProperties = (VkPhysicalDeviceProperties) {
-      .apiVersion = VK_MAKE_VERSION(1, 0, 2),
+      .apiVersion = VK_MAKE_VERSION(1, 0, 5),
       .driverVersion = 1,
       .vendorID = 0x8086,
       .deviceID = pdevice->chipset_id,
@@ -716,8 +734,7 @@ anv_device_submit_simple_batch(struct anv_device *device,
 
    /* Kernel driver requires 8 byte aligned batch length */
    size = align_u32(batch->next - batch->start, 8);
-   assert(size < device->batch_bo_pool.bo_size);
-   result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo);
+   result = anv_bo_pool_alloc(&device->batch_bo_pool, &bo, size);
    if (result != VK_SUCCESS)
       return result;
 
@@ -827,9 +844,16 @@ VkResult anv_CreateDevice(
    device->info = *physical_device->info;
    device->isl_dev = physical_device->isl_dev;
 
+   /* On Broadwell and later, we can use batch chaining to more efficiently
+    * implement growing command buffers.  Prior to Haswell, the kernel
+    * command parser gets in the way and we have to fall back to growing
+    * the batch.
+    */
+   device->can_chain_batches = device->info.gen >= 8;
+
    pthread_mutex_init(&device->mutex, NULL);
 
-   anv_bo_pool_init(&device->batch_bo_pool, device, ANV_CMD_BUFFER_BATCH_SIZE);
+   anv_bo_pool_init(&device->batch_bo_pool, device);
 
    anv_block_pool_init(&device->dynamic_state_block_pool, device, 16384);
 
@@ -1060,8 +1084,8 @@ VkResult anv_DeviceWaitIdle(
    batch.start = batch.next = cmds;
    batch.end = (void *) cmds + sizeof(cmds);
 
-   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
-   anv_batch_emit(&batch, GEN7_MI_NOOP);
+   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END, bbe);
+   anv_batch_emit(&batch, GEN7_MI_NOOP, noop);
 
    return anv_device_submit_simple_batch(device, &batch);
 }
@@ -1390,7 +1414,7 @@ VkResult anv_CreateFence(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
 
-   result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo);
+   result = anv_bo_pool_alloc(&device->batch_bo_pool, &fence_bo, 4096);
    if (result != VK_SUCCESS)
       return result;
 
@@ -1402,8 +1426,8 @@ VkResult anv_CreateFence(
    const uint32_t batch_offset = align_u32(sizeof(*fence), CACHELINE_SIZE);
    batch.next = batch.start = fence->bo.map + batch_offset;
    batch.end = fence->bo.map + fence->bo.size;
-   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
-   anv_batch_emit(&batch, GEN7_MI_NOOP);
+   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END, bbe);
+   anv_batch_emit(&batch, GEN7_MI_NOOP, noop);
 
    if (!device->info.has_llc) {
       assert(((uintptr_t) batch.start & CACHELINE_MASK) == 0);