From 8a9fba982799704bbe14376f3eb44d324c45f32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Tue, 23 Jul 2024 12:32:04 +0200 Subject: [PATCH] gl-renderer: Merge duplicated functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge duplicated gl_renderer_attach_dmabuf() and gl_renderer_attach_egl() functions into a single gl_renderer_attach_buffer() one. Signed-off-by: Loïc Molinari --- libweston/renderer-gl/gl-renderer.c | 33 +++-------------------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 941e0481..a73b3ad9 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2933,28 +2933,6 @@ err_free: return false; } -static void -gl_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) -{ - struct weston_compositor *ec = es->compositor; - struct gl_renderer *gr = get_renderer(ec); - struct gl_surface_state *gs = get_surface_state(es); - struct gl_buffer_state *gb = buffer->renderer_private; - GLenum target; - int i; - - assert(gb); - - gs->buffer = gb; - - target = gl_shader_texture_variant_get_target(gb->shader_variant); - for (i = 0; i < gb->num_images; i++) { - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(target, gb->textures[i]); - gr->image_target_texture_2d(target, gb->images[i]); - } -} - static void gl_renderer_destroy_dmabuf(struct linux_dmabuf_buffer *dmabuf) { @@ -3458,9 +3436,8 @@ attach_direct_display_placeholder(struct weston_paint_node *pnode) gb->shader_variant = SHADER_VARIANT_SOLID; } - -static bool -gl_renderer_attach_dmabuf(struct weston_surface *surface, +static void +gl_renderer_attach_buffer(struct weston_surface *surface, struct weston_buffer *buffer) { struct gl_renderer *gr = get_renderer(surface->compositor); @@ -3480,8 +3457,6 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, glBindTexture(target, gb->textures[i]); gr->image_target_texture_2d(target, gb->images[i]); } - - return true; } static const struct weston_drm_format_array * @@ -3607,10 +3582,8 @@ gl_renderer_attach(struct weston_paint_node *pnode) gl_renderer_attach_shm(es, buffer); break; case WESTON_BUFFER_DMABUF: - gl_renderer_attach_dmabuf(es, buffer); - break; case WESTON_BUFFER_RENDERER_OPAQUE: - gl_renderer_attach_egl(es, buffer); + gl_renderer_attach_buffer(es, buffer); break; case WESTON_BUFFER_SOLID: gl_renderer_attach_solid(es, buffer);