Skip to content

Commit

Permalink
add wine-staging-9.0-rc2 with dlssg-fsr3 mod patches
Browse files Browse the repository at this point in the history
ValveSoftware/Proton#7361

Signed-off-by: Gonçalo Duarte <[email protected]>
  • Loading branch information
MrDuartePT committed Dec 22, 2023
1 parent 3fd82b1 commit 45419c0
Show file tree
Hide file tree
Showing 11 changed files with 2,336 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app-emulation/wine-staging/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIST wine-8.21.tar.xz 29919212 BLAKE2B 2e1c135d1c247f4b268c0323538748944b01fe65c82dee27d81f70613aa2fe632c1b4d696f05838a6ab801579a4d13a191de0f4c1a2e2222d40ca767499a98c3 SHA512 4d04d40141d2ea5e548b76aed870ac28d8a03241ffd4e761979c795310baa19136e54a8e518c6ea9bf563c3b23d3c4eb1baefc9906d7eeca469e9942ff99dc40
DIST wine-9.0-rc2.tar.xz 29989604 BLAKE2B 2eddc96df30a8239b4b3314b7127eb3a11f953826506f12b8f5dc2acfe45f8a4fc3de7a4af4ada5c14c60783771ba865eb35189dcdb09eeb7e52438dd34fe668 SHA512 20644b626c3e5eb5864ea5beb91f4470f19bf7a51dbd706efcce86ca552cab5e6754dc5705ec24255e0fd75bd5ea185cd2f63a47cd255a54796b4514ccfc4ad9
DIST wine-staging-8.21.tar.gz 9669500 BLAKE2B 600ad4b5696a38adefbde2fb9f51623dc7a7d9249ba15ceddcf1062040d840064285c6d2602266fd90f3658f0bdfe2fbca6a486f40e6e3f317fe704553ce39c7 SHA512 abba6084f2aefa8507c2a79c688b717f8137375168e5457ee40a0c96bfce31e9dc44370ecb5a8e8a397e90ce2eb8543fd07b447bf48c4b2d4c68aac9b3674214
DIST wine-staging-9.0-rc2.tar.gz 9536907 BLAKE2B ba63735fa9f0081b0b2cb854f6ef90a4dab596f1900022a3d23449ae823d4fc40e1dd53099f7c7dc186a3141ad27a1a68cd36b8a94ec632372876f076fb4375b SHA512 b2cacb51bc8d68c5b37b2969b22dae7e8f5e6d1cb2c363924d11a04f650068dde5d2af2098ac84bc3bbdcffafa3127f1e4a4042e6f663253b7fde4e27ed9f252
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Also write GNU-stack note on dummy files used for stub libraries.
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1676,2 +1676,3 @@
output( "\t.text\n" );
+ output_gnu_stack_note();
}
36 changes: 36 additions & 0 deletions app-emulation/wine-staging/files/wine-staging-7.20-unwind.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Fix build with llvm-libunwind, and also fix for non-llvm libunwind
when using clang+bfd given clang doesn't have _Unwind_Find_FDE in
its rtlib and expects it from llvm-libunwind.

The _CONFIG_H_ check is for <llvm-libunwind-15 (adds _VERSION).
--- a/dlls/ntdll/unix/dwarf.h
+++ b/dlls/ntdll/unix/dwarf.h
@@ -255,5 +255,7 @@
};

+#if defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__) || !defined(__clang__)
extern const struct dwarf_fde *_Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
+#endif

static unsigned char dwarf_get_u1( const unsigned char **p )
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -632,5 +632,5 @@
int rc;

