weston-egl-ext.h: add EGL_EXT_swap_buffers_with_damage definitions
... and use it from simple-egl and gl-renderer. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
885a9fe4d9
commit
0725cf17f9
|
@ -48,11 +48,7 @@
|
||||||
#define IVI_SURFACE_ID 9000
|
#define IVI_SURFACE_ID 9000
|
||||||
|
|
||||||
#include "shared/platform.h"
|
#include "shared/platform.h"
|
||||||
|
#include "weston-egl-ext.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
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_buffer_age
|
#ifndef EGL_EXT_buffer_age
|
||||||
#define EGL_EXT_buffer_age 1
|
#define EGL_EXT_buffer_age 1
|
||||||
|
|
|
@ -183,11 +183,7 @@ struct gl_renderer {
|
||||||
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
|
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
|
||||||
PFNEGLCREATEIMAGEKHRPROC create_image;
|
PFNEGLCREATEIMAGEKHRPROC create_image;
|
||||||
PFNEGLDESTROYIMAGEKHRPROC destroy_image;
|
PFNEGLDESTROYIMAGEKHRPROC destroy_image;
|
||||||
|
|
||||||
#ifdef EGL_EXT_swap_buffers_with_damage
|
|
||||||
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
||||||
#endif
|
|
||||||
|
|
||||||
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
|
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
|
||||||
|
|
||||||
int has_unpack_subimage;
|
int has_unpack_subimage;
|
||||||
|
@ -1085,11 +1081,9 @@ gl_renderer_repaint_output(struct weston_output *output,
|
||||||
struct gl_renderer *gr = get_renderer(compositor);
|
struct gl_renderer *gr = get_renderer(compositor);
|
||||||
EGLBoolean ret;
|
EGLBoolean ret;
|
||||||
static int errored;
|
static int errored;
|
||||||
#ifdef EGL_EXT_swap_buffers_with_damage
|
|
||||||
int i, nrects, buffer_height;
|
int i, nrects, buffer_height;
|
||||||
EGLint *egl_damage, *d;
|
EGLint *egl_damage, *d;
|
||||||
pixman_box32_t *rects;
|
pixman_box32_t *rects;
|
||||||
#endif
|
|
||||||
pixman_region32_t buffer_damage, total_damage;
|
pixman_region32_t buffer_damage, total_damage;
|
||||||
enum gl_border_status border_damage = BORDER_STATUS_CLEAN;
|
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);
|
pixman_region32_copy(&output->previous_damage, output_damage);
|
||||||
wl_signal_emit(&output->frame_signal, output);
|
wl_signal_emit(&output->frame_signal, output);
|
||||||
|
|
||||||
#ifdef EGL_EXT_swap_buffers_with_damage
|
|
||||||
if (gr->swap_buffers_with_damage) {
|
if (gr->swap_buffers_with_damage) {
|
||||||
pixman_region32_init(&buffer_damage);
|
pixman_region32_init(&buffer_damage);
|
||||||
weston_transformed_region(output->width, output->height,
|
weston_transformed_region(output->width, output->height,
|
||||||
|
@ -1182,9 +1175,6 @@ gl_renderer_repaint_output(struct weston_output *output,
|
||||||
} else {
|
} else {
|
||||||
ret = eglSwapBuffers(gr->egl_display, go->egl_surface);
|
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) {
|
if (ret == EGL_FALSE && !errored) {
|
||||||
errored = 1;
|
errored = 1;
|
||||||
|
@ -2752,14 +2742,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
|
||||||
weston_log("warning: EGL_EXT_buffer_age not supported. "
|
weston_log("warning: EGL_EXT_buffer_age not supported. "
|
||||||
"Performance could be affected.\n");
|
"Performance could be affected.\n");
|
||||||
|
|
||||||
#ifdef EGL_EXT_swap_buffers_with_damage
|
|
||||||
if (check_extension(extensions, "EGL_EXT_swap_buffers_with_damage"))
|
if (check_extension(extensions, "EGL_EXT_swap_buffers_with_damage"))
|
||||||
gr->swap_buffers_with_damage =
|
gr->swap_buffers_with_damage =
|
||||||
(void *) eglGetProcAddress("eglSwapBuffersWithDamageEXT");
|
(void *) eglGetProcAddress("eglSwapBuffersWithDamageEXT");
|
||||||
else
|
else
|
||||||
weston_log("warning: EGL_EXT_swap_buffers_with_damage not "
|
weston_log("warning: EGL_EXT_swap_buffers_with_damage not "
|
||||||
"supported. Performance could be affected.\n");
|
"supported. Performance could be affected.\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EGL_MESA_configless_context
|
#ifdef EGL_MESA_configless_context
|
||||||
if (check_extension(extensions, "EGL_MESA_configless_context"))
|
if (check_extension(extensions, "EGL_MESA_configless_context"))
|
||||||
|
|
|
@ -116,5 +116,10 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
|
||||||
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
|
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue