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
May 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
705 discussions
Start a n
N
ew thread
Rémi Bernon : win32u: Enumerate offscreen vulkan devices as GPU devices.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: c2bdb4cf28370c336279927287d4fa385907a649 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c2bdb4cf28370c336279927287d4fa…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu May 2 16:26:17 2024 +0200 win32u: Enumerate offscreen vulkan devices as GPU devices. --- dlls/win32u/sysparams.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 07aa44e02be..c6eb09c4268 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1994,6 +1994,18 @@ static UINT update_display_devices( BOOL force, struct device_manager_ctx *ctx ) return status; } +static void add_vulkan_only_gpus( struct device_manager_ctx *ctx ) +{ + struct list gpus = LIST_INIT(gpus); + struct vulkan_gpu *gpu, *next; + + LIST_FOR_EACH_ENTRY_SAFE( gpu, next, &ctx->vulkan_gpus, struct vulkan_gpu, entry ) + { + TRACE( "adding vulkan-only gpu uuid %s, name %s\n", debugstr_guid(&gpu->uuid), debugstr_a(gpu->name)); + add_gpu( gpu->name, &gpu->pci_id, &gpu->uuid, ctx ); + } +} + BOOL update_display_cache( BOOL force ) { static const WCHAR wine_service_station_name[] = @@ -2016,7 +2028,8 @@ BOOL update_display_cache( BOOL force ) if (!get_vulkan_gpus( &ctx.vulkan_gpus )) WARN( "Failed to find any vulkan GPU\n" ); - status = update_display_devices( force, &ctx ); + if (!(status = update_display_devices( force, &ctx ))) + add_vulkan_only_gpus( &ctx ); release_display_manager_ctx( &ctx ); if (status && status != STATUS_ALREADY_COMPLETE) WARN( "Failed to update display devices, status %#x\n", status );
1
0
0
0
Rémi Bernon : win32u: Query GPU memory from vulkan physical device.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 1e21f3000725143ea5a9732a71cfafcf4e75820e URL:
https://gitlab.winehq.org/wine/wine/-/commit/1e21f3000725143ea5a9732a71cfaf…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Apr 22 18:28:39 2024 +0200 win32u: Query GPU memory from vulkan physical device. --- dlls/win32u/d3dkmt.c | 11 +++++++++++ dlls/win32u/sysparams.c | 7 +++---- dlls/win32u/win32u_private.h | 1 + dlls/wineandroid.drv/init.c | 2 +- dlls/winemac.drv/display.c | 2 +- dlls/winewayland.drv/display.c | 2 +- dlls/winex11.drv/display.c | 3 +-- dlls/winex11.drv/x11drv.h | 1 - dlls/winex11.drv/xrandr.c | 12 +----------- include/wine/gdi_driver.h | 2 +- 10 files changed, 21 insertions(+), 22 deletions(-) diff --git a/dlls/win32u/d3dkmt.c b/dlls/win32u/d3dkmt.c index a016c735f13..b644135bfa1 100644 --- a/dlls/win32u/d3dkmt.c +++ b/dlls/win32u/d3dkmt.c @@ -61,6 +61,7 @@ static struct list d3dkmt_vidpn_sources = LIST_INIT( d3dkmt_vidpn_sources ); / static VkInstance d3dkmt_vk_instance; /* Vulkan instance for D3DKMT functions */ static PFN_vkGetPhysicalDeviceMemoryProperties2KHR pvkGetPhysicalDeviceMemoryProperties2KHR; +static PFN_vkGetPhysicalDeviceMemoryProperties pvkGetPhysicalDeviceMemoryProperties; static PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR; static PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices; static const struct vulkan_funcs *vulkan_funcs; @@ -107,6 +108,7 @@ static void d3dkmt_init_vulkan(void) } LOAD_VK_FUNC( vkEnumeratePhysicalDevices ) LOAD_VK_FUNC( vkGetPhysicalDeviceProperties2KHR ) + LOAD_VK_FUNC( vkGetPhysicalDeviceMemoryProperties ) LOAD_VK_FUNC( vkGetPhysicalDeviceMemoryProperties2KHR ) #undef LOAD_VK_FUNC } @@ -570,6 +572,7 @@ BOOL get_vulkan_gpus( struct list *gpus ) { VkPhysicalDeviceIDProperties id = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES}; VkPhysicalDeviceProperties2 properties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &id}; + VkPhysicalDeviceMemoryProperties mem_properties; struct vulkan_gpu *gpu; if (!(gpu = calloc( 1, sizeof(*gpu) ))) break; @@ -578,6 +581,14 @@ BOOL get_vulkan_gpus( struct list *gpus ) gpu->name = strdup( properties2.properties.deviceName ); gpu->pci_id.vendor = properties2.properties.vendorID; gpu->pci_id.device = properties2.properties.deviceID; + + pvkGetPhysicalDeviceMemoryProperties( devices[i], &mem_properties ); + for (i = 0; i < mem_properties.memoryHeapCount; i++) + { + if (mem_properties.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) + gpu->memory += mem_properties.memoryHeaps[i].size; + } + list_add_tail( gpus, &gpu->entry ); } diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 4c122fb3bd8..07aa44e02be 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1206,8 +1206,7 @@ static struct vulkan_gpu *find_vulkan_gpu_from_pci_id( const struct device_manag return NULL; } -static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, - ULONGLONG memory_size, void *param ) +static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, void *param ) { struct device_manager_ctx *ctx = param; char buffer[4096]; @@ -1294,7 +1293,7 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * NtClose( hkey ); - if (!write_gpu_to_registry( &ctx->gpu, pci_id, memory_size )) + if (!write_gpu_to_registry( &ctx->gpu, pci_id, vulkan_gpu ? vulkan_gpu->memory : 0 )) WARN( "Failed to write gpu to registry\n" ); else ctx->gpu_count++; @@ -1799,7 +1798,7 @@ static NTSTATUS default_update_display_devices( BOOL force, struct device_manage if (!force) return STATUS_ALREADY_COMPLETE; - add_gpu( "Default GPU", &pci_id, NULL, 0, ctx ); + add_gpu( "Default GPU", &pci_id, NULL, ctx ); add_source( "Default", source_flags, ctx ); if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &mode )) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 8bb280c4611..8c6542a06b8 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -198,6 +198,7 @@ struct vulkan_gpu struct pci_id pci_id; char *name; GUID uuid; + ULONGLONG memory; }; extern BOOL get_vulkan_gpus( struct list *gpus ); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 9a06d8f147b..44a10b567e5 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -289,7 +289,7 @@ UINT ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag }; DEVMODEW current = mode; - device_manager->add_gpu( "Android GPU", &pci_id, NULL, 0, param ); + device_manager->add_gpu( "Android GPU", &pci_id, NULL, param ); device_manager->add_source( "Default", source_flags, param ); device_manager->add_monitor( &gdi_monitor, param ); diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index cc580e155ef..57489c766f0 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1155,7 +1155,7 @@ UINT macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage .subsystem = gpu->subsys_id, .revision = gpu->revision_id, }; - device_manager->add_gpu(gpu->name, &pci_id, NULL, 0, param); + device_manager->add_gpu(gpu->name, &pci_id, NULL, param); /* Initialize adapters */ if (macdrv_get_adapters(gpu->id, &adapters, &adapter_count)) break; diff --git a/dlls/winewayland.drv/display.c b/dlls/winewayland.drv/display.c index a1dc925a183..dfe2689006c 100644 --- a/dlls/winewayland.drv/display.c +++ b/dlls/winewayland.drv/display.c @@ -206,7 +206,7 @@ static void wayland_add_device_gpu(const struct gdi_device_manager *device_manag TRACE("\n"); - device_manager->add_gpu("Wayland GPU", &pci_id, NULL, 0, param); + device_manager->add_gpu("Wayland GPU", &pci_id, NULL, param); } static void wayland_add_device_source(const struct gdi_device_manager *device_manager, diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 861146d3e90..237aa047321 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -517,8 +517,7 @@ UINT X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage for (gpu = 0; gpu < gpu_count; gpu++) { - device_manager->add_gpu( gpus[gpu].name, &gpus[gpu].pci_id, &gpus[gpu].vulkan_uuid, - gpus[gpu].memory_size, param ); + device_manager->add_gpu( gpus[gpu].name, &gpus[gpu].pci_id, &gpus[gpu].vulkan_uuid, param ); /* Initialize adapters */ if (!host_handler.get_adapters( gpus[gpu].id, &adapters, &adapter_count )) break; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 5c9592705b8..1aaba9bf24b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -770,7 +770,6 @@ struct x11drv_gpu char *name; struct pci_id pci_id; GUID vulkan_uuid; - ULONGLONG memory_size; }; struct x11drv_adapter diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 6cc3c277213..03b2b21a98b 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -645,11 +645,9 @@ static BOOL get_gpu_properties_from_vulkan( struct x11drv_gpu *gpu, const XRRPro VkResult (*pvkGetRandROutputDisplayEXT)( VkPhysicalDevice, Display *, RROutput, VkDisplayKHR * ); PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR; PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices; - PFN_vkGetPhysicalDeviceMemoryProperties pvkGetPhysicalDeviceMemoryProperties; - uint32_t device_count, device_idx, output_idx, heap_idx, i; + uint32_t device_count, device_idx, output_idx, i; VkPhysicalDevice *vk_physical_devices = NULL; VkPhysicalDeviceProperties2 properties2; - VkPhysicalDeviceMemoryProperties mem_properties; PFN_vkCreateInstance pvkCreateInstance; VkInstanceCreateInfo create_info; VkPhysicalDeviceIDProperties id; @@ -685,7 +683,6 @@ static BOOL get_gpu_properties_from_vulkan( struct x11drv_gpu *gpu, const XRRPro LOAD_VK_FUNC(vkEnumeratePhysicalDevices) LOAD_VK_FUNC(vkGetPhysicalDeviceProperties2KHR) LOAD_VK_FUNC(vkGetRandROutputDisplayEXT) - LOAD_VK_FUNC(vkGetPhysicalDeviceMemoryProperties) #undef LOAD_VK_FUNC vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, NULL ); @@ -743,13 +740,6 @@ static BOOL get_gpu_properties_from_vulkan( struct x11drv_gpu *gpu, const XRRPro } gpu->name = strdup( properties2.properties.deviceName ); - pvkGetPhysicalDeviceMemoryProperties( vk_physical_devices[device_idx], &mem_properties ); - for (heap_idx = 0; heap_idx < mem_properties.memoryHeapCount; heap_idx++) - { - if (mem_properties.memoryHeaps[heap_idx].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) - gpu->memory_size += mem_properties.memoryHeaps[heap_idx].size; - } - ret = TRUE; goto done; } diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index c299dc2ae42..21298587267 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -255,7 +255,7 @@ struct gdi_monitor struct gdi_device_manager { - void (*add_gpu)( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, ULONGLONG memory_size, void *param ); + void (*add_gpu)( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, void *param ); void (*add_source)( const char *name, UINT state_flags, void *param ); void (*add_monitor)( const struct gdi_monitor *monitor, void *param ); void (*add_modes)( const DEVMODEW *current, UINT modes_count, const DEVMODEW *modes, void *param );
1
0
0
0
Rémi Bernon : win32u: Match driver GPUs with vulkan GPUS from their ids, or index.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 73ad5443541517da89616f8b5b3e47cce35e1ead URL:
https://gitlab.winehq.org/wine/wine/-/commit/73ad5443541517da89616f8b5b3e47…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Apr 22 16:23:54 2024 +0200 win32u: Match driver GPUs with vulkan GPUS from their ids, or index. --- dlls/win32u/sysparams.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index bc86f72f345..4c122fb3bd8 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1184,12 +1184,36 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p return TRUE; } +static struct vulkan_gpu *find_vulkan_gpu_from_uuid( const struct device_manager_ctx *ctx, const GUID *uuid ) +{ + struct vulkan_gpu *gpu; + + if (!uuid) return NULL; + + LIST_FOR_EACH_ENTRY( gpu, &ctx->vulkan_gpus, struct vulkan_gpu, entry ) + if (!memcmp( &gpu->uuid, uuid, sizeof(*uuid) )) return gpu; + + return NULL; +} + +static struct vulkan_gpu *find_vulkan_gpu_from_pci_id( const struct device_manager_ctx *ctx, const struct pci_id *pci_id ) +{ + struct vulkan_gpu *gpu; + + LIST_FOR_EACH_ENTRY( gpu, &ctx->vulkan_gpus, struct vulkan_gpu, entry ) + if (gpu->pci_id.vendor == pci_id->vendor && gpu->pci_id.device == pci_id->device) return gpu; + + return NULL; +} + static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID *vulkan_uuid, ULONGLONG memory_size, void *param ) { struct device_manager_ctx *ctx = param; char buffer[4096]; KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer; + struct vulkan_gpu *vulkan_gpu = NULL; + struct list *ptr; unsigned int i; HKEY hkey, subkey; DWORD len; @@ -1209,7 +1233,24 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * memset( &ctx->gpu, 0, sizeof(ctx->gpu) ); ctx->gpu.index = ctx->gpu_count; + + if ((vulkan_gpu = find_vulkan_gpu_from_uuid( ctx, vulkan_uuid ))) + TRACE( "Found vulkan GPU matching uuid %s, pci_id %#04x:%#04x, name %s\n", debugstr_guid(&vulkan_gpu->uuid), + pci_id->vendor, pci_id->device, debugstr_a(vulkan_gpu->name)); + else if ((vulkan_gpu = find_vulkan_gpu_from_pci_id( ctx, pci_id ))) + TRACE( "Found vulkan GPU matching pci_id %#04x:%#04x, uuid %s, name %s\n", pci_id->vendor, pci_id->device, + debugstr_guid(&vulkan_gpu->uuid), debugstr_a(vulkan_gpu->name)); + else if ((ptr = list_head( &ctx->vulkan_gpus ))) + { + vulkan_gpu = LIST_ENTRY( ptr, struct vulkan_gpu, entry ); + WARN( "Using vulkan GPU pci_id %#04x:%#04x, uuid %s, name %s\n", pci_id->vendor, pci_id->device, + debugstr_guid(&vulkan_gpu->uuid), debugstr_a(vulkan_gpu->name)); + } + if (vulkan_uuid) ctx->gpu.vulkan_uuid = *vulkan_uuid; + else if (vulkan_gpu) ctx->gpu.vulkan_uuid = vulkan_gpu->uuid; + + if (!name && vulkan_gpu) name = vulkan_gpu->name; if (name) RtlUTF8ToUnicodeN( ctx->gpu.name, sizeof(ctx->gpu.name) - sizeof(WCHAR), &len, name, strlen( name ) ); snprintf( ctx->gpu.path, sizeof(ctx->gpu.path), "PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\\%08X", @@ -1257,6 +1298,12 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * WARN( "Failed to write gpu to registry\n" ); else ctx->gpu_count++; + + if (vulkan_gpu) + { + list_remove( &vulkan_gpu->entry ); + free_vulkan_gpu( vulkan_gpu ); + } } static BOOL write_source_to_registry( const struct source *source, HKEY *source_key )
1
0
0
0
Rémi Bernon : win32u: Keep a list of vulkan GPUS in the device manager context.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: de87343d20ceff4d1ee30f757fa3deb6d68d278d URL:
https://gitlab.winehq.org/wine/wine/-/commit/de87343d20ceff4d1ee30f757fa3de…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Apr 22 16:23:54 2024 +0200 win32u: Keep a list of vulkan GPUS in the device manager context. --- dlls/win32u/d3dkmt.c | 59 +++++++++++++++++++++++++++++++++++++------- dlls/win32u/sysparams.c | 12 ++++++++- dlls/win32u/win32u_private.h | 11 +++++++++ 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/dlls/win32u/d3dkmt.c b/dlls/win32u/d3dkmt.c index e75a29e0934..a016c735f13 100644 --- a/dlls/win32u/d3dkmt.c +++ b/dlls/win32u/d3dkmt.c @@ -189,28 +189,36 @@ NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromDeviceName( D3DKMT_OPENADAPTERFROMDEVIC return STATUS_SUCCESS; } -static VkPhysicalDevice get_vulkan_physical_device( const GUID *uuid ) +static UINT get_vulkan_physical_devices( VkPhysicalDevice **devices ) { - VkPhysicalDevice *devices, device; - UINT device_count, i; + UINT device_count; VkResult vr; if ((vr = pvkEnumeratePhysicalDevices( d3dkmt_vk_instance, &device_count, NULL ))) { WARN( "vkEnumeratePhysicalDevices returned %d\n", vr ); - return VK_NULL_HANDLE; + return 0; } - if (!device_count || !(devices = malloc( device_count * sizeof(*devices) ))) - return VK_NULL_HANDLE; + if (!device_count || !(*devices = malloc( device_count * sizeof(**devices) ))) return 0; - if ((vr = pvkEnumeratePhysicalDevices( d3dkmt_vk_instance, &device_count, devices ))) + if ((vr = pvkEnumeratePhysicalDevices( d3dkmt_vk_instance, &device_count, *devices ))) { WARN( "vkEnumeratePhysicalDevices returned %d\n", vr ); - free( devices ); - return VK_NULL_HANDLE; + free( *devices ); + return 0; } + return device_count; +} + +static VkPhysicalDevice get_vulkan_physical_device( const GUID *uuid ) +{ + VkPhysicalDevice *devices, device; + UINT device_count, i; + + if (!(device_count = get_vulkan_physical_devices( &devices ))) return VK_NULL_HANDLE; + for (i = 0, device = VK_NULL_HANDLE; i < device_count; ++i) { VkPhysicalDeviceIDProperties id = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES}; @@ -549,3 +557,36 @@ NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNE pthread_mutex_unlock( &d3dkmt_lock ); return STATUS_SUCCESS; } + +BOOL get_vulkan_gpus( struct list *gpus ) +{ + VkPhysicalDevice *devices; + UINT i, count; + + if (!d3dkmt_use_vulkan()) return FALSE; + if (!(count = get_vulkan_physical_devices( &devices ))) return FALSE; + + for (i = 0; i < count; ++i) + { + VkPhysicalDeviceIDProperties id = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES}; + VkPhysicalDeviceProperties2 properties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &id}; + struct vulkan_gpu *gpu; + + if (!(gpu = calloc( 1, sizeof(*gpu) ))) break; + pvkGetPhysicalDeviceProperties2KHR( devices[i], &properties2 ); + memcpy( &gpu->uuid, id.deviceUUID, sizeof(gpu->uuid) ); + gpu->name = strdup( properties2.properties.deviceName ); + gpu->pci_id.vendor = properties2.properties.vendorID; + gpu->pci_id.device = properties2.properties.deviceID; + list_add_tail( gpus, &gpu->entry ); + } + + free( devices ); + return TRUE; +} + +void free_vulkan_gpu( struct vulkan_gpu *gpu ) +{ + free( gpu->name ); + free( gpu ); +} diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 2914454936d..bc86f72f345 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -932,6 +932,7 @@ struct device_manager_ctx struct gpu gpu; struct source source; HKEY source_key; + struct list vulkan_gpus; /* for the virtual desktop settings */ BOOL is_primary; DEVMODEW primary; @@ -1487,6 +1488,13 @@ static void release_display_manager_ctx( struct device_manager_ctx *ctx ) last_query_display_time = 0; } if (ctx->gpu_count) cleanup_devices(); + + while (!list_empty( &ctx->vulkan_gpus )) + { + struct vulkan_gpu *gpu = LIST_ENTRY( list_head( &ctx->vulkan_gpus ), struct vulkan_gpu, entry ); + list_remove( &gpu->entry ); + free_vulkan_gpu( gpu ); + } } static void clear_display_devices(void) @@ -1945,7 +1953,7 @@ BOOL update_display_cache( BOOL force ) static const WCHAR wine_service_station_name[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; HWINSTA winstation = NtUserGetProcessWindowStation(); - struct device_manager_ctx ctx = {0}; + struct device_manager_ctx ctx = {.vulkan_gpus = LIST_INIT(ctx.vulkan_gpus)}; UINT status; WCHAR name[MAX_PATH]; @@ -1960,6 +1968,8 @@ BOOL update_display_cache( BOOL force ) return TRUE; } + if (!get_vulkan_gpus( &ctx.vulkan_gpus )) WARN( "Failed to find any vulkan GPU\n" ); + status = update_display_devices( force, &ctx ); release_display_manager_ctx( &ctx ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 94b9d00b4fb..8bb280c4611 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -191,6 +191,17 @@ extern BOOL update_display_cache( BOOL force ); extern void user_lock(void); extern void user_unlock(void); extern void user_check_not_lock(void); + +struct vulkan_gpu +{ + struct list entry; + struct pci_id pci_id; + char *name; + GUID uuid; +}; + +extern BOOL get_vulkan_gpus( struct list *gpus ); +extern void free_vulkan_gpu( struct vulkan_gpu *gpu ); extern BOOL get_vulkan_uuid_from_luid( const LUID *luid, GUID *uuid ); /* winstation.c */
1
0
0
0
Rémi Bernon : win32u: Load the graphics driver vulkan functions lazily.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 70cf97a59c0e48370ab0ff719a82aed015ad3195 URL:
https://gitlab.winehq.org/wine/wine/-/commit/70cf97a59c0e48370ab0ff719a82ae…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu May 16 12:53:22 2024 +0200 win32u: Load the graphics driver vulkan functions lazily. So that VulkanInit is only called when surface related functions are needed, breaking the re-entry when we call d3dkmt vulkan functions from update_display_cache, which is called when graphics drivers are loaded. --- dlls/win32u/vulkan.c | 73 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 59b9364065e..5b128afe3cb 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -213,22 +213,14 @@ static const struct vulkan_driver_funcs nulldrv_funcs = .p_get_host_surface_extension = nulldrv_get_host_surface_extension, }; -static void vulkan_init(void) +static void vulkan_driver_init(void) { UINT status; - if (!(vulkan_handle = dlopen( SONAME_LIBVULKAN, RTLD_NOW ))) - { - ERR( "Failed to load %s\n", SONAME_LIBVULKAN ); - return; - } - if ((status = user_driver->pVulkanInit( WINE_VULKAN_DRIVER_VERSION, vulkan_handle, &driver_funcs )) && status != STATUS_NOT_IMPLEMENTED) { ERR( "Failed to initialize the driver vulkan functions, status %#x\n", status ); - dlclose( vulkan_handle ); - vulkan_handle = NULL; return; } @@ -239,6 +231,65 @@ static void vulkan_init(void) vulkan_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = driver_funcs->p_vkGetPhysicalDeviceWin32PresentationSupportKHR; vulkan_funcs.p_get_host_surface_extension = driver_funcs->p_get_host_surface_extension; } +} + +static void vulkan_driver_load(void) +{ + static pthread_once_t init_once = PTHREAD_ONCE_INIT; + pthread_once( &init_once, vulkan_driver_init ); +} + +static VkResult lazydrv_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) +{ + vulkan_driver_load(); + return driver_funcs->p_vulkan_surface_create( hwnd, instance, surface, private ); +} + +static void lazydrv_vulkan_surface_destroy( HWND hwnd, void *private ) +{ + vulkan_driver_load(); + return driver_funcs->p_vulkan_surface_destroy( hwnd, private ); +} + +static void lazydrv_vulkan_surface_detach( HWND hwnd, void *private ) +{ + vulkan_driver_load(); + return driver_funcs->p_vulkan_surface_detach( hwnd, private ); +} + +static void lazydrv_vulkan_surface_presented( HWND hwnd, VkResult result ) +{ + vulkan_driver_load(); + return driver_funcs->p_vulkan_surface_presented( hwnd, result ); +} + +static VkBool32 lazydrv_vkGetPhysicalDeviceWin32PresentationSupportKHR( VkPhysicalDevice device, uint32_t queue ) +{ + vulkan_driver_load(); + return driver_funcs->p_vkGetPhysicalDeviceWin32PresentationSupportKHR( device, queue ); +} + +static const char *lazydrv_get_host_surface_extension(void) +{ + vulkan_driver_load(); + return driver_funcs->p_get_host_surface_extension(); +} + +static const struct vulkan_driver_funcs lazydrv_funcs = +{ + .p_vulkan_surface_create = lazydrv_vulkan_surface_create, + .p_vulkan_surface_destroy = lazydrv_vulkan_surface_destroy, + .p_vulkan_surface_detach = lazydrv_vulkan_surface_detach, + .p_vulkan_surface_presented = lazydrv_vulkan_surface_presented, +}; + +static void vulkan_init(void) +{ + if (!(vulkan_handle = dlopen( SONAME_LIBVULKAN, RTLD_NOW ))) + { + ERR( "Failed to load %s\n", SONAME_LIBVULKAN ); + return; + } #define LOAD_FUNCPTR( f ) \ if (!(p_##f = dlsym( vulkan_handle, #f ))) \ @@ -254,6 +305,10 @@ static void vulkan_init(void) LOAD_FUNCPTR( vkGetDeviceProcAddr ); LOAD_FUNCPTR( vkGetInstanceProcAddr ); #undef LOAD_FUNCPTR + + driver_funcs = &lazydrv_funcs; + vulkan_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = lazydrv_vkGetPhysicalDeviceWin32PresentationSupportKHR; + vulkan_funcs.p_get_host_surface_extension = lazydrv_get_host_surface_extension; } void vulkan_detach_surfaces( struct list *surfaces )
1
0
0
0
Rémi Bernon : win32u: Fix default_update_display_devices return type to NTSTATUS.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 0ee8f4ab974ad9b9960186b961fd5cf9f54c2e70 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0ee8f4ab974ad9b9960186b961fd5c…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 14 14:03:20 2024 +0200 win32u: Fix default_update_display_devices return type to NTSTATUS. --- dlls/win32u/sysparams.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index d25ac89f130..2914454936d 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1711,7 +1711,7 @@ static BOOL update_display_cache_from_registry(void) return ret; } -static BOOL default_update_display_devices( BOOL force, struct device_manager_ctx *ctx ) +static NTSTATUS default_update_display_devices( BOOL force, struct device_manager_ctx *ctx ) { /* default implementation: expose an adapter and a monitor with a few standard modes, * and read / write current display settings from / to the registry. @@ -1742,7 +1742,7 @@ static BOOL default_update_display_devices( BOOL force, struct device_manager_ct struct gdi_monitor monitor = {0}; DEVMODEW mode = {.dmSize = sizeof(mode)}; - if (!force) return TRUE; + if (!force) return STATUS_ALREADY_COMPLETE; add_gpu( "Default GPU", &pci_id, NULL, 0, ctx ); add_source( "Default", source_flags, ctx ); @@ -1760,7 +1760,7 @@ static BOOL default_update_display_devices( BOOL force, struct device_manager_ct add_monitor( &monitor, ctx ); add_modes( &mode, ARRAY_SIZE(modes), modes, ctx ); - return TRUE; + return STATUS_SUCCESS; } /* parse the desktop size specification */
1
0
0
0
Myah Caron : msvcrt: Fix _kbhit ignoring the last event.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 9731b96a6d04ffdaaa0c13a19ad8eadd840ff37c URL:
https://gitlab.winehq.org/wine/wine/-/commit/9731b96a6d04ffdaaa0c13a19ad8ea…
Author: Myah Caron <qsniyg(a)protonmail.com> Date: Tue May 21 02:53:24 2024 +0000 msvcrt: Fix _kbhit ignoring the last event. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=56697
Signed-off-by: Myah Caron <qsniyg(a)protonmail.com> --- dlls/msvcrt/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msvcrt/console.c b/dlls/msvcrt/console.c index 6fedb8f434f..2c6b59d36c6 100644 --- a/dlls/msvcrt/console.c +++ b/dlls/msvcrt/console.c @@ -488,7 +488,7 @@ int CDECL _kbhit(void) if (count && (ir = malloc(count * sizeof(INPUT_RECORD))) && PeekConsoleInputA(msvcrt_input_console(), ir, count, &count)) - for(i = 0; i < count - 1; i++) + for(i = 0; i < count; i++) { if (ir[i].EventType == KEY_EVENT && ir[i].Event.KeyEvent.bKeyDown &&
1
0
0
0
Alexandre Julliard : msvcp: Unify call_copy_ctor/call_dtor implementations.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 4c7503395616ebfa3250270fd244f773c886348a URL:
https://gitlab.winehq.org/wine/wine/-/commit/4c7503395616ebfa3250270fd244f7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 21 20:33:59 2024 +0200 msvcp: Unify call_copy_ctor/call_dtor implementations. --- dlls/msvcp90/exception.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 3abf776a508..3d569d8d855 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -1173,7 +1173,7 @@ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object return object; } -#ifdef __i386__ +#ifdef __ASM_USE_THISCALL_WRAPPER extern void call_copy_ctor( void *func, void *this, void *src, int has_vbase ); __ASM_GLOBAL_FUNC( call_copy_ctor, "pushl %ebp\n\t" @@ -1188,15 +1188,24 @@ __ASM_GLOBAL_FUNC( call_copy_ctor, "leave\n" __ASM_CFI(".cfi_def_cfa %esp,4\n\t") __ASM_CFI(".cfi_same_value %ebp\n\t") - "ret" ); + "ret" ) +extern void call_dtor( void *func, void *this ); +__ASM_GLOBAL_FUNC( call_dtor, + "movl 8(%esp),%ecx\n\t" + "call *4(%esp)\n\t" + "ret" ) #else static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase ) { TRACE( "calling copy ctor %p object %p src %p\n", func, this, src ); if (has_vbase) - ((void (__cdecl*)(void*, void*, BOOL))func)(this, src, 1); + ((void (__thiscall*)(void*, void*, BOOL))func)(this, src, 1); else - ((void (__cdecl*)(void*, void*))func)(this, src); + ((void (__thiscall*)(void*, void*))func)(this, src); +} +static inline void call_dtor( void *func, void *this ) +{ + ((void (__thiscall*)(void*))func)( this ); } #endif @@ -1217,24 +1226,6 @@ void __cdecl __ExceptionPtrCreate(exception_ptr *ep) ep->ref = NULL; } -#ifdef __ASM_USE_THISCALL_WRAPPER -extern void call_dtor(const cxx_exception_type *type, void *func, void *object); - -__ASM_GLOBAL_FUNC( call_dtor, - "movl 12(%esp),%ecx\n\t" - "call *8(%esp)\n\t" - "ret" ); -#elif __x86_64__ -static inline void call_dtor(const cxx_exception_type *type, unsigned int dtor, void *object) -{ - char *base = RtlPcToFileHeader((void*)type, (void**)&base); - void (__cdecl *func)(void*) = (void*)(base + dtor); - func(object); -} -#else -#define call_dtor(type, func, object) ((void (__thiscall*)(void*))(func))(object) -#endif - /********************************************************************* * ?__ExceptionPtrDestroy@@YAXPAX@Z * ?__ExceptionPtrDestroy@@YAXPEAX@Z @@ -1252,8 +1243,9 @@ void __cdecl __ExceptionPtrDestroy(exception_ptr *ep) { const cxx_exception_type *type = (void*)ep->rec->ExceptionInformation[2]; void *obj = (void*)ep->rec->ExceptionInformation[1]; + uintptr_t base = rtti_rva_base( type ); - if (type && type->destructor) call_dtor(type, type->destructor, obj); + if (type && type->destructor) call_dtor( rtti_rva(type->destructor, base), obj ); HeapFree(GetProcessHeap(), 0, obj); }
1
0
0
0
Alexandre Julliard : msvcp: Unify __ExceptionPtrCurrentException implementation.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 897cc66fd8a58fd33bc161cf03b60045b1ed7043 URL:
https://gitlab.winehq.org/wine/wine/-/commit/897cc66fd8a58fd33bc161cf03b600…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 21 20:33:50 2024 +0200 msvcp: Unify __ExceptionPtrCurrentException implementation. --- dlls/msvcp90/exception.c | 63 +++++------------------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 50ddc045226..3abf776a508 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -1306,7 +1306,6 @@ void __cdecl __ExceptionPtrRethrow(const exception_ptr *ep) * ?__ExceptionPtrCurrentException@@YAXPAX@Z * ?__ExceptionPtrCurrentException@@YAXPEAX@Z */ -#ifndef __x86_64__ void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep) { void **current_exception = __current_exception(); @@ -1329,14 +1328,13 @@ void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep) if (ep->rec->ExceptionCode == CXX_EXCEPTION) { + void *obj = (void*)ep->rec->ExceptionInformation[1]; const cxx_exception_type *et = (void*)ep->rec->ExceptionInformation[2]; - const cxx_type_info *ti; - void **data, *obj; + uintptr_t base = rtti_rva_base( et ); + const cxx_type_info_table *table = rtti_rva( et->type_info_table, base ); + const cxx_type_info *ti = rtti_rva( table->info[0], base ); + void **data = HeapAlloc(GetProcessHeap(), 0, ti->size); - ti = et->type_info_table->info[0]; - data = HeapAlloc(GetProcessHeap(), 0, ti->size); - - obj = (void*)ep->rec->ExceptionInformation[1]; if (ti->flags & CLASS_IS_SIMPLE_TYPE) { memcpy(data, obj, ti->size); @@ -1344,7 +1342,7 @@ void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep) } else if (ti->copy_ctor) { - call_copy_ctor(ti->copy_ctor, data, get_this_pointer(&ti->offsets, obj), + call_copy_ctor(rtti_rva(ti->copy_ctor, base), data, get_this_pointer(&ti->offsets, obj), ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS); } else @@ -1353,55 +1351,6 @@ void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep) } return; } -#else -void __cdecl __ExceptionPtrCurrentException(exception_ptr *ep) -{ - void **current_exception = __current_exception(); - EXCEPTION_RECORD *rec = current_exception ? *current_exception : NULL; - - TRACE("(%p)\n", ep); - - if (!rec) - { - ep->rec = NULL; - ep->ref = NULL; - return; - } - - ep->rec = HeapAlloc(GetProcessHeap(), 0, sizeof(EXCEPTION_RECORD)); - ep->ref = HeapAlloc(GetProcessHeap(), 0, sizeof(int)); - - *ep->rec = *rec; - *ep->ref = 1; - - if (ep->rec->ExceptionCode == CXX_EXCEPTION) - { - const cxx_exception_type *et = (void*)ep->rec->ExceptionInformation[2]; - const cxx_type_info *ti; - void **data, *obj; - char *base = RtlPcToFileHeader((void*)et, (void**)&base); - - ti = (const cxx_type_info*)(base + ((const cxx_type_info_table*)(base + et->type_info_table))->info[0]); - data = HeapAlloc(GetProcessHeap(), 0, ti->size); - - obj = (void*)ep->rec->ExceptionInformation[1]; - if (ti->flags & CLASS_IS_SIMPLE_TYPE) - { - memcpy(data, obj, ti->size); - if (ti->size == sizeof(void *)) *data = get_this_pointer(&ti->offsets, *data); - } - else if (ti->copy_ctor) - { - call_copy_ctor(base + ti->copy_ctor, data, get_this_pointer(&ti->offsets, obj), - ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS); - } - else - memcpy(data, get_this_pointer(&ti->offsets, obj), ti->size); - ep->rec->ExceptionInformation[1] = (ULONG_PTR)data; - } - return; -} -#endif /********************************************************************* * ?__ExceptionPtrToBool@@YA_NPBX@Z
1
0
0
0
Alexandre Julliard : msvcp: Unify __ExceptionPtrCopyException implementation.
by Alexandre Julliard
21 May '24
21 May '24
Module: wine Branch: master Commit: 5e3f45a6c523a1d249524b272dba248ca3bb16cf URL:
https://gitlab.winehq.org/wine/wine/-/commit/5e3f45a6c523a1d249524b272dba24…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 21 20:33:37 2024 +0200 msvcp: Unify __ExceptionPtrCopyException implementation. --- dlls/msvcp90/exception.c | 57 +++++++++++------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 8c52a8cdbe9..50ddc045226 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -30,6 +30,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcp); #define CXX_FRAME_MAGIC_VC6 0x19930520 +#ifdef RTTI_USE_RVA +#define CXX_EXCEPTION_PARAMS 4 +#else +#define CXX_EXCEPTION_PARAMS 3 +#endif + CREATE_TYPE_INFO_VTABLE #define CLASS_IS_SIMPLE_TYPE 1 @@ -1410,51 +1416,14 @@ bool __cdecl __ExceptionPtrToBool(exception_ptr *ep) * ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z * ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z */ -#ifndef __x86_64__ -void __cdecl __ExceptionPtrCopyException(exception_ptr *ep, - exception *object, const cxx_exception_type *type) -{ - const cxx_type_info *ti; - void **data; - - __ExceptionPtrDestroy(ep); - - ep->rec = HeapAlloc(GetProcessHeap(), 0, sizeof(EXCEPTION_RECORD)); - ep->ref = HeapAlloc(GetProcessHeap(), 0, sizeof(int)); - *ep->ref = 1; - - memset(ep->rec, 0, sizeof(EXCEPTION_RECORD)); - ep->rec->ExceptionCode = CXX_EXCEPTION; - ep->rec->ExceptionFlags = EXCEPTION_NONCONTINUABLE; - ep->rec->NumberParameters = 3; - ep->rec->ExceptionInformation[0] = CXX_FRAME_MAGIC_VC6; - ep->rec->ExceptionInformation[2] = (ULONG_PTR)type; - - ti = type->type_info_table->info[0]; - data = HeapAlloc(GetProcessHeap(), 0, ti->size); - if (ti->flags & CLASS_IS_SIMPLE_TYPE) - { - memcpy(data, object, ti->size); - if (ti->size == sizeof(void *)) *data = get_this_pointer(&ti->offsets, *data); - } - else if (ti->copy_ctor) - { - call_copy_ctor(ti->copy_ctor, data, get_this_pointer(&ti->offsets, object), - ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS); - } - else - memcpy(data, get_this_pointer(&ti->offsets, object), ti->size); - ep->rec->ExceptionInformation[1] = (ULONG_PTR)data; -} -#else void __cdecl __ExceptionPtrCopyException(exception_ptr *ep, exception *object, const cxx_exception_type *type) { + const cxx_type_info_table *table; const cxx_type_info *ti; void **data; - char *base; + uintptr_t base = rtti_rva_base( type ); - RtlPcToFileHeader((void*)type, (void**)&base); __ExceptionPtrDestroy(ep); ep->rec = HeapAlloc(GetProcessHeap(), 0, sizeof(EXCEPTION_RECORD)); @@ -1464,12 +1433,13 @@ void __cdecl __ExceptionPtrCopyException(exception_ptr *ep, memset(ep->rec, 0, sizeof(EXCEPTION_RECORD)); ep->rec->ExceptionCode = CXX_EXCEPTION; ep->rec->ExceptionFlags = EXCEPTION_NONCONTINUABLE; - ep->rec->NumberParameters = 4; + ep->rec->NumberParameters = CXX_EXCEPTION_PARAMS; ep->rec->ExceptionInformation[0] = CXX_FRAME_MAGIC_VC6; ep->rec->ExceptionInformation[2] = (ULONG_PTR)type; - ep->rec->ExceptionInformation[3] = (ULONG_PTR)base; + if (CXX_EXCEPTION_PARAMS == 4) ep->rec->ExceptionInformation[3] = base; - ti = (const cxx_type_info*)(base + ((const cxx_type_info_table*)(base + type->type_info_table))->info[0]); + table = rtti_rva( type->type_info_table, base ); + ti = rtti_rva( table->info[0], base ); data = HeapAlloc(GetProcessHeap(), 0, ti->size); if (ti->flags & CLASS_IS_SIMPLE_TYPE) { @@ -1478,14 +1448,13 @@ void __cdecl __ExceptionPtrCopyException(exception_ptr *ep, } else if (ti->copy_ctor) { - call_copy_ctor(base + ti->copy_ctor, data, get_this_pointer(&ti->offsets, object), + call_copy_ctor( rtti_rva(ti->copy_ctor, base), data, get_this_pointer(&ti->offsets, object), ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS); } else memcpy(data, get_this_pointer(&ti->offsets, object), ti->size); ep->rec->ExceptionInformation[1] = (ULONG_PTR)data; } -#endif /********************************************************************* * ?__ExceptionPtrCompare@@YA_NPBX0@Z
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
71
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
Results per page:
10
25
50
100
200