renderer-gl: Assert function presence matches extensions

Some extensions (such as EGL_KHR_partial_update) add functions to EGL.
When the extension is present, GetProcAddress must return usable
function pointers for those entrypoints.

Assert that GetProcAddress returns a non-NULL function pointer in these
cases.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 5 years ago committed by Pekka Paalanen
parent 570490cef5
commit d7120032b0
  1. 14
      libweston/renderer-gl/gl-renderer.c

@ -3526,6 +3526,9 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
if (weston_check_egl_extension(extensions, "EGL_WL_bind_wayland_display")) if (weston_check_egl_extension(extensions, "EGL_WL_bind_wayland_display"))
gr->has_bind_display = true; gr->has_bind_display = true;
if (gr->has_bind_display) { if (gr->has_bind_display) {
assert(gr->bind_display);
assert(gr->unbind_display);
assert(gr->query_buffer);
ret = gr->bind_display(gr->egl_display, ec->wl_display); ret = gr->bind_display(gr->egl_display, ec->wl_display);
if (!ret) if (!ret)
gr->has_bind_display = false; gr->has_bind_display = false;
@ -3534,8 +3537,10 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
if (weston_check_egl_extension(extensions, "EGL_EXT_buffer_age")) if (weston_check_egl_extension(extensions, "EGL_EXT_buffer_age"))
gr->has_egl_buffer_age = true; gr->has_egl_buffer_age = true;
if (weston_check_egl_extension(extensions, "EGL_KHR_partial_update")) if (weston_check_egl_extension(extensions, "EGL_KHR_partial_update")) {
assert(gr->set_damage_region);
gr->has_egl_partial_update = true; gr->has_egl_partial_update = true;
}
for (i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint); i++) { for (i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint); i++) {
if (weston_check_egl_extension(extensions, if (weston_check_egl_extension(extensions,
@ -3543,6 +3548,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
gr->swap_buffers_with_damage = gr->swap_buffers_with_damage =
(void *) eglGetProcAddress( (void *) eglGetProcAddress(
swap_damage_ext_to_entrypoint[i].entrypoint); swap_damage_ext_to_entrypoint[i].entrypoint);
assert(gr->swap_buffers_with_damage);
break; break;
} }
} }
@ -3563,6 +3569,8 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglQueryDmaBufFormatsEXT"); (void *) eglGetProcAddress("eglQueryDmaBufFormatsEXT");
gr->query_dmabuf_modifiers = gr->query_dmabuf_modifiers =
(void *) eglGetProcAddress("eglQueryDmaBufModifiersEXT"); (void *) eglGetProcAddress("eglQueryDmaBufModifiersEXT");
assert(gr->query_dmabuf_formats);
assert(gr->query_dmabuf_modifiers);
gr->has_dmabuf_import_modifiers = true; gr->has_dmabuf_import_modifiers = true;
} }
@ -3574,6 +3582,9 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglDestroySyncKHR"); (void *) eglGetProcAddress("eglDestroySyncKHR");
gr->dup_native_fence_fd = gr->dup_native_fence_fd =
(void *) eglGetProcAddress("eglDupNativeFenceFDANDROID"); (void *) eglGetProcAddress("eglDupNativeFenceFDANDROID");
assert(gr->create_sync);
assert(gr->destroy_sync);
assert(gr->dup_native_fence_fd);
gr->has_native_fence_sync = true; gr->has_native_fence_sync = true;
} else { } else {
weston_log("warning: Disabling render GPU timeline and explicit " weston_log("warning: Disabling render GPU timeline and explicit "
@ -3583,6 +3594,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
if (weston_check_egl_extension(extensions, "EGL_KHR_wait_sync")) { if (weston_check_egl_extension(extensions, "EGL_KHR_wait_sync")) {
gr->wait_sync = (void *) eglGetProcAddress("eglWaitSyncKHR"); gr->wait_sync = (void *) eglGetProcAddress("eglWaitSyncKHR");
assert(gr->wait_sync);
gr->has_wait_sync = true; gr->has_wait_sync = true;
} else { } else {
weston_log("warning: Disabling explicit synchronization due" weston_log("warning: Disabling explicit synchronization due"

Loading…
Cancel
Save