diff options
author | emersion <contact@emersion.fr> | 2018-05-30 14:18:07 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-05-30 17:08:15 +0100 |
commit | 135721118a719ecacfd2bd83524a9c53c6ca6015 (patch) | |
tree | 5079957bc4cae37edfbd78a9d6b708a6000e1438 /render/gles2 | |
parent | 41e53d14997de21fbad80d420acb358bec4341e8 (diff) |
render: remove wlr_renderer_check_import_dmabuf
It's possible to implement it outside the renderer, by creating a
texture and destroying it right away. This reduces the API surface
of the renderer.
Diffstat (limited to 'render/gles2')
-rw-r--r-- | render/gles2/renderer.c | 7 | ||||
-rw-r--r-- | render/gles2/texture.c | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index e68bb83f..ed12fc7c 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -242,12 +242,6 @@ static int gles2_get_dmabuf_modifiers(struct wlr_renderer *wlr_renderer, return wlr_egl_get_dmabuf_modifiers(renderer->egl, format, modifiers); } -static bool gles2_check_import_dmabuf(struct wlr_renderer *wlr_renderer, - struct wlr_dmabuf_attributes *attribs) { - struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - return wlr_egl_check_import_dmabuf(renderer->egl, attribs); -} - static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer, enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, @@ -348,7 +342,6 @@ static const struct wlr_renderer_impl renderer_impl = { .wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size, .get_dmabuf_formats = gles2_get_dmabuf_formats, .get_dmabuf_modifiers = gles2_get_dmabuf_modifiers, - .check_import_dmabuf = gles2_check_import_dmabuf, .read_pixels = gles2_read_pixels, .format_supported = gles2_format_supported, .texture_from_pixels = gles2_texture_from_pixels, diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 2627e292..89a175c4 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -198,6 +198,10 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl, return &texture->wlr_texture; } +#ifndef DRM_FORMAT_BIG_ENDIAN +#define DRM_FORMAT_BIG_ENDIAN 0x80000000 +#endif + struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, struct wlr_dmabuf_attributes *attribs) { assert(wlr_egl_is_current(egl)); @@ -212,6 +216,18 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl, return NULL; } + switch (attribs->format & ~DRM_FORMAT_BIG_ENDIAN) { + case WL_SHM_FORMAT_YUYV: + case WL_SHM_FORMAT_YVYU: + case WL_SHM_FORMAT_UYVY: + case WL_SHM_FORMAT_VYUY: + case WL_SHM_FORMAT_AYUV: + // TODO: YUV based formats not yet supported, require multiple images + return false; + default: + break; + } + struct wlr_gles2_texture *texture = calloc(1, sizeof(struct wlr_gles2_texture)); if (texture == NULL) { |