aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2018-06-09 11:35:07 +0200
committerVincent Vanlaer <vincent.vanlaer@skynet.be>2018-06-09 11:39:14 +0200
commit5ec6d8230d4df137dff722bf4d72f73b0be4c8e6 (patch)
tree1a90ff2ca65dcc98eda863063bbbff692e678d59
parent9179b438a596943f78dd2f7c27086c3116b26b01 (diff)
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.
-rw-r--r--include/wlr/render/egl.h1
-rw-r--r--render/egl.c9
2 files changed, 6 insertions, 4 deletions
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;
diff --git a/render/egl.c b/render/egl.c
index eafaebd7..61d3af1a 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -154,7 +154,8 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
check_egl_ext(egl->exts_str, "EGL_EXT_buffer_age");
egl->exts.swap_buffers_with_damage =
(check_egl_ext(egl->exts_str, "EGL_EXT_swap_buffers_with_damage") &&
- eglSwapBuffersWithDamageEXT) ||
+ eglSwapBuffersWithDamageEXT);
+ egl->exts.swap_buffers_with_damage_khr =
(check_egl_ext(egl->exts_str, "EGL_KHR_swap_buffers_with_damage") &&
eglSwapBuffersWithDamageKHR);
@@ -313,7 +314,8 @@ 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 ||
+ egl->exts.swap_buffers_with_damage_khr)) {
int nrects;
pixman_box32_t *rects =
pixman_region32_rectangles(damage, &nrects);
@@ -325,8 +327,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1;
}
- assert(eglSwapBuffersWithDamageEXT || eglSwapBuffersWithDamageKHR);
- if (eglSwapBuffersWithDamageEXT) {
+ if (egl->exts.swap_buffers_with_damage) {
ret = eglSwapBuffersWithDamageEXT(egl->display, surface, egl_damage,
nrects);
} else {