|
|
|
@ -5,7 +5,6 @@
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <wayland-client.h>
|
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
|
|
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
|
#include <EGL/eglext.h>
|
|
|
|
@ -39,37 +38,34 @@ bool egl_init(struct wl_display *display) {
|
|
|
|
|
eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
|
|
|
|
if (client_exts_str == NULL) {
|
|
|
|
|
if (eglGetError() == EGL_BAD_DISPLAY) {
|
|
|
|
|
wlr_log(WLR_ERROR,
|
|
|
|
|
"EGL_EXT_client_extensions not supported");
|
|
|
|
|
fprintf(stderr, "EGL_EXT_client_extensions not supported\n");
|
|
|
|
|
} else {
|
|
|
|
|
wlr_log(WLR_ERROR,
|
|
|
|
|
"Failed to query EGL client extensions");
|
|
|
|
|
fprintf(stderr, "Failed to query EGL client extensions\n");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strstr(client_exts_str, "EGL_EXT_platform_base")) {
|
|
|
|
|
wlr_log(WLR_ERROR, "EGL_EXT_platform_base not supported");
|
|
|
|
|
fprintf(stderr, "EGL_EXT_platform_base not supported\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strstr(client_exts_str, "EGL_EXT_platform_wayland")) {
|
|
|
|
|
wlr_log(WLR_ERROR, "EGL_EXT_platform_wayland not supported");
|
|
|
|
|
fprintf(stderr, "EGL_EXT_platform_wayland not supported\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
eglGetPlatformDisplayEXT =
|
|
|
|
|
(void *)eglGetProcAddress("eglGetPlatformDisplayEXT");
|
|
|
|
|
if (eglGetPlatformDisplayEXT == NULL) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to get eglGetPlatformDisplayEXT");
|
|
|
|
|
fprintf(stderr, "Failed to get eglGetPlatformDisplayEXT\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
eglCreatePlatformWindowSurfaceEXT =
|
|
|
|
|
(void *)eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
|
|
|
|
|
if (eglCreatePlatformWindowSurfaceEXT == NULL) {
|
|
|
|
|
wlr_log(WLR_ERROR,
|
|
|
|
|
"Failed to get eglCreatePlatformWindowSurfaceEXT");
|
|
|
|
|
fprintf(stderr, "Failed to get eglCreatePlatformWindowSurfaceEXT\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -77,23 +73,23 @@ bool egl_init(struct wl_display *display) {
|
|
|
|
|
eglGetPlatformDisplayEXT(EGL_PLATFORM_WAYLAND_EXT,
|
|
|
|
|
display, NULL);
|
|
|
|
|
if (egl_display == EGL_NO_DISPLAY) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to create EGL display");
|
|
|
|
|
fprintf(stderr, "Failed to create EGL display\n");
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (eglInitialize(egl_display, NULL, NULL) == EGL_FALSE) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to initialize EGL");
|
|
|
|
|
fprintf(stderr, "Failed to initialize EGL\n");
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EGLint matched = 0;
|
|
|
|
|
if (!eglChooseConfig(egl_display, config_attribs,
|
|
|
|
|
&egl_config, 1, &matched)) {
|
|
|
|
|
wlr_log(WLR_ERROR, "eglChooseConfig failed");
|
|
|
|
|
fprintf(stderr, "eglChooseConfig failed\n");
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
if (matched == 0) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to match an EGL config");
|
|
|
|
|
fprintf(stderr, "Failed to match an EGL config\n");
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,7 +97,7 @@ bool egl_init(struct wl_display *display) {
|
|
|
|
|
eglCreateContext(egl_display, egl_config,
|
|
|
|
|
EGL_NO_CONTEXT, context_attribs);
|
|
|
|
|
if (egl_context == EGL_NO_CONTEXT) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to create EGL context");
|
|
|
|
|
fprintf(stderr, "Failed to create EGL context\n");
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|