mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[egl] added fallback for platforms not supporting eglGetPlatformDisplay
This commit is contained in:
parent
406e22a681
commit
278d851c7c
@ -367,11 +367,26 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *client_exts = eglQueryString(NULL, EGL_EXTENSIONS);
|
||||
DEBUG_INFO("Supported extensions: %s", client_exts);
|
||||
|
||||
bool useNative = false;
|
||||
if (strstr(client_exts, "EGL_KHR_platform_base") != NULL)
|
||||
useNative = true;
|
||||
|
||||
DEBUG_INFO("use native: %s", useNative ? "true" : "false");
|
||||
|
||||
switch(wminfo.subsystem)
|
||||
{
|
||||
case SDL_SYSWM_X11:
|
||||
{
|
||||
this->display = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR, wminfo.info.x11.display, NULL);
|
||||
if (!useNative)
|
||||
this->display = eglGetPlatformDisplay(EGL_PLATFORM_X11_KHR, wminfo.info.x11.display, NULL);
|
||||
else
|
||||
{
|
||||
EGLNativeDisplayType native = (EGLNativeDisplayType)wminfo.info.x11.display;
|
||||
this->display = eglGetDisplay(native);
|
||||
}
|
||||
this->nativeWind = (EGLNativeWindowType)wminfo.info.x11.window;
|
||||
break;
|
||||
}
|
||||
@ -381,7 +396,13 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
|
||||
{
|
||||
int width, height;
|
||||
SDL_GetWindowSize(window, &width, &height);
|
||||
this->display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, wminfo.info.wl.display, NULL);
|
||||
if (!useNative)
|
||||
this->display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, wminfo.info.wl.display, NULL);
|
||||
else
|
||||
{
|
||||
EGLNativeDisplayType native = (EGLNativeDisplayType)wminfo.info.wl.display;
|
||||
this->display = eglGetDisplay(native);
|
||||
}
|
||||
this->nativeWind = (EGLNativeWindowType)wl_egl_window_create(wminfo.info.wl.surface, width, height);
|
||||
break;
|
||||
}
|
||||
@ -564,4 +585,4 @@ struct LG_Renderer LGR_EGL =
|
||||
.render_startup = egl_render_startup,
|
||||
.render = egl_render,
|
||||
.update_fps = egl_update_fps
|
||||
};
|
||||
};
|
||||
|
@ -34,6 +34,14 @@ FrameBuffer;
|
||||
|
||||
typedef bool (*FrameBufferReadFn)(void * opaque, const void * src, size_t size);
|
||||
|
||||
/**
|
||||
* Wait for the framebuffer to fill to the specified size
|
||||
*/
|
||||
static inline void framebuffer_wait(const FrameBuffer * frame, size_t size)
|
||||
{
|
||||
while(frame->wp != size) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from the KVMFRFrame into the dst buffer
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user