compositor-headless: Support starting with zero outputs
authorArmin Krezović <krezovic.armin@gmail.com>
Thu, 23 Jun 2016 09:59:29 +0000 (11:59 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 27 Jun 2016 10:17:05 +0000 (13:17 +0300)
This patch adds a new command line option which can be
used to tell headless backend not to create any
virtual outputs.

This will be used for output hotplug emulation, where
weston will start with no outputs available, and the
virtual output will be created at runtime.

v2:

- Use bool instead of int for the indicator flag
- Move final newspace to a separate line in command
  line options

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
compositor/main.c
libweston/compositor-headless.c
libweston/compositor-headless.h

index 6f713c3e1ae2dcfcdbec669c6f2b51cdd84782a6..86732f9d6af03164ba032fe9c8c6be671ccb4a6e 100644 (file)
@@ -526,7 +526,9 @@ usage(int error_code)
                "  --height=HEIGHT\tHeight of memory surface\n"
                "  --transform=TR\tThe output transformation, TR is one of:\n"
                "\tnormal 90 180 270 flipped flipped-90 flipped-180 flipped-270\n"
-               "  --use-pixman\t\tUse the pixman (CPU) renderer (default: no rendering)\n\n");
+               "  --use-pixman\t\tUse the pixman (CPU) renderer (default: no rendering)\n"
+               "  --no-outputs\t\tDo not create any virtual outputs\n"
+               "\n");
 #endif
 
 #if defined(BUILD_RDP_COMPOSITOR)
@@ -1037,6 +1039,7 @@ load_headless_backend(struct weston_compositor *c,
                { WESTON_OPTION_INTEGER, "height", 0, &config.height },
                { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
                { WESTON_OPTION_STRING, "transform", 0, &transform },
+               { WESTON_OPTION_BOOLEAN, "no-outputs", 0, &config.no_outputs },
        };
 
        parse_options(options, ARRAY_LENGTH(options), argc, argv);
index b78c3210422e2c4f05c9d3543005f8c937deb0a5..6c22ee303be6fda96892d4ee852923792b2912bd 100644 (file)
@@ -212,8 +212,11 @@ headless_backend_create(struct weston_compositor *compositor,
        if (b->use_pixman) {
                pixman_renderer_init(compositor);
        }
-       if (headless_backend_create_output(b, config) < 0)
-               goto err_input;
+
+       if (!config->no_outputs) {
+               if (headless_backend_create_output(b, config) < 0)
+                       goto err_input;
+       }
 
        if (!b->use_pixman && noop_renderer_init(compositor) < 0)
                goto err_input;
index 79f39c89caec5acf9b846db7126daefb024687d5..1432f70010cb085f553c0a20bde6fde9cbf2bbdd 100644 (file)
@@ -44,6 +44,7 @@ struct weston_headless_backend_config {
        int use_pixman;
 
        uint32_t transform;
+       bool no_outputs;
 };
 
 #ifdef  __cplusplus