[PATCH weston v2 2/2] simple-egl: add support for EGL_KHR_swap_buffers_with_damage
Frank Binns
frank.binns at imgtec.com
Mon Nov 14 16:25:27 UTC 2016
On 14/11/16 16:03, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> Functionally identical to the EXT version of the extension.
>
> v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com> (v1)
> ---
> clients/simple-egl.c | 33 +++++++++++++++++++++++++++------
> 1 file changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/clients/simple-egl.c b/clients/simple-egl.c
> index 9d401f9..8c923f8 100644
> --- a/clients/simple-egl.c
> +++ b/clients/simple-egl.c
> @@ -48,6 +48,7 @@
> #include "protocol/ivi-application-client-protocol.h"
> #define IVI_SURFACE_ID 9000
>
> +#include "shared/helpers.h"
> #include "shared/platform.h"
> #include "weston-egl-ext.h"
>
> @@ -125,6 +126,19 @@ static int running = 1;
> static void
> init_egl(struct display *display, struct window *window)
> {
> + static const struct {
> + char *extension, *entrypoint;
> + } foo[] = {
I guess you forgot to do the rename on this one.
Thanks
Frank
> + {
> + .extension = "EGL_EXT_swap_buffers_with_damage",
> + .entrypoint = "eglSwapBuffersWithDamageEXT",
> + },
> + {
> + .extension = "EGL_KHR_swap_buffers_with_damage",
> + .entrypoint = "eglSwapBuffersWithDamageKHR",
> + },
> + };
> +
> static const EGLint context_attribs[] = {
> EGL_CONTEXT_CLIENT_VERSION, 2,
> EGL_NONE
> @@ -191,14 +205,21 @@ init_egl(struct display *display, struct window *window)
> display->swap_buffers_with_damage = NULL;
> extensions = eglQueryString(display->egl.dpy, EGL_EXTENSIONS);
> if (extensions &&
> - weston_check_egl_extension(extensions, "EGL_EXT_swap_buffers_with_damage") &&
> - weston_check_egl_extension(extensions, "EGL_EXT_buffer_age"))
> - display->swap_buffers_with_damage =
> - (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
> - eglGetProcAddress("eglSwapBuffersWithDamageEXT");
> + weston_check_egl_extension(extensions, "EGL_EXT_buffer_age")) {
> + for (i = 0; i < ARRAY_LENGTH(foo); i++) {
> + if (weston_check_egl_extension(extensions,
> + foo[i].extension)) {
> + /* The EXTPROC is identical to the KHR one */
> + display->swap_buffers_with_damage =
> + (PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)
> + eglGetProcAddress(foo[i].entrypoint);
> + break;
> + }
> + }
> + }
>
> if (display->swap_buffers_with_damage)
> - printf("has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage\n");
> + printf("has EGL_EXT_buffer_age and %s\n", foo[i].extension);
>
> }
>
More information about the wayland-devel
mailing list