backend-x11: 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
0a5bb7acff
commit
53a32e7888
@ -3274,6 +3274,7 @@ load_x11_backend(struct weston_compositor *c,
|
||||
const struct weston_windowed_output_api *api;
|
||||
struct weston_x11_backend_config config = {{ 0, }};
|
||||
struct weston_config_section *section;
|
||||
bool force_pixman;
|
||||
int ret = 0;
|
||||
int option_count = 1;
|
||||
int output_count = 0;
|
||||
@ -3285,7 +3286,7 @@ load_x11_backend(struct weston_compositor *c,
|
||||
return -1;
|
||||
|
||||
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 options[] = {
|
||||
@ -3295,7 +3296,7 @@ load_x11_backend(struct weston_compositor *c,
|
||||
{ WESTON_OPTION_BOOLEAN, "fullscreen", 'f', &config.fullscreen },
|
||||
{ WESTON_OPTION_INTEGER, "output-count", 0, &option_count },
|
||||
{ WESTON_OPTION_BOOLEAN, "no-input", 0, &config.no_input },
|
||||
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
|
||||
{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &force_pixman },
|
||||
};
|
||||
|
||||
parse_options(options, ARRAY_LENGTH(options), argc, argv);
|
||||
@ -3303,6 +3304,11 @@ load_x11_backend(struct weston_compositor *c,
|
||||
config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION;
|
||||
config.base.struct_size = sizeof(struct weston_x11_backend_config);
|
||||
|
||||
if (force_pixman)
|
||||
config.renderer = WESTON_RENDERER_PIXMAN;
|
||||
else
|
||||
config.renderer = WESTON_RENDERER_AUTO;
|
||||
|
||||
wet_set_simple_head_configurator(c, x11_backend_output_configure);
|
||||
|
||||
/* load the actual backend and configure it */
|
||||
|
@ -34,7 +34,7 @@ extern "C" {
|
||||
|
||||
#include <libweston/libweston.h>
|
||||
|
||||
#define WESTON_X11_BACKEND_CONFIG_VERSION 2
|
||||
#define WESTON_X11_BACKEND_CONFIG_VERSION 3
|
||||
|
||||
struct weston_x11_backend_config {
|
||||
struct weston_backend_config base;
|
||||
@ -42,8 +42,7 @@ struct weston_x11_backend_config {
|
||||
bool fullscreen;
|
||||
bool no_input;
|
||||
|
||||
/** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
|
||||
bool use_pixman;
|
||||
enum weston_renderer_type renderer;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1895,7 +1895,7 @@ x11_backend_create(struct weston_compositor *compositor,
|
||||
config->fullscreen = 0;
|
||||
}
|
||||
|
||||
if (config->use_pixman) {
|
||||
if (config->renderer == WESTON_RENDERER_PIXMAN) {
|
||||
if (pixman_renderer_init(compositor) < 0) {
|
||||
weston_log("Failed to initialize pixman renderer for X11 backend\n");
|
||||
goto err_xdisplay;
|
||||
@ -1904,7 +1904,8 @@ x11_backend_create(struct weston_compositor *compositor,
|
||||
else if (init_gl_renderer(b) < 0) {
|
||||
goto err_xdisplay;
|
||||
}
|
||||
weston_log("Using %s renderer\n", config->use_pixman ? "pixman" : "gl");
|
||||
weston_log("Using %s renderer\n",
|
||||
(config->renderer == WESTON_RENDERER_PIXMAN) ? "pixman" : "gl");
|
||||
|
||||
b->base.destroy = x11_destroy;
|
||||
b->base.create_output = x11_output_create;
|
||||
|
Loading…
Reference in New Issue
Block a user