Pixman can be used for rendering if the default GLESv2 rendering
is broken or cannot be used.

Pixman-based rendering is already available with the command-line
switch '--use-pixman'. This patch adds support for this option to
the configuration file. Putting

  [core]
  use-pixman=true

into 'weston.ini' enables pixman-based rendering for all backends
that support it. With this change, pixman has to be enabled once.

Signed-off-by: Thomas Zimmermann <t...@users.sourceforge.net>
---
 compositor/main.c  | 39 +++++++++++++++++++++++++++++++++++----
 man/weston.ini.man |  6 ++++++
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 1e827884..e7ac52ca 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1104,18 +1104,26 @@ load_drm_backend(struct weston_compositor *c,
        struct weston_config_section *section;
        struct wet_compositor *wet = to_wet_compositor(c);
        int ret = 0;
+       int use_pixman_config_ = 0;
+       int32_t use_pixman_ = 0;
 
        wet->drm_use_current_mode = false;
 
+       section = weston_config_get_section(wc, "core", NULL, NULL);
+       weston_config_section_get_bool(section, "use-pixman", 
&use_pixman_config_,
+                                      use_pixman_config_);
+       use_pixman_ = use_pixman_config_;
+
        const struct weston_option options[] = {
                { WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
                { WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
                { WESTON_OPTION_STRING, "drm-device", 0, 
&config.specific_device },
                { WESTON_OPTION_BOOLEAN, "current-mode", 0, 
&wet->drm_use_current_mode },
-               { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
+               { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
        };
 
        parse_options(options, ARRAY_LENGTH(options), argc, argv);
+       config.use_pixman = use_pixman_;
 
        section = weston_config_get_section(wc, "core", NULL, NULL);
        weston_config_section_get_string(section,
@@ -1160,23 +1168,32 @@ load_headless_backend(struct weston_compositor *c,
 {
        const struct weston_windowed_output_api *api;
        struct weston_headless_backend_config config = {{ 0, }};
+       struct weston_config_section *section;
        int no_outputs = 0;
        int ret = 0;
        char *transform = NULL;
+       int32_t use_pixman_config_ = 0;
+       int use_pixman_ = 0;
 
        struct wet_output_config *parsed_options = wet_init_parsed_options(c);
        if (!parsed_options)
                return -1;
 
+       section = weston_config_get_section(wc, "core", NULL, NULL);
+       weston_config_section_get_bool(section, "use-pixman", 
&use_pixman_config_,
+                                      use_pixman_config_);
+       use_pixman_ = use_pixman_config_;
+
        const struct weston_option options[] = {
                { WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
                { WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
-               { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
+               { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
                { WESTON_OPTION_STRING, "transform", 0, &transform },
                { WESTON_OPTION_BOOLEAN, "no-outputs", 0, &no_outputs },
        };
 
        parse_options(options, ARRAY_LENGTH(options), argc, argv);
+       config.use_pixman = use_pixman_;
 
        if (transform) {
                if (weston_parse_transform(transform, 
&parsed_options->transform) < 0) {
@@ -1385,11 +1402,18 @@ load_x11_backend(struct weston_compositor *c,
        int output_count = 0;
        char const *section_name;
        int i;
+       int32_t use_pixman_config_ = 0;
+       int use_pixman_ = 0;
 
        struct wet_output_config *parsed_options = wet_init_parsed_options(c);
        if (!parsed_options)
                return -1;
 
+       section = weston_config_get_section(wc, "core", NULL, NULL);
+       weston_config_section_get_bool(section, "use-pixman", 
&use_pixman_config_,
+                                      use_pixman_config_);
+       use_pixman_ = use_pixman_config_;
+
        const struct weston_option options[] = {
               { WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
               { WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
@@ -1397,10 +1421,11 @@ 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, &use_pixman_ },
        };
 
        parse_options(options, ARRAY_LENGTH(options), argc, argv);
+       config.use_pixman = use_pixman_;
 
        config.base.struct_version = WESTON_X11_BACKEND_CONFIG_VERSION;
        config.base.struct_size = sizeof(struct weston_x11_backend_config);
@@ -1503,6 +1528,7 @@ load_wayland_backend(struct weston_compositor *c,
        int32_t use_pixman_ = 0;
        int32_t sprawl_ = 0;
        int32_t fullscreen_ = 0;
+       int use_pixman_config_ = 0;
 
        struct wet_output_config *parsed_options = wet_init_parsed_options(c);
        if (!parsed_options)
@@ -1512,6 +1538,11 @@ load_wayland_backend(struct weston_compositor *c,
        config.cursor_theme = NULL;
        config.display_name = NULL;
 
+       section = weston_config_get_section(wc, "core", NULL, NULL);
+       weston_config_section_get_bool(section, "use-pixman", 
&use_pixman_config_,
+                                      use_pixman_config_);
+       use_pixman_ = use_pixman_config_;
+
        const struct weston_option wayland_options[] = {
                { WESTON_OPTION_INTEGER, "width", 0, &parsed_options->width },
                { WESTON_OPTION_INTEGER, "height", 0, &parsed_options->height },
@@ -1525,8 +1556,8 @@ load_wayland_backend(struct weston_compositor *c,
 
        parse_options(wayland_options, ARRAY_LENGTH(wayland_options), argc, 
argv);
        config.sprawl = sprawl_;
-       config.use_pixman = use_pixman_;
        config.fullscreen = fullscreen_;
+       config.use_pixman = use_pixman_config_;
 
        section = weston_config_get_section(wc, "shell", NULL, NULL);
        weston_config_section_get_string(section, "cursor-theme",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index f237fd60..cc1cb409 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -189,6 +189,12 @@ useful for debugging a crash on start-up when it would be 
inconvenient to
 launch weston directly from a debugger. Boolean, defaults to
 .BR false .
 There is also a command line option to do the same.
+.TP 7
+.BI "use-pixman=" true
+Enables pixman-based rendering for all outputs on backends that support it.
+Boolean, defaults to
+.BR false .
+There is also a command line option to do the same.
 
 .SH "LIBINPUT SECTION"
 The
-- 
2.14.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to