backend-wayland: drop use_pixman from wayland_backend

Now that the renderer type is stored in struct weston_renderer,
use that instead of use_pixman to determine the renderer type.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
Philipp Zabel 2022-11-30 11:10:18 +01:00 committed by Daniel Stone
parent a9c1b41f3f
commit e752c8737f

View File

@ -86,7 +86,6 @@ struct wayland_backend {
uint32_t event_mask; uint32_t event_mask;
} parent; } parent;
bool use_pixman;
bool sprawl_across_outputs; bool sprawl_across_outputs;
bool fullscreen; bool fullscreen;
@ -728,16 +727,13 @@ static int
wayland_output_disable(struct weston_output *base) wayland_output_disable(struct weston_output *base)
{ {
struct wayland_output *output = to_wayland_output(base); struct wayland_output *output = to_wayland_output(base);
struct wayland_backend *b;
assert(output); assert(output);
b = to_wayland_backend(base->compositor);
if (!output->base.enabled) if (!output->base.enabled)
return 0; return 0;
if (b->use_pixman) { if (base->compositor->renderer->type == WESTON_RENDERER_PIXMAN) {
pixman_renderer_output_destroy(&output->base); pixman_renderer_output_destroy(&output->base);
#ifdef ENABLE_EGL #ifdef ENABLE_EGL
} else { } else {
@ -1141,7 +1137,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
old_mode->flags &= ~WL_OUTPUT_MODE_CURRENT; old_mode->flags &= ~WL_OUTPUT_MODE_CURRENT;
output->base.current_mode->flags |= WL_OUTPUT_MODE_CURRENT; output->base.current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
if (b->use_pixman) { if (output_base->compositor->renderer->type == WESTON_RENDERER_PIXMAN) {
pixman_renderer_output_destroy(output_base); pixman_renderer_output_destroy(output_base);
if (wayland_output_init_pixman_renderer(output) < 0) if (wayland_output_init_pixman_renderer(output) < 0)
goto err_output; goto err_output;
@ -1275,7 +1271,7 @@ wayland_output_enable(struct weston_output *base)
if (ret < 0) if (ret < 0)
return -1; return -1;
if (b->use_pixman) { if (base->compositor->renderer->type == WESTON_RENDERER_PIXMAN) {
if (wayland_output_init_pixman_renderer(output) < 0) if (wayland_output_init_pixman_renderer(output) < 0)
goto err_output; goto err_output;
@ -2837,6 +2833,7 @@ wayland_backend_create(struct weston_compositor *compositor,
{ {
struct wayland_backend *b; struct wayland_backend *b;
struct wl_event_loop *loop; struct wl_event_loop *loop;
bool use_pixman;
int fd; int fd;
b = zalloc(sizeof *b); b = zalloc(sizeof *b);
@ -2874,21 +2871,21 @@ wayland_backend_create(struct weston_compositor *compositor,
create_cursor(b, new_config); create_cursor(b, new_config);
#ifdef ENABLE_EGL #ifdef ENABLE_EGL
b->use_pixman = new_config->use_pixman; use_pixman = new_config->use_pixman;
#else #else
b->use_pixman = true; use_pixman = true;
#endif #endif
b->fullscreen = new_config->fullscreen; b->fullscreen = new_config->fullscreen;
if (!b->use_pixman) { if (!use_pixman) {
gl_renderer = weston_load_module("gl-renderer.so", gl_renderer = weston_load_module("gl-renderer.so",
"gl_renderer_interface", "gl_renderer_interface",
LIBWESTON_MODULEDIR); LIBWESTON_MODULEDIR);
if (!gl_renderer) if (!gl_renderer)
b->use_pixman = true; use_pixman = true;
} }
if (!b->use_pixman) { if (!use_pixman) {
const struct gl_renderer_display_options options = { const struct gl_renderer_display_options options = {
.egl_platform = EGL_PLATFORM_WAYLAND_KHR, .egl_platform = EGL_PLATFORM_WAYLAND_KHR,
.egl_native_display = b->parent.wl_display, .egl_native_display = b->parent.wl_display,
@ -2899,11 +2896,11 @@ wayland_backend_create(struct weston_compositor *compositor,
if (gl_renderer->display_create(compositor, &options) < 0) { if (gl_renderer->display_create(compositor, &options) < 0) {
weston_log("Failed to initialize the GL renderer; " weston_log("Failed to initialize the GL renderer; "
"falling back to pixman.\n"); "falling back to pixman.\n");
b->use_pixman = true; use_pixman = true;
} }
} }
if (b->use_pixman) { if (use_pixman) {
if (pixman_renderer_init(compositor) < 0) { if (pixman_renderer_init(compositor) < 0) {
weston_log("Failed to initialize pixman renderer\n"); weston_log("Failed to initialize pixman renderer\n");
goto err_display; goto err_display;