mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 07:55:59 +01:00
render/egl: remove wlr_egl.external_only_dmabuf_formats
Replace it with wlr_egl.dmabuf_render_formats.
This commit is contained in:
parent
1f15dd093d
commit
83a5d03bf3
2 changed files with 1 additions and 38 deletions
|
@ -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
|
||||
|
|
38
render/egl.c
38
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue