From fc0cf1d258650818c1ee4bd096473e1f4b0f141c Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 17 Oct 2023 12:45:20 -0500 Subject: [PATCH] libglvnd: Bump to 1.7.0 with our patches fully upstream --- ...vnd-1.6.0.recipe => libglvnd-1.7.0.recipe} | 5 +- .../libglvnd/patches/libglvnd-1.6.0.patchset | 1375 ----------------- 2 files changed, 2 insertions(+), 1378 deletions(-) rename sys-libs/libglvnd/{libglvnd-1.6.0.recipe => libglvnd-1.7.0.recipe} (95%) delete mode 100644 sys-libs/libglvnd/patches/libglvnd-1.6.0.patchset diff --git a/sys-libs/libglvnd/libglvnd-1.6.0.recipe b/sys-libs/libglvnd/libglvnd-1.7.0.recipe similarity index 95% rename from sys-libs/libglvnd/libglvnd-1.6.0.recipe rename to sys-libs/libglvnd/libglvnd-1.7.0.recipe index 33aa7ad76..c41fe640b 100644 --- a/sys-libs/libglvnd/libglvnd-1.6.0.recipe +++ b/sys-libs/libglvnd/libglvnd-1.7.0.recipe @@ -4,11 +4,10 @@ pipeline." HOMEPAGE="http://gitlab.freedesktop.org/glvnd/libglvnd" COPYRIGHT="2013, NVIDIA CORPORATION" LICENSE="MIT" -REVISION="5" +REVISION="1" SOURCE_URI="https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v$portVersion/libglvnd-v$portVersion.tar.gz" SOURCE_DIR="libglvnd-v$portVersion" -CHECKSUM_SHA256="efc756ffd24b24059e1c53677a9d57b4b237b00a01c54a6f1611e1e51661d70c" -PATCHES="libglvnd-$portVersion.patchset" +CHECKSUM_SHA256="2b6e15b06aafb4c0b6e2348124808cbd9b291c647299eaaba2e3202f51ff2f3d" ARCHITECTURES="?all" SECONDARY_ARCHITECTURES="?x86_gcc2 ?x86" diff --git a/sys-libs/libglvnd/patches/libglvnd-1.6.0.patchset b/sys-libs/libglvnd/patches/libglvnd-1.6.0.patchset deleted file mode 100644 index b48412656..000000000 --- a/sys-libs/libglvnd/patches/libglvnd-1.6.0.patchset +++ /dev/null @@ -1,1375 +0,0 @@ -From 112a6f5ad0579e6e7cda45c780e5f8b12b5fc32a Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sun, 11 Dec 2022 02:25:51 +0000 -Subject: [PATCH 1/6] meson.build: error out on unsupported OSes - -This is a requirement for WrapDB. Also prevents the build from wasting -time by failing early. - -Signed-off-by: Rosen Penev ---- - meson.build | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/meson.build b/meson.build -index a87548e..8144a22 100644 ---- a/meson.build -+++ b/meson.build -@@ -29,6 +29,10 @@ project( - default_options : ['c_std=gnu99'] - ) - -+if host_machine.system() in ['darwin', 'windows'] -+ error('Host OS: @0@ is unsupported.'.format(host_machine.system())) -+endif -+ - dep_null = dependency('', required : false) - cc = meson.get_compiler('c') - prog_py = import('python').find_installation() --- -2.37.3 - -From 5013d3528822b230f8c0cdc32029bf9cf92bb97e Mon Sep 17 00:00:00 2001 -From: Pino Toscano -Date: Fri, 10 Mar 2023 15:13:16 +0100 -Subject: [PATCH 2/6] Update bin/symbols-check.py from mesa/mesa@9d42e31b - -Fixes https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/224 - -Signed-off-by: Pino Toscano ---- - bin/symbols-check.py | 32 ++++++++++++++++++++++++++++++-- - 1 file changed, 30 insertions(+), 2 deletions(-) - -diff --git a/bin/symbols-check.py b/bin/symbols-check.py -index 5ebeb86..6049cbe 100644 ---- a/bin/symbols-check.py -+++ b/bin/symbols-check.py -@@ -13,6 +13,34 @@ PLATFORM_SYMBOLS = [ - '__cxa_guard_abort', - '__cxa_guard_acquire', - '__cxa_guard_release', -+ '__cxa_allocate_dependent_exception', -+ '__cxa_allocate_exception', -+ '__cxa_begin_catch', -+ '__cxa_call_unexpected', -+ '__cxa_current_exception_type', -+ '__cxa_current_primary_exception', -+ '__cxa_decrement_exception_refcount', -+ '__cxa_deleted_virtual', -+ '__cxa_demangle', -+ '__cxa_end_catch', -+ '__cxa_free_dependent_exception', -+ '__cxa_free_exception', -+ '__cxa_get_exception_ptr', -+ '__cxa_get_globals', -+ '__cxa_get_globals_fast', -+ '__cxa_increment_exception_refcount', -+ '__cxa_new_handler', -+ '__cxa_pure_virtual', -+ '__cxa_rethrow', -+ '__cxa_rethrow_primary_exception', -+ '__cxa_terminate_handler', -+ '__cxa_throw', -+ '__cxa_uncaught_exception', -+ '__cxa_uncaught_exceptions', -+ '__cxa_unexpected_handler', -+ '__dynamic_cast', -+ '__emutls_get_address', -+ '__gxx_personality_v0', - '__end__', - '__odr_asan._glapi_Context', - '__odr_asan._glapi_Dispatch', -@@ -40,7 +68,7 @@ def get_symbols_nm(nm, lib): - if len(fields) == 2 or fields[1] == 'U': - continue - symbol_name = fields[0] -- if platform_name == 'Linux': -+ if platform_name == 'Linux' or platform_name == 'GNU' or platform_name.startswith('GNU/'): - if symbol_name in PLATFORM_SYMBOLS: - continue - elif platform_name == 'Darwin': -@@ -73,7 +101,7 @@ def get_symbols_dumpbin(dumpbin, lib): - continue - symbol_name = fields[3] - # De-mangle symbols -- if symbol_name[0] == '_': -+ if symbol_name[0] == '_' and '@' in symbol_name: - symbol_name = symbol_name[1:].split('@')[0] - symbols.append(symbol_name) - return symbols --- -2.37.3 - -From 2795b8f09c229a58134c34ecb83001ff72254a53 Mon Sep 17 00:00:00 2001 -From: X512 -Date: Sat, 21 May 2022 12:20:22 +0900 -Subject: [PATCH 3/6] HGL: add Haiku libGL.so implementation based on EGL - ---- - include/HGL/OpenGLKit.h | 10 + - include/HGL/README | 21 ++ - include/HGL/opengl/GLView.h | 196 ++++++++++++ - include/Makefile.am | 6 +- - include/meson.build | 13 +- - meson.build | 6 + - meson_options.txt | 6 + - src/EGL/meson.build | 19 +- - src/HGL/.gitignore | 2 + - src/HGL/BitmapHook.h | 17 ++ - src/HGL/GLView.cpp | 580 ++++++++++++++++++++++++++++++++++++ - src/HGL/libgl.c | 59 ++++ - src/HGL/meson.build | 53 ++++ - src/meson.build | 4 + - 14 files changed, 987 insertions(+), 5 deletions(-) - create mode 100644 include/HGL/OpenGLKit.h - create mode 100644 include/HGL/README - create mode 100644 include/HGL/opengl/GLView.h - create mode 100644 src/HGL/.gitignore - create mode 100644 src/HGL/BitmapHook.h - create mode 100644 src/HGL/GLView.cpp - create mode 100644 src/HGL/libgl.c - create mode 100644 src/HGL/meson.build - -diff --git a/include/HGL/OpenGLKit.h b/include/HGL/OpenGLKit.h -new file mode 100644 -index 0000000..71d9830 ---- /dev/null -+++ b/include/HGL/OpenGLKit.h -@@ -0,0 +1,10 @@ -+/* -+ * Master include file for the Haiku OpenGL Kit. -+ */ -+ -+#include -+#include -+ -+// Projects needing GL/glu.h and GL/glut.h should now -+// include these headers independently as glu and glut -+// are no longer core parts of mesa -diff --git a/include/HGL/README b/include/HGL/README -new file mode 100644 -index 0000000..b452c18 ---- /dev/null -+++ b/include/HGL/README -@@ -0,0 +1,21 @@ -+These headers make up the Haiku OpenGL kit. -+ -+Headers in this directory preserve some BeOS™ compatibility -+compatibility, so changes should be mentioned to the Haiku -+project mailing list. -+ -+Haiku Website: http://haiku-os.org -+BeOS OpenGL API Docs: https://www.haiku-os.org/legacy-docs/bebook/TheOpenGLKit_Overview.html -+ -+Normal Haiku OpenGL layout: -+ -+ * headers/os/OpenGLKit.h -+ * headers/os/opengl/GLView.h -+ * headers/os/opengl/GL/gl.h -+ * headers/os/opengl/GL/glext.h -+ * headers/os/opengl/GL/osmesa.h (needed?) -+ -+Extras: -+ -+ * headers/os/opengl/GL/glu.h -+ * headers/os/opengl/GL/glut.h -diff --git a/include/HGL/opengl/GLView.h b/include/HGL/opengl/GLView.h -new file mode 100644 -index 0000000..5649115 ---- /dev/null -+++ b/include/HGL/opengl/GLView.h -@@ -0,0 +1,196 @@ -+/* -+ * Copyright 2008-2023, Haiku, Inc. All Rights Reserved. -+ * Distributed under the terms of the MIT License. -+ * -+ * This header defines BGLView, the base class making up -+ * the Haiku OpenGL Kit. -+ * -+ */ -+#ifndef BGLVIEW_H -+#define BGLVIEW_H -+ -+ -+#include -+ -+#define BGL_RGB 0 -+#define BGL_INDEX 1 -+#define BGL_SINGLE 0 -+#define BGL_DOUBLE 2 -+#define BGL_DIRECT 0 -+#define BGL_INDIRECT 4 -+#define BGL_ACCUM 8 -+#define BGL_ALPHA 16 -+#define BGL_DEPTH 32 -+#define BGL_OVERLAY 64 -+#define BGL_UNDERLAY 128 -+#define BGL_STENCIL 512 -+#define BGL_SHARE_CONTEXT 1024 -+ -+ -+#ifdef __cplusplus -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+struct glview_direct_info; -+ -+class _EXPORT BGLView : public BView { -+public: -+ BGLView(BRect rect, const char* name, -+ ulong resizingMode, ulong mode, -+ ulong options); -+ virtual ~BGLView(); -+ -+ void LockGL(); -+ void UnlockGL(); -+ void SwapBuffers(); -+ void SwapBuffers(bool vSync); -+ -+ BView* EmbeddedView(); -+ void* GetGLProcAddress(const char* procName); -+ -+ status_t CopyPixelsOut(BPoint source, BBitmap *dest); -+ status_t CopyPixelsIn(BBitmap *source, BPoint dest); -+ -+ // Mesa's GLenum is uint where Be's ones was ulong! -+ virtual void ErrorCallback(unsigned long errorCode); -+ -+ virtual void Draw(BRect updateRect); -+ virtual void AttachedToWindow(); -+ virtual void AllAttached(); -+ virtual void DetachedFromWindow(); -+ virtual void AllDetached(); -+ -+ virtual void FrameResized(float newWidth, float newHeight); -+ virtual status_t Perform(perform_code d, void *arg); -+ -+ virtual status_t Archive(BMessage *data, bool deep = true) const; -+ -+ virtual void MessageReceived(BMessage *message); -+ virtual void SetResizingMode(uint32 mode); -+ -+ virtual void Show(); -+ virtual void Hide(); -+ -+ virtual BHandler* ResolveSpecifier(BMessage *msg, int32 index, -+ BMessage *specifier, int32 form, -+ const char *property); -+ virtual status_t GetSupportedSuites(BMessage *data); -+ -+ void DirectConnected(direct_buffer_info *info); -+ void EnableDirectMode(bool enabled); -+ -+ void* getGC() { return fGc; } -+ -+ virtual void GetPreferredSize(float* width, float* height); -+ -+private: -+ class Display; -+ struct Renderer; -+ -+ virtual void _ReservedGLView1(); -+ virtual void _ReservedGLView2(); -+ virtual void _ReservedGLView3(); -+ virtual void _ReservedGLView4(); -+ virtual void _ReservedGLView5(); -+ virtual void _ReservedGLView6(); -+ virtual void _ReservedGLView7(); -+ virtual void _ReservedGLView8(); -+ -+ BGLView(const BGLView &); -+ BGLView &operator=(const BGLView &); -+ -+ static Display sDisplay; -+ -+ void _DitherFront(); -+ bool _ConfirmDither(); -+ void _Draw(BRect rect); -+ void _CallDirectConnected(); -+ -+ void* fGc; -+ uint32 fOptions; -+ uint32 fUnused1; -+ BLocker fDrawLock; -+ BLocker fDisplayLock; -+ glview_direct_info* fClipInfo; -+ -+ Renderer* fRenderer; -+ void* fUnused2; -+ void* fUnused3; -+ BRect fUnused4; -+ void* fUnused5[2]; -+ uint64 _reserved[8]; -+ -+ void _LockDraw(); -+ void _UnlockDraw(); -+ -+// BeOS compatibility -+private: -+ BGLView(BRect rect, char* name, -+ ulong resizingMode, ulong mode, -+ ulong options); -+}; -+ -+ -+class BGLScreen : public BWindowScreen { -+public: -+ BGLScreen(char* name, -+ ulong screenMode, ulong options, -+ status_t *error, bool debug=false); -+ ~BGLScreen(); -+ -+ void LockGL(); -+ void UnlockGL(); -+ void SwapBuffers(); -+ // Mesa's GLenum is uint where Be's ones was ulong! -+ virtual void ErrorCallback(unsigned long errorCode); -+ -+ virtual void ScreenConnected(bool connected); -+ virtual void FrameResized(float width, float height); -+ virtual status_t Perform(perform_code code, void *arg); -+ -+ virtual status_t Archive(BMessage *data, bool deep = true) const; -+ virtual void MessageReceived(BMessage *message); -+ -+ virtual void Show(); -+ virtual void Hide(); -+ -+ virtual BHandler* ResolveSpecifier(BMessage *message, -+ int32 index, -+ BMessage *specifier, -+ int32 form, -+ const char *property); -+ virtual status_t GetSupportedSuites(BMessage *data); -+ -+private: -+ -+ virtual void _ReservedGLScreen1(); -+ virtual void _ReservedGLScreen2(); -+ virtual void _ReservedGLScreen3(); -+ virtual void _ReservedGLScreen4(); -+ virtual void _ReservedGLScreen5(); -+ virtual void _ReservedGLScreen6(); -+ virtual void _ReservedGLScreen7(); -+ virtual void _ReservedGLScreen8(); -+ -+ BGLScreen(const BGLScreen &); -+ BGLScreen &operator=(const BGLScreen &); -+ -+ void* fGc; -+ long fOptions; -+ BLocker fDrawLock; -+ -+ int32 fColorSpace; -+ uint32 fScreenMode; -+ -+ uint64 _reserved[7]; -+}; -+ -+#endif // __cplusplus -+ -+#endif // BGLVIEW_H -diff --git a/include/Makefile.am b/include/Makefile.am -index 800ed55..49ffb8b 100644 ---- a/include/Makefile.am -+++ b/include/Makefile.am -@@ -44,6 +44,10 @@ EGL_HEADER_FILES = \ - EGL/eglext.h \ - EGL/eglplatform.h - -+HGL_HEADER_FILES = \ -+ HGL/OpenGLKit.h \ -+ HGL/opengl/GLView.h -+ - if ENABLE_GL_HEADERS - nobase_include_HEADERS += $(GL_HEADER_FILES) - else -@@ -76,4 +80,4 @@ else - noinst_HEADERS += $(EGL_HEADER_FILES) - endif - --EXTRA_DIST = meson.build -\ No newline at end of file -+EXTRA_DIST = meson.build $(HGL_HEADER_FILES) -diff --git a/include/meson.build b/include/meson.build -index 5efb90d..408e83a 100644 ---- a/include/meson.build -+++ b/include/meson.build -@@ -22,6 +22,7 @@ - # MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - - inc_include = include_directories('.') -+inc_include_hgl = include_directories('HGL/opengl') - - install_headers( - 'glvnd/GLdispatchABI.h', -@@ -54,6 +55,17 @@ if with_glx and _headers - ) - endif - -+if with_hgl and _headers -+ install_headers( -+ 'HGL/opengl/GLView.h', -+ subdir : 'opengl', -+ ) -+ install_headers( -+ 'HGL/OpenGLKit.h', -+ subdir : '', -+ ) -+endif -+ - if get_option('gles1') and _headers - install_headers( - 'GLES/egl.h', -@@ -89,4 +101,3 @@ if get_option('egl') and _headers - subdir : 'EGL', - ) - endif -- -diff --git a/meson.build b/meson.build -index 8144a22..ab16ffb 100644 ---- a/meson.build -+++ b/meson.build -@@ -110,6 +110,12 @@ elif not get_option('glx').disabled() and dep_x11.found() - with_glx = true - endif - -+with_hgl = false -+if get_option('hgl') and host_machine.system() in ['haiku'] -+ add_languages('cpp') -+ with_hgl = true -+endif -+ - if cc.compiles('typeof(int *);', name : 'typeof') - add_project_arguments('-DHAVE_TYPEOF', language : ['c']) - endif -diff --git a/meson_options.txt b/meson_options.txt -index 43198f6..2b2727a 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -42,6 +42,12 @@ option( - type : 'feature', - description : 'Support the GLX platform.' - ) -+option( -+ 'hgl', -+ type : 'boolean', -+ value : true, -+ description : 'Support the Haiku GL platform.' -+) - option( - 'gles1', - type : 'boolean', -diff --git a/src/EGL/meson.build b/src/EGL/meson.build -index 9d109b1..c90f0ca 100644 ---- a/src/EGL/meson.build -+++ b/src/EGL/meson.build -@@ -29,6 +29,21 @@ libegl_dispatch_stubs = static_library( - gnu_symbol_visibility : 'hidden', - ) - -+if host_machine.system() in ['haiku'] -+ # A booted Haiku system has a rigid directory structure. -+ # non-packaged prefixes are like local where the user can modify the contents. -+ # Anything missing "non-packaged" is read-only and populated by our software packages. -+ # Anything in system is system installed software, anything in home is user installed -+ egl_vendor_config_dirs = '/boot/home/config/non-packaged/add-ons/opengl/egl_vendor.d' -+ egl_vendor_config_dirs += ':/boot/home/config/add-ons/opengl/egl_vendor.d' -+ egl_vendor_config_dirs += ':/boot/system/non-packaged/add-ons/opengl/egl_vendor.d' -+ egl_vendor_config_dirs += ':/boot/system/add-ons/opengl/egl_vendor.d' -+else -+ egl_vendor_config_dirs = '@0@/glvnd/egl_vendor.d:@1@/glvnd/egl_vendor.d'.format( -+ join_paths(get_option('prefix'),get_option('sysconfdir')), -+ join_paths(get_option('prefix'),get_option('datadir'))) -+endif -+ - libEGL = shared_library( - 'EGL', - [ -@@ -39,9 +54,7 @@ libEGL = shared_library( - 'libeglerror.c', - ], - c_args : [ -- '-DDEFAULT_EGL_VENDOR_CONFIG_DIRS="@0@/glvnd/egl_vendor.d:@1@/glvnd/egl_vendor.d"'.format( -- join_paths(get_option('prefix'), get_option('sysconfdir')), -- join_paths(get_option('prefix'), get_option('datadir'))), -+ '-DDEFAULT_EGL_VENDOR_CONFIG_DIRS="@0@"'.format(egl_vendor_config_dirs) - ], - include_directories : inc_include, - link_args : '-Wl,-Bsymbolic', -diff --git a/src/HGL/.gitignore b/src/HGL/.gitignore -new file mode 100644 -index 0000000..84a797f ---- /dev/null -+++ b/src/HGL/.gitignore -@@ -0,0 +1,2 @@ -+g_glapi_mapi_gl_tmp.h -+g_libglglxwrapper.c -diff --git a/src/HGL/BitmapHook.h b/src/HGL/BitmapHook.h -new file mode 100644 -index 0000000..5a9ec53 ---- /dev/null -+++ b/src/HGL/BitmapHook.h -@@ -0,0 +1,17 @@ -+/* -+ * Copyright 2006-2023, Haiku. All rights reserved. -+ * Distributed under the terms of the MIT License. -+ */ -+ -+#pragma once -+ -+#include -+ -+class BBitmap; -+ -+class BitmapHook { -+public: -+ virtual ~BitmapHook() {}; -+ virtual void GetSize(uint32_t &width, uint32_t &height) = 0; -+ virtual BBitmap *SetBitmap(BBitmap *bmp) = 0; -+}; -diff --git a/src/HGL/GLView.cpp b/src/HGL/GLView.cpp -new file mode 100644 -index 0000000..9b99853 ---- /dev/null -+++ b/src/HGL/GLView.cpp -@@ -0,0 +1,580 @@ -+/* -+ * Copyright 2006-2023, Haiku. All rights reserved. -+ * Distributed under the terms of the MIT License. -+ * -+ * Authors: -+ * Jérôme Duval, korli@users.berlios.de -+ * Philippe Houdoin, philippe.houdoin@free.fr -+ * Stefano Ceccherini, burton666@libero.it -+ * X512, danger_mail@list.ru -+ * Alexander von Gluck IV, kallisti5@unixzen.com -+ */ -+ -+#include -+ -+#define EGL_EGL_PROTOTYPES 0 -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "BitmapHook.h" -+ -+ -+struct glview_direct_info { -+ direct_buffer_info* direct_info; -+ bool direct_connected; -+ bool enable_direct_mode; -+ -+ glview_direct_info(); -+ ~glview_direct_info(); -+}; -+ -+#define LIBEGL_HOOK_LIST(REQUIRED) \ -+ REQUIRED(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress) \ -+ REQUIRED(PFNEGLGETDISPLAYPROC, eglGetDisplay) \ -+ REQUIRED(PFNEGLINITIALIZEPROC, eglInitialize) \ -+ REQUIRED(PFNEGLCHOOSECONFIGPROC, eglChooseConfig) \ -+ REQUIRED(PFNEGLBINDAPIPROC, eglBindAPI) \ -+ REQUIRED(PFNEGLCREATECONTEXTPROC, eglCreateContext) \ -+ REQUIRED(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext) \ -+ REQUIRED(PFNEGLMAKECURRENTPROC, eglMakeCurrent) \ -+ REQUIRED(PFNEGLTERMINATEPROC, eglTerminate) \ -+ REQUIRED(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers) \ -+ REQUIRED(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface) \ -+ REQUIRED(PFNEGLCREATEPBUFFERSURFACEPROC, eglCreatePbufferSurface) \ -+ REQUIRED(PFNEGLDESTROYSURFACEPROC, eglDestroySurface) \ -+ REQUIRED(PFNEGLGETCURRENTCONTEXTPROC, eglGetCurrentContext) \ -+ REQUIRED(PFNEGLGETCURRENTDISPLAYPROC, eglGetCurrentDisplay) -+ -+ -+class BGLView::Display : public BReferenceable { -+public: -+#define DISPATCH_TABLE_ENTRY(x, y) x y {}; -+ LIBEGL_HOOK_LIST(DISPATCH_TABLE_ENTRY) -+#undef DISPATCH_TABLE_ENTRY -+ -+ EGLDisplay eglDpy {}; -+ EGLConfig eglCfg {}; -+ -+private: -+ status_t Init(); -+ -+ pthread_mutex_t fLock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; -+ status_t fStatus = B_NO_INIT; -+ void *libEgl {}; -+ -+protected: -+ virtual void FirstReferenceAcquired(); -+ virtual void LastReferenceReleased(); -+ -+public: -+ Display(); -+ virtual ~Display() = default; -+ -+ status_t InitCheck(); -+}; -+ -+ -+struct BGLView::Renderer { -+ BGLView *view; -+ -+ BReference display; -+ -+ EGLContext eglCtx = EGL_NO_CONTEXT; -+ EGLSurface eglSurf = EGL_NO_SURFACE; -+ uint32_t width = 0; -+ uint32_t height = 0; -+ -+ class BitmapHook: public ::BitmapHook { -+ private: -+ inline Renderer *Base() {return (Renderer*)((char*)this - offsetof(Renderer, fBmpHook));} -+ -+ public: -+ virtual ~BitmapHook() {}; -+ void GetSize(uint32_t &width, uint32_t &height) override; -+ BBitmap *SetBitmap(BBitmap *bmp) override; -+ } fBmpHook; -+ pthread_mutex_t fLock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; -+ ObjectDeleter fBitmap; -+ -+ ~Renderer(); -+ status_t Init(); -+ void SwapBuffers(); -+}; -+ -+ -+BGLView::Display BGLView::sDisplay; -+ -+ -+BGLView::Display::Display() -+{ -+ fReferenceCount = 0; -+} -+ -+status_t BGLView::Display::InitCheck() -+{ -+ PthreadMutexLocker lock(&fLock); -+ return fStatus; -+} -+ -+void BGLView::Display::FirstReferenceAcquired() -+{ -+ PthreadMutexLocker lock(&fLock); -+ fStatus = Init(); -+} -+ -+void BGLView::Display::LastReferenceReleased() -+{ -+ PthreadMutexLocker lock(&fLock); -+ -+ if (fStatus < B_OK) -+ return; -+ -+ fStatus = B_NO_INIT; -+ -+ if (eglDpy == eglGetCurrentDisplay()) -+ eglMakeCurrent(eglDpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -+ -+ eglTerminate(eglDpy); eglDpy = NULL; -+ dlclose(libEgl); libEgl = NULL; -+} -+ -+status_t BGLView::Display::Init() -+{ -+ libEgl = dlopen("libEGL.so.1", RTLD_LOCAL); -+ if (libEgl == NULL) { -+ fprintf(stderr, "[!] libEGL.so.1 not found\n"); -+ return B_ERROR; -+ } -+ -+#define DISPATCH_TABLE_ENTRY(x, y) \ -+ *(void**)&y = dlsym(libEgl, #y); \ -+ if (y == NULL) { \ -+ fprintf(stderr, "[!] libEGL symbol " #y " not found\n"); \ -+ return B_ERROR; \ -+ } -+ LIBEGL_HOOK_LIST(DISPATCH_TABLE_ENTRY) -+#undef DISPATCH_TABLE_ENTRY -+ -+ eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); -+ if (eglDpy == EGL_NO_DISPLAY) { -+ fprintf(stderr, "[!] eglGetDisplay failed to obtain EGL_DEFAULT_DISPLAY\n"); -+ return B_ERROR; -+ } -+ -+ EGLint major, minor; -+ EGLBoolean result = eglInitialize(eglDpy, &major, &minor); -+ if (result != EGL_TRUE) { -+ fprintf(stderr, "[!] eglInitialize failed for EGL_DEFAULT_DISPLAY\n"); -+ return B_ERROR; -+ } -+ -+ EGLint numConfigs; -+ static const EGLint configAttribs[] = { -+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, -+ EGL_BLUE_SIZE, 8, -+ EGL_GREEN_SIZE, 8, -+ EGL_RED_SIZE, 8, -+ EGL_DEPTH_SIZE, 8, -+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, -+ EGL_NONE -+ }; -+ result = eglChooseConfig(eglDpy, configAttribs, &eglCfg, 1, &numConfigs); -+ if (result != EGL_TRUE || numConfigs <= 0) { -+ fprintf(stderr, "[!] eglChooseDisplay failed\n"); -+ return B_ERROR; -+ } -+ -+ return B_OK; -+} -+ -+void BGLView::Renderer::BitmapHook::GetSize(uint32_t &width, uint32_t &height) -+{ -+ PthreadMutexLocker lock(&Base()->fLock); -+ width = Base()->width; -+ height = Base()->height; -+} -+ -+BBitmap *BGLView::Renderer::BitmapHook::SetBitmap(BBitmap *bmp) -+{ -+ PthreadMutexLocker lock(&Base()->fLock); -+ BBitmap* oldBmp = Base()->fBitmap.Detach(); -+ Base()->fBitmap.SetTo(bmp); -+ BMessenger(Base()->view).SendMessage(B_INVALIDATE); -+ return oldBmp; -+} -+ -+status_t BGLView::Renderer::Init() -+{ -+ display = &BGLView::sDisplay; -+ if (display->InitCheck() < B_OK) -+ return display->InitCheck(); -+ -+ EGLContext shareCtx = EGL_NO_CONTEXT; -+ if ((view->fOptions & BGL_SHARE_CONTEXT) != 0) { -+ shareCtx = display->eglGetCurrentContext(); -+ } -+ -+ EGLBoolean result = display->eglBindAPI(EGL_OPENGL_API); -+ if (result != EGL_TRUE) { -+ fprintf(stderr, "[!] eglBindAPI failed\n"); -+ return B_ERROR; -+ } -+ -+ eglCtx = display->eglCreateContext(display->eglDpy, display->eglCfg, shareCtx, NULL); -+ if (eglCtx == NULL) { -+ fprintf(stderr, "[!] eglCreateContext failed\n"); -+ return B_ERROR; -+ } -+ -+ BRect viewFrame = view->Frame(); -+ width = (uint32_t)viewFrame.Width() + 1; -+ height = (uint32_t)viewFrame.Height() + 1; -+ -+ eglSurf = display->eglCreateWindowSurface(display->eglDpy, display->eglCfg, -+ (EGLNativeWindowType)&fBmpHook, NULL); -+ if (eglSurf == NULL) { -+ fprintf(stderr, "[!] eglCreateWindowSurface failed\n"); -+ return B_ERROR; -+ } -+ -+ return B_OK; -+} -+ -+BGLView::Renderer::~Renderer() -+{ -+ if (display->InitCheck() < B_OK) -+ return; -+ -+ if (display->eglDpy == display->eglGetCurrentDisplay() -+ && eglCtx == display->eglGetCurrentContext()) -+ display->eglMakeCurrent(display->eglDpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -+ -+ if (eglSurf != EGL_NO_SURFACE) { -+ display->eglDestroySurface(display->eglDpy, eglSurf); -+ eglSurf = EGL_NO_SURFACE; -+ } -+ -+ if (eglCtx != EGL_NO_CONTEXT) { -+ display->eglDestroyContext(display->eglDpy, eglCtx); -+ eglCtx = EGL_NO_CONTEXT; -+ } -+} -+ -+void BGLView::Renderer::SwapBuffers() -+{ -+ display->eglSwapBuffers(display->eglDpy, eglSurf); -+} -+ -+// #pragma mark - -+ -+BGLView::BGLView(BRect rect, const char* name, ulong resizingMode, ulong mode, -+ ulong options) -+ : -+ BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), -+ fGc(NULL), -+ fOptions(options), -+ fDrawLock("BGLView draw lock"), -+ fDisplayLock("BGLView display lock"), -+ fClipInfo(NULL), -+ fRenderer(new Renderer{.view = this}) -+{ -+ if (fRenderer->Init() < B_OK) { -+ delete fRenderer; -+ fRenderer = NULL; -+ } -+} -+ -+// BeOS compatibility: contrary to others BView's contructors, -+// BGLView one wants a non-const name argument. -+BGLView::BGLView(BRect rect, char* name, ulong resizingMode, ulong mode, -+ ulong options) -+ : -+ BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), -+ fGc(NULL), -+ fOptions(options), -+ fDrawLock("BGLView draw lock"), -+ fDisplayLock("BGLView display lock"), -+ fClipInfo(NULL), -+ fRenderer(new Renderer{.view = this}) -+{ -+ if (fRenderer->Init() < B_OK) { -+ delete fRenderer; -+ fRenderer = NULL; -+ } -+} -+ -+BGLView::~BGLView() -+{ -+ delete fRenderer; -+ delete fClipInfo; -+} -+ -+void -+BGLView::LockGL() -+{ -+ fDisplayLock.Lock(); -+ if (fDisplayLock.CountLocks() == 1) { -+ fRenderer->display->eglMakeCurrent(fRenderer->display->eglDpy, fRenderer->eglSurf, -+ fRenderer->eglSurf, fRenderer->eglCtx); -+ } -+} -+ -+void -+BGLView::UnlockGL() -+{ -+ thread_id lockerThread = fDisplayLock.LockingThread(); -+ thread_id callerThread = find_thread(NULL); -+ -+ if (lockerThread != B_ERROR && lockerThread != callerThread) { -+ printf("UnlockGL is called from wrong thread, lockerThread: %d, callerThread: %d\n", -+ (int)lockerThread, (int)callerThread); -+ } -+ -+ if (fDisplayLock.CountLocks() == 1) { -+ fRenderer->display->eglMakeCurrent(fRenderer->display->eglDpy, EGL_NO_SURFACE, -+ EGL_NO_SURFACE, EGL_NO_CONTEXT); -+ } -+ fDisplayLock.Unlock(); -+} -+ -+void -+BGLView::SwapBuffers() -+{ -+ SwapBuffers(false); -+} -+ -+void -+BGLView::SwapBuffers(bool vSync) -+{ -+ _LockDraw(); -+ fRenderer->SwapBuffers(); -+ _UnlockDraw(); -+} -+ -+ -+BView* -+BGLView::EmbeddedView() -+{ -+ return NULL; -+} -+ -+void* -+BGLView::GetGLProcAddress(const char* procName) -+{ -+ return (void*)fRenderer->display->eglGetProcAddress(procName); -+} -+ -+status_t -+BGLView::CopyPixelsOut(BPoint source, BBitmap* dest) -+{ -+ if (!dest || !dest->Bounds().IsValid()) -+ return B_BAD_VALUE; -+ -+ return ENOSYS; -+} -+ -+status_t -+BGLView::CopyPixelsIn(BBitmap* source, BPoint dest) -+{ -+ if (!source || !source->Bounds().IsValid()) -+ return B_BAD_VALUE; -+ -+ return ENOSYS; -+} -+ -+/*! Mesa's GLenum is not ulong but uint, so we can't use GLenum -+ without breaking this method signature. -+ Instead, we have to use the effective BeOS's SGI OpenGL GLenum type: -+ unsigned long. -+ */ -+void -+BGLView::ErrorCallback(unsigned long errorCode) -+{ -+ char msg[32]; -+ sprintf(msg, "GL: Error code $%04lx.", errorCode); -+ // TODO: under BeOS R5, it call debugger(msg); -+ fprintf(stderr, "%s\n", msg); -+} -+ -+void -+BGLView::Draw(BRect updateRect) -+{ -+ BRegion region(updateRect); -+ PthreadMutexLocker lock(&fRenderer->fLock); -+ if (fRenderer->fBitmap.IsSet()) { -+ DrawBitmap(fRenderer->fBitmap.Get(), B_ORIGIN); -+ region.Exclude(fRenderer->fBitmap->Bounds()); -+ } -+ FillRegion(®ion, B_SOLID_LOW); -+} -+ -+void -+BGLView::AttachedToWindow() -+{ -+ BView::AttachedToWindow(); -+ -+ { -+ PthreadMutexLocker lock(&fRenderer->fLock); -+ fRenderer->width = Bounds().IntegerWidth() + 1; -+ fRenderer->height = Bounds().IntegerHeight() + 1; -+ } -+ -+ // Set default OpenGL viewport: -+ LockGL(); -+ glViewport(0, 0, Bounds().IntegerWidth() + 1, Bounds().IntegerHeight() + 1); -+ UnlockGL(); -+} -+ -+void BGLView::GetPreferredSize(float* _width, float* _height) -+{ -+ if (_width) -+ *_width = 0; -+ if (_height) -+ *_height = 0; -+} -+ -+void -+BGLView::DirectConnected(direct_buffer_info* info) -+{ -+} -+ -+ -+void -+BGLView::EnableDirectMode(bool enabled) -+{ -+} -+ -+void BGLView::FrameResized(float width, float height) -+{ -+ BView::FrameResized(width, height); -+ PthreadMutexLocker lock(&fRenderer->fLock); -+ fRenderer->width = (uint32_t)width + 1; -+ fRenderer->height = (uint32_t)height + 1; -+} -+ -+ -+// forward to base class -+void BGLView::AllAttached() { -+ BView::AllAttached(); -+} -+ -+void BGLView::DetachedFromWindow() { -+ BView::DetachedFromWindow(); -+} -+ -+void BGLView::AllDetached() { -+ BView::AllDetached(); -+} -+ -+status_t BGLView::Perform(perform_code d, void* arg) { -+ return BView::Perform(d, arg); -+} -+ -+status_t BGLView::Archive(BMessage* data, bool deep) const { -+ return BView::Archive(data, deep); -+} -+ -+void BGLView::MessageReceived(BMessage* msg) { -+ BView::MessageReceived(msg); -+} -+ -+void BGLView::SetResizingMode(uint32 mode) { -+ BView::SetResizingMode(mode); -+} -+ -+void BGLView::Show() { -+ BView::Show(); -+} -+ -+void BGLView::Hide() { -+ BView::Hide(); -+} -+ -+BHandler* BGLView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, -+ int32 form, const char* property) { -+ return BView::ResolveSpecifier(msg, index, specifier, form, property); -+} -+ -+status_t BGLView::GetSupportedSuites(BMessage* data) { -+ return BView::GetSupportedSuites(data); -+} -+ -+void BGLView::_LockDraw() -+{ -+ if (!fClipInfo || !fClipInfo->enable_direct_mode) -+ return; -+ -+ fDrawLock.Lock(); -+} -+ -+void BGLView::_UnlockDraw() -+{ -+ if (!fClipInfo || !fClipInfo->enable_direct_mode) -+ return; -+ -+ fDrawLock.Unlock(); -+} -+ -+//---- virtual reserved methods ---------- -+ -+void BGLView::_ReservedGLView1() {} -+void BGLView::_ReservedGLView2() {} -+void BGLView::_ReservedGLView3() {} -+void BGLView::_ReservedGLView4() {} -+void BGLView::_ReservedGLView5() {} -+void BGLView::_ReservedGLView6() {} -+void BGLView::_ReservedGLView7() {} -+void BGLView::_ReservedGLView8() {} -+ -+// #pragma mark - -+ -+const char* color_space_name(color_space space) -+{ -+#define C2N(a) case a: return #a -+ -+ switch (space) { -+ C2N(B_RGB24); -+ C2N(B_RGB32); -+ C2N(B_RGBA32); -+ C2N(B_RGB32_BIG); -+ C2N(B_RGBA32_BIG); -+ C2N(B_GRAY8); -+ C2N(B_GRAY1); -+ C2N(B_RGB16); -+ C2N(B_RGB15); -+ C2N(B_RGBA15); -+ C2N(B_CMAP8); -+ default: -+ return "Unknown!"; -+ }; -+ -+#undef C2N -+}; -+ -+glview_direct_info::glview_direct_info() -+{ -+ // TODO: See direct_window_data() in app_server's ServerWindow.cpp -+ direct_info = (direct_buffer_info*)calloc(1, DIRECT_BUFFER_INFO_AREA_SIZE); -+ direct_connected = false; -+ enable_direct_mode = false; -+} -+ -+glview_direct_info::~glview_direct_info() -+{ -+ free(direct_info); -+} -diff --git a/src/HGL/libgl.c b/src/HGL/libgl.c -new file mode 100644 -index 0000000..e13571d ---- /dev/null -+++ b/src/HGL/libgl.c -@@ -0,0 +1,59 @@ -+/* -+ * Copyright (c) 2013, NVIDIA CORPORATION. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and/or associated documentation files (the -+ * "Materials"), to deal in the Materials without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Materials, and to -+ * permit persons to whom the Materials are furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * unaltered in all copies or substantial portions of the Materials. -+ * Any additions, deletions, or changes to the original source files -+ * must be clearly indicated in accompanying documentation. -+ * -+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -+ */ -+ -+#include -+#include -+#include "compiler.h" -+#include "entry.h" -+#include "stub.h" -+#include "GLdispatch.h" -+ -+static int patchStubId = -1; -+ -+// Initialize GLX imports -+#if defined(USE_ATTRIBUTE_CONSTRUCTOR) -+void __attribute__((constructor)) __libGLInit(void) -+#else -+void _init(void) -+#endif -+{ -+ __glDispatchInit(); -+ -+ // Register these entrypoints with GLdispatch so they can be overwritten at -+ // runtime -+ patchStubId = __glDispatchRegisterStubCallbacks(stub_get_patch_callbacks()); -+} -+ -+#if defined(USE_ATTRIBUTE_CONSTRUCTOR) -+void __attribute__((destructor)) __libGLFini(void) -+#else -+void _fini(void) -+#endif -+{ -+ // Unregister the GLdispatch entrypoints -+ stub_cleanup(); -+ __glDispatchUnregisterStubCallbacks(patchStubId); -+ __glDispatchFini(); -+} -diff --git a/src/HGL/meson.build b/src/HGL/meson.build -new file mode 100644 -index 0000000..601fab7 ---- /dev/null -+++ b/src/HGL/meson.build -@@ -0,0 +1,53 @@ -+ -+# Copyright © 2019 Intel Corporation -+ -+# Permission is hereby granted, free of charge, to any person obtaining a -+# copy of this software and/or associated documentation files (the -+# "Materials"), to deal in the Materials without restriction, including -+# without limitation the rights to use, copy, modify, merge, publish, -+# distribute, sublicense, and/or sell copies of the Materials, and to -+# permit persons to whom the Materials are furnished to do so, subject to -+# the following conditions: -+ -+# The above copyright notice and this permission notice shall be included -+# unaltered in all copies or substantial portions of the Materials. -+# Any additions, deletions, or changes to the original source files -+# must be clearly indicated in accompanying documentation. -+ -+# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -+ -+dep_be = cc.find_library('be') -+ -+libGL = shared_library( -+ 'GL', -+ [ -+ 'libgl.c', -+ 'GLView.cpp', -+ ], -+ include_directories : [ -+ inc_include, -+ inc_include_hgl, -+ '/boot/system/develop/headers/private/shared' -+ ], -+ link_args : '-Wl,-Bsymbolic', -+ dependencies : [ -+ dep_dl, idep_gldispatch, idep_glapi_gl, idep_utils_misc, -+ dep_be -+ ], -+ version : '1.0.0', -+ gnu_symbol_visibility : 'hidden', -+ install : true, -+) -+ -+pkg.generate( -+ libGL, -+ filebase : 'gl', -+ description : 'Legacy OpenGL and HGL library and headers.', -+ version : '1.2', -+) -diff --git a/src/meson.build b/src/meson.build -index bedb18c..db489ae 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -35,6 +35,10 @@ if with_glx - subdir('GL') - endif - -+if with_hgl -+ subdir('HGL') -+endif -+ - if get_option('gles1') - subdir('GLESv1') - endif --- -2.37.3 - -From 51138d2b5af83bd0209e926123ae377bcb69c2cd Mon Sep 17 00:00:00 2001 -From: Alexander von Gluck IV -Date: Tue, 28 Mar 2023 20:54:14 -0500 -Subject: [PATCH 4/6] symbols-check: Add Haiku platform symbols - ---- - bin/symbols-check.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/bin/symbols-check.py b/bin/symbols-check.py -index 6049cbe..947105f 100644 ---- a/bin/symbols-check.py -+++ b/bin/symbols-check.py -@@ -52,8 +52,11 @@ PLATFORM_SYMBOLS = [ - '_fbss', - '_fdata', - '_ftext', -+ '_gSharedObjectHaikuABI', -+ '_gSharedObjectHaikuVersion', - ] - -+ - def get_symbols_nm(nm, lib): - ''' - List all the (non platform-specific) symbols exported by the library -@@ -68,7 +71,7 @@ def get_symbols_nm(nm, lib): - if len(fields) == 2 or fields[1] == 'U': - continue - symbol_name = fields[0] -- if platform_name == 'Linux' or platform_name == 'GNU' or platform_name.startswith('GNU/'): -+ if platform_name in ['Linux', 'GNU', 'Haiku'] or platform_name.startswith('GNU/'): - if symbol_name in PLATFORM_SYMBOLS: - continue - elif platform_name == 'Darwin': --- -2.37.3 - -From 249b2cefed2aa76e16ffef8ea8d1cef9a5cbc42b Mon Sep 17 00:00:00 2001 -From: Alexander von Gluck IV -Date: Wed, 29 Mar 2023 07:20:39 -0500 -Subject: [PATCH 5/6] tests/egl: Fix LIBRARY_PATH on Haiku - ---- - tests/eglenv.sh | 10 ++++++++-- - tests/meson.build | 6 +++++- - 2 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/tests/eglenv.sh b/tests/eglenv.sh -index 8237ce5..3b1c026 100644 ---- a/tests/eglenv.sh -+++ b/tests/eglenv.sh -@@ -3,5 +3,11 @@ - __EGL_VENDOR_LIBRARY_DIRS=$TOP_SRCDIR/tests/json - export __EGL_VENDOR_LIBRARY_DIRS - --LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TOP_BUILDDIR/tests/dummy/.libs --export LD_LIBRARY_PATH -+PLATFORM=$(uname -s) -+if test $PLATFORM -eq "Haiku"; then -+ LIBRARY_PATH=$LIBRARY_PATH:$TOP_BUILDDIR/tests/dummy/.libs -+ export LIBRARY_PATH -+else -+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TOP_BUILDDIR/tests/dummy/.libs -+ export LD_LIBRARY_PATH -+fi -diff --git a/tests/meson.build b/tests/meson.build -index 3be62b7..521834c 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -60,7 +60,11 @@ test( - suite : ['gldispatch'], - ) - --_env_ld = 'LD_LIBRARY_PATH=@0@/'.format(dummy_build_dir) -+if host_machine.system() in ['haiku'] -+ _env_ld = 'LIBRARY_PATH=@0@:/boot/system/lib'.format(dummy_build_dir) -+else -+ _env_ld = 'LD_LIBRARY_PATH=@0@'.format(dummy_build_dir) -+endif - - if with_glx - env_glx = [ --- -2.37.3 - -From 782351619d8d804ccbd8aad43bf04f831048dd3e Mon Sep 17 00:00:00 2001 -From: X512 -Date: Wed, 25 Jan 2023 03:40:07 +0900 -Subject: [PATCH 6/6] fix crash on library unload - ---- - src/EGL/libeglcurrent.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/EGL/libeglcurrent.c b/src/EGL/libeglcurrent.c -index a09b96d..7870bc9 100644 ---- a/src/EGL/libeglcurrent.c -+++ b/src/EGL/libeglcurrent.c -@@ -100,6 +100,8 @@ void __eglCurrentTeardown(EGLBoolean doReset) - - if (doReset) { - __glvndPthreadFuncs.mutex_init(¤tStateListMutex, NULL); -+ } else { -+ __glvndPthreadFuncs.key_delete(threadStateKey); - } - } - --- -2.37.3 -