From e77f8ad79bdf3613dc7e587ea0cf5b9d39e4f8e0 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 8 Jun 2016 17:39:37 +0300 Subject: [PATCH] compositor-fbdev: drop EGL support EGL code was added to the fbdev backend in 4aa756dc7a8d3cf3b4c6f018c3e2a053fff424b0 in 2013, apparently for running Weston on libhybris with Android hardware drivers. This actually had nothing to do with the fbdev backend, really. Fbdev was just a convenient platform to plug in the EGL init code and load GL-renderer. Fbdev itself was not used at all in this case. Fbdev should be forgotten and die, as we have better interfaces for accelerated rendering and for controlling displays. It may be a bit too harsh to remove the whole fbdev backend just yet, but let us at least simplify it this much. Fbdev+EGL has been the unholy union used by proprietary driver stacks of hardware vendors in the non-PC world as a quick and dirty way to get something out on the screen. In these cases it is actually the EGL implementation that does everything internally, fbdev is not needed. Fbdev was never meant for the sort anyway. If anyone still needs this use case, I recommend sticking with a outdated Weston to match your outdated platform. Or if you really insist, write a new backend that does not pretend to use fbdev and just initializes EGL and GL-renderer. Cc: Adrian Negreanu Signed-off-by: Pekka Paalanen Reviewed-by: Quentin Glidic Reviewed-by: Derek Foreman --- src/compositor-fbdev.c | 97 +++++++----------------------------------- src/compositor-fbdev.h | 1 - src/main.c | 3 +- 3 files changed, 16 insertions(+), 85 deletions(-) diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c index 3f2347fb..e21ceca5 100644 --- a/src/compositor-fbdev.c +++ b/src/compositor-fbdev.c @@ -48,7 +48,6 @@ #include "launcher-util.h" #include "pixman-renderer.h" #include "libinput-seat.h" -#include "gl-renderer.h" #include "presentation-time-server-protocol.h" struct fbdev_backend { @@ -58,7 +57,6 @@ struct fbdev_backend { struct udev *udev; struct udev_input input; - int use_pixman; uint32_t output_transform; struct wl_listener session_listener; }; @@ -95,8 +93,6 @@ struct fbdev_output { uint8_t depth; }; -struct gl_renderer_interface *gl_renderer; - static const char default_seat[] = "seat0"; static inline struct fbdev_output * @@ -120,8 +116,8 @@ fbdev_output_start_repaint_loop(struct weston_output *output) weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID); } -static void -fbdev_output_repaint_pixman(struct weston_output *base, pixman_region32_t *damage) +static int +fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage) { struct fbdev_output *output = to_fbdev_output(base); struct weston_compositor *ec = output->base.compositor; @@ -143,26 +139,6 @@ fbdev_output_repaint_pixman(struct weston_output *base, pixman_region32_t *damag * refresh rate is given in mHz and the interval in ms. */ wl_event_source_timer_update(output->finish_frame_timer, 1000000 / output->mode.refresh); -} - -static int -fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage) -{ - struct fbdev_output *output = to_fbdev_output(base); - struct fbdev_backend *fbb = output->backend; - struct weston_compositor *ec = fbb->compositor; - - if (fbb->use_pixman) { - fbdev_output_repaint_pixman(base,damage); - } else { - ec->renderer->repaint_output(base, damage); - /* Update the damage region. */ - pixman_region32_subtract(&ec->primary_plane.damage, - &ec->primary_plane.damage, damage); - - wl_event_source_timer_update(output->finish_frame_timer, - 1000000 / output->mode.refresh); - } return 0; } @@ -471,13 +447,10 @@ fbdev_output_create(struct fbdev_backend *backend, weston_log("Creating frame buffer failed.\n"); goto out_free; } - if (backend->use_pixman) { - if (fbdev_frame_buffer_map(output, fb_fd) < 0) { - weston_log("Mapping frame buffer failed.\n"); - goto out_free; - } - } else { - close(fb_fd); + + if (fbdev_frame_buffer_map(output, fb_fd) < 0) { + weston_log("Mapping frame buffer failed.\n"); + goto out_free; } output->base.start_repaint_loop = fbdev_output_start_repaint_loop; @@ -505,19 +478,8 @@ fbdev_output_create(struct fbdev_backend *backend, backend->output_transform, 1); - if (backend->use_pixman) { - if (pixman_renderer_output_create(&output->base) < 0) - goto out_hw_surface; - } else { - setenv("HYBRIS_EGLPLATFORM", "wayland", 1); - if (gl_renderer->output_create(&output->base, - (EGLNativeWindowType)NULL, NULL, - gl_renderer->opaque_attribs, - NULL, 0) < 0) { - weston_log("gl_renderer_output_create failed.\n"); - goto out_hw_surface; - } - } + if (pixman_renderer_output_create(&output->base) < 0) + goto out_hw_surface; loop = wl_display_get_event_loop(backend->compositor->wl_display); output->finish_frame_timer = @@ -548,19 +510,14 @@ static void fbdev_output_destroy(struct weston_output *base) { struct fbdev_output *output = to_fbdev_output(base); - struct fbdev_backend *backend = output->backend; weston_log("Destroying fbdev output.\n"); /* Close the frame buffer. */ fbdev_output_disable(base); - if (backend->use_pixman) { - if (base->renderer_state != NULL) - pixman_renderer_output_destroy(base); - } else { - gl_renderer->output_destroy(base); - } + if (base->renderer_state != NULL) + pixman_renderer_output_destroy(base); /* Remove the output. */ weston_output_destroy(&output->base); @@ -629,11 +586,9 @@ fbdev_output_reenable(struct fbdev_backend *backend, } /* Map the device if it has the same details as before. */ - if (backend->use_pixman) { - if (fbdev_frame_buffer_map(output, fb_fd) < 0) { - weston_log("Mapping frame buffer failed.\n"); - goto err; - } + if (fbdev_frame_buffer_map(output, fb_fd) < 0) { + weston_log("Mapping frame buffer failed.\n"); + goto err; } return 0; @@ -649,12 +604,9 @@ static void fbdev_output_disable(struct weston_output *base) { struct fbdev_output *output = to_fbdev_output(base); - struct fbdev_backend *backend = output->backend; weston_log("Disabling fbdev output.\n"); - if ( ! backend->use_pixman) return; - if (output->hw_surface != NULL) { pixman_image_unref(output->hw_surface); output->hw_surface = NULL; @@ -768,30 +720,12 @@ fbdev_backend_create(struct weston_compositor *compositor, backend->base.restore = fbdev_restore; backend->prev_state = WESTON_COMPOSITOR_ACTIVE; - backend->use_pixman = !param->use_gl; backend->output_transform = param->output_transform; weston_setup_vt_switch_bindings(compositor); - if (backend->use_pixman) { - if (pixman_renderer_init(compositor) < 0) - goto out_launcher; - } else { - gl_renderer = weston_load_module("gl-renderer.so", - "gl_renderer_interface"); - if (!gl_renderer) { - weston_log("could not load gl renderer\n"); - goto out_launcher; - } - - if (gl_renderer->create(compositor, NO_EGL_PLATFORM, - EGL_DEFAULT_DISPLAY, - gl_renderer->opaque_attribs, - NULL, 0) < 0) { - weston_log("gl_renderer_create failed.\n"); - goto out_launcher; - } - } + if (pixman_renderer_init(compositor) < 0) + goto out_launcher; if (fbdev_output_create(backend, param->device) < 0) goto out_launcher; @@ -822,7 +756,6 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config) * udev, rather than passing a device node in as a parameter. */ config->tty = 0; /* default to current tty */ config->device = "/dev/fb0"; /* default frame buffer */ - config->use_gl = 0; config->output_transform = WL_OUTPUT_TRANSFORM_NORMAL; } diff --git a/src/compositor-fbdev.h b/src/compositor-fbdev.h index 450be5d1..9b5bf8e6 100644 --- a/src/compositor-fbdev.h +++ b/src/compositor-fbdev.h @@ -41,7 +41,6 @@ struct weston_fbdev_backend_config { int tty; char *device; - int use_gl; uint32_t output_transform; diff --git a/src/main.c b/src/main.c index 193a845d..d0226152 100644 --- a/src/main.c +++ b/src/main.c @@ -516,7 +516,7 @@ usage(int error_code) "Options for fbdev-backend.so:\n\n" " --tty=TTY\t\tThe tty to use\n" " --device=DEVICE\tThe framebuffer device to use\n" - " --use-gl\t\tUse the GL renderer\n\n"); + "\n"); #endif #if defined(BUILD_HEADLESS_COMPOSITOR) @@ -1111,7 +1111,6 @@ load_fbdev_backend(struct weston_compositor *c, const struct weston_option fbdev_options[] = { { WESTON_OPTION_INTEGER, "tty", 0, &config.tty }, { WESTON_OPTION_STRING, "device", 0, &config.device }, - { WESTON_OPTION_BOOLEAN, "use-gl", 0, &config.use_gl }, }; parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);