[PATCH 0/1] MR9736: opengl32: Retrieve display OpenGL functions table only when needed.
There's no real need to keep the function table pointer around, win32u already has an initialization guard and then simply returns a pointer. Initializing OpenGL on process attach often causes OOM errors with 32bit process, as Wine still holds most of the low address space reserved memory, and only releases it after modules have been loaded. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59093 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9736
From: Rémi Bernon <rbernon@codeweavers.com> There's no real need to keep the function table pointer around, win32u already has an initialization guard and then simply returns a pointer. Initializing OpenGL on process attach often causes OOM errors with 32bit process, as Wine still holds most of the low address space reserved memory, and only releases it after modules have been loaded. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59093 --- dlls/opengl32/unix_private.h | 6 ++++-- dlls/opengl32/unix_wgl.c | 2 -- dlls/win32u/opengl.c | 8 -------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dlls/opengl32/unix_private.h b/dlls/opengl32/unix_private.h index 2e2c41d9bdc..ffae783ead2 100644 --- a/dlls/opengl32/unix_private.h +++ b/dlls/opengl32/unix_private.h @@ -45,12 +45,14 @@ extern const struct registry_entry extension_registry[]; extern const int extension_registry_size; extern struct opengl_funcs null_opengl_funcs; -extern const struct opengl_funcs *opengl_funcs; static inline const struct opengl_funcs *get_dc_funcs( HDC hdc ) { DWORD has_opengl; - if (NtGdiGetDCDword( hdc, NtGdiHasOpenGL, &has_opengl ) && has_opengl) return opengl_funcs; + + if (NtGdiGetDCDword( hdc, NtGdiHasOpenGL, &has_opengl ) && has_opengl) + return __wine_get_opengl_driver( WINE_OPENGL_DRIVER_VERSION ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return &null_opengl_funcs; } diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 806571aa859..849c84258cb 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -53,7 +53,6 @@ static BOOL is_wow64(void) return !!NtCurrentTeb()->WowTebOffset; } -const struct opengl_funcs *opengl_funcs; static UINT64 call_gl_debug_message_callback; pthread_mutex_t wgl_lock = PTHREAD_MUTEX_INITIALIZER; @@ -2115,7 +2114,6 @@ NTSTATUS process_attach( void *args ) zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; } - opengl_funcs = __wine_get_opengl_driver( WINE_OPENGL_DRIVER_VERSION ); return STATUS_SUCCESS; } diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 60349f8eace..e770c0f7d3f 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1104,14 +1104,6 @@ static void init_device_info( struct egl_platform *egl, const struct opengl_func TRACE( " - device_uuid: %s\n", debugstr_guid(&egl->device_uuid) ); TRACE( " - driver_uuid: %s\n", debugstr_guid(&egl->driver_uuid) ); - if (!egl->accelerated && sizeof(void *) == 4) - { - WARN( "Skipping bogus 32bit llvmpipe device initialization\n" ); - egl->device_name = "llvmpipe"; - egl->vendor_name = "Mesa"; - return; - } - funcs->p_eglBindAPI( EGL_OPENGL_API ); funcs->p_eglGetConfigs( egl->display, &config, 1, &count ); if (!count) config = EGL_NO_CONFIG_KHR; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9736
participants (3)
-
Rémi Bernon -
Rémi Bernon (@rbernon) -
Zhiyi Zhang (@zhiyi)