From 5ec6d8230d4df137dff722bf4d72f73b0be4c8e6 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sat, 9 Jun 2018 11:35:07 +0200 Subject: Split eglSwapBuffersWithDamage feature detection Detecting whether eglSwapBuffersWithDamageEXT or eglSwapBuffersWithDamageKHR is used should be based on the extension string, not only on the availability of the function. --- include/wlr/render/egl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/wlr') diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 55086755..91f8f4c0 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -22,6 +22,7 @@ struct wlr_egl { bool dmabuf_import; bool image_base; bool swap_buffers_with_damage; + bool swap_buffers_with_damage_khr; } exts; struct wl_display *wl_display; -- cgit v1.2.3 From f1a62a3200ef78e2d70035862c9b5a86bae27e21 Mon Sep 17 00:00:00 2001 From: Vincent Vanlaer Date: Sat, 9 Jun 2018 18:56:04 +0200 Subject: Rename egl.exts to match the extension names --- include/wlr/render/egl.h | 12 ++++++------ render/egl.c | 40 ++++++++++++++++++++-------------------- render/gles2/texture.c | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 91f8f4c0..0f591d60 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -16,12 +16,12 @@ struct wlr_egl { const char *exts_str; struct { - bool bind_wayland_display; - bool buffer_age; - bool dmabuf_import_modifiers; - bool dmabuf_import; - bool image_base; - bool swap_buffers_with_damage; + bool bind_wayland_display_wl; + bool buffer_age_ext; + bool image_dmabuf_import_modifiers_ext; + bool image_dmabuf_import_ext; + bool image_base_khr; + bool swap_buffers_with_damage_ext; bool swap_buffers_with_damage_khr; } exts; diff --git a/render/egl.c b/render/egl.c index 61d3af1a..450562db 100644 --- a/render/egl.c +++ b/render/egl.c @@ -77,7 +77,7 @@ static bool check_egl_ext(const char *exts, const char *ext) { static void print_dmabuf_formats(struct wlr_egl *egl) { /* Avoid log msg if extension is not present */ - if (!egl->exts.dmabuf_import_modifiers) { + if (!egl->exts.image_dmabuf_import_modifiers_ext) { return; } @@ -146,27 +146,27 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display, wlr_log(L_INFO, "Supported EGL extensions: %s", egl->exts_str); wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR)); - egl->exts.image_base = + egl->exts.image_base_khr = check_egl_ext(egl->exts_str, "EGL_KHR_image_base") && eglCreateImageKHR && eglDestroyImageKHR; - egl->exts.buffer_age = + egl->exts.buffer_age_ext = check_egl_ext(egl->exts_str, "EGL_EXT_buffer_age"); - egl->exts.swap_buffers_with_damage = + egl->exts.swap_buffers_with_damage_ext = (check_egl_ext(egl->exts_str, "EGL_EXT_swap_buffers_with_damage") && eglSwapBuffersWithDamageEXT); egl->exts.swap_buffers_with_damage_khr = (check_egl_ext(egl->exts_str, "EGL_KHR_swap_buffers_with_damage") && eglSwapBuffersWithDamageKHR); - egl->exts.dmabuf_import = + egl->exts.image_dmabuf_import_ext = check_egl_ext(egl->exts_str, "EGL_EXT_image_dma_buf_import"); - egl->exts.dmabuf_import_modifiers = + egl->exts.image_dmabuf_import_modifiers_ext = check_egl_ext(egl->exts_str, "EGL_EXT_image_dma_buf_import_modifiers") && eglQueryDmaBufFormatsEXT && eglQueryDmaBufModifiersEXT; print_dmabuf_formats(egl); - egl->exts.bind_wayland_display = + egl->exts.bind_wayland_display_wl = check_egl_ext(egl->exts_str, "EGL_WL_bind_wayland_display") && eglBindWaylandDisplayWL && eglUnbindWaylandDisplayWL && eglQueryWaylandBufferWL; @@ -235,7 +235,7 @@ void wlr_egl_finish(struct wlr_egl *egl) { eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (egl->wl_display) { - assert(egl->exts.bind_wayland_display); + assert(egl->exts.bind_wayland_display_wl); eglUnbindWaylandDisplayWL(egl->display, egl->wl_display); } @@ -245,7 +245,7 @@ void wlr_egl_finish(struct wlr_egl *egl) { } bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display) { - if (!egl->exts.bind_wayland_display) { + if (!egl->exts.bind_wayland_display_wl) { return false; } @@ -258,7 +258,7 @@ bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display) } bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImage image) { - if (!egl->exts.image_base) { + if (!egl->exts.image_base_khr) { return false; } if (!image) { @@ -279,7 +279,7 @@ EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) { } static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) { - if (!egl->exts.buffer_age) { + if (!egl->exts.buffer_age_ext) { return -1; } @@ -314,7 +314,7 @@ bool wlr_egl_is_current(struct wlr_egl *egl) { bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface, pixman_region32_t *damage) { EGLBoolean ret; - if (damage != NULL && (egl->exts.swap_buffers_with_damage || + if (damage != NULL && (egl->exts.swap_buffers_with_damage_ext || egl->exts.swap_buffers_with_damage_khr)) { int nrects; pixman_box32_t *rects = @@ -327,7 +327,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface, egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1; } - if (egl->exts.swap_buffers_with_damage) { + if (egl->exts.swap_buffers_with_damage_ext) { ret = eglSwapBuffersWithDamageEXT(egl->display, surface, egl_damage, nrects); } else { @@ -348,7 +348,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface, EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl, struct wl_resource *data, EGLint *fmt, int *width, int *height, bool *inverted_y) { - if (!egl->exts.bind_wayland_display || !egl->exts.image_base) { + if (!egl->exts.bind_wayland_display_wl || !egl->exts.image_base_khr) { return NULL; } @@ -377,13 +377,13 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl, EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, struct wlr_dmabuf_attributes *attributes) { - if (!egl->exts.image_base) { + if (!egl->exts.image_base_khr) { return NULL; } bool has_modifier = false; if (attributes->modifier != DRM_FORMAT_MOD_INVALID) { - if (!egl->exts.dmabuf_import_modifiers) { + if (!egl->exts.image_dmabuf_import_modifiers_ext) { return NULL; } has_modifier = true; @@ -455,8 +455,8 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, int wlr_egl_get_dmabuf_formats(struct wlr_egl *egl, int **formats) { - if (!egl->exts.dmabuf_import || - !egl->exts.dmabuf_import_modifiers) { + if (!egl->exts.image_dmabuf_import_ext || + !egl->exts.image_dmabuf_import_modifiers_ext) { wlr_log(L_DEBUG, "dmabuf extension not present"); return -1; } @@ -483,8 +483,8 @@ int wlr_egl_get_dmabuf_formats(struct wlr_egl *egl, int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl, int format, uint64_t **modifiers) { - if (!egl->exts.dmabuf_import || - !egl->exts.dmabuf_import_modifiers) { + if (!egl->exts.image_dmabuf_import_ext || + !egl->exts.image_dmabuf_import_modifiers_ext) { wlr_log(L_DEBUG, "dmabuf extension not present"); return -1; } diff --git a/render/gles2/texture.c b/render/gles2/texture.c index ca1398e8..da98a523 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -210,7 +210,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, return NULL; } - if (!egl->exts.dmabuf_import) { + if (!egl->exts.image_dmabuf_import_ext) { wlr_log(L_ERROR, "Cannot create DMA-BUF texture: EGL extension " "unavailable"); return NULL; -- cgit v1.2.3