libweston: assert that renderer->get_supported_formats() is set

This just documents why we can be sure that
renderer->get_supported_formats() is set in bind_linux_dmabuf().

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Leandro Ribeiro 3 years ago
parent 60c7fee48d
commit 18f53ab2d4
  1. 6
      libweston/linux-dmabuf.c

@ -494,8 +494,12 @@ bind_linux_dmabuf(struct wl_client *client,
wl_resource_set_implementation(resource, &linux_dmabuf_implementation, wl_resource_set_implementation(resource, &linux_dmabuf_implementation,
compositor, NULL); compositor, NULL);
/* Advertise the formats/modifiers */ /* If we got here, it means that the renderer is able to import dma-buf
* buffers, and so it must have get_supported_formats() set. */
assert(compositor->renderer->get_supported_formats != NULL);
supported_formats = compositor->renderer->get_supported_formats(compositor); supported_formats = compositor->renderer->get_supported_formats(compositor);
/* Advertise the formats/modifiers */
wl_array_for_each(fmt, &supported_formats->arr) { wl_array_for_each(fmt, &supported_formats->arr) {
modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers); modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers);
for (i = 0; i < num_modifiers; i++) { for (i = 0; i < num_modifiers; i++) {

Loading…
Cancel
Save