Rework wayland backend output implementation

This commit is contained in:
nyorain 2017-06-19 22:36:40 +02:00
parent e65ca967f9
commit 792d535225
8 changed files with 156 additions and 154 deletions

View file

@ -73,6 +73,7 @@ static bool egl_get_config(EGLDisplay disp, EGLConfig *out) {
ret = eglGetConfigs(disp, NULL, 0, &count);
if (ret == EGL_FALSE || count == 0) {
wlr_log(L_ERROR, "eglGetConfigs returned no configs");
return false;
}
@ -80,12 +81,19 @@ static bool egl_get_config(EGLDisplay disp, EGLConfig *out) {
ret = eglChooseConfig(disp, NULL, configs, count, &matched);
if (ret == EGL_FALSE) {
wlr_log(L_ERROR, "eglChooseConfig failed");
return false;
}
for (int i = 0; i < matched; ++i) {
EGLint gbm_format;
// TODO, see below
// best would probably be to propagate parameter or config
// choose callback
*out = configs[i];
return true;
if (!eglGetConfigAttrib(disp,
configs[i],
EGL_NATIVE_VISUAL_ID,
@ -101,6 +109,7 @@ static bool egl_get_config(EGLDisplay disp, EGLConfig *out) {
}
}
wlr_log(L_ERROR, "no valid egl config found");
return false;
}
@ -109,7 +118,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *display) {
if (!egl_exts()) {
return false;
}
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
wlr_log(L_ERROR, "Failed to bind to the OpenGL ES API: %s", egl_error());
goto error;
@ -163,7 +172,7 @@ void wlr_egl_free(struct wlr_egl *egl) {
eglDestroyContext(egl->display, egl->context);
eglTerminate(egl->display);
eglReleaseThread();
eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) {