From 49115e9d5d1c9f9c61c4f05c8e7a16191426b21e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 18 Nov 2020 14:53:13 +0100 Subject: render: rename wlr_renderer_get_dmabuf_formats Rename wlr_renderer_get_dmabuf_formats to wlr_renderer_get_dmabuf_texture_formats. This makes it clear the formats are only suitable for creating wlr_textures. --- include/wlr/render/egl.h | 5 +++-- include/wlr/render/interface.h | 2 +- include/wlr/render/wlr_renderer.h | 2 +- render/egl.c | 19 +++++++++++-------- render/gles2/renderer.c | 6 +++--- render/wlr_renderer.c | 6 +++--- types/wlr_linux_dmabuf_v1.c | 2 +- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index f2d04049..e921201a 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -77,7 +77,7 @@ struct wlr_egl { struct wl_display *wl_display; - struct wlr_drm_format_set dmabuf_formats; + struct wlr_drm_format_set dmabuf_texture_formats; struct wlr_drm_format_set dmabuf_render_formats; EGLBoolean **external_only_dmabuf_formats; }; @@ -126,7 +126,8 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, /** * Get DMA-BUF formats suitable for sampling usage. */ -const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl); +const struct wlr_drm_format_set *wlr_egl_get_dmabuf_texture_formats( + struct wlr_egl *egl); /** * Get DMA-BUF formats suitable for rendering usage. */ diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 44b5a48c..0b364995 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -50,7 +50,7 @@ struct wlr_renderer_impl { struct wl_resource *resource); void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer, struct wl_resource *buffer, int *width, int *height); - const struct wlr_drm_format_set *(*get_dmabuf_formats)( + const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)( struct wlr_renderer *renderer); const struct wlr_drm_format_set *(*get_dmabuf_render_formats)( struct wlr_renderer *renderer); diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index c992ded5..6c6853ca 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -102,7 +102,7 @@ void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *renderer, * Get the DMA-BUF formats supporting sampling usage. Buffers allocated with * a format from this list may be imported via wlr_texture_from_dmabuf. */ -const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_formats( +const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats( struct wlr_renderer *renderer); /** * Reads out of pixels of the currently bound surface into data. `stride` is in diff --git a/render/egl.c b/render/egl.c index 2180c7a1..ff6b916d 100644 --- a/render/egl.c +++ b/render/egl.c @@ -157,13 +157,15 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { } if (modifiers_len == 0) { - wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, DRM_FORMAT_MOD_INVALID); + wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt, + DRM_FORMAT_MOD_INVALID); wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, DRM_FORMAT_MOD_INVALID); } for (int j = 0; j < modifiers_len; j++) { - wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, modifiers[j]); + wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt, + modifiers[j]); if (!external_only[j]) { wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, modifiers[j]); @@ -398,13 +400,13 @@ void wlr_egl_finish(struct wlr_egl *egl) { return; } - for (size_t i = 0; i < egl->dmabuf_formats.len; i++) { + 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_formats); + wlr_drm_format_set_finish(&egl->dmabuf_texture_formats); eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (egl->wl_display) { @@ -605,8 +607,8 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl, 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_formats.len; i++) { - struct wlr_drm_format *fmt = egl->dmabuf_formats.formats[i]; + 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; @@ -812,8 +814,9 @@ static int get_egl_dmabuf_modifiers(struct wlr_egl *egl, int format, return num; } -const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl) { - return &egl->dmabuf_formats; +const struct wlr_drm_format_set *wlr_egl_get_dmabuf_texture_formats( + struct wlr_egl *egl) { + return &egl->dmabuf_texture_formats; } const struct wlr_drm_format_set *wlr_egl_get_dmabuf_render_formats( diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index e5bdcd75..28a24087 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -429,10 +429,10 @@ static void gles2_wl_drm_buffer_get_size(struct wlr_renderer *wlr_renderer, buffer, EGL_HEIGHT, height); } -static const struct wlr_drm_format_set *gles2_get_dmabuf_formats( +static const struct wlr_drm_format_set *gles2_get_dmabuf_texture_formats( struct wlr_renderer *wlr_renderer) { struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); - return wlr_egl_get_dmabuf_formats(renderer->egl); + return wlr_egl_get_dmabuf_texture_formats(renderer->egl); } static const struct wlr_drm_format_set *gles2_get_dmabuf_render_formats( @@ -708,7 +708,7 @@ static const struct wlr_renderer_impl renderer_impl = { .formats = gles2_renderer_formats, .resource_is_wl_drm_buffer = gles2_resource_is_wl_drm_buffer, .wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size, - .get_dmabuf_formats = gles2_get_dmabuf_formats, + .get_dmabuf_texture_formats = gles2_get_dmabuf_texture_formats, .get_dmabuf_render_formats = gles2_get_dmabuf_render_formats, .preferred_read_format = gles2_preferred_read_format, .read_pixels = gles2_read_pixels, diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index f366f80f..18d6c928 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -165,12 +165,12 @@ void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *r, return r->impl->wl_drm_buffer_get_size(r, buffer, width, height); } -const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_formats( +const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats( struct wlr_renderer *r) { - if (!r->impl->get_dmabuf_formats) { + if (!r->impl->get_dmabuf_texture_formats) { return NULL; } - return r->impl->get_dmabuf_formats(r); + return r->impl->get_dmabuf_texture_formats(r); } const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_render_formats( diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index acd4cb4c..87fe3a7c 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -389,7 +389,7 @@ static void linux_dmabuf_send_formats(struct wlr_linux_dmabuf_v1 *linux_dmabuf, struct wl_resource *resource, uint32_t version) { uint64_t modifier_invalid = DRM_FORMAT_MOD_INVALID; const struct wlr_drm_format_set *formats = - wlr_renderer_get_dmabuf_formats(linux_dmabuf->renderer); + wlr_renderer_get_dmabuf_texture_formats(linux_dmabuf->renderer); if (formats == NULL) { return; } -- cgit v1.2.3