From 83a5d03bf361ab9ffa29fb2b809a8e81c4a75d0f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 30 Nov 2020 10:56:24 +0100 Subject: render/egl: remove wlr_egl.external_only_dmabuf_formats Replace it with wlr_egl.dmabuf_render_formats. --- include/wlr/render/egl.h | 1 - render/egl.c | 38 +------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index e921201a..114dd9c7 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -79,7 +79,6 @@ struct wlr_egl { struct wlr_drm_format_set dmabuf_texture_formats; struct wlr_drm_format_set dmabuf_render_formats; - EGLBoolean **external_only_dmabuf_formats; }; // TODO: Allocate and return a wlr_egl diff --git a/render/egl.c b/render/egl.c index ff6b916d..2b899593 100644 --- a/render/egl.c +++ b/render/egl.c @@ -138,13 +138,6 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { return; } - egl->external_only_dmabuf_formats = calloc(formats_len, sizeof(EGLBoolean *)); - if (egl->external_only_dmabuf_formats == NULL) { - wlr_log_errno(WLR_ERROR, "Allocation failed"); - goto out; - } - - size_t external_formats_len = 0; for (int i = 0; i < formats_len; i++) { uint32_t fmt = formats[i]; @@ -173,9 +166,6 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { } free(modifiers); - - egl->external_only_dmabuf_formats[external_formats_len] = external_only; - external_formats_len++; } char *str_formats = malloc(formats_len * 5 + 1); @@ -400,11 +390,6 @@ void wlr_egl_finish(struct wlr_egl *egl) { return; } - for (size_t i = 0; i < egl->dmabuf_texture_formats.len; i++) { - free(egl->external_only_dmabuf_formats[i]); - } - free(egl->external_only_dmabuf_formats); - wlr_drm_format_set_finish(&egl->dmabuf_render_formats); wlr_drm_format_set_finish(&egl->dmabuf_texture_formats); @@ -605,27 +590,6 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl, EGL_WAYLAND_BUFFER_WL, data, attribs); } -static bool dmabuf_format_is_external_only(struct wlr_egl *egl, - uint32_t format, uint64_t modifier) { - for (size_t i = 0; i < egl->dmabuf_texture_formats.len; i++) { - struct wlr_drm_format *fmt = egl->dmabuf_texture_formats.formats[i]; - if (fmt->format == format) { - if (egl->external_only_dmabuf_formats[i] == NULL) { - break; - } - for (size_t j = 0; j < fmt->len; j++) { - if (fmt->modifiers[j] == modifier) { - return egl->external_only_dmabuf_formats[i][j]; - } - } - break; - } - } - // No info, we're doomed. Choose GL_TEXTURE_EXTERNAL_OES and hope for the - // best. - return true; -} - EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, struct wlr_dmabuf_attributes *attributes, bool *external_only) { if (!egl->exts.image_base_khr || !egl->exts.image_dmabuf_import_ext) { @@ -715,7 +679,7 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, return EGL_NO_IMAGE_KHR; } - *external_only = dmabuf_format_is_external_only(egl, + *external_only = !wlr_drm_format_set_has(&egl->dmabuf_render_formats, attributes->format, attributes->modifier); return image; } -- cgit v1.2.3