summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorRye <rye@alchemyviewer.org>2025-10-30 17:22:09 -0400
committerRye <rye@alchemyviewer.org>2025-11-02 21:40:05 -0500
commit0c1cbf2d38cbd0db5c9cfb86559b4fc5e4acee0d (patch)
tree725abfa056852880daeaa3bae41951b03c1bcb3d /indra/llwindow
parent0c796b0c429058b334ee8968c4f0019445c09d55 (diff)
Add support for GLX and EGL to GL extension loader
Fix dullahan wayland support Fix shader GL_ERROR under GL Core profile in Mesa Signed-off-by: Rye <rye@alchemyviewer.org>
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/CMakeLists.txt2
-rw-r--r--indra/llwindow/llsdl.cpp2
-rw-r--r--indra/llwindow/llwindowsdl.cpp57
-rw-r--r--indra/llwindow/llwindowsdl.h33
4 files changed, 91 insertions, 3 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 1f846de35d..aacaef9257 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -160,7 +160,7 @@ if (BUILD_HEADLESS)
${llwindowheadless_HEADER_FILES}
)
- target_compile_definitions( llwindowheadless PUBLIC LL_MESA=1 LL_MESA_HEADLESS=1 )
+ target_compile_definitions( llwindowheadless PUBLIC LL_MESA_HEADLESS=1 )
target_link_libraries (llwindowheadless
llcommon
diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp
index c97356ee80..d0a7552647 100644
--- a/indra/llwindow/llsdl.cpp
+++ b/indra/llwindow/llsdl.cpp
@@ -64,10 +64,12 @@ void sdl_logger(void *userdata, int category, SDL_LogPriority priority, const ch
void init_sdl(const std::string& app_name)
{
+#ifndef LL_SDL_APP
if (!gSDLMainHandled)
{
SDL_SetMainReady();
}
+#endif
SDL_SetLogOutputFunction(&sdl_logger, nullptr);
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 57110f8634..1cfb0b2acb 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -40,11 +40,11 @@
#include "llpreeditor.h"
#include "llsdl.h"
+#if LL_LINUX
#ifdef LL_GLIB
#include <glib.h>
#endif
-#if LL_LINUX
extern "C" {
# include "fontconfig/fontconfig.h"
}
@@ -55,6 +55,13 @@ extern "C" {
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
+
+#if LL_X11
+LLWindowSDL::X11_DATA LLWindowSDL::sX11Data = {};
+#endif
+#if LL_WAYLAND
+LLWindowSDL::WAYLAND_DATA LLWindowSDL::sWaylandData = {};
+#endif
#endif // LL_LINUX
#if LL_DARWIN
@@ -248,7 +255,7 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
if(mFullscreen)
{
- tryFindFullscreenSize( width, height );
+ tryFindFullscreenSize(width, height);
}
SDL_PropertiesID props = SDL_CreateProperties();
@@ -322,6 +329,52 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
mRefreshRate = DEFAULT_REFRESH_RATE;
}
+ /* Grab the window manager specific information */
+#if LL_LINUX
+ if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0)
+ {
+ LL_INFOS() << "Running under X11" << LL_ENDL;
+ mServerProtocol = X11;
+
+ gGLManager.mIsX11 = true;
+
+#if LL_X11
+ sX11Data.xdisplay = (Display *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_DISPLAY_POINTER, nullptr);
+ sX11Data.xwindow = (Window)SDL_GetNumberProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
+ sX11Data.xscreen = (int)SDL_GetNumberProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_X11_SCREEN_NUMBER, -1);
+ if (sX11Data.xdisplay && sX11Data.xwindow)
+ {
+
+ }
+#endif
+
+ gGLManager.initGLX();
+ }
+ else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0)
+ {
+ LL_INFOS() << "Running under Wayland" << LL_ENDL;
+ mServerProtocol = Wayland;
+
+ gGLManager.mIsWayland = true;
+
+#if LL_WAYLAND
+ sWaylandData.display = (struct wl_display *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nullptr);
+ sWaylandData.surface = (struct wl_surface *)SDL_GetPointerProperty(SDL_GetWindowProperties(mWindow), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
+ if (sWaylandData.display && sWaylandData.surface)
+ {
+ }
+#endif
+
+ gGLManager.initEGL();
+
+ // If set (XWayland) remove DISPLAY, this will prompt dullahan to also use Wayland
+ if(getenv("DISPLAY"))
+ {
+ unsetenv("DISPLAY");
+ }
+ }
+#endif
+
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits);
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits);
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueBits);
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 966999ac12..8a8e9dd1bf 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -35,6 +35,15 @@
#include "SDL3/SDL.h"
#include "SDL3/SDL_endian.h"
+#ifdef LL_WAYLAND
+#include <wayland-client-protocol.h>
+#endif
+
+#if LL_X11
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#endif
+
class LLPreeditor;
class LLWindowSDL final : public LLWindow
@@ -217,6 +226,30 @@ private:
U32 mKeyModifiers = SDL_KMOD_NONE;
void tryFindFullscreenSize(int &aWidth, int &aHeight);
+
+ enum EServerProtocol{ X11, Wayland, Unknown };
+ EServerProtocol mServerProtocol = Unknown;
+public:
+#if LL_X11
+ // X11
+ struct X11_DATA
+ {
+ Display* xdisplay = nullptr;
+ Window xwindow = 0;
+ int xscreen = -1;
+ };
+ static X11_DATA sX11Data;
+#endif
+
+#if LL_WAYLAND
+ // Wayland
+ struct WAYLAND_DATA
+ {
+ struct wl_display* display = nullptr;
+ struct wl_surface* surface = nullptr;
+ };
+ static WAYLAND_DATA sWaylandData;
+#endif
};
class LLSplashScreenSDL : public LLSplashScreen