libweston, compositor: let weston_compositor_load_backend return backend
Let weston_compositor_load_backend() return a backend pointer and remove the backend pointer from struct weston_compositor. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
44f36b9b55
commit
a4f0666659
|
@ -2971,7 +2971,6 @@ wet_compositor_load_backend(struct weston_compositor *compositor,
|
|||
{
|
||||
struct wet_compositor *wet = to_wet_compositor(compositor);
|
||||
struct wet_backend *wb;
|
||||
int ret;
|
||||
|
||||
wb = xzalloc(sizeof *wb);
|
||||
|
||||
|
@ -2983,20 +2982,15 @@ wet_compositor_load_backend(struct weston_compositor *compositor,
|
|||
&wb->heads_changed_listener);
|
||||
}
|
||||
|
||||
ret = weston_compositor_load_backend(compositor, backend, config_base);
|
||||
|
||||
if (ret == 0) {
|
||||
/*
|
||||
* At this point compositor->backend should point to the last
|
||||
* loaded backend.
|
||||
*/
|
||||
wb->backend = compositor->backend;
|
||||
wl_list_insert(wet->backend_list.prev, &wb->compositor_link);
|
||||
} else {
|
||||
wb->backend = weston_compositor_load_backend(compositor, backend,
|
||||
config_base);
|
||||
if (!wb->backend) {
|
||||
free(wb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wl_list_insert(wet->backend_list.prev, &wb->compositor_link);
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
||||
|
|
|
@ -1439,7 +1439,6 @@ struct weston_compositor {
|
|||
struct weston_renderer *renderer;
|
||||
const struct pixel_format_info *read_format;
|
||||
|
||||
struct weston_backend *backend;
|
||||
struct wl_list backend_list;
|
||||
|
||||
struct weston_launcher *launcher;
|
||||
|
@ -2331,7 +2330,7 @@ enum weston_renderer_type {
|
|||
WESTON_RENDERER_GL = 3,
|
||||
};
|
||||
|
||||
int
|
||||
struct weston_backend *
|
||||
weston_compositor_load_backend(struct weston_compositor *compositor,
|
||||
enum weston_compositor_backend backend,
|
||||
struct weston_backend_config *config_base);
|
||||
|
|
|
@ -9537,35 +9537,35 @@ static const char * const backend_map[] = {
|
|||
* \param config_base A pointer to a backend-specific configuration
|
||||
* structure's 'base' member.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
* \return A new \c weston_backend on success, or NULL on error.
|
||||
*
|
||||
* \ingroup compositor
|
||||
*/
|
||||
WL_EXPORT int
|
||||
WL_EXPORT struct weston_backend *
|
||||
weston_compositor_load_backend(struct weston_compositor *compositor,
|
||||
enum weston_compositor_backend backend,
|
||||
struct weston_backend_config *config_base)
|
||||
{
|
||||
int (*backend_init)(struct weston_compositor *c,
|
||||
struct weston_backend_config *config_base);
|
||||
struct weston_backend *b;
|
||||
|
||||
if (backend >= ARRAY_LENGTH(backend_map))
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
backend_init = weston_load_module(backend_map[backend],
|
||||
"weston_backend_init",
|
||||
LIBWESTON_MODULEDIR);
|
||||
if (!backend_init)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
if (backend_init(compositor, config_base) < 0)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
/* Point compositor->backend to the last loaded backend. */
|
||||
compositor->backend = wl_container_of(compositor->backend_list.next,
|
||||
compositor->backend, link);
|
||||
/* Return the last loaded backend. */
|
||||
b = wl_container_of(compositor->backend_list.next, b, link);
|
||||
|
||||
return 0;
|
||||
return b;
|
||||
}
|
||||
|
||||
WL_EXPORT int
|
||||
|
|
Loading…
Reference in New Issue