backend-wayland: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to force Pixman on. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
b846c26d97
commit
0a5bb7acff
@ -3384,6 +3384,7 @@ load_wayland_backend(struct weston_compositor *c,
|
||||
const struct weston_windowed_output_api *api;
|
||||
const char *section_name;
|
||||
char *output_name = NULL;
|
||||
bool force_pixman = false;
|
||||
int count = 1;
|
||||
int ret = 0;
|
||||
int i;
|
||||
@ -3397,7 +3398,7 @@ load_wayland_backend(struct weston_compositor *c,
|
||||
config.display_name = NULL;
|
||||
|
||||
section = weston_config_get_section(wc, "core", NULL, NULL);
|
||||
weston_config_section_get_bool(section, "use-pixman", &config.use_pixman,
|
||||
weston_config_section_get_bool(section, "use-pixman", &force_pixman,
|
||||
false);
|
||||
|
||||
const struct weston_option wayland_options[] = {
|
||||
@ -3405,7 +3406,7 @@ load_wayland_backend(struct weston_compositor *c,
|
||||
{ WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
|
||||
{ WESTON_OPTION_INTEGER, "scale", 0, &parsed_options->scale },
|
||||
{ WESTON_OPTION_STRING, "display", 0, &config.display_name },
|
||||
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
|
||||
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &force_pixman },
|
||||
{ WESTON_OPTION_INTEGER, "output-count", 0, &count },
|
||||
{ WESTON_OPTION_BOOLEAN, "fullscreen", 0, &config.fullscreen },
|
||||
{ WESTON_OPTION_BOOLEAN, "sprawl", 0, &config.sprawl },
|
||||
@ -3422,6 +3423,11 @@ load_wayland_backend(struct weston_compositor *c,
|
||||
config.base.struct_size = sizeof(struct weston_wayland_backend_config);
|
||||
config.base.struct_version = WESTON_WAYLAND_BACKEND_CONFIG_VERSION;
|
||||
|
||||
if (force_pixman)
|
||||
config.renderer = WESTON_RENDERER_PIXMAN;
|
||||
else
|
||||
config.renderer = WESTON_RENDERER_AUTO;
|
||||
|
||||
/* load the actual wayland backend and configure it */
|
||||
ret = weston_compositor_load_backend(c, WESTON_BACKEND_WAYLAND,
|
||||
&config.base);
|
||||
|
@ -34,11 +34,11 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define WESTON_WAYLAND_BACKEND_CONFIG_VERSION 2
|
||||
#define WESTON_WAYLAND_BACKEND_CONFIG_VERSION 3
|
||||
|
||||
struct weston_wayland_backend_config {
|
||||
struct weston_backend_config base;
|
||||
bool use_pixman;
|
||||
enum weston_renderer_type renderer;
|
||||
bool sprawl;
|
||||
char *display_name;
|
||||
bool fullscreen;
|
||||
|
@ -2752,7 +2752,7 @@ wayland_backend_create(struct weston_compositor *compositor,
|
||||
{
|
||||
struct wayland_backend *b;
|
||||
struct wl_event_loop *loop;
|
||||
bool use_pixman;
|
||||
enum weston_renderer_type renderer = new_config->renderer;
|
||||
int fd;
|
||||
|
||||
b = zalloc(sizeof *b);
|
||||
@ -2789,22 +2789,7 @@ wayland_backend_create(struct weston_compositor *compositor,
|
||||
|
||||
create_cursor(b, new_config);
|
||||
|
||||
#ifdef ENABLE_EGL
|
||||
use_pixman = new_config->use_pixman;
|
||||
#else
|
||||
use_pixman = true;
|
||||
#endif
|
||||
b->fullscreen = new_config->fullscreen;
|
||||
|
||||
if (!use_pixman) {
|
||||
gl_renderer = weston_load_module("gl-renderer.so",
|
||||
"gl_renderer_interface",
|
||||
LIBWESTON_MODULEDIR);
|
||||
if (!gl_renderer)
|
||||
use_pixman = true;
|
||||
}
|
||||
|
||||
if (!use_pixman) {
|
||||
if (renderer == WESTON_RENDERER_AUTO || renderer == WESTON_RENDERER_GL) {
|
||||
const struct gl_renderer_display_options options = {
|
||||
.egl_platform = EGL_PLATFORM_WAYLAND_KHR,
|
||||
.egl_native_display = b->parent.wl_display,
|
||||
@ -2812,14 +2797,26 @@ wayland_backend_create(struct weston_compositor *compositor,
|
||||
.drm_formats = wayland_formats,
|
||||
.drm_formats_count = ARRAY_LENGTH(wayland_formats),
|
||||
};
|
||||
if (gl_renderer->display_create(compositor, &options) < 0) {
|
||||
weston_log("Failed to initialize the GL renderer; "
|
||||
"falling back to pixman.\n");
|
||||
use_pixman = true;
|
||||
|
||||
#ifdef ENABLE_EGL
|
||||
gl_renderer = weston_load_module("gl-renderer.so",
|
||||
"gl_renderer_interface",
|
||||
LIBWESTON_MODULEDIR);
|
||||
#endif
|
||||
|
||||
if (!gl_renderer ||
|
||||
gl_renderer->display_create(compositor, &options) < 0) {
|
||||
weston_log("Failed to initialize the GL renderer");
|
||||
if (renderer == WESTON_RENDERER_AUTO) {
|
||||
weston_log_continue("; falling back to Pixman.\n");
|
||||
renderer = WESTON_RENDERER_PIXMAN;
|
||||
} else {
|
||||
goto err_display;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (use_pixman) {
|
||||
if (renderer == WESTON_RENDERER_PIXMAN) {
|
||||
if (pixman_renderer_init(compositor) < 0) {
|
||||
weston_log("Failed to initialize pixman renderer\n");
|
||||
goto err_display;
|
||||
|
Loading…
Reference in New Issue
Block a user