Merge pull request #761 from emersion/remove-gl-from-egl

render: remove GL calls from wlr_egl
This commit is contained in:
Drew DeVault 2018-03-27 17:07:36 -04:00 committed by GitHub
commit 6f2de28e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View File

@ -28,6 +28,7 @@ struct wlr_gles2_renderer {
struct wlr_renderer wlr_renderer; struct wlr_renderer wlr_renderer;
struct wlr_egl *egl; struct wlr_egl *egl;
const char *exts_str;
struct { struct {
GLuint quad; GLuint quad;

View File

@ -13,8 +13,7 @@ struct wlr_egl {
EGLConfig config; EGLConfig config;
EGLContext context; EGLContext context;
const char *egl_exts_str; const char *exts_str;
const char *gl_exts_str;
struct { struct {
bool buffer_age; bool buffer_age;

View File

@ -2,7 +2,6 @@
#include <stdio.h> #include <stdio.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <stdlib.h> #include <stdlib.h>
#include <wlr/render/egl.h> #include <wlr/render/egl.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
@ -155,32 +154,28 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
} }
eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl->context); eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, egl->context);
egl->egl_exts_str = eglQueryString(egl->display, EGL_EXTENSIONS); egl->exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
egl->gl_exts_str = (const char*) glGetString(GL_EXTENSIONS);
wlr_log(L_INFO, "Using EGL %d.%d", (int)major, (int)minor); wlr_log(L_INFO, "Using EGL %d.%d", (int)major, (int)minor);
wlr_log(L_INFO, "Supported EGL extensions: %s", egl->egl_exts_str); wlr_log(L_INFO, "Supported EGL extensions: %s", egl->exts_str);
wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR)); wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
wlr_log(L_INFO, "Using %s", glGetString(GL_VERSION));
wlr_log(L_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
wlr_log(L_INFO, "Supported OpenGL ES extensions: %s", egl->gl_exts_str);
if (!check_egl_ext(egl->egl_exts_str, "EGL_WL_bind_wayland_display") || if (!check_egl_ext(egl->exts_str, "EGL_WL_bind_wayland_display") ||
!check_egl_ext(egl->egl_exts_str, "EGL_KHR_image_base")) { !check_egl_ext(egl->exts_str, "EGL_KHR_image_base")) {
wlr_log(L_ERROR, "Required egl extensions not supported"); wlr_log(L_ERROR, "Required egl extensions not supported");
goto error; goto error;
} }
egl->egl_exts.buffer_age = egl->egl_exts.buffer_age =
check_egl_ext(egl->egl_exts_str, "EGL_EXT_buffer_age"); check_egl_ext(egl->exts_str, "EGL_EXT_buffer_age");
egl->egl_exts.swap_buffers_with_damage = egl->egl_exts.swap_buffers_with_damage =
check_egl_ext(egl->egl_exts_str, "EGL_EXT_swap_buffers_with_damage") || check_egl_ext(egl->exts_str, "EGL_EXT_swap_buffers_with_damage") ||
check_egl_ext(egl->egl_exts_str, "EGL_KHR_swap_buffers_with_damage"); check_egl_ext(egl->exts_str, "EGL_KHR_swap_buffers_with_damage");
egl->egl_exts.dmabuf_import = egl->egl_exts.dmabuf_import =
check_egl_ext(egl->egl_exts_str, "EGL_EXT_image_dma_buf_import"); check_egl_ext(egl->exts_str, "EGL_EXT_image_dma_buf_import");
egl->egl_exts.dmabuf_import_modifiers = egl->egl_exts.dmabuf_import_modifiers =
check_egl_ext(egl->egl_exts_str, "EGL_EXT_image_dma_buf_import_modifiers") check_egl_ext(egl->exts_str, "EGL_EXT_image_dma_buf_import_modifiers")
&& eglQueryDmaBufFormatsEXT && eglQueryDmaBufModifiersEXT; && eglQueryDmaBufFormatsEXT && eglQueryDmaBufModifiersEXT;
print_dmabuf_formats(egl); print_dmabuf_formats(egl);

View File

@ -377,6 +377,11 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend) {
renderer->egl = wlr_backend_get_egl(backend); renderer->egl = wlr_backend_get_egl(backend);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL); wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
wlr_log(L_INFO, "Using %s", glGetString(GL_VERSION));
wlr_log(L_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
wlr_log(L_INFO, "Supported GLES2 extensions: %s", renderer->exts_str);
if (glDebugMessageCallbackKHR && glDebugMessageControlKHR) { if (glDebugMessageCallbackKHR && glDebugMessageControlKHR) {
glEnable(GL_DEBUG_OUTPUT_KHR); glEnable(GL_DEBUG_OUTPUT_KHR);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR);