[PATCH weston 3/7] weston-egl-ext.h: add EGL_EXT_swap_buffers_with_damage definitions
Emil Velikov
emil.l.velikov at gmail.com
Mon Jul 4 14:27:15 UTC 2016
From: Emil Velikov <emil.velikov at collabora.com>
... and use it from simple-egl and gl-renderer.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
clients/simple-egl.c | 6 +-----
libweston/gl-renderer.c | 12 ------------
libweston/weston-egl-ext.h | 5 +++++
3 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index d8233c1..6b4f1a1 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -48,11 +48,7 @@
#define IVI_SURFACE_ID 9000
#include "shared/platform.h"
-
-#ifndef EGL_EXT_swap_buffers_with_damage
-#define EGL_EXT_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
+#include "weston-egl-ext.h"
#ifndef EGL_EXT_buffer_age
#define EGL_EXT_buffer_age 1
diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index 28c0b50..bff74ef 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -183,11 +183,7 @@ struct gl_renderer {
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
PFNEGLCREATEIMAGEKHRPROC create_image;
PFNEGLDESTROYIMAGEKHRPROC destroy_image;
-
-#ifdef EGL_EXT_swap_buffers_with_damage
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
-#endif
-
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
int has_unpack_subimage;
@@ -1085,11 +1081,9 @@ gl_renderer_repaint_output(struct weston_output *output,
struct gl_renderer *gr = get_renderer(compositor);
EGLBoolean ret;
static int errored;
-#ifdef EGL_EXT_swap_buffers_with_damage
int i, nrects, buffer_height;
EGLint *egl_damage, *d;
pixman_box32_t *rects;
-#endif
pixman_region32_t buffer_damage, total_damage;
enum gl_border_status border_damage = BORDER_STATUS_CLEAN;
@@ -1144,7 +1138,6 @@ gl_renderer_repaint_output(struct weston_output *output,
pixman_region32_copy(&output->previous_damage, output_damage);
wl_signal_emit(&output->frame_signal, output);
-#ifdef EGL_EXT_swap_buffers_with_damage
if (gr->swap_buffers_with_damage) {
pixman_region32_init(&buffer_damage);
weston_transformed_region(output->width, output->height,
@@ -1182,9 +1175,6 @@ gl_renderer_repaint_output(struct weston_output *output,
} else {
ret = eglSwapBuffers(gr->egl_display, go->egl_surface);
}
-#else /* ! defined EGL_EXT_swap_buffers_with_damage */
- ret = eglSwapBuffers(gr->egl_display, go->egl_surface);
-#endif
if (ret == EGL_FALSE && !errored) {
errored = 1;
@@ -2752,14 +2742,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
weston_log("warning: EGL_EXT_buffer_age not supported. "
"Performance could be affected.\n");
-#ifdef EGL_EXT_swap_buffers_with_damage
if (check_extension(extensions, "EGL_EXT_swap_buffers_with_damage"))
gr->swap_buffers_with_damage =
(void *) eglGetProcAddress("eglSwapBuffersWithDamageEXT");
else
weston_log("warning: EGL_EXT_swap_buffers_with_damage not "
"supported. Performance could be affected.\n");
-#endif
#ifdef EGL_MESA_configless_context
if (check_extension(extensions, "EGL_MESA_configless_context"))
diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h
index e1754f5..7f69ecb 100644
--- a/libweston/weston-egl-ext.h
+++ b/libweston/weston-egl-ext.h
@@ -106,5 +106,10 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
#endif
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
#endif
--
2.8.2
More information about the wayland-devel
mailing list