[PATCH weston 08/12 v2] weston: Port Wayland backend to new output handling API

Pekka Paalanen ppaalanen at gmail.com
Thu Aug 18 11:21:31 UTC 2016


On Thu, 18 Aug 2016 13:31:22 +0300
Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Wed, 17 Aug 2016 19:49:06 +0200
> Armin Krezović <krezovic.armin at gmail.com> wrote:
> 
> > On 17.08.2016 17:07, Pekka Paalanen wrote:  
> > > On Sun, 14 Aug 2016 17:28:17 +0200
> > > Armin Krezović <krezovic.armin at gmail.com> wrote:
> > >     
> > >> This is a complete port of the Wayland backend that
> > >> uses recently added output handling API for output
> > >> configuration.
> > >>
> > >> - Output can be configured at runtime by passing the
> > >>   necessary configuration parameters, which can be
> > >>   filled in manually, obtained from the configuration
> > >>   file or obtained from the command line using
> > >>   previously added functionality. It is required that
> > >>   the scale and transform values are set using the
> > >>   previously added functionality.
> > >>
> > >> - Output can be created at runtime using the output
> > >>   API. The output creation only creates a pending
> > >>   output, which needs to be configured the same way as
> > >>   mentioned above.
> > >>
> > >> However, the backend can behave both as windowed backend
> > >> and as a backend that issues "hotplug" events, when
> > >> running under fullscreen shell or with --sprawl command
> > >> line option. The first case was covered by reusing
> > >> previously added functionality. The second case required
> > >> another API to be introduced and implemented into both
> > >> the backend and compositor for handling output setup.
> > >>
> > >> After everything has been set, output needs to be
> > >> enabled manually using weston_output_enable().
> > >>
> > >> v2:
> > >>
> > >>  - Fix wet_configure_windowed_output_from_config() usage.
> > >>  - Call wayland_output_disable() explicitly from
> > >>    wayland_output_destroy().
> > >>
> > >> Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
> > >> ---
> > >>  compositor/main.c              | 275 +++++++++++++++-------------------
> > >>  libweston/compositor-wayland.c | 327 +++++++++++++++++++++++------------------
> > >>  libweston/compositor-wayland.h |  27 +++-
> > >>  3 files changed, 325 insertions(+), 304 deletions(-)
> > >>
> > >> diff --git a/compositor/main.c b/compositor/main.c
> > >> index a72c2f9..143ee21 100644
> > >> --- a/compositor/main.c
> > >> +++ b/compositor/main.c  
> 
> > >> -/*
> > >> - * Append a new output struct at the end of new_config.outputs and return a
> > >> - * pointer to the newly allocated structure or NULL if fail. The allocated
> > >> - * structure is NOT cleared nor set to default values.
> > >> - */
> > >> -static struct weston_wayland_backend_output_config *
> > >> -weston_wayland_backend_config_add_new_output(struct weston_wayland_backend_config *config)
> > >> +wayland_backend_output_configure(struct wl_listener *listener, void *data)
> > >>  {
> > >> -	struct weston_wayland_backend_output_config *outputs;
> > >> -	const size_t element_size = sizeof(struct weston_wayland_backend_output_config);
> > >> +	struct weston_output *output = data;
> > >> +	struct wet_output_config defaults = {
> > >> +		.width = 1024,
> > >> +		.height = 640,
> > >> +		.scale = 1,
> > >> +		.transform = WL_OUTPUT_TRANSFORM_NORMAL
> > >> +	};
> > >>  
> > >> -	outputs = realloc(config->outputs,
> > >> -			  (config->num_outputs + 1) * element_size);
> > >> -	if (!outputs)
> > >> -		return NULL;
> > >> -	config->num_outputs += 1;
> > >> -	config->outputs = outputs;
> > >> -	return &(config->outputs[config->num_outputs - 1]);
> > >> +	if (wet_configure_windowed_output_from_config(output, &defaults) < 0)
> > >> +		weston_log("Cannot configure output \"%s\".\n",
> > >> +			   output->name ? output->name : "unnamed");    
> > > 
> > > I think wayland_backend_output_configure() is missing a special case
> > > for --fullscreen. That is, desktop shell (windowed api) but asked to be
> > > fullscreen...
> > > 
> > > Actually no, this is fine. It would just need a comment explaining that
> > > the backend will override the size if --fullscreen was given. I see
> > > this would be inconvenient to realize otherwise.
> > > 
> > >     
> > 
> > The backend would only set the surface fullscreen. I don't know what it will
> > do to the size though, the values aren't touched, at least not that I saw it.  
> 
> Setting fullscreen involves a shell protocol hand-shake to negotiate
> the size. The backend should be doing that already.

Btw. that will be an interesting fact for the output layout work. You
won't know the size until after the negotiation.

Another thing is, it might not make sense to allow the compositor to
set the layout itself if you sprawl all outputs. The outputs are
already arranged somehow, so you might want to use the parent
compositor's layout. If there is one. Maybe you need to let the
compositor decide if it goes with the parent compositor layout or uses
its own.

2c.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160818/aea8bcb9/attachment.sig>


More information about the wayland-devel mailing list