render: choose DMA-BUF texture target via eglQueryDmaBufModifiersEXT

EGL_EXT_image_dma_buf_import_modifiers tells us whether we should use
GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES. Using the right texture target
can fix some failures and/or improve performance on some drivers.

This does the same as a Weston commit [1].

[1]: 40c519a3e6

Closes: https://github.com/swaywm/wlroots/issues/2173
This commit is contained in:
Simon Ser 2020-06-05 15:13:32 +02:00
parent 363bf44a35
commit a3ba82885c
3 changed files with 73 additions and 16 deletions

View file

@ -65,6 +65,7 @@ struct wlr_egl {
struct wl_display *wl_display;
struct wlr_drm_format_set dmabuf_formats;
EGLBoolean **external_only_dmabuf_formats;
};
// TODO: Allocate and return a wlr_egl
@ -106,7 +107,7 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
* of the dmabuf with wlr_egl_check_import_dmabuf once first.
*/
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_attributes *attributes);
struct wlr_dmabuf_attributes *attributes, bool *external_only);
/**
* Get the available dmabuf formats