SHA256
1
0
forked from pool/Mesa
Mesa/0009-zink-don-t-print-error-messages-when-failing-an-impl.patch
Stefan Dirsch f72bdc5d3e - 0001-loader-delete-unused-param-from-pipe_loader_sw_probe.patch,
0002-glx-fix-some-indentation.patch,
  0003-glx-add-an-implicit-param-to-createScreen.patch,
  0004-glx-pass-implicit-load-param-through-allocation.patch,
  0005-dri-plumb-a-implicit-param-through-createNewScreen-i.patch,
  0006-gbm-plumb-an-implicit-param-through-device-creation.patch,
  0007-frontends-dri-plumb-an-implicit-param-through-screen.patch,
  0008-pipe-loader-plumb-a-flag-for-implicit-driver-load-th.patch,
  0009-zink-don-t-print-error-messages-when-failing-an-impl.patch
  * get rid of error message:
    'MESA: error: ZINK: vkEnumeratePhysicalDevices failed
    (VK_ERROR_INITIALIZATION_FAILED)' 
    [gitlab mesa issue #10802]

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=1273
2024-03-19 08:04:25 +00:00

328 lines
15 KiB
Diff

From 940d9bce8ec9a1acc5065bce9d3e4c369546319b Mon Sep 17 00:00:00 2001
From: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Date: Tue, 12 Mar 2024 10:22:24 -0400
Subject: [PATCH 9/9] zink: don't print error messages when failing an implicit
driver load
---
src/gallium/drivers/zink/zink_device_info.py | 6 +-
src/gallium/drivers/zink/zink_instance.py | 15 ++--
src/gallium/drivers/zink/zink_screen.c | 76 +++++++++++++-------
src/gallium/drivers/zink/zink_types.h | 1 +
4 files changed, 66 insertions(+), 32 deletions(-)
Index: mesa-24.0.3/src/gallium/drivers/zink/zink_device_info.py
===================================================================
--- mesa-24.0.3.orig/src/gallium/drivers/zink/zink_device_info.py
+++ mesa-24.0.3/src/gallium/drivers/zink/zink_device_info.py
@@ -463,14 +463,16 @@ zink_get_physical_device_info(struct zin
// enumerate device supported extensions
VkResult result = screen->vk.EnumerateDeviceExtensionProperties(screen->pdev, NULL, &num_extensions, NULL);
if (result != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateDeviceExtensionProperties failed (%s)", vk_Result_to_str(result));
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateDeviceExtensionProperties failed (%s)", vk_Result_to_str(result));
} else {
if (num_extensions > 0) {
VkExtensionProperties *extensions = MALLOC(sizeof(VkExtensionProperties) * num_extensions);
if (!extensions) goto fail;
result = screen->vk.EnumerateDeviceExtensionProperties(screen->pdev, NULL, &num_extensions, extensions);
if (result != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateDeviceExtensionProperties failed (%s)", vk_Result_to_str(result));
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateDeviceExtensionProperties failed (%s)", vk_Result_to_str(result));
}
for (uint32_t i = 0; i < num_extensions; ++i) {
Index: mesa-24.0.3/src/gallium/drivers/zink/zink_instance.py
===================================================================
--- mesa-24.0.3.orig/src/gallium/drivers/zink/zink_instance.py
+++ mesa-24.0.3/src/gallium/drivers/zink/zink_instance.py
@@ -156,12 +156,14 @@ zink_create_instance(struct zink_screen
// Build up the extensions from the reported ones but only for the unnamed layer
uint32_t extension_count = 0;
if (vk_EnumerateInstanceExtensionProperties(NULL, &extension_count, NULL) != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed");
} else {
VkExtensionProperties *extension_props = malloc(extension_count * sizeof(VkExtensionProperties));
if (extension_props) {
if (vk_EnumerateInstanceExtensionProperties(NULL, &extension_count, extension_props) != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateInstanceExtensionProperties failed");
} else {
for (uint32_t i = 0; i < extension_count; i++) {
%for ext in extensions:
@@ -179,12 +181,14 @@ zink_create_instance(struct zink_screen
uint32_t layer_count = 0;
if (vk_EnumerateInstanceLayerProperties(&layer_count, NULL) != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed");
} else {
VkLayerProperties *layer_props = malloc(layer_count * sizeof(VkLayerProperties));
if (layer_props) {
if (vk_EnumerateInstanceLayerProperties(&layer_count, layer_props) != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumerateInstanceLayerProperties failed");
} else {
for (uint32_t i = 0; i < layer_count; i++) {
%for layer in layers:
@@ -256,7 +260,8 @@ zink_create_instance(struct zink_screen
VkResult err = vk_CreateInstance(&ici, NULL, &screen->instance);
if (err != VK_SUCCESS) {
- mesa_loge("ZINK: vkCreateInstance failed (%s)", vk_Result_to_str(err));
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkCreateInstance failed (%s)", vk_Result_to_str(err));
return false;
}
Index: mesa-24.0.3/src/gallium/drivers/zink/zink_screen.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/drivers/zink/zink_screen.c
+++ mesa-24.0.3/src/gallium/drivers/zink/zink_screen.c
@@ -1606,7 +1606,8 @@ choose_pdev(struct zink_screen *screen,
VkPhysicalDevice *pdevs;
VkResult result = VKSCR(EnumeratePhysicalDevices)(screen->instance, &pdev_count, NULL);
if (result != VK_SUCCESS) {
- mesa_loge("ZINK: vkEnumeratePhysicalDevices failed (%s)", vk_Result_to_str(result));
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumeratePhysicalDevices failed (%s)", vk_Result_to_str(result));
return;
}
@@ -1614,7 +1615,8 @@ choose_pdev(struct zink_screen *screen,
pdevs = malloc(sizeof(*pdevs) * pdev_count);
if (!pdevs) {
- mesa_loge("ZINK: failed to allocate pdevs!");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to allocate pdevs!");
return;
}
result = VKSCR(EnumeratePhysicalDevices)(screen->instance, &pdev_count, pdevs);
@@ -1641,7 +1643,8 @@ choose_pdev(struct zink_screen *screen,
unsigned pdev_count = 1;
VkResult result = VKSCR(EnumeratePhysicalDevices)(screen->instance, &pdev_count, &pdev);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
- mesa_loge("ZINK: vkEnumeratePhysicalDevices failed (%s)", vk_Result_to_str(result));
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: vkEnumeratePhysicalDevices failed (%s)", vk_Result_to_str(result));
return;
}
screen->pdev = pdev;
@@ -3147,10 +3150,12 @@ zink_internal_create_screen(const struct
struct zink_screen *screen = rzalloc(NULL, struct zink_screen);
if (!screen) {
- mesa_loge("ZINK: failed to allocate screen");
+ if (!config->implicit_driver_load)
+ mesa_loge("ZINK: failed to allocate screen");
return NULL;
}
+ screen->implicitly_loaded = config->implicit_driver_load;
screen->drm_fd = -1;
glsl_type_singleton_init_or_ref();
@@ -3170,7 +3175,8 @@ zink_internal_create_screen(const struct
screen->loader_lib = util_dl_open(VK_LIBNAME);
if (!screen->loader_lib) {
- mesa_loge("ZINK: failed to load "VK_LIBNAME);
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to load "VK_LIBNAME);
goto fail;
}
@@ -3178,7 +3184,8 @@ zink_internal_create_screen(const struct
screen->vk_GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)util_dl_get_proc_address(screen->loader_lib, "vkGetDeviceProcAddr");
if (!screen->vk_GetInstanceProcAddr ||
!screen->vk_GetDeviceProcAddr) {
- mesa_loge("ZINK: failed to get proc address");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to get proc address");
goto fail;
}
@@ -3199,7 +3206,8 @@ zink_internal_create_screen(const struct
if (zink_debug & ZINK_DEBUG_VALIDATION) {
if (!screen->instance_info.have_layer_KHRONOS_validation &&
!screen->instance_info.have_layer_LUNARG_standard_validation) {
- mesa_loge("Failed to load validation layer");
+ if (!screen->implicitly_loaded)
+ mesa_loge("Failed to load validation layer");
goto fail;
}
}
@@ -3214,12 +3222,15 @@ zink_internal_create_screen(const struct
zink_verify_instance_extensions(screen);
if (screen->instance_info.have_EXT_debug_utils &&
- (zink_debug & ZINK_DEBUG_VALIDATION) && !create_debug(screen))
- debug_printf("ZINK: failed to setup debug utils\n");
+ (zink_debug & ZINK_DEBUG_VALIDATION) && !create_debug(screen)) {
+ if (!screen->implicitly_loaded)
+ debug_printf("ZINK: failed to setup debug utils\n");
+ }
choose_pdev(screen, dev_major, dev_minor);
if (screen->pdev == VK_NULL_HANDLE) {
- mesa_loge("ZINK: failed to choose pdev");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to choose pdev");
goto fail;
}
screen->is_cpu = screen->info.props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU;
@@ -3234,7 +3245,8 @@ zink_internal_create_screen(const struct
VK_FORMAT_D32_SFLOAT_S8_UINT);
if (!zink_get_physical_device_info(screen)) {
- debug_printf("ZINK: failed to detect features\n");
+ if (!screen->implicitly_loaded)
+ debug_printf("ZINK: failed to detect features\n");
goto fail;
}
@@ -3277,18 +3289,21 @@ zink_internal_create_screen(const struct
setup_renderdoc(screen);
if (screen->threaded_submit && !util_queue_init(&screen->flush_queue, "zfq", 8, 1, UTIL_QUEUE_INIT_RESIZE_IF_FULL, screen)) {
- mesa_loge("zink: Failed to create flush queue.\n");
+ if (!screen->implicitly_loaded)
+ mesa_loge("zink: Failed to create flush queue.\n");
goto fail;
}
zink_internal_setup_moltenvk(screen);
if (!screen->info.have_KHR_timeline_semaphore && !screen->info.feats12.timelineSemaphore) {
- mesa_loge("zink: KHR_timeline_semaphore is required");
+ if (!screen->implicitly_loaded)
+ mesa_loge("zink: KHR_timeline_semaphore is required");
goto fail;
}
if (zink_debug & ZINK_DEBUG_DGC) {
if (!screen->info.have_NV_device_generated_commands) {
- mesa_loge("zink: can't use DGC without NV_device_generated_commands");
+ if (!screen->implicitly_loaded)
+ mesa_loge("zink: can't use DGC without NV_device_generated_commands");
goto fail;
}
}
@@ -3404,14 +3419,16 @@ zink_internal_create_screen(const struct
if (!zink_screen_resource_init(&screen->base))
goto fail;
if (!zink_bo_init(screen)) {
- mesa_loge("ZINK: failed to initialize suballocator");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to initialize suballocator");
goto fail;
}
zink_screen_fence_init(&screen->base);
zink_screen_init_compiler(screen);
if (!disk_cache_init(screen)) {
- mesa_loge("ZINK: failed to initialize disk cache");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to initialize disk cache");
goto fail;
}
if (!util_queue_init(&screen->cache_get_thread, "zcfq", 8, 4,
@@ -3426,12 +3443,14 @@ zink_internal_create_screen(const struct
screen->total_video_mem = get_video_mem(screen);
screen->clamp_video_mem = screen->total_video_mem * 0.8;
if (!os_get_total_physical_memory(&screen->total_mem)) {
- mesa_loge("ZINK: failed to get total physical memory");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to get total physical memory");
goto fail;
}
if (!zink_screen_init_semaphore(screen)) {
- mesa_loge("zink: failed to create timeline semaphore");
+ if (!screen->implicitly_loaded)
+ mesa_loge("zink: failed to create timeline semaphore");
goto fail;
}
@@ -3439,35 +3458,40 @@ zink_internal_create_screen(const struct
{
if (!screen->info.have_EXT_descriptor_buffer) {
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
- mesa_loge("Cannot use db descriptor mode without EXT_descriptor_buffer");
+ if (!screen->implicitly_loaded)
+ mesa_loge("Cannot use db descriptor mode without EXT_descriptor_buffer");
goto fail;
}
can_db = false;
}
if (!screen->resizable_bar) {
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
- mesa_loge("Cannot use db descriptor mode without resizable bar");
+ if (!screen->implicitly_loaded)
+ mesa_loge("Cannot use db descriptor mode without resizable bar");
goto fail;
}
can_db = false;
}
if (!screen->info.have_EXT_non_seamless_cube_map) {
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
- mesa_loge("Cannot use db descriptor mode without EXT_non_seamless_cube_map");
+ if (!screen->implicitly_loaded)
+ mesa_loge("Cannot use db descriptor mode without EXT_non_seamless_cube_map");
goto fail;
}
can_db = false;
}
if (!screen->info.rb2_feats.nullDescriptor) {
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
- mesa_loge("Cannot use db descriptor mode without robustness2.nullDescriptor");
+ if (!screen->implicitly_loaded)
+ mesa_loge("Cannot use db descriptor mode without robustness2.nullDescriptor");
goto fail;
}
can_db = false;
}
if (ZINK_FBFETCH_DESCRIPTOR_SIZE < screen->info.db_props.inputAttachmentDescriptorSize) {
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
- mesa_loge("Cannot use db descriptor mode with inputAttachmentDescriptorSize(%u) > %u", (unsigned)screen->info.db_props.inputAttachmentDescriptorSize, ZINK_FBFETCH_DESCRIPTOR_SIZE);
+ if (!screen->implicitly_loaded)
+ mesa_loge("Cannot use db descriptor mode with inputAttachmentDescriptorSize(%u) > %u", (unsigned)screen->info.db_props.inputAttachmentDescriptorSize, ZINK_FBFETCH_DESCRIPTOR_SIZE);
goto fail;
}
mesa_logw("zink: bug detected: inputAttachmentDescriptorSize(%u) > %u", (unsigned)screen->info.db_props.inputAttachmentDescriptorSize, ZINK_FBFETCH_DESCRIPTOR_SIZE);
@@ -3526,12 +3550,14 @@ zink_internal_create_screen(const struct
zink_init_screen_pipeline_libs(screen);
if (!init_layouts(screen)) {
- mesa_loge("ZINK: failed to initialize layouts");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to initialize layouts");
goto fail;
}
if (!zink_descriptor_layouts_init(screen)) {
- mesa_loge("ZINK: failed to initialize descriptor layouts");
+ if (!screen->implicitly_loaded)
+ mesa_loge("ZINK: failed to initialize descriptor layouts");
goto fail;
}
Index: mesa-24.0.3/src/gallium/drivers/zink/zink_types.h
===================================================================
--- mesa-24.0.3.orig/src/gallium/drivers/zink/zink_types.h
+++ mesa-24.0.3/src/gallium/drivers/zink/zink_types.h
@@ -1408,6 +1408,7 @@ struct zink_screen {
bool is_cpu;
bool abort_on_hang;
bool frame_marker_emitted;
+ bool implicitly_loaded;
uint64_t curr_batch; //the current batch id
uint32_t last_finished;
VkSemaphore sem;