[PATCH weston 3/3] main: stub the functions to load the backends with the new config system

Bryce Harrington bryce at osg.samsung.com
Mon Oct 19 17:43:58 PDT 2015


On Sat, Oct 17, 2015 at 07:24:15PM +0300, Giulio Camuffo wrote:
> ---
>  src/main.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 59 insertions(+), 9 deletions(-)

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
 
> diff --git a/src/main.c b/src/main.c
> index 11ade46..8c7b853 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -629,6 +629,64 @@ handle_exit(struct weston_compositor *c)
>  	wl_display_terminate(c->wl_display);
>  }
>  
> +/* Temporary function to be removed when all backends are converted. */
> +static int
> +load_backend_old(struct weston_compositor *compositor, const char *backend,
> +		 int *argc, char **argv, struct weston_config *wc)
> +{
> +	int (*backend_init)(struct weston_compositor *c,
> +			    int *argc, char *argv[],
> +			    struct weston_config *config,
> +			    struct weston_backend_config *config_base);
> +
> +	backend_init = weston_load_module(backend, "backend_init");
> +	if (!backend_init)
> +		return -1;
> +
> +	return backend_init(compositor, argc, argv, wc, NULL);
> +}
> +
> +/* Temporary function to be replaced by weston_compositor_load_backend(). */
> +static int
> +load_backend_new(struct weston_compositor *compositor, const char *backend,
> +		 struct weston_backend_config *config_base)
> +{
> +	int (*backend_init)(struct weston_compositor *c,
> +			    int *argc, char *argv[],
> +			    struct weston_config *config,
> +			    struct weston_backend_config *config_base);
> +
> +	backend_init = weston_load_module(backend, "backend_init");
> +	if (!backend_init)
> +		return -1;
> +
> +	return backend_init(compositor, NULL, NULL, NULL, config_base);
> +}
> +
> +static int
> +load_backend(struct weston_compositor *compositor, const char *backend,
> +	     int *argc, char **argv, struct weston_config *config)
> +{
> +#if 0
> +	if (strstr(backend, "drm-backend.so"))
> +		return load_drm_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "wayland-backend.so"))
> +		return load_wayland_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "x11-backend.so"))
> +		return load_x11_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "fbdev-backend.so"))
> +		return load_fbdev_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "headless-backend.so"))
> +		return load_headless_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "rpi-backend.so"))
> +		return load_rpi_backend(compositor, backend, argc, argv, config);
> +	else if (strstr(backend, "rdp-backend.so"))
> +		return load_rdp_backend(compositor, backend, argc, argv, config);
> +#endif
> +
> +	return load_backend_old(compositor, backend, argc, argv, config);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  	int ret = EXIT_FAILURE;
> @@ -636,10 +694,6 @@ int main(int argc, char *argv[])
>  	struct weston_compositor *ec;
>  	struct wl_event_source *signals[4];
>  	struct wl_event_loop *loop;
> -	int (*backend_init)(struct weston_compositor *c,
> -			    int *argc, char *argv[],
> -			    struct weston_config *config,
> -			    struct weston_backend_config *config_base);
>  	int i, fd;
>  	char *backend = NULL;
>  	char *shell = NULL;
> @@ -724,10 +778,6 @@ int main(int argc, char *argv[])
>  			backend = weston_choose_default_backend();
>  	}
>  
> -	backend_init = weston_load_module(backend, "backend_init");
> -	if (!backend_init)
> -		goto out_signals;
> -
>  	ec = weston_compositor_create(display, NULL);
>  	if (ec == NULL) {
>  		weston_log("fatal: failed to create compositor\n");
> @@ -738,7 +788,7 @@ int main(int argc, char *argv[])
>  	if (weston_compositor_init_config(ec, config) < 0)
>  		goto out;
>  
> -	if (backend_init(ec, &argc, argv, config, NULL) < 0) {
> +	if (load_backend(ec, backend, &argc, argv, config) < 0) {
>  		weston_log("fatal: failed to create compositor backend\n");
>  		goto out;
>  	}
> -- 
> 2.6.1
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list