-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__)
rc = unw_getcontext( &unw_context );
if (rc == UNW_ESUCCESS)
@@ -755,4 +755,5 @@
{
struct dwarf_eh_bases bases;
+#if defined(_LIBUNWIND_VERSION) || defined(____LIBUNWIND_CONFIG_H__) || !defined(__clang__)
const struct dwarf_fde *fde = _Unwind_Find_FDE( (void *)(context->Rip - 1), &bases );

@@ -760,4 +761,5 @@
return dwarf_virtual_unwind( context->Rip, &dispatch->EstablisherFrame, context, fde,
&bases, &dispatch->LanguageHandler, &dispatch->HandlerData );
+#endif
#ifdef HAVE_LIBUNWIND
return libunwind_virtual_unwind( context->Rip, &dispatch->EstablisherFrame, context,
15 changes: 15 additions & 0 deletions app-emulation/wine-staging/files/wine-staging-8.13-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Patch Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/wine/rpath.patch
Alpine Bug: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13249

--- a/configure.ac
+++ b/configure.ac
@@ -784,6 +784,9 @@ case $host_os in
[WINELOADER_LDFLAGS="$WINELOADER_LDFLAGS -Wl,-z,max-page-size=0x1000"])
;;
esac
+
+ # do this at the end because it needs double dollar for makefile
+ WINE_TRY_CFLAGS([-Wl,-rpath,\\\$ORIGIN],[UNIXLDFLAGS="$UNIXLDFLAGS '-Wl,-rpath,\$\$ORIGIN'"])
;;
esac

227 changes: 227 additions & 0 deletions app-emulation/wine-staging/files/wine-staging-9.0-gpu_detection.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index c5e47cb355c..8bc83755746 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -367,7 +367,6 @@ static BOOL is_broken_driver(void)
XRRScreenResources *screen_resources;
XRROutputInfo *output_info;
XRRModeInfo *first_mode;
- INT major, event, error;
INT output_idx, i, j;
BOOL only_one_mode;

@@ -418,15 +417,6 @@ static BOOL is_broken_driver(void)

if (!only_one_mode)
continue;
-
- /* Check if it is NVIDIA proprietary driver */
- if (XQueryExtension( gdi_display, "NV-CONTROL", &major, &event, &error ))
- {
- ERR_(winediag)("Broken NVIDIA RandR detected, falling back to RandR 1.0. "
- "Please consider using the Nouveau driver instead.\n");
- pXRRFreeScreenResources( screen_resources );
- return TRUE;
- }
}
pXRRFreeScreenResources( screen_resources );
return FALSE;
@@ -625,6 +615,113 @@ static BOOL is_crtc_primary( RECT primary, const XRRCrtcInfo *crtc )
crtc->y + crtc->height == primary.bottom;
}

+static void add_remaining_gpus_via_vulkan( struct gdi_gpu **gpus, int *count )
+{
+ static const char *extensions[] =
+ {
+ VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME,
+ };
+ const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION );
+ PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR;
+ PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices;
+ uint32_t device_count;
+ VkPhysicalDevice *vk_physical_devices = NULL;
+ VkPhysicalDeviceProperties2 properties2;
+ VkInstanceCreateInfo create_info;
+ VkPhysicalDeviceIDProperties id;
+ VkInstance vk_instance = NULL;
+ INT gpu_idx, device_idx;
+ INT original_gpu_count = *count;
+ struct gdi_gpu *new_gpu;
+ BOOL new;
+ VkResult vr;
+
+ memset( &create_info, 0, sizeof(create_info) );
+ create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+ create_info.enabledExtensionCount = ARRAY_SIZE(extensions);
+ create_info.ppEnabledExtensionNames = extensions;
+ vr = vulkan_funcs->p_vkCreateInstance( &create_info, NULL, &vk_instance );
+
+ if (vr != VK_SUCCESS)
+ {
+ WARN("Failed to create a Vulkan instance, vr %d.\n", vr);
+ goto done;
+ }
+
+#define LOAD_VK_FUNC(f) \
+ if (!(p##f = (void *)vulkan_funcs->p_vkGetInstanceProcAddr( vk_instance, #f ))) \
+ { \
+ WARN("Failed to load " #f ".\n"); \
+ goto done; \
+ }
+
+ LOAD_VK_FUNC(vkEnumeratePhysicalDevices)
+ LOAD_VK_FUNC(vkGetPhysicalDeviceProperties2KHR)
+#undef LOAD_VK_FUNC
+
+ vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, NULL );
+ if (vr != VK_SUCCESS || !device_count)
+ {
+ WARN("No Vulkan device found, vr %d, device_count %d.\n", vr, device_count);
+ goto done;
+ }
+
+ if (!(vk_physical_devices = calloc( device_count, sizeof(*vk_physical_devices) )))
+ goto done;
+
+ vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, vk_physical_devices );
+ if (vr != VK_SUCCESS)
+ {
+ WARN("vkEnumeratePhysicalDevices failed, vr %d.\n", vr);
+ goto done;
+ }
+
+ for (device_idx = 0; device_idx < device_count; ++device_idx)
+ {
+ memset( &id, 0, sizeof(id) );
+ id.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
+ properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
+ properties2.pNext = &id;
+
+ pvkGetPhysicalDeviceProperties2KHR( vk_physical_devices[device_idx], &properties2 );
+
+ /* Ignore Khronos vendor IDs */
+ if (properties2.properties.vendorID >= 0x10000)
+ continue;
+
+ new = TRUE;
+ for (gpu_idx = 0; gpu_idx < original_gpu_count; ++gpu_idx)
+ {
+ if (!memcmp( &(*gpus)[gpu_idx].vulkan_uuid, id.deviceUUID, sizeof(id.deviceUUID) ))
+ {
+ new = FALSE;
+ break;
+ }
+ }
+
+ if (!new)
+ continue;
+
+ *gpus = realloc( *gpus, (*count + 1) * sizeof(**gpus) );
+ if (!gpus) goto done;
+ new_gpu = &(*gpus)[(*count)++];
+ memset( new_gpu, 0, sizeof(*new_gpu) );
+ new_gpu->id = -1;
+
+ memcpy( &new_gpu->vulkan_uuid, id.deviceUUID, sizeof(id.deviceUUID) );
+ new_gpu->vendor_id = properties2.properties.vendorID;
+ new_gpu->device_id = properties2.properties.deviceID;
+ ntdll_umbstowcs( properties2.properties.deviceName, -1, new_gpu->name, ARRAY_SIZE(new_gpu->name) );
+
+ TRACE("Added a new GPU via Vulkan: %04x:%04x %s\n", new_gpu->vendor_id, new_gpu->device_id, debugstr_w(new_gpu->name));
+ }
+
+done:
+ free( vk_physical_devices );
+ if (vk_instance)
+ vulkan_funcs->p_vkDestroyInstance( vk_instance, NULL );
+}
+
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR)

static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProviderInfo *provider_info,
@@ -772,6 +869,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p
XRRProviderInfo *provider_info = NULL;
XRRCrtcInfo *crtc_info = NULL;
INT primary_provider = -1;
+ INT gpu_count = 0;
RECT primary_rect;
BOOL ret = FALSE;
DWORD len;
@@ -785,21 +883,16 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p
if (!provider_resources)
goto done;

- gpus = calloc( provider_resources->nproviders ? provider_resources->nproviders : 1, sizeof(*gpus) );
- if (!gpus)
- goto done;
-
/* Some XRandR implementations don't support providers.
* In this case, report a fake one to try searching adapters in screen resources */
if (!provider_resources->nproviders)
{
WARN("XRandR implementation doesn't report any providers, faking one.\n");
- lstrcpyW( gpus[0].name, wine_adapterW );
- *new_gpus = gpus;
- *count = 1;
- ret = TRUE;
- goto done;
+ goto fallback;
}
+
+ gpus = calloc( provider_resources->nproviders, sizeof(*gpus) );
+ if (!gpus) goto done;

primary_rect = get_primary_rect( screen_resources );
for (i = 0; i < provider_resources->nproviders; ++i)
@@ -834,6 +927,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p
/* FIXME: Add an alternate method of getting PCI IDs, for systems that don't support Vulkan */
}
pXRRFreeProviderInfo( provider_info );
+ gpu_count++;
}

/* Make primary GPU the first */
@@ -843,9 +937,30 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count, BOOL get_p
gpus[0] = gpus[primary_provider];
gpus[primary_provider] = tmp;
}
+
+ fallback:
+ /* Add the Vulkan only GPUs only if we need all the detailed properties */
+ if (get_properties)
+ add_remaining_gpus_via_vulkan( &gpus, &gpu_count );
+
+ if (gpu_count == 0)
+ {
+ /* we need at least one for get_adapters() / get_id() */
+ gpus = calloc( 1, sizeof(*gpus) );
+ if (!gpus) goto done;
+ lstrcpyW( gpus[0].name, wine_adapterW );
+ gpu_count = 1;
+ }
+ else if (gpus[0].id == -1)
+ {
+ /* the only GPUs we have are from Vulkan, mark the first one
+ * as main so that we can use screen resources for adapters,
+ * see xrandr14_get_adapters() */
+ gpus[0].id = 0;
+ }

*new_gpus = gpus;
- *count = provider_resources->nproviders;
+ *count = gpu_count;
ret = TRUE;
done:
if (provider_resources)
@@ -885,6 +1000,10 @@ static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
if (!screen_resources)
goto done;

+ /* Vulkan-only, adapter-less GPU */
+ if (gpu_id == -1)
+ goto done;
+
if (gpu_id)
{
provider_info = pXRRGetProviderInfo( gdi_display, screen_resources, gpu_id );
Loading

0 comments on commit 45419c0

Please sign in to comment.