EXT: [PATCH weston v6 37/73] compositor-wayland: migrate to head-based output API

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 26 10:57:53 UTC 2018


On Sat, 24 Mar 2018 10:13:48 +0000
"Ray, Ian (GE Healthcare)" <ian.ray at ge.com> wrote:

> > On 16 Feb 2018, at 16.57, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > 
> > From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > 
> > Follow the standard pattern used in the headless and x11 backend
> > migration, but also cater for the two other backend modes: --sprawl or
> > fullscreen-shell, and --fullscreen.
> > 
> > Stops relying on the implicit weston_output::head.
> > 
> > Unlike other backends, this uses the attach_head hook to do the
> > required head setup that is not possible to do without an output, but
> > must be done before weston_output_enable(). This also requires the
> > detach_head hook for the one case where the user attaches a --fullscreen
> > head and then detaches it without enabling the output.
> > 
> > It is a little awkward to fully initialize heads as late as attach, but
> > aside from the --sprawl/fullscreen-shell case, there is not really a way
> > to know the head properties without creating the parent wl_surface and
> > configuring it.
> > 
> > Heads/outputs created for parent outputs now have distinct names instead
> > of all being called "wlparent".
> > 
> > Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > ---
> > libweston/compositor-wayland.c | 239 ++++++++++++++++++++++++++++++-----------
> > 1 file changed, 178 insertions(+), 61 deletions(-)
> > 
> > diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
> > index cf4a5f3f..455d94a0 100644
> > --- a/libweston/compositor-wayland.c
> > +++ b/libweston/compositor-wayland.c
> > @@ -137,7 +137,7 @@ struct wayland_output {
> > 
> > struct wayland_parent_output {
> > 	struct wayland_backend *backend;	/**< convenience */
> > -	struct wayland_output *output;
> > +	struct wayland_head *head;
> > 	struct wl_list link;
> > 
> > 	struct wl_output *global;
> > @@ -161,6 +161,11 @@ struct wayland_parent_output {
> > 	struct weston_mode *current_mode;
> > };
> > 
> > +struct wayland_head {
> > +	struct weston_head base;
> > +	struct wayland_parent_output *parent_output;
> > +};

> > +static int
> > +wayland_output_attach_head(struct weston_output *output_base,
> > +			   struct weston_head *head_base)
> > +{
> > +	struct wayland_backend *b = to_wayland_backend(output_base->compositor);
> > +	struct wayland_output *output = to_wayland_output(output_base);
> > +	struct wayland_head *head = to_wayland_head(head_base);
> > +
> > +	if (!wl_list_empty(&output->base.head_list))
> > +		return -1;
> > +
> > +	if (head->parent_output) {
> > +		if (wayland_output_setup_for_parent_output(output,
> > +							   head->parent_output) < 0)
> > +			return -1;
> > +	} else if (b->fullscreen) {
> > +		if (wayland_output_setup_fullscreen(output, head) < 0)
> > +			return -1;
> > +	} else {
> > +		/* A floating window, nothing to do. */
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static void
> > +wayland_output_detach_head(struct weston_output *output_base,
> > +			   struct weston_head *head)  
> 
> Nit: head unused.  (GCC_CFLAGS contains `-Wno-unused-parameter' so
> presumably I should not report similar occurrences?)

Hi Ian,

yes, it's not a mistake. There are lots of code in Weston in general
where functions that need to follow API do not actually use all their
arguments.

In this specific case, wayland-backend can only ever have a single head
per output, so if any head is removed, it was sure to be the only head
on the output which is then left with none. I'm not sure I could put
even an assert here to assure the head argument is correct even if
unnecessary.

> > +{
> > +	struct wayland_output *output = to_wayland_output(output_base);
> > +
> > +	/* Rely on the disable hook if the output was enabled. We do not
> > +	 * support cloned heads, so detaching is guaranteed to disable the
> > +	 * output.
> > +	 */
> > +	if (output->base.enabled)
> > +		return;
> > +
> > +	/* undo setup fullscreen */
> > +	if (output->parent.surface)
> > +		wayland_backend_destroy_output_surface(output);
> > +}


Thanks,
pq
-------------- 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/20180326/146e9e9b/attachment.sig>


More information about the wayland-devel mailing list