winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2024
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
775 discussions
Start a n
N
ew thread
Rémi Bernon : winevulkan: Use a single allocation for instance and physical devices.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: aaeb221f52052f870fee4b3c59ef4694aaaa7b08 URL:
https://gitlab.winehq.org/wine/wine/-/commit/aaeb221f52052f870fee4b3c59ef46…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Mar 13 18:06:49 2024 +0100 winevulkan: Use a single allocation for instance and physical devices. --- dlls/winevulkan/vulkan.c | 71 ++++++++++++++-------------------------- dlls/winevulkan/vulkan_private.h | 58 ++++++++++++++++---------------- 2 files changed, 54 insertions(+), 75 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 6df610e7e36..b2c386dbd2a 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -217,30 +217,22 @@ static VkBool32 debug_report_callback_conversion(VkDebugReportFlagsEXT flags, Vk return VK_FALSE; } -static void wine_vk_physical_device_free(struct wine_phys_dev *phys_dev) +static void wine_phys_dev_cleanup(struct wine_phys_dev *phys_dev) { - if (!phys_dev) - return; - remove_handle_mapping(phys_dev->instance, &phys_dev->wrapper_entry); free(phys_dev->extensions); - free(phys_dev); } -static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance *instance, - VkPhysicalDevice host_handle, VkPhysicalDevice client_handle) +static VkResult wine_vk_physical_device_init(struct wine_phys_dev *object, VkPhysicalDevice host_handle, + VkPhysicalDevice client_handle, struct wine_instance *instance) { BOOL have_memory_placed = FALSE, have_map_memory2 = FALSE; - struct wine_phys_dev *object; uint32_t num_host_properties, num_properties = 0; VkExtensionProperties *host_properties = NULL; BOOL have_external_memory_host = FALSE; VkResult res; unsigned int i, j; - if (!(object = calloc(1, sizeof(*object)))) - return NULL; - object->instance = instance; object->handle = client_handle; object->host_physical_device = host_handle; @@ -363,12 +355,12 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance } free(host_properties); - return object; + return VK_SUCCESS; err: - wine_vk_physical_device_free(object); + wine_phys_dev_cleanup(object); free(host_properties); - return NULL; + return res; } static void wine_vk_free_command_buffers(struct wine_device *device, @@ -643,7 +635,7 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context * } /* Helper function which stores wrapped physical devices in the instance object. */ -static VkResult wine_vk_instance_load_physical_devices(struct wine_instance *instance) +static VkResult wine_vk_instance_init_physical_devices(struct wine_instance *instance) { VkPhysicalDevice *host_handles; uint32_t phys_dev_count; @@ -676,32 +668,23 @@ static VkResult wine_vk_instance_load_physical_devices(struct wine_instance *ins return res; } - instance->phys_devs = calloc(phys_dev_count, sizeof(*instance->phys_devs)); - if (!instance->phys_devs) - { - free(host_handles); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - /* Wrap each host physical device handle into a dispatchable object for the ICD loader. */ for (i = 0; i < phys_dev_count; i++) { - struct wine_phys_dev *phys_dev = wine_vk_physical_device_alloc(instance, host_handles[i], - &instance->handle->phys_devs[i]); - if (!phys_dev) - { - ERR("Unable to allocate memory for physical device!\n"); - free(host_handles); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - - instance->phys_devs[i] = phys_dev; - instance->phys_dev_count = i + 1; + struct wine_phys_dev *phys_dev = instance->phys_devs + i; + res = wine_vk_physical_device_init(phys_dev, host_handles[i], &instance->handle->phys_devs[i], instance); + if (res != VK_SUCCESS) + goto err; } instance->phys_dev_count = phys_dev_count; free(host_handles); return VK_SUCCESS; + +err: + while (i) wine_phys_dev_cleanup(&instance->phys_devs[--i]); + free(host_handles); + return res; } static struct wine_phys_dev *wine_vk_instance_wrap_physical_device(struct wine_instance *instance, @@ -711,7 +694,7 @@ static struct wine_phys_dev *wine_vk_instance_wrap_physical_device(struct wine_i for (i = 0; i < instance->phys_dev_count; ++i) { - struct wine_phys_dev *current = instance->phys_devs[i]; + struct wine_phys_dev *current = instance->phys_devs + i; if (current->host_physical_device == host_handle) return current; } @@ -724,19 +707,13 @@ static struct wine_phys_dev *wine_vk_instance_wrap_physical_device(struct wine_i */ static void wine_vk_instance_free(struct wine_instance *instance) { + unsigned int i; + if (!instance) return; - if (instance->phys_devs) - { - unsigned int i; - - for (i = 0; i < instance->phys_dev_count; i++) - { - wine_vk_physical_device_free(instance->phys_devs[i]); - } - free(instance->phys_devs); - } + for (i = 0; i < instance->phys_dev_count; i++) + wine_phys_dev_cleanup(&instance->phys_devs[i]); if (instance->host_instance) { @@ -891,7 +868,7 @@ VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, if (allocator) FIXME("Support for allocation callbacks not implemented yet\n"); - if (!(object = calloc(1, sizeof(*object)))) + if (!(object = calloc(1, offsetof(struct wine_instance, phys_devs[client_instance->phys_dev_count])))) { ERR("Failed to allocate memory for instance\n"); return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -928,7 +905,7 @@ VkResult wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, * the host physical devices and present those to the application. * Cleanup happens as part of wine_vkDestroyInstance. */ - res = wine_vk_instance_load_physical_devices(object); + res = wine_vk_instance_init_physical_devices(object); if (res != VK_SUCCESS) { ERR("Failed to load physical devices, res=%d\n", res); @@ -1102,7 +1079,7 @@ VkResult wine_vkEnumeratePhysicalDevices(VkInstance handle, uint32_t *count, VkP *count = min(*count, instance->phys_dev_count); for (i = 0; i < *count; i++) { - devices[i] = instance->phys_devs[i]->handle; + devices[i] = instance->phys_devs[i].handle; } TRACE("Returning %u devices.\n", *count); diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 31e9e981168..f65b285e02a 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -109,6 +109,30 @@ struct wine_debug_report_callback struct wrapper_entry wrapper_entry; }; +struct wine_phys_dev +{ + struct wine_instance *instance; /* parent */ + + VkPhysicalDevice handle; /* client physical device */ + VkPhysicalDevice host_physical_device; + + VkPhysicalDeviceMemoryProperties memory_properties; + VkExtensionProperties *extensions; + uint32_t extension_count; + + uint32_t external_memory_align; + uint32_t map_placed_align; + + struct wrapper_entry wrapper_entry; +}; + +static inline struct wine_phys_dev *wine_phys_dev_from_handle(VkPhysicalDevice handle) +{ + return (struct wine_phys_dev *)(uintptr_t)handle->base.unix_handle; +} + +struct wine_debug_report_callback; + struct wine_instance { struct vulkan_instance_funcs funcs; @@ -116,12 +140,6 @@ struct wine_instance VkInstance handle; /* client instance */ VkInstance host_instance; - /* We cache devices as we need to wrap them as they are - * dispatchable objects. - */ - struct wine_phys_dev **phys_devs; - uint32_t phys_dev_count; - VkBool32 enable_win32_surface; VkBool32 enable_wrapper_list; struct rb_tree wrappers; @@ -135,35 +153,19 @@ struct wine_instance unsigned int quirks; struct wrapper_entry wrapper_entry; + + /* We cache devices as we need to wrap them as they are dispatchable objects. */ + uint32_t phys_dev_count; + struct wine_phys_dev phys_devs[]; }; +C_ASSERT(sizeof(struct wine_instance) == offsetof(struct wine_instance, phys_devs[0])); + static inline struct wine_instance *wine_instance_from_handle(VkInstance handle) { return (struct wine_instance *)(uintptr_t)handle->base.unix_handle; } -struct wine_phys_dev -{ - struct wine_instance *instance; /* parent */ - - VkPhysicalDevice handle; /* client physical device */ - VkPhysicalDevice host_physical_device; - - VkPhysicalDeviceMemoryProperties memory_properties; - VkExtensionProperties *extensions; - uint32_t extension_count; - - uint32_t external_memory_align; - uint32_t map_placed_align; - - struct wrapper_entry wrapper_entry; -}; - -static inline struct wine_phys_dev *wine_phys_dev_from_handle(VkPhysicalDevice handle) -{ - return (struct wine_phys_dev *)(uintptr_t)handle->base.unix_handle; -} - struct wine_cmd_pool { VkCommandPool handle;
1
0
0
0
Rémi Bernon : winevulkan: Rename wine_vk_physical_device_alloc parameters and variables.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: bda48ed85e520a19485e978274d3a2a107cb9e84 URL:
https://gitlab.winehq.org/wine/wine/-/commit/bda48ed85e520a19485e978274d3a2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Mar 13 18:05:19 2024 +0100 winevulkan: Rename wine_vk_physical_device_alloc parameters and variables. --- dlls/winevulkan/vulkan.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 995b059fd54..6df610e7e36 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -228,7 +228,7 @@ static void wine_vk_physical_device_free(struct wine_phys_dev *phys_dev) } static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance *instance, - VkPhysicalDevice phys_dev, VkPhysicalDevice handle) + VkPhysicalDevice host_handle, VkPhysicalDevice client_handle) { BOOL have_memory_placed = FALSE, have_map_memory2 = FALSE; struct wine_phys_dev *object; @@ -242,15 +242,15 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance return NULL; object->instance = instance; - object->handle = handle; - object->host_physical_device = phys_dev; + object->handle = client_handle; + object->host_physical_device = host_handle; - handle->base.unix_handle = (uintptr_t)object; - add_handle_mapping_ptr(instance, handle, phys_dev, &object->wrapper_entry); + client_handle->base.unix_handle = (uintptr_t)object; + add_handle_mapping_ptr(instance, client_handle, host_handle, &object->wrapper_entry); - instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(phys_dev, &object->memory_properties); + instance->funcs.p_vkGetPhysicalDeviceMemoryProperties(host_handle, &object->memory_properties); - res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(phys_dev, + res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(host_handle, NULL, &num_host_properties, NULL); if (res != VK_SUCCESS) { @@ -265,7 +265,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance goto err; } - res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(phys_dev, + res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(host_handle, NULL, &num_host_properties, host_properties); if (res != VK_SUCCESS) { @@ -325,7 +325,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance .pNext = &map_placed_feature, }; - instance->funcs.p_vkGetPhysicalDeviceFeatures2KHR(phys_dev, &features); + instance->funcs.p_vkGetPhysicalDeviceFeatures2KHR(host_handle, &features); if (map_placed_feature.memoryMapPlaced && map_placed_feature.memoryUnmapReserve) { VkPhysicalDeviceMapMemoryPlacedPropertiesEXT map_placed_props = @@ -338,7 +338,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance .pNext = &map_placed_props, }; - instance->funcs.p_vkGetPhysicalDeviceProperties2(phys_dev, &props); + instance->funcs.p_vkGetPhysicalDeviceProperties2(host_handle, &props); object->map_placed_align = map_placed_props.minPlacedMemoryMapAlignment; TRACE( "Using placed map with alignment %u\n", object->map_placed_align ); } @@ -355,7 +355,7 @@ static struct wine_phys_dev *wine_vk_physical_device_alloc(struct wine_instance .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &host_mem_props, }; - instance->funcs.p_vkGetPhysicalDeviceProperties2KHR(phys_dev, &props); + instance->funcs.p_vkGetPhysicalDeviceProperties2KHR(host_handle, &props); object->external_memory_align = host_mem_props.minImportedHostPointerAlignment; if (object->external_memory_align) TRACE("Using VK_EXT_external_memory_host for memory mapping with alignment: %u\n", @@ -645,7 +645,7 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context * /* Helper function which stores wrapped physical devices in the instance object. */ static VkResult wine_vk_instance_load_physical_devices(struct wine_instance *instance) { - VkPhysicalDevice *tmp_phys_devs; + VkPhysicalDevice *host_handles; uint32_t phys_dev_count; unsigned int i; VkResult res; @@ -666,32 +666,32 @@ static VkResult wine_vk_instance_load_physical_devices(struct wine_instance *ins } instance->handle->phys_dev_count = phys_dev_count; - if (!(tmp_phys_devs = calloc(phys_dev_count, sizeof(*tmp_phys_devs)))) + if (!(host_handles = calloc(phys_dev_count, sizeof(*host_handles)))) return VK_ERROR_OUT_OF_HOST_MEMORY; - res = instance->funcs.p_vkEnumeratePhysicalDevices(instance->host_instance, &phys_dev_count, tmp_phys_devs); + res = instance->funcs.p_vkEnumeratePhysicalDevices(instance->host_instance, &phys_dev_count, host_handles); if (res != VK_SUCCESS) { - free(tmp_phys_devs); + free(host_handles); return res; } instance->phys_devs = calloc(phys_dev_count, sizeof(*instance->phys_devs)); if (!instance->phys_devs) { - free(tmp_phys_devs); + free(host_handles); return VK_ERROR_OUT_OF_HOST_MEMORY; } /* Wrap each host physical device handle into a dispatchable object for the ICD loader. */ for (i = 0; i < phys_dev_count; i++) { - struct wine_phys_dev *phys_dev = wine_vk_physical_device_alloc(instance, tmp_phys_devs[i], + struct wine_phys_dev *phys_dev = wine_vk_physical_device_alloc(instance, host_handles[i], &instance->handle->phys_devs[i]); if (!phys_dev) { ERR("Unable to allocate memory for physical device!\n"); - free(tmp_phys_devs); + free(host_handles); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -700,22 +700,22 @@ static VkResult wine_vk_instance_load_physical_devices(struct wine_instance *ins } instance->phys_dev_count = phys_dev_count; - free(tmp_phys_devs); + free(host_handles); return VK_SUCCESS; } static struct wine_phys_dev *wine_vk_instance_wrap_physical_device(struct wine_instance *instance, - VkPhysicalDevice physical_device) + VkPhysicalDevice host_handle) { unsigned int i; for (i = 0; i < instance->phys_dev_count; ++i) { struct wine_phys_dev *current = instance->phys_devs[i]; - if (current->host_physical_device == physical_device) return current; + if (current->host_physical_device == host_handle) return current; } - ERR("Unrecognized physical device %p.\n", physical_device); + ERR("Unrecognized physical device %p.\n", host_handle); return NULL; } @@ -1221,8 +1221,8 @@ static VkResult wine_vk_enumerate_physical_device_groups(struct wine_instance *i VkPhysicalDeviceGroupProperties *current = &properties[i]; for (j = 0; j < current->physicalDeviceCount; ++j) { - VkPhysicalDevice dev = current->physicalDevices[j]; - struct wine_phys_dev *phys_dev = wine_vk_instance_wrap_physical_device(instance, dev); + VkPhysicalDevice host_handle = current->physicalDevices[j]; + struct wine_phys_dev *phys_dev = wine_vk_instance_wrap_physical_device(instance, host_handle); if (!phys_dev) return VK_ERROR_INITIALIZATION_FAILED; current->physicalDevices[j] = phys_dev->handle;
1
0
0
0
Rémi Bernon : winevulkan: Pass VkDeviceQueueCreateInfo to wine_vk_device_init_queues.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 3b390276552de90a1850bce7e3f8b8b4dcb501b4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/3b390276552de90a1850bce7e3f8b8…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Feb 22 12:18:28 2024 +0100 winevulkan: Pass VkDeviceQueueCreateInfo to wine_vk_device_init_queues. --- dlls/winevulkan/vulkan.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index a6169f4f824..995b059fd54 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -391,40 +391,41 @@ static void wine_vk_free_command_buffers(struct wine_device *device, } } -static void wine_vk_device_get_queues(struct wine_device *device, - uint32_t family_index, uint32_t queue_count, VkDeviceQueueCreateFlags flags, - struct wine_queue *queues, VkQueue *handles) +static void wine_vk_device_init_queues(struct wine_device *device, const VkDeviceQueueCreateInfo *info, + VkQueue *handles) { VkDeviceQueueInfo2 queue_info; - unsigned int i; + UINT i; + + TRACE("Queue family index %u, queue count %u.\n", info->queueFamilyIndex, info->queueCount); - for (i = 0; i < queue_count; i++) + for (i = 0; i < info->queueCount; i++) { - struct wine_queue *queue = &queues[i]; + struct wine_queue *queue = device->queues + device->queue_count + i; queue->device = device; queue->handle = (*handles)++; - queue->family_index = family_index; + queue->family_index = info->queueFamilyIndex; queue->queue_index = i; - queue->flags = flags; + queue->flags = info->flags; /* The Vulkan spec says: * * "vkGetDeviceQueue must only be used to get queues that were created * with the flags parameter of VkDeviceQueueCreateInfo set to zero." */ - if (flags && device->funcs.p_vkGetDeviceQueue2) + if (info->flags && device->funcs.p_vkGetDeviceQueue2) { queue_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2; queue_info.pNext = NULL; - queue_info.flags = flags; - queue_info.queueFamilyIndex = family_index; + queue_info.flags = info->flags; + queue_info.queueFamilyIndex = info->queueFamilyIndex; queue_info.queueIndex = i; device->funcs.p_vkGetDeviceQueue2(device->host_device, &queue_info, &queue->host_queue); } else { - device->funcs.p_vkGetDeviceQueue(device->host_device, family_index, i, &queue->host_queue); + device->funcs.p_vkGetDeviceQueue(device->host_device, info->queueFamilyIndex, i, &queue->host_queue); } queue->handle->base.unix_handle = (uintptr_t)queue; @@ -432,6 +433,8 @@ static void wine_vk_device_get_queues(struct wine_device *device, TRACE("Got device %p queue %p, host_queue %p.\n", device, queue, queue->host_queue); } + + device->queue_count += info->queueCount; } static const char *find_extension(const char *const *extensions, uint32_t count, const char *ext) @@ -807,7 +810,6 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre VkDevice device_handle = client_ptr; VkDeviceCreateInfo create_info_host; struct VkQueue_T *queue_handles; - struct wine_queue *next_queue; struct conversion_context ctx; struct wine_device *object; unsigned int queue_count, i; @@ -859,20 +861,9 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre ALL_VK_DEVICE_FUNCS() #undef USE_VK_FUNC - next_queue = object->queues; queue_handles = device_handle->queues; for (i = 0; i < create_info_host.queueCreateInfoCount; i++) - { - uint32_t flags = create_info_host.pQueueCreateInfos[i].flags; - uint32_t family_index = create_info_host.pQueueCreateInfos[i].queueFamilyIndex; - uint32_t queue_count = create_info_host.pQueueCreateInfos[i].queueCount; - - TRACE("Queue family index %u, queue count %u.\n", family_index, queue_count); - - wine_vk_device_get_queues(object, family_index, queue_count, flags, next_queue, &queue_handles); - next_queue += queue_count; - } - object->queue_count = next_queue - object->queues; + wine_vk_device_init_queues(object, create_info_host.pQueueCreateInfos + i, &queue_handles); device_handle->quirks = instance->quirks; device_handle->base.unix_handle = (uintptr_t)object;
1
0
0
0
Rémi Bernon : winevulkan: Use a single allocation for device and queues.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 5ef47e916ade51dc6634c5d5bdbe9e0c65949de3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5ef47e916ade51dc6634c5d5bdbe9e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Mar 13 17:53:19 2024 +0100 winevulkan: Use a single allocation for device and queues. --- dlls/winevulkan/vulkan.c | 38 ++++++++++----------------------- dlls/winevulkan/vulkan_private.h | 46 +++++++++++++++++++++------------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 39ecf1698b2..a6169f4f824 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -511,22 +511,15 @@ static VkResult wine_vk_device_convert_create_info(struct wine_phys_dev *phys_de */ static void wine_vk_device_free(struct wine_device *device) { - struct wine_queue *queue; + unsigned int i; if (!device) return; - if (device->queues) + for (i = 0; i < device->queue_count; i++) { - unsigned int i; - for (i = 0; i < device->queue_count; i++) - { - queue = &device->queues[i]; - if (queue && queue->host_queue) - remove_handle_mapping(device->phys_dev->instance, &queue->wrapper_entry); - } - free(device->queues); - device->queues = NULL; + struct wine_queue *queue = device->queues + i; + if (queue->host_queue) remove_handle_mapping(device->phys_dev->instance, &queue->wrapper_entry); } if (device->host_device && device->funcs.p_vkDestroyDevice) @@ -817,7 +810,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre struct wine_queue *next_queue; struct conversion_context ctx; struct wine_device *object; - unsigned int i; + unsigned int queue_count, i; VkResult res; if (allocator) @@ -834,7 +827,11 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre TRACE("Driver version: %#x.\n", properties.driverVersion); } - if (!(object = calloc(1, sizeof(*object)))) + /* We need to cache all queues within the device as each requires wrapping since queues are dispatchable objects. */ + for (queue_count = 0, i = 0; i < create_info->queueCreateInfoCount; i++) + queue_count += create_info->pQueueCreateInfos[i].queueCount; + + if (!(object = calloc(1, offsetof(struct wine_device, queues[queue_count])))) return VK_ERROR_OUT_OF_HOST_MEMORY; object->phys_dev = phys_dev; @@ -862,20 +859,6 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre ALL_VK_DEVICE_FUNCS() #undef USE_VK_FUNC - /* We need to cache all queues within the device as each requires wrapping since queues are - * dispatchable objects. - */ - for (i = 0; i < create_info_host.queueCreateInfoCount; i++) - { - object->queue_count += create_info_host.pQueueCreateInfos[i].queueCount; - } - - if (!(object->queues = calloc(object->queue_count, sizeof(*object->queues)))) - { - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto fail; - } - next_queue = object->queues; queue_handles = device_handle->queues; for (i = 0; i < create_info_host.queueCreateInfoCount; i++) @@ -889,6 +872,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre wine_vk_device_get_queues(object, family_index, queue_count, flags, next_queue, &queue_handles); next_queue += queue_count; } + object->queue_count = next_queue - object->queues; device_handle->quirks = instance->quirks; device_handle->base.unix_handle = (uintptr_t)object; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 7b1e24f3e56..31e9e981168 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -55,6 +55,25 @@ static inline struct wine_cmd_buffer *wine_cmd_buffer_from_handle(VkCommandBuffe return (struct wine_cmd_buffer *)(uintptr_t)handle->base.unix_handle; } +struct wine_queue +{ + struct wine_device *device; /* parent */ + + VkQueue handle; /* client queue */ + VkQueue host_queue; + + uint32_t family_index; + uint32_t queue_index; + VkDeviceQueueCreateFlags flags; + + struct wrapper_entry wrapper_entry; +}; + +static inline struct wine_queue *wine_queue_from_handle(VkQueue handle) +{ + return (struct wine_queue *)(uintptr_t)handle->base.unix_handle; +} + struct wine_device { struct vulkan_device_funcs funcs; @@ -63,12 +82,14 @@ struct wine_device VkDevice handle; /* client device */ VkDevice host_device; - struct wine_queue *queues; - uint32_t queue_count; - struct wrapper_entry wrapper_entry; + + uint32_t queue_count; + struct wine_queue queues[]; }; +C_ASSERT(sizeof(struct wine_device) == offsetof(struct wine_device, queues[0])); + static inline struct wine_device *wine_device_from_handle(VkDevice handle) { return (struct wine_device *)(uintptr_t)handle->base.unix_handle; @@ -143,25 +164,6 @@ static inline struct wine_phys_dev *wine_phys_dev_from_handle(VkPhysicalDevice h return (struct wine_phys_dev *)(uintptr_t)handle->base.unix_handle; } -struct wine_queue -{ - struct wine_device *device; /* parent */ - - VkQueue handle; /* client queue */ - VkQueue host_queue; - - uint32_t family_index; - uint32_t queue_index; - VkDeviceQueueCreateFlags flags; - - struct wrapper_entry wrapper_entry; -}; - -static inline struct wine_queue *wine_queue_from_handle(VkQueue handle) -{ - return (struct wine_queue *)(uintptr_t)handle->base.unix_handle; -} - struct wine_cmd_pool { VkCommandPool handle;
1
0
0
0
Rémi Bernon : winevulkan: Use an rb_tree and allocate entries for handle mappings.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 5bde3f4c97d9d9a1ef0e7aea90c768c1bd79f581 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5bde3f4c97d9d9a1ef0e7aea90c768…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Feb 12 17:19:56 2024 +0100 winevulkan: Use an rb_tree and allocate entries for handle mappings. --- dlls/winevulkan/vulkan.c | 135 +++++++++++++++++++-------------------- dlls/winevulkan/vulkan_private.h | 34 +++++----- 2 files changed, 84 insertions(+), 85 deletions(-)
1
0
0
0
Paul Gofman : ntdll: Only allocate debug info in critical sections with RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 8b3944e1341baaf693927c8b758851d2dbba725a URL:
https://gitlab.winehq.org/wine/wine/-/commit/8b3944e1341baaf693927c8b758851…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Mar 7 16:52:30 2024 -0600 ntdll: Only allocate debug info in critical sections with RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO. --- dlls/kernel32/tests/sync.c | 8 ++++---- dlls/ntdll/sync.c | 8 ++++++-- dlls/ntdll/tests/rtl.c | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 25cf75cd686..c06ced47298 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -2741,7 +2741,7 @@ static void test_crit_section(void) to override that. */ memset(&cs, 0, sizeof(cs)); InitializeCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, + ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); @@ -2755,7 +2755,7 @@ static void test_crit_section(void) memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, 0); ok(ret, "Failed to initialize critical section.\n"); - todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, + ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); @@ -2765,12 +2765,12 @@ static void test_crit_section(void) ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, 0); ok(ret, "Failed to initialize critical section.\n"); - todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, + ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index bb5dcbb66e6..00ab614803f 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -232,7 +232,7 @@ NTSTATUS WINAPI RtlInitializeCriticalSectionEx( RTL_CRITICAL_SECTION *crit, ULON * is done, then debug info should be managed through Rtlp[Allocate|Free]DebugInfo * so (e.g.) MakeCriticalSectionGlobal() doesn't free it using HeapFree(). */ - if (flags & RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO) + if (!(flags & RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO)) crit->DebugInfo = no_debug_info_marker; else { @@ -288,7 +288,11 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ) crit->DebugInfo = NULL; } } - else NtClose( crit->LockSemaphore ); + else + { + NtClose( crit->LockSemaphore ); + crit->DebugInfo = NULL; + } crit->LockSemaphore = 0; return STATUS_SUCCESS; } diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 4a4370d5903..224eeec6df7 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -2973,7 +2973,7 @@ static void test_RtlInitializeCriticalSectionEx(void) memset(&cs, 0x11, sizeof(cs)); pRtlInitializeCriticalSectionEx(&cs, 0, 0); - ok((cs.DebugInfo != NULL && cs.DebugInfo != no_debug) || broken(cs.DebugInfo == no_debug) /* >= Win 8 */, + ok(cs.DebugInfo == no_debug || broken(cs.DebugInfo != NULL && cs.DebugInfo != no_debug) /* < Win8 */, "expected DebugInfo != NULL and DebugInfo != ~0, got %p\n", cs.DebugInfo); ok(cs.LockCount == -1, "expected LockCount == -1, got %ld\n", cs.LockCount); ok(cs.RecursionCount == 0, "expected RecursionCount == 0, got %ld\n", cs.RecursionCount);
1
0
0
0
Paul Gofman : explorer: Force debug info in critical sections.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 9115dc0abadfab6c8b16a3ba310d82a138cbfb3a URL:
https://gitlab.winehq.org/wine/wine/-/commit/9115dc0abadfab6c8b16a3ba310d82…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Mar 7 16:32:28 2024 -0600 explorer: Force debug info in critical sections. --- programs/explorer/desktop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 4e8f9a84c07..25bba7cb7cb 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -2402,7 +2402,7 @@ static void shellwindows_init(void) CoInitialize(NULL); shellwindows.IShellWindows_iface.lpVtbl = &shellwindowsvtbl; - InitializeCriticalSection(&shellwindows.cs); + InitializeCriticalSectionEx(&shellwindows.cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); shellwindows.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": shellwindows.cs"); hr = CoRegisterClassObject(&CLSID_ShellWindows,
1
0
0
0
Paul Gofman : services: Force debug info in critical sections.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 95b0e65b079bee3dd30248e127d0d62841e24266 URL:
https://gitlab.winehq.org/wine/wine/-/commit/95b0e65b079bee3dd30248e127d0d6…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Mar 7 16:31:23 2024 -0600 services: Force debug info in critical sections. --- programs/services/services.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/services/services.c b/programs/services/services.c index b45022eaec8..273a146c784 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -667,7 +667,7 @@ static DWORD scmdatabase_create(struct scmdatabase **db) list_init(&(*db)->processes); list_init(&(*db)->services); - InitializeCriticalSection(&(*db)->cs); + InitializeCriticalSectionEx(&(*db)->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); (*db)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": scmdatabase"); err = RegCreateKeyExW(HKEY_LOCAL_MACHINE, SZ_SERVICES_KEY, 0, NULL,
1
0
0
0
Paul Gofman : qasf: Force debug info in critical sections.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: 90ee219c44d4a3a78051e27d1a6d4520088acb6b URL:
https://gitlab.winehq.org/wine/wine/-/commit/90ee219c44d4a3a78051e27d1a6d45…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Mar 7 16:27:00 2024 -0600 qasf: Force debug info in critical sections. --- dlls/qasf/asfreader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 7a832e9a718..91fdc6fbb34 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -1038,7 +1038,7 @@ HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) strmbase_filter_init(&object->filter, outer, &CLSID_WMAsfReader, &filter_ops); object->IFileSourceFilter_iface.lpVtbl = &file_source_vtbl; - InitializeCriticalSection(&object->status_cs); + InitializeCriticalSectionEx(&object->status_cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); object->status_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": status_cs"); TRACE("Created WM ASF reader %p.\n", object);
1
0
0
0
Paul Gofman : dsdmo: Force debug info in critical sections.
by Alexandre Julliard
14 Mar '24
14 Mar '24
Module: wine Branch: master Commit: c4ab638083cacca88d2223f0cd357fdfb3115abb URL:
https://gitlab.winehq.org/wine/wine/-/commit/c4ab638083cacca88d2223f0cd357f…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Mar 7 16:26:37 2024 -0600 dsdmo: Force debug info in critical sections. --- dlls/dsdmo/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/dsdmo/main.c b/dlls/dsdmo/main.c index 77345b1b5d1..d6f36b53159 100644 --- a/dlls/dsdmo/main.c +++ b/dlls/dsdmo/main.c @@ -588,7 +588,7 @@ static void effect_init(struct effect *effect, IUnknown *outer, const struct eff effect->IMediaParams_iface.lpVtbl = &effect_media_params_vtbl; effect->IMediaParamInfo_iface.lpVtbl = &effect_media_param_info_vtbl; - InitializeCriticalSection(&effect->cs); + InitializeCriticalSectionEx(&effect->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); effect->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": effect.cs"); effect->ops = ops;
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200