aboutsummaryrefslogtreecommitdiff
path: root/render/egl.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-01-09 11:44:28 +0100
committerSimon Ser <contact@emersion.fr>2021-01-12 11:31:04 +0100
commit50b120927ddcf26c83b219ebe9351b143efebfad (patch)
treea8c7ba46a46b93987ab238f8e3049f6b1e375cc3 /render/egl.c
parent76ed2255ef8da963b1d4a9a121e24a094dfead20 (diff)
render/egl: remove wlr_egl_swap_buffers
Diffstat (limited to 'render/egl.c')
-rw-r--r--render/egl.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/render/egl.c b/render/egl.c
index 22feade3..57146a06 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -196,8 +196,6 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
goto error;
}
- egl->platform = platform;
-
EGLint major, minor;
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
wlr_log(WLR_ERROR, "Failed to initialize EGL");
@@ -219,17 +217,6 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
egl->exts.buffer_age_ext =
check_egl_ext(display_exts_str, "EGL_EXT_buffer_age");
- if (check_egl_ext(display_exts_str, "EGL_KHR_swap_buffers_with_damage")) {
- egl->exts.swap_buffers_with_damage = true;
- load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
- "eglSwapBuffersWithDamageKHR");
- } else if (check_egl_ext(display_exts_str,
- "EGL_EXT_swap_buffers_with_damage")) {
- egl->exts.swap_buffers_with_damage = true;
- load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
- "eglSwapBuffersWithDamageEXT");
- }
-
egl->exts.image_dmabuf_import_ext =
check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import");
if (check_egl_ext(display_exts_str,
@@ -487,60 +474,6 @@ bool wlr_egl_restore_context(struct wlr_egl_context *context) {
context->read_surface, context->context);
}
-bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
- pixman_region32_t *damage) {
- // Never block when swapping buffers on Wayland
- if (egl->platform == EGL_PLATFORM_WAYLAND_EXT) {
- eglSwapInterval(egl->display, 0);
- }
-
- EGLBoolean ret;
- if (damage != NULL && egl->exts.swap_buffers_with_damage) {
- EGLint width = 0, height = 0;
- eglQuerySurface(egl->display, surface, EGL_WIDTH, &width);
- eglQuerySurface(egl->display, surface, EGL_HEIGHT, &height);
-
- pixman_region32_t flipped_damage;
- pixman_region32_init(&flipped_damage);
- wlr_region_transform(&flipped_damage, damage,
- WL_OUTPUT_TRANSFORM_FLIPPED_180, width, height);
-
- int nrects;
- pixman_box32_t *rects =
- pixman_region32_rectangles(&flipped_damage, &nrects);
- EGLint egl_damage[4 * nrects + 1];
- for (int i = 0; i < nrects; ++i) {
- egl_damage[4*i] = rects[i].x1;
- egl_damage[4*i + 1] = rects[i].y1;
- egl_damage[4*i + 2] = rects[i].x2 - rects[i].x1;
- egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1;
- }
-
- pixman_region32_fini(&flipped_damage);
-
- if (nrects == 0) {
- // Swapping with no rects is the same as swapping with the entire
- // surface damaged. To swap with no damage, we set the damage region
- // to a single empty rectangle.
- nrects = 1;
- memset(egl_damage, 0, sizeof(egl_damage));
- }
-
- ret = egl->procs.eglSwapBuffersWithDamage(egl->display, surface,
- egl_damage, nrects);
- } else {
- ret = eglSwapBuffers(egl->display, surface);
- }
-
- if (!ret) {
- wlr_log(WLR_ERROR, "eglSwapBuffers failed");
- return false;
- }
-
- wlr_egl_unset_current(egl);
- return true;
-}
-
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) {