From 8c4f75f0eac095c95c8b8e2b2685b02e69bd690f Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 22 Jul 2022 17:38:47 +0300 Subject: [PATCH] backend-x11: use resize_output with GL-renderer We get rid of unnecessary GL-renderer output state destroy and create, meaning we don't destroy and create an EGLSurface either. Signed-off-by: Pekka Paalanen --- libweston/backend-x11/x11.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c index d02ee3ca8..2e7d16045 100644 --- a/libweston/backend-x11/x11.c +++ b/libweston/backend-x11/x11.c @@ -826,7 +826,6 @@ x11_output_switch_mode(struct weston_output *base, struct weston_mode *mode) struct x11_output *output = to_x11_output(base); struct weston_size fb_size; static uint32_t values[2]; - int ret; assert(output); @@ -857,28 +856,15 @@ x11_output_switch_mode(struct weston_output *base, struct weston_mode *mode) fb_size.width = output->mode.width = mode->width; fb_size.height = output->mode.height = mode->height; + weston_renderer_resize_output(&output->base, &fb_size, NULL); + if (b->use_pixman) { - weston_renderer_resize_output(&output->base, &fb_size, NULL); x11_output_deinit_shm(b, output); if (x11_output_init_shm(b, output, fb_size.width, fb_size.height) < 0) { weston_log("Failed to initialize SHM for the X11 output\n"); return -1; } - } else { - Window xid = (Window) output->window; - const struct gl_renderer_output_options options = { - .window_for_legacy = (EGLNativeWindowType) (uintptr_t) output->window, - .window_for_platform = &xid, - .drm_formats = x11_formats, - .drm_formats_count = ARRAY_LENGTH(x11_formats), - }; - - gl_renderer->output_destroy(&output->base); - - ret = gl_renderer->output_window_create(&output->base, &options); - if (ret < 0) - return -1; } output->resize_pending = false;