anv: Only enable GPL if ANV_GPL=true, or if zink or DXVK are the engine.
authorEmma Anholt <emma@anholt.net>
Thu, 6 Apr 2023 22:57:43 +0000 (15:57 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 17 Apr 2023 22:43:37 +0000 (22:43 +0000)
Since there are concerns that the VK_EXT_GPL implementation may have
issues with mesh shading, disable it by default but give users a knob to
turn it on to experiment.

This doesn't automatically enable GPL use in zink, because we lack
extendedDynamicState2PatchControlPoints, but it means that you only need
to set ZINK_DEBUG=gpl and not both env vars.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15637>

docs/envvars.rst
src/intel/ci/deqp-anv-tgl-vk.toml
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h

index ef9dc73..c607fc7 100644 (file)
@@ -422,6 +422,11 @@ on Windows.
 Intel driver environment variables
 ----------------------------------------------------
 
+.. envvar:: ANV_GPL
+
+   If set to 1, true, or yes, then VK_EXT_graphics_pipeline_library
+   will be exposed, which may be incompatible with mesh shaders.
+
 .. envvar:: INTEL_BLACKHOLE_DEFAULT
 
    if set to 1, true or yes, then the OpenGL implementation will
index 10ef564..2ddbf51 100644 (file)
@@ -3,4 +3,13 @@
 deqp = "/deqp/external/vulkancts/modules/vulkan/deqp-vk"
 caselists = ["/deqp/mustpass/vk-master.txt"]
 fraction = 2
-renderer_check = "TGL GT2"
\ No newline at end of file
+renderer_check = "TGL GT2"
+
+[[deqp]]
+deqp = "/deqp/external/vulkancts/modules/vulkan/deqp-vk"
+caselists = ["/deqp/mustpass/vk-master.txt"]
+fraction = 2
+include = ["dEQP-VK.pipeline.pipeline_library"]
+prefix = "gpl-"
+[deqp.env]
+ANV_GPL = "true"
index 1ae6feb..ee892d7 100644 (file)
@@ -308,7 +308,7 @@ get_device_extensions(const struct anv_physical_device *device,
                                                VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR,
       .EXT_global_priority_query             = device->max_context_priority >=
                                                VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR,
-      .EXT_graphics_pipeline_library         = true,
+      .EXT_graphics_pipeline_library         = device->gpl_enabled,
       .EXT_host_query_reset                  = true,
       .EXT_image_2d_view_of_3d               = true,
       .EXT_image_robustness                  = true,
@@ -916,6 +916,18 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
       debug_get_bool_option("ANV_ENABLE_GENERATED_INDIRECT_DRAWS",
                             true);
 
+   /* The GPL implementation is new, and may have issues in conjunction with
+    * mesh shading. Enable it by default for zink for performance reasons (where
+    * mesh shading is unused anyway), and have an env var for testing in CI or
+    * by end users.
+    * */
+   if (debug_get_bool_option("ANV_GPL",
+                             instance->vk.app_info.engine_name != NULL &&
+                             (strcmp(instance->vk.app_info.engine_name, "mesa zink") == 0 ||
+                              strcmp(instance->vk.app_info.engine_name, "DXVK") == 0))) {
+      device->gpl_enabled = true;
+   }
+
    unsigned st_idx = 0;
 
    device->sync_syncobj_type = vk_drm_syncobj_get_type(fd);
@@ -1384,7 +1396,7 @@ void anv_GetPhysicalDeviceFeatures2(
 
       /* VK_EXT_global_priority_query */
       .globalPriorityQuery = true,
-      .graphicsPipelineLibrary = true,
+      .graphicsPipelineLibrary = pdevice->gpl_enabled,
 
       /* VK_KHR_fragment_shading_rate */
       .pipelineFragmentShadingRate = true,
index 09fd9fb..6a3697e 100644 (file)
@@ -915,6 +915,7 @@ struct anv_physical_device {
     struct intel_device_info                      info;
     bool                                        supports_48bit_addresses;
     bool                                        video_decode_enabled;
+    bool                                        gpl_enabled;
 
     struct brw_compiler *                       compiler;
     struct isl_device                           isl_dev;