[PATCH weston 1/2] gl-renderer: add support for EGL_KHR_swap_buffers_with_damage
Eric Engestrom
eric.engestrom at imgtec.com
Fri Nov 4 11:32:39 UTC 2016
On Thursday, 2016-11-03 22:38:19 +0000, Emil Velikov wrote:
> Extension is identical to the EXT one, yet we need to check for the KHR
> abbreviated extension name + entry-point.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
> libweston/gl-renderer.c | 29 +++++++++++++++++++++++------
> 1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
> index 3e8e5ab..a585001 100644
> --- a/libweston/gl-renderer.c
> +++ b/libweston/gl-renderer.c
> @@ -2781,6 +2781,18 @@ renderer_setup_egl_client_extensions(struct gl_renderer *gr)
> static int
> gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
> {
> + static const struct {
> + char *extension, *entrypoint;
> + } foo[] = {
Since the goal of this table is to get the entrypoint when you found an
extension, how about `swap_buffers_with_damage_ext_to_entrypoint`?
Rather long I'll concede, but explicit.
You can also drop the middle bit: `swap_damage_ext_to_entrypoint`
With an appropriate name here (and the other patch), the series is:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
> + {
> + .extension = "EGL_EXT_swap_buffers_with_damage",
> + .entrypoint = "eglSwapBuffersWithDamageEXT",
> + },
> + {
> + .extension = "EGL_KHR_swap_buffers_with_damage",
> + .entrypoint = "eglSwapBuffersWithDamageKHR",
> + },
> + };
> struct gl_renderer *gr = get_renderer(ec);
> const char *extensions;
> EGLBoolean ret;
> @@ -2815,12 +2827,17 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
> weston_log("warning: EGL_EXT_buffer_age not supported. "
> "Performance could be affected.\n");
>
> - if (weston_check_egl_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");
> + for (unsigned i = 0; i < ARRAY_LENGTH(foo); i++) {
Yay for not forgetting `i<` :P
> + if (weston_check_egl_extension(extensions, foo[i].extension)) {
> + gr->swap_buffers_with_damage =
> + (void *) eglGetProcAddress(foo[i].entrypoint);
> + break;
> + }
> + }
> + if (!gr->swap_buffers_with_damage)
> + weston_log("warning: neither %s or %s is supported. "
> + "Performance could be affected.\n",
> + foo[0].extension, foo[1].extension);
>
> if (weston_check_egl_extension(extensions, "EGL_MESA_configless_context"))
> gr->has_configless_context = 1;
> --
> 2.9.3
>
More information about the wayland-devel
mailing list