[PATCH v8 2/6] compositor-fbdev: support the --seat option, (and XDG_SEAT variable)

Pekka Paalanen ppaalanen at gmail.com
Fri Jun 29 09:56:00 UTC 2018


On Wed, 27 Jun 2018 20:44:18 -0400
nerdopolis <bluescreen_avenger at verizon.net> wrote:

> This allows the fbdev backend to run on, and use devices from the
> specified seat, similar to the drm backend.
> ---
>  compositor/main.c            |  2 ++
>  libweston/compositor-fbdev.c | 10 +++++++++-
>  libweston/compositor-fbdev.h |  9 +++++++++
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/compositor/main.c b/compositor/main.c
> index 7bfe0a33..068cdd8f 100644
> --- a/compositor/main.c
> +++ b/compositor/main.c
> @@ -494,6 +494,7 @@ usage(int error_code)
>  		"Options for fbdev-backend.so:\n\n"
>  		"  --tty=TTY\t\tThe tty to use\n"
>  		"  --device=DEVICE\tThe framebuffer device to use\n"
> +		"  --seat=SEAT\t\tThe seat that weston should run on, instead of the seat defined in XDG_SEAT\n"
>  		"\n");
>  #endif
>  
> @@ -1593,6 +1594,7 @@ load_fbdev_backend(struct weston_compositor *c,
>  	const struct weston_option fbdev_options[] = {
>  		{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
>  		{ WESTON_OPTION_STRING, "device", 0, &config.device },
> +		{ WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
>  	};
>  
>  	parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> index a78f6fab..09a2eb39 100644
> --- a/libweston/compositor-fbdev.c
> +++ b/libweston/compositor-fbdev.c
> @@ -776,6 +776,13 @@ fbdev_backend_create(struct weston_compositor *compositor,
>  {
>  	struct fbdev_backend *backend;
>  	const char *seat_id = default_seat;
> +	const char *session_seat;
> +
> +	session_seat = getenv("XDG_SEAT");
> +	if (session_seat)
> +		seat_id = session_seat;
> +	if (param->seat_id)
> +		seat_id = param->seat_id;
>  
>  	weston_log("initializing fbdev backend\n");
>  
> @@ -800,7 +807,7 @@ fbdev_backend_create(struct weston_compositor *compositor,
>  	wl_signal_add(&compositor->session_signal,
>  		      &backend->session_listener);
>  	compositor->launcher =
> -		weston_launcher_connect(compositor, param->tty, "seat0", false);
> +		weston_launcher_connect(compositor, param->tty, seat_id, false);
>  	if (!compositor->launcher) {
>  		weston_log("fatal: fbdev backend should be run using "
>  			   "weston-launch binary, or your system should "
> @@ -846,6 +853,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
>  	 * udev, rather than passing a device node in as a parameter. */
>  	config->tty = 0; /* default to current tty */
>  	config->device = "/dev/fb0"; /* default frame buffer */
> +	config->seat_id = NULL;
>  }
>  
>  WL_EXPORT int
> diff --git a/libweston/compositor-fbdev.h b/libweston/compositor-fbdev.h
> index 8b7d900e..540120a4 100644
> --- a/libweston/compositor-fbdev.h
> +++ b/libweston/compositor-fbdev.h
> @@ -52,6 +52,15 @@ struct weston_fbdev_backend_config {
>  	 */
>  	void (*configure_device)(struct weston_compositor *compositor,
>  				 struct libinput_device *device);
> +
> +	/** The seat to be used for input and output.
> +	 *
> +	 * Set first by the XDG_SEAT variable, and overridable by the --seat option.
> +	 * If none are specified, the default "seat0" is assumed. The backend will

With the above wording fixed as explained for patch 1, this is:

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq

> +	 * take ownership of the seat_id pointer and will free it on
> +	 * backend destruction.
> +	 */
> +	char *seat_id;
>  };
>  
>  #ifdef  __cplusplus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180629/3ed7eb93/attachment.sig>


More information about the wayland-devel mailing list