[PATCH 10/10] Cleanup unneeded stuff left during the porting phrase
Quentin Glidic
sardemff7+wayland at sardemff7.net
Fri Aug 12 11:58:54 UTC 2016
On 11/08/2016 17:34, Armin Krezović wrote:
> - Removed weston_backend_output_config structure; Outputs
> should be configured from compositors using plugin-api.
>
> - Merged weston_output_init() into weston_output_enable()
>
> - Renamed weston_output_init_pending() to weston_output_init()
>
> Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
I love this one:
Reviewed-by: Quentin Glidic <sardemff7+git at sardemff7.net>
Cheers,
> ---
> libweston/compositor-drm.c | 2 +-
> libweston/compositor-fbdev.c | 2 +-
> libweston/compositor-headless.c | 2 +-
> libweston/compositor-rdp.c | 2 +-
> libweston/compositor-wayland.c | 4 +-
> libweston/compositor-x11.c | 2 +-
> libweston/compositor.c | 130 ++++++++++++++--------------------------
> libweston/compositor.h | 22 +------
> 8 files changed, 54 insertions(+), 112 deletions(-)
>
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 76c1314..b3c63d6 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -2550,7 +2550,7 @@ create_output_for_connector(struct drm_backend *b,
> output->destroy_pending = 0;
> output->disable_pending = 0;
>
> - weston_output_init_pending(&output->base, b->compositor);
> + weston_output_init(&output->base, b->compositor);
>
> return 0;
> }
> diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
> index afa1e7a..0dad030 100644
> --- a/libweston/compositor-fbdev.c
> +++ b/libweston/compositor-fbdev.c
> @@ -498,7 +498,7 @@ fbdev_output_create(struct fbdev_backend *backend,
> output->base.disable = NULL;
> output->base.enable = fbdev_output_enable;
>
> - weston_output_init_pending(&output->base, backend->compositor);
> + weston_output_init(&output->base, backend->compositor);
>
> /* only one static mode in list */
> output->mode.flags =
> diff --git a/libweston/compositor-headless.c b/libweston/compositor-headless.c
> index 793b8a9..31ae0e2 100644
> --- a/libweston/compositor-headless.c
> +++ b/libweston/compositor-headless.c
> @@ -222,7 +222,7 @@ headless_output_create(struct weston_compositor *compositor,
> output->base.disable = headless_output_disable;
> output->base.enable = headless_output_enable;
>
> - weston_output_init_pending(&output->base, compositor);
> + weston_output_init(&output->base, compositor);
>
> return 0;
> }
> diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
> index b217d7d..7058567 100644
> --- a/libweston/compositor-rdp.c
> +++ b/libweston/compositor-rdp.c
> @@ -570,7 +570,7 @@ rdp_backend_create_output(struct weston_compositor *compositor)
> output->base.disable = rdp_output_disable;
> output->base.enable = rdp_output_enable;
>
> - weston_output_init_pending(&output->base, compositor);
> + weston_output_init(&output->base, compositor);
>
> return 0;
> }
> diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> index e67adf9..2e68674 100644
> --- a/libweston/compositor-wayland.c
> +++ b/libweston/compositor-wayland.c
> @@ -1125,7 +1125,7 @@ wayland_output_create(struct weston_compositor *compositor, const char *name)
>
> output->base.name = name ? strdup(name) : NULL;
>
> - weston_output_init_pending(&output->base, compositor);
> + weston_output_init(&output->base, compositor);
>
> return 0;
> }
> @@ -1224,7 +1224,7 @@ wayland_output_create_for_parent_output(struct wayland_backend *b,
> output->user_data = poutput;
> output->base.name = NULL;
>
> - weston_output_init_pending(&output->base, b->compositor);
> + weston_output_init(&output->base, b->compositor);
>
> return 0;
> }
> diff --git a/libweston/compositor-x11.c b/libweston/compositor-x11.c
> index 10bce65..0158d4f 100644
> --- a/libweston/compositor-x11.c
> +++ b/libweston/compositor-x11.c
> @@ -1017,7 +1017,7 @@ x11_output_create(struct weston_compositor *compositor,
> output->base.disable = x11_output_disable;
> output->base.enable = x11_output_enable;
>
> - weston_output_init_pending(&output->base, compositor);
> + weston_output_init(&output->base, compositor);
>
> return 0;
> }
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index f60ebb8..84715ac 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -4220,80 +4220,6 @@ weston_output_move(struct weston_output *output, int x, int y)
> }
> }
>
> -/** Initialize a weston_output object's parameters
> - *
> - * \param output The weston_output object to initialize
> - * \param c The output's compositor
> - * \param x x coordinate for the output in global coordinate space
> - * \param y y coordinate for the output in global coordinate space
> - * \param mm_width Physical width of the output as reported by the backend
> - * \param mm_height Physical height of the output as reported by the backend
> - * \param transform Rotation of the output
> - * \param scale Native scaling factor for the output
> - *
> - * Sets up the transformation, zoom, and geometry of the output using
> - * the input properties.
> - *
> - * Establishes a repaint timer for the output with the relevant display
> - * object's event loop. See output_repaint_timer_handler().
> - *
> - * The output is assigned an ID. Weston can support up to 32 distinct
> - * outputs, with IDs numbered from 0-31; the compositor's output_id_pool
> - * is referred to and used to find the first available ID number, and
> - * then this ID is marked as used in output_id_pool.
> - *
> - * The output is also assigned a Wayland global with the wl_output
> - * external interface.
> - */
> -WL_EXPORT void
> -weston_output_init(struct weston_output *output, struct weston_compositor *c,
> - int x, int y, int mm_width, int mm_height, uint32_t transform,
> - int32_t scale)
> -{
> - struct wl_event_loop *loop;
> -
> - /* Verify we haven't reached the limit of 32 available output IDs */
> - assert(ffs(~c->output_id_pool) > 0);
> -
> - output->compositor = c;
> - output->x = x;
> - output->y = y;
> - output->mm_width = mm_width;
> - output->mm_height = mm_height;
> - output->dirty = 1;
> - output->original_scale = scale;
> -
> - weston_output_transform_scale_init(output, transform, scale);
> - weston_output_init_zoom(output);
> -
> - weston_output_init_geometry(output, x, y);
> - weston_output_damage(output);
> -
> - wl_signal_init(&output->frame_signal);
> - wl_signal_init(&output->destroy_signal);
> - wl_list_init(&output->animation_list);
> - wl_list_init(&output->resource_list);
> - wl_list_init(&output->feedback_list);
> - wl_list_init(&output->link);
> -
> - loop = wl_display_get_event_loop(c->wl_display);
> - output->repaint_timer = wl_event_loop_add_timer(loop,
> - output_repaint_timer_handler, output);
> -
> - /* Invert the output id pool and look for the lowest numbered
> - * switch (the least significant bit). Take that bit's position
> - * as our ID, and mark it used in the compositor's output_id_pool.
> - */
> - output->id = ffs(~output->compositor->output_id_pool) - 1;
> - output->compositor->output_id_pool |= 1u << output->id;
> -
> - output->global =
> - wl_global_create(c->wl_display, &wl_output_interface, 3,
> - output, bind_output);
> -
> - output->initialized = true;
> -}
> -
> /** Adds an output to the compositor's output list and
> * send the compositor's output_created signal.
> *
> @@ -4419,8 +4345,8 @@ weston_output_set_transform(struct weston_output *output,
> * disable before it returns.
> */
> WL_EXPORT void
> -weston_output_init_pending(struct weston_output *output,
> - struct weston_compositor *compositor)
> +weston_output_init(struct weston_output *output,
> + struct weston_compositor *compositor)
> {
> output->compositor = compositor;
> output->destroying = 0;
> @@ -4442,9 +4368,6 @@ weston_output_init_pending(struct weston_output *output,
> wl_signal_emit(&compositor->output_pending_signal, output);
> }
>
> -/* NOTE: Some documentation is copy/pasted from weston_output_init(), as this
> - is intended to replace it. */
> -
> /** Constructs a weston_output object that can be used by the compositor.
> *
> * \param output The weston_output object that needs to be enabled.
> @@ -4480,15 +4403,17 @@ weston_output_init_pending(struct weston_output *output,
> WL_EXPORT int
> weston_output_enable(struct weston_output *output)
> {
> + struct weston_compositor *c = output->compositor;
> struct weston_output *iterator;
> + struct wl_event_loop *loop;
> int x = 0, y = 0;
>
> assert(output->enable);
>
> - iterator = container_of(output->compositor->output_list.prev,
> + iterator = container_of(c->output_list.prev,
> struct weston_output, link);
>
> - if (!wl_list_empty(&output->compositor->output_list))
> + if (!wl_list_empty(&c->output_list))
> x = iterator->x + iterator->width;
>
> /* Make sure the width and height are configured */
> @@ -4503,10 +4428,43 @@ weston_output_enable(struct weston_output *output)
> /* Remove it from pending/disabled output list */
> wl_list_remove(&output->link);
>
> - /* TODO: Merge weston_output_init here. */
> - weston_output_init(output, output->compositor, x, y,
> - output->mm_width, output->mm_height,
> - output->transform, output->scale);
> + /* Verify we haven't reached the limit of 32 available output IDs */
> + assert(ffs(~c->output_id_pool) > 0);
> +
> + output->x = x;
> + output->y = y;
> + output->dirty = 1;
> + output->original_scale = output->scale;
> +
> + weston_output_transform_scale_init(output, output->transform, output->scale);
> + weston_output_init_zoom(output);
> +
> + weston_output_init_geometry(output, x, y);
> + weston_output_damage(output);
> +
> + wl_signal_init(&output->frame_signal);
> + wl_signal_init(&output->destroy_signal);
> + wl_list_init(&output->animation_list);
> + wl_list_init(&output->resource_list);
> + wl_list_init(&output->feedback_list);
> + wl_list_init(&output->link);
> +
> + loop = wl_display_get_event_loop(c->wl_display);
> + output->repaint_timer = wl_event_loop_add_timer(loop,
> + output_repaint_timer_handler, output);
> +
> + /* Invert the output id pool and look for the lowest numbered
> + * switch (the least significant bit). Take that bit's position
> + * as our ID, and mark it used in the compositor's output_id_pool.
> + */
> + output->id = ffs(~output->compositor->output_id_pool) - 1;
> + output->compositor->output_id_pool |= 1u << output->id;
> +
> + output->global =
> + wl_global_create(c->wl_display, &wl_output_interface, 3,
> + output, bind_output);
> +
> + output->initialized = true;
>
> /* Enable the output (set up the crtc or create a
> * window representing the output, set up the
> @@ -4530,7 +4488,7 @@ weston_output_enable(struct weston_output *output)
> *
> * \param output The weston_output object that needs to be disabled.
> *
> - * See weston_output_init_pending() for more information on the
> + * See weston_output_init() for more information on the
> * state output is returned to.
> *
> * Calls a backend specific function to disable an output, in case
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 0cb04ad..af790a7 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -683,20 +683,6 @@ enum weston_capability {
> WESTON_CAP_VIEW_CLIP_MASK = 0x0010,
> };
>
> -/* Configuration struct for an output.
> - *
> - * This struct is used to pass the configuration for an output
> - * to the compositor backend when creating a new output.
> - * The backend can subclass this struct to handle backend
> - * specific data.
> - */
> -struct weston_backend_output_config {
> - uint32_t transform;
> - uint32_t width;
> - uint32_t height;
> - uint32_t scale;
> -};
> -
> /* Configuration struct for a backend.
> *
> * This struct carries the configuration for a backend, and it's
> @@ -1591,9 +1577,7 @@ void
> weston_output_update_matrix(struct weston_output *output);
> void
> weston_output_move(struct weston_output *output, int x, int y);
> -void
> -weston_output_init(struct weston_output *output, struct weston_compositor *c,
> - int x, int y, int width, int height, uint32_t transform, int32_t scale);
> +
> void
> weston_compositor_add_output(struct weston_compositor *compositor,
> struct weston_output *output);
> @@ -1810,8 +1794,8 @@ weston_output_set_transform(struct weston_output *output,
> uint32_t transform);
>
> void
> -weston_output_init_pending(struct weston_output *output,
> - struct weston_compositor *compositor);
> +weston_output_init(struct weston_output *output,
> + struct weston_compositor *compositor);
>
> int
> weston_output_enable(struct weston_output *output);
>
--
Quentin “Sardem FF7” Glidic
More information about the wayland-devel
mailing list