src/agl-compositor.git
2 months agoAdd gitlab issue/merge request templates 17.90.0 ricefish/17.90.0 ricefish_17.90.0
Jan-Simon Moeller [Tue, 13 Feb 2024 22:01:49 +0000 (23:01 +0100)]
Add gitlab issue/merge request templates

Add template files for gitlab

Bug-AGL: SPEC-4474
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Change-Id: I811994c1179932fe83a6b5f1ceb674f65ec1c568

3 months agolayout: Add the ability to deactivate fullscreen surfaces 08/29608/1
Marius Vlad [Tue, 23 Jan 2024 13:39:47 +0000 (15:39 +0200)]
layout: Add the ability to deactivate fullscreen surfaces

Deactivating fullscreen is a special case so we need to handle it
similarly to dialog/popups.

This adds an additional schedule for repaint in the fullscreen part to
force a redraw, otherwise deactivation/activation would need to inflict
any sort of damage to trigger a redraw.

Bug-AGL: SPEC-4348
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I258543f43514af07dfed7b36531816e90561cc61

4 months agogrpc-proxy: Add a prefix tag for debugging messages 73/29573/1
Marius Vlad [Tue, 2 Jan 2024 17:28:38 +0000 (19:28 +0200)]
grpc-proxy: Add a prefix tag for debugging messages

Bug-AGL: SPEC-4977
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib26d0b9f9d47e7d2e2d42b47a9702ba31d03f3b9

4 months agogrpc-proxy: Re-work bound_ok/bound_fail events handling 67/29567/4
Marius Vlad [Fri, 29 Dec 2023 20:16:37 +0000 (22:16 +0200)]
grpc-proxy: Re-work bound_ok/bound_fail events handling

This bigger patch changes the way gRPC proxy client connects to the
server, more specifically how it binds to the same agl_shell interface
as the shell client.

I debated if this should be split into more pieces but I think it makes
more sense to have contained into a single patch as it doesn't make
sense to have some bits off and some bits on, as both the server and the
client side need to be changed at the same time.

This biggest change with this patch is to avoid a potential race condition
between the gRPC proxy client and the shell-client, but also to simplify
the way the gRPC client connects to the server as there aren't sufficient
guards in the server to the provent various corner cases to take place.
Rather than attempting to fix that, simplifying the entire bit and
allow only a single agl-shell client and a sigle gRPC proxy client
connected at a single time and remove any other potential clients
trying to connect at all, later on.

Context and usage:

Both the gRPC proxy and shell-client bind to the same agl_shell
interface, meaning that both use the shell-client (homescreen,
flutter-ics-homescreen, flutter-auto, wam) and the gRPC proxy can
issue agl_shell requests, with some minor differences --
setting background and panels which do not make sense for
gRPC proxy client.

The compositor can signal back to clients when a bind was OK or
not with the bound_ok/bound_fail event. Previously to
adding the bound_ok/bound_fail events, any other client trying to use
agl_shell interface, more than once, would get a protocol violation.
With the bound_ok/bound_fail events clients would instead receive this
event and could theoretically act upon it.

The race that this patch tries to overcome is that the gRPC client will
periodically attempt to verify if there's a shell-client already
connected to server by binding to agl_shell interface and waiting for
bound_fail event. In case it got bound_ok, it would disconnect and
attempt at latter point in time, until it got the bound_failed event, and thus
signalling that there's shell client already connected, allowing to
proceed further.

This worked fine most of the time, depending on how fast the shell
client also bind to agl_shell.  For a brief period of time, it might be
that shell client also gets a bound_fail, requiring it to retry at a
later point in time. The disconnected/reconnect of the gRPC proxy would
then complicate matters as the client resources will get overwritten. So
rather than trying to try that fix that, a better approach is to
simplify the way this works entirely.

The change in this patch is that the gRPC proxy doesn't
connect/disconnect periodically but rather it waits for the compositor
to signal when it is ready to bind to agl_shell interface.

That happens with the help of the doas event status, from the
agl_shell_ext interface. If this event status is alright (OK) then it means
the gRPC can then bind to agl_shell interface.

If it gets a failed status it would just wait and then issue another
doas request and continue as such forever until it got an alright
status. The distinct is that in this case the gRPC proxy would not disconnect
and then reconnect retrying the same thing.

This change to simplify some of the assumption in server, and
client side implementation would just race with the shell client when
binding to the agl_shell interface.

Bug-AGL: SPEC-4977
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib74f789553d3b130ee8e61d0068e617dc2209a58

4 months agoshell: Provide a better explanation for terminating the connection 48/29548/1
Marius Vlad [Tue, 19 Dec 2023 14:24:05 +0000 (16:24 +0200)]
shell: Provide a better explanation for terminating the connection

And make sure we clear off the remaing client resources when doing an
unbind.

It seems we would hit it when checking set_background/ready/set_panel
requests, resulting in a protocol violation and finally terminating the
connection.

Bug-AGL: SPEC-4977
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie5ed881511ec2ac4501d2a5cac349abc7f83c1fe

4 months agoshell: Don't assume an output previously set-up 35/29535/1
Marius Vlad [Fri, 15 Dec 2023 10:21:49 +0000 (12:21 +0200)]
shell: Don't assume an output previously set-up

This is unlikely to happen in practice, but discovered while doing a
code audit, so let's let be on the safe side and don't attempt to deref
as we'll get invalid memory.

Bug-AGL: SPEC-5018
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib874a7194ab3a7019a304ec4c1974824c78b26cc

5 months agomeson.build: Bump version to 0.0.22 02/29402/1
Marius Vlad [Tue, 14 Nov 2023 10:15:10 +0000 (12:15 +0200)]
meson.build: Bump version to 0.0.22

We haven't add an official release since the beginning of the year, when
we introduced the gRPC API. So do another one, as we've changed a bit
the say the gRPC starts.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Idc2feace89a0cd77d1788e629fff9b5f2f443fce

6 months agogrpc-proxy: Use smaller waiting time 06/29306/2
Marius Vlad [Wed, 25 Oct 2023 13:22:19 +0000 (16:22 +0300)]
grpc-proxy: Use smaller waiting time

This would speed the time checking if agl-shell was bounded or not.
Shouldn't make that much of a difference but we do not need to wait 250
ms just for testing that.

Bug-AGL: SPEC-4912
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I8751c1d69898a82a415ba9b756bdfe9657ef0546

6 months agogrpc-proxy: Start the gRPC server and waiting thread much sooner 05/29305/3
Marius Vlad [Tue, 24 Oct 2023 14:39:45 +0000 (17:39 +0300)]
grpc-proxy: Start the gRPC server and waiting thread much sooner

This change moves a bit the start-up sequence of the gRPC server and
when it connects to the compositor.

Changing the start-up sequence avoids waiting for the channel to change
its state from disconnected to connected, and only wait for the wayland
connection to take place. Otherwise, we would wait first for the wayland
connection to take place, then wait for the gRPC server to start up
and finally wait for the channel to be in connected state, all which
would incur a massive waiting time.

Moving it a bit early requires to at least verify that we have the proxy
side (the wayland connection) is already set-up at that time.

Bug-AGL: SPEC-4912
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ied88a917df8ff98fefa601103ce04e13c8bb21ac

6 months agogrpc-proxy: Fix missing args LOG() 04/29304/2
Marius Vlad [Tue, 24 Oct 2023 14:11:12 +0000 (17:11 +0300)]
grpc-proxy: Fix missing args LOG()

These are not seen until enabling the DEBUG directive.

Bug-AGL: SPEC-4912
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic18c701909975978e82ef811ade416d802e567b5

6 months agogrpc-proxy/main-grpc: Don't fall trough assuming we have a wl_display 17/29317/3
Marius Vlad [Fri, 27 Oct 2023 13:16:19 +0000 (16:16 +0300)]
grpc-proxy/main-grpc: Don't fall trough assuming we have a wl_display

Maybe the third time is a charm to avoid fall through and assume on the
exit path we do have a wl_display.

Bug-AGL: SPEC-4935
Reported-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
Tested-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4adef5bf72d6b1a32a218bf1cfa6c8ed4450ba48

6 months agogrpc-proxy: Don't attempt to connect if there's no compositor running 13/29313/1
Marius Vlad [Fri, 27 Oct 2023 10:52:09 +0000 (13:52 +0300)]
grpc-proxy: Don't attempt to connect if there's no compositor running

Commit d8e72099ecbcad, 'grpc-proxy: Terminate thread when we're
exiting', addressed a rather bigger issue to handle correctly the
shutdown/restart sequence. A consequence of that is the initial issue
opened in SPEC-4935 with a trace showing a protocol issue, due to fact
we're supplying an invalid wl_display without being connected to the
compositor.

While commit d8e72099ecbcad, 'grpc-proxy: Terminate thread when we're
exiting' does fix the issue and would make the underlying bug disappear
let's be more pedantic and don't attempt assume we have a compositor
connection when in fact we do not.

Bug-AGL: SPEC-4935
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id10dabe5178f52fa6a0cf6d70c70799c98f4b6d5

6 months agogrpc-proxy: Terminate thread when we're exiting 01/29301/1
Marius Vlad [Tue, 24 Oct 2023 13:51:59 +0000 (16:51 +0300)]
grpc-proxy: Terminate thread when we're exiting

We need to be joining the thread to be able to exit properly, so let us
do that.

Bug-AGL: SPEC-4935
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib4e54fcb23267b632f61c10d6ec2835c55ec2f23

8 months agogrpc-proxy: Add dynamic scale of floating windows 69/29069/2
Marius Vlad [Mon, 31 Jul 2023 11:41:48 +0000 (14:41 +0300)]
grpc-proxy: Add dynamic scale of floating windows

This adds basic scaling for floating windows, sending new dimensions to
the clients to resize itself.

Bug-AGL: SPEC-4862
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic693153cd704b278dcddd2514afc8dafecf8829b

8 months agogrpc-proxy: Add dynamic floating window movement 68/29068/2
Marius Vlad [Thu, 27 Jul 2023 13:37:15 +0000 (16:37 +0300)]
grpc-proxy: Add dynamic floating window movement

This adds basic movement for floating type of windows. The window needs
to be a floating type for this request to work out.

For the agl-shell protocol, this adds a set_app_float() request while
for gRPC it adds a SetAppPosition() request.

Bug-AGL: SPEC-4863
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I5ecc4257c3e84d15a8cabb183757753be37867f5

8 months agodesktop: Fix Xwayland build 40/29140/1
Marius Vlad [Thu, 17 Aug 2023 11:59:24 +0000 (14:59 +0300)]
desktop: Fix Xwayland build

Turns out weston doesn't install xwayland-api header if Xwayland is not
installed, which is a shame, and should be rectified. Meanwhile, let's
guard access to the header and the API that the header exports.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I77638b263483628f8cc7a3dcbd08c8947db1d86b

9 months agocompositor: Use the logging context when iterating over scopes 65/29065/2
Marius Vlad [Mon, 24 Jul 2023 17:24:33 +0000 (20:24 +0300)]
compositor: Use the logging context when iterating over scopes

In accordance to the upstream changes refer to the logging context
rather than the compositor instance.

Depends on https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/29064

Bug-AGL: SPEC-4861
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4a8aeac4ef33e0631c23ae85347fea8a1b36c4de

9 months agolayout: Check against app_id being valid 62/29062/1
Marius Vlad [Fri, 21 Jul 2023 16:38:19 +0000 (19:38 +0300)]
layout: Check against app_id being valid

All app_ids are not valid for xwayland type of surfaces to need to check
against it.

Bug-AGL: SPEC-4847
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I84dc9b493648f4fe48b1c23c8ead0283505acce0

9 months agolayout: Determine xwayland surface in a generic fashion 61/29061/1
Marius Vlad [Fri, 21 Jul 2023 12:37:49 +0000 (15:37 +0300)]
layout: Determine xwayland surface in a generic fashion

This provides a far better way of determining if the surface is
xwayland or not. We can then make sure all X11 clients can be displayed.

Bug-AGL: SPEC-4847
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2140c452c0d37a84323eaf75787eb32a7771a56e

10 months agocompositor: Add XWayland basic support 74/28874/3
Marius Vlad [Mon, 8 May 2023 16:20:25 +0000 (19:20 +0300)]
compositor: Add XWayland basic support

This allow starting up XWayland and the ability to display, albeit
is incomplete, given that we have no way at this moment to make the
window maximized, as we do with xdg-shell/native wayland applications.

A further patch, together with libweston changes are needed to make this
complete. For now this can provide us with initial smoke testing. Tested
with basic X11 clients, including Unigine, which is the reason for
having this the moment.

Note that this at the moment compiled-out, requiring the pass
-Dxwayland=true when building the compositor.

Bug-AGL: SPEC-4782
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I87d2a852165cb3f03482bea1e04931bdd6d4c115

10 months agolayout: Give ini config precedence over agl_shell 12/29012/1
Marius Vlad [Tue, 13 Jun 2023 11:04:40 +0000 (14:04 +0300)]
layout: Give ini config precedence over agl_shell

The activation area can set-up with agl_shell as well, so give
the ini configuration file precedence over the one set-up by
agl_shell.

Bug-AGL: SPEC-4829
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ifae82b8c29575e7a9a06422588ad6a8cce80946e

10 months agoshell: Don't reset the activation area always 11/29011/1
Marius Vlad [Tue, 13 Jun 2023 10:47:19 +0000 (13:47 +0300)]
shell: Don't reset the activation area always

Rather than doing that always, be more selective, and perform it if we
had already an application active.

Bug-AGL: SPEC-4829
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I707f92d1cc1f820af493bae9daa5a948aa452ad8

10 months agolayout: Add a fallback for reading activation-area 10/29010/1
Marius Vlad [Fri, 9 Jun 2023 08:49:36 +0000 (11:49 +0300)]
layout: Add a fallback for reading activation-area

This is a temporary work-around for doing another read of the ini file
for the activation-area in case we detected that we have one set-up but
the activation area is empty. This happens when we're getting the ready()
request from the shell client, when we're initializing the layout.

Bug-AGL: SPEC-4829
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I152e7cba34b74390de2a46df4799c1fb44441d3f

11 months agopolicy-deny: Remove SMACK support 24/28924/2
Marius Vlad [Tue, 23 May 2023 12:58:31 +0000 (15:58 +0300)]
policy-deny: Remove SMACK support

Similar to Waltham, SMACK hasn't been really used and it was actually
a compile option, showing as a example the deny policy. The RBA and the
allow-all policy still available, and we can revisit the policy
mechanism if we plan on switching to SELinux.

Bug-AGL: SPEC-4806
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iedac63585676ebc47201debcf73870cb0538cc09

11 months agocompositor: Remove Waltham support 23/28923/2
Marius Vlad [Tue, 23 May 2023 12:48:56 +0000 (15:48 +0300)]
compositor: Remove Waltham support

Waltham hasn't been used in a while, its support has been removed for
some time, we've been deprecating it last release so it's time to remove
it from the compositor as well.

Bug-AGL: SPEC-4669
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iaf1e467b1228051fd96cac424ac6781d67f9fefa

11 months agoclients/screenshooter: Add the output name to screenshot name 92/28892/1
Marius Vlad [Fri, 12 May 2023 18:51:32 +0000 (21:51 +0300)]
clients/screenshooter: Add the output name to screenshot name

And split the screenshot in multiple files, to match each output.

Bug-AGL: SPEC-4788
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I6d9e545c05ff949900f0158720888eb757c2c271

12 months agocompositor: Let the user know about the debug scopes available 03/28803/1
Marius Vlad [Thu, 4 May 2023 15:01:16 +0000 (18:01 +0300)]
compositor: Let the user know about the debug scopes available

Bug-AGL: SPEC-4593
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I79d4447b7768b72712e244504782a33ba257a33d

12 months agocompositor: Add support for subscribing to libweston scopes 02/28802/1
Marius Vlad [Thu, 4 May 2023 11:42:56 +0000 (14:42 +0300)]
compositor: Add support for subscribing to libweston scopes

This brings in support to pass, over the command line, debug scopes
that can help out debug issues with HW with other components or with
libweston itself. One particular importance is the drm-backend debug
scope.

Bug-AGL: SPEC-4593
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I7a182ffe0b2b9bfdeced184514283265bb17c607

12 months agoshell: Add the ability to dynamically move application window 24/28724/3
Marius Vlad [Wed, 26 Apr 2023 06:48:40 +0000 (09:48 +0300)]
shell: Add the ability to dynamically move application window

So far, we could start an application on a different output, but
moving them back-and-worth wasn't really supported. This handles
a few use-cases like:

- move an application's window from one output to another
- install black curtain in case we no longer have any other surfaces
  on that output;
- deactivate and switch to the previous active window in case there's
  one available
- the activation is handled by the shell client, while deactivation
  is done implicitly by the compositor to simplify the shell client

This does a bit of rewording of a function that returns true whenever
we have only a single application window on a particular output.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I58cde58c6a2e2dade93566bfd7aff5ed697f5450

12 months agolayout: Fix no-op check due to invalid checks 23/28723/2
Marius Vlad [Wed, 26 Apr 2023 06:49:08 +0000 (09:49 +0300)]
layout: Fix no-op check due to invalid checks

Checking both width and height isn't a strict requirement, either can
different. This unties the check such that we can actually move
windows/applications between different outputs.

We also add here an explicit surface damage as we're removing the view
from the layer.

Bug-AGL: SPEC-4773
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie91b8c0fd2e9357fe00fd693e2a70fa3b4b4d31a

12 months agodesktop: Look for app_ids after the initial commit 87/28687/4
Marius Vlad [Fri, 21 Apr 2023 11:38:32 +0000 (14:38 +0300)]
desktop: Look for app_ids after the initial commit

Some applications, set up their app_ids after the initial surface
commit, which is too late to move them/place them to a different output.

This addresses that in the case the application sets one up, after the
initial surface commit.

Bug-AGL: SPEC-4759
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4762af1ba6e8708722385ac06c37486dd4b6aac1

12 months agosrc: Send out the output name for the remote role 43/28643/6
Marius Vlad [Fri, 14 Apr 2023 13:46:06 +0000 (16:46 +0300)]
src: Send out the output name for the remote role

A while ago we switched to activation-by-default turned off which passes
the responsability of activating applications to the shell client. The
shell client uses the app_id to indentify the application to display,
and the output.

The output would normally be hard-coded to the first available output
but there is nothing that prevents the shell to display it on other
outputs.

This patch does just that, it would allow the user use configurable
option in the ini file, under the [output], agl-shell-app-id=app_id, by
re-using the event from the compositor sent to the shell client to
pick up a different output, the one specified in the section entry.

Bug-AGL: SPEC-4529
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ieea1a28fe6776ecc691fd38da9b4c3495ac5a5ea

12 months agolayout: Split remote from desktop role 42/28642/4
Marius Vlad [Thu, 13 Apr 2023 08:58:19 +0000 (11:58 +0300)]
layout: Split remote from desktop role

Though there's no difference between the desktop and remote role this
would simplify handling, and with it we remove the implicit activation
of surfaces, which wasn't addressed when we switched to
activate-by-default=false by default.

Bug-AGL: SPEC-4673, SPEC-4759, SPEC-4529, SPEC-4756
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ia5e57155ed26c53958e0e9590be04f91c5de1c28

12 months agogrpc-proxy: Added set_app_output request 41/28641/2
Marius Vlad [Fri, 7 Apr 2023 12:59:49 +0000 (15:59 +0300)]
grpc-proxy: Added set_app_output request

This is identical to the remote role, but I feel this conveys more
information than remote role, as remote denotes that the output is
displayed on another device, which it isn't always the case (the
system has multiple outputs all connected directly).

This introduces two new additions to the agl-shell protocol, a request
to use a different output to display/show the application and an event
to inform the shell client to use as a map between the application id
and its output. The event is necessary to let the shell client know
which output to activate the application on.

This requests implements a wrapper for gRPC that maps 1-to-1 to the
agl-shell request. There's no gRPC subscription similar to the event
though.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I070e9fdbafd5616f3a98415193bf846aeaee9a4a

12 months agocompositor: Don't reuse previous return values 25/28625/1
Marius Vlad [Thu, 6 Apr 2023 07:59:37 +0000 (10:59 +0300)]
compositor: Don't reuse previous return values

In case we couldn't enable the output do not return early without
setting the proper return value. This causes an issue later one, because
the signal list isn't initalized, taking down the compositor with a crash.

Bug-AGL: SPEC-4734
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ia5ebc226f6b8f702e710a5976c471d04302bcb00

13 months agomeson.build: Add an explicit weston dependency 73/28573/1
Marius Vlad [Wed, 15 Mar 2023 10:48:21 +0000 (12:48 +0200)]
meson.build: Add an explicit weston dependency

Required when building the compositor locally, without yocto/OE as
weston cflags includes the full path to weston.

Bug-AGL: SPEC-4725
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: If3a4e8238cb40c6fbe0db26bd1056fce48243038

13 months agomeson.build: Remove any prefix assumptions 72/28572/1
Marius Vlad [Sat, 11 Mar 2023 17:02:26 +0000 (19:02 +0200)]
meson.build: Remove any prefix assumptions

This forces to create a include directory by hand, which we don't seem
to be needing. This only affected the cases where we build the
compositor locally, without yocto/OE.

Bug-AGL: SPEC-4725
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic279714671809eae2362da9fccaf592f10f2b888

14 months agogrpc-proxy: Add set_app_fullscreen functionality 52/28552/1
Marius Vlad [Wed, 1 Mar 2023 14:57:38 +0000 (16:57 +0200)]
grpc-proxy: Add set_app_fullscreen functionality

This implements set_app_fullscreen which clients can set-up before being
mapped.

The worthwhile change here was the fact that transitioning between
fullscreen, normal, and float would cause invalid tracking of the active
window when switching between these states. This would make floating
operation display the incorrect active window, so in order to reconcile
that, we only update the previous surface if it is different that the
current active one. Otherwise this fairly similar to set_app_float.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie912c86ff7ac38d034cf4d97b2adbc5ef47ce9d3

14 months agoshell: Reset normal state when getting back to maximized 51/28551/1
Marius Vlad [Thu, 2 Mar 2023 17:05:51 +0000 (19:05 +0200)]
shell: Reset normal state when getting back to maximized

When resetting back to normal, maximized state, reset also the state,
just in case we might to check it up latter on.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I0107e6963c01bde22a5a3ab30f392cb618a4f258

14 months agoprotocol: Add set_app_normal request 65/28465/3
Marius Vlad [Thu, 9 Feb 2023 12:06:49 +0000 (14:06 +0200)]
protocol: Add set_app_normal request

This request allows transitioning back from other roles like
float/split/fullscreen to regular maximized, normal state.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id7f04ffee193677621bd32860998457498acc388

14 months agoprotocol, grpc-proxy: Add support for set_app_float 64/28464/3
Marius Vlad [Fri, 20 Jan 2023 14:32:35 +0000 (16:32 +0200)]
protocol, grpc-proxy: Add support for set_app_float

Add support for setting a window as float/popup. This allows either the
application itself be set-up as float, or from other gRPC clients.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic7ee8203cd9c4dfcc51b7fc9709f35be504ae9d0

14 months agoprotocol/grpc-proxy: Add deactivate_app request 63/28463/2
Marius Vlad [Fri, 20 Jan 2023 11:34:00 +0000 (13:34 +0200)]
protocol/grpc-proxy: Add deactivate_app request

This request will hide the currently active window, and activate
either the background or the previously active window.

This request mimics the agl-shell-desktop request, actually using the
same code path. It only handles regular windows and float/pop-up. Once
we add other roles like fullscreen/split we can improve on this.

Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I593cda5d008dfc32fe5e3b079fad9450dc1a490d

14 months agocompositor: Added layout_save/layout_restore 05/28505/1
Marius Vlad [Wed, 15 Feb 2023 15:02:28 +0000 (17:02 +0200)]
compositor: Added layout_save/layout_restore

In order to send correct dimensions after a hot-plug event, we need to
be able to save the area we had before.

Note that implies that the connectors do not change names in between
hot-plugs, which normally doesn't happen, but it might if udev rules are
executed/invoked. We restore based on output name it had previously.

Bug-AGL: SPEC-4705
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ice3a127edfc9d356830ba8f0d0a20bb86284d7de

14 months agoshell: Check for a valid ivi_surface 04/28504/1
Marius Vlad [Wed, 15 Feb 2023 15:49:50 +0000 (17:49 +0200)]
shell: Check for a valid ivi_surface

A hot-plug/re-plug event means we remove the black curtain with it the
ivi_surface that hangs out of it, so verify it before assuming there's
one installed.

Bug-AGL: SPEC-4705
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iad53ae34b4e15b5962cf984978a65c344aac9200

14 months agoshell: Check for invalid outputs passed on when activating 03/28503/1
Marius Vlad [Wed, 15 Feb 2023 10:19:42 +0000 (12:19 +0200)]
shell: Check for invalid outputs passed on when activating

Connector hot-plugging would generate new wl_output object, which the
client might re-use so rather than blindly trusting the client, make
sure that the output we're getting is really one suitable.

This should avoid getting an incorrect output upon re-plugging in a
connector.

Bug-AGL: SPEC-4705
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I732283fc16841e0e57ddbec5d8bd2333d5028433

14 months agocompositor: Fix memleak when disabling the output 02/28502/1
Marius Vlad [Wed, 15 Feb 2023 15:07:09 +0000 (17:07 +0200)]
compositor: Fix memleak when disabling the output

Turns out we're leaking out the app_ids when disabling the output so
turn that memleak off.

Bug-AGL: SPEC-4705
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ia2d46ecd1748c078e924d8d6c90bd86e9c49f64c

15 months agoivi-compositor: Add support for multiple app_ids 79/28379/3
Marius Vlad [Wed, 11 Jan 2023 15:23:37 +0000 (17:23 +0200)]
ivi-compositor: Add support for multiple app_ids

Verify if more than one app_id is being passed in the agl-shell-app-id
to allow more than one appid being placed to that output.

Bug-AGL: SPEC-4666
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I79dc77564ffca41148832af597b6836d7d28f686

15 months agomeson: Deprecate waltham and inform users of that 78/28378/3
Marius Vlad [Wed, 11 Jan 2023 12:48:06 +0000 (14:48 +0200)]
meson: Deprecate waltham and inform users of that

Waltham isn't really used, this is a step forward removing
support for it. For now just add an configuration option if users still
want to use it.

Bug-AGL: SPEC-4670
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I5ec900ef075717b438ef9e41167ad4833b2a8b87

15 months agomeson: Bump to version 0.0.21 77/28377/2
Marius Vlad [Wed, 11 Jan 2023 13:05:02 +0000 (15:05 +0200)]
meson: Bump to version 0.0.21

We should probably cut and update the compositor to a newer version
as gRPC support is a big change to have.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iac400a3d2f0e62c5fe3b2ab0f681ce228a1865db

15 months agoshell: Reset the area activation 85/28385/1
Marius Vlad [Sat, 14 Jan 2023 17:46:47 +0000 (19:46 +0200)]
shell: Reset the area activation

Re-starting the shell client wouldn't reset the activation area, which
might be rather confusing, so better be re-initialize it as to be able to
switch in-between various configurations.

Bug-AGL: SPEC-4674
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib964ebed2c189f82092ffcf4d54dee2cf22093e1

15 months agoshell: Verify agl-shell version for bound_ok/bound_fail 62/28362/1
Marius Vlad [Wed, 4 Jan 2023 14:42:43 +0000 (16:42 +0200)]
shell: Verify agl-shell version for bound_ok/bound_fail

Some additional checks to avoid cases where agl-shell is still
using the version 1 but we're checking against at least version 2 (where
we introduced some additional events). Part of the compat series.

Bug-AGL: SPEC-4667
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4f5d34fd8b9fe6cf6b8097948afebee550f5345d

15 months agoshell: Add fallback agl-shell version 1 61/28361/1
Marius Vlad [Thu, 5 Jan 2023 11:50:23 +0000 (13:50 +0200)]
shell: Add fallback agl-shell version 1

Turns out I made a mistake making all clients with version 1
not able to bind to agl-shell anymore. Rather than doing that still
allow older clients to bind to agl-shell.

Bug-AGL: SPEC-4667
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I61224f39dd8b0d96b36695f536eed8e701130877

16 months agoinput: Fix minor issue while reporting disable cursor 17/28317/1
Marius Vlad [Wed, 28 Dec 2022 15:59:36 +0000 (17:59 +0200)]
input: Fix minor issue while reporting disable cursor

We actually reported the cursor being disabled when it fact it was not.

Bug-AGL: SPEC-4658
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I81ee23e4ef2621c96344ce526a7b53d235d325e3

16 months agoinput: Rename hide-cursor to disable-cursor 16/28316/1
Marius Vlad [Wed, 28 Dec 2022 14:21:01 +0000 (16:21 +0200)]
input: Rename hide-cursor to disable-cursor

Since hide-cursor doesn't hide the cursor but disables the pointer,
better rename it to something much more appropriate.

While doing that, move also move the ini entry retrieval where is also
more suitable, along side the other parts that do that. Shouldn't be
any functional change while doing that.

Bug-AGL: SPEC-4658
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I8d1aab849b9a96177d17bb639c8e1e209205f7e7

16 months agosrc: Verify if the output is present 59/28259/5
Marius Vlad [Mon, 12 Dec 2022 19:02:19 +0000 (21:02 +0200)]
src: Verify if the output is present

The output destroy handler will invalidate the weston output and with it
we're no longer have access to it when the shell client closes up. This
checks against the weston output to avoid an illegal memory access.

Still part of the hot-plug connector fixes.

Bug-AGL: SPEC-4625
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Detlev Casanova <detlev.casanova@collabora.com>
Change-Id: Ic4c389422057fa082aff7fdbbc13af0c16f7bbb6

16 months agosrc: Further hotplug connector fixes 58/28258/4
Marius Vlad [Thu, 1 Dec 2022 16:37:02 +0000 (18:37 +0200)]
src: Further hotplug connector fixes

Some further checks for the black curtain not being present always when
perform hot-plugging operations.

Bug-AGL: SPEC-4625
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Detlev Casanova <detlev.casanova@collabora.com>
Change-Id: Ia7c05e5b90b9e8260f661a8115a93b0d246b9d98

16 months agogrpc-proxy: Init gRPC 71/28071/5 sandbox/mvlad/grpc-async-cb
Marius Vlad [Tue, 25 Oct 2022 10:06:41 +0000 (13:06 +0300)]
grpc-proxy: Init gRPC

This brings in support for accessing agl-shell protocol indirectly by
using a gRPC interface which bridges the communication between a
particular client (the client issuing gRPC requests) and the AGL
compositor which does that by re-using the same agl-shell protocol.

In order to achieve that, and further more, to avoid having ifdefs code
in the compositor and deal with threading, we instead resorted to using
a helper client.

On one side this helper implements the gRPC server API,
and on the other, a wayland native client that implements the
agl_shell interface.

It uses the agl_shell_ext interface added
previously to communicate with the compositor that it requires access
to agl_shell interface as well. The helper expects that agl_shell interface
was already bounded to another client before starting it so it waits
until that happens and then it implements the protocol specification,
for each interface.

Launching the helper client automatically can be done by adding the
following entry to the ini file:

[shell-client-ext]
command=/path/to/agl-shell-grpc-server

The gRPC server implementation only handles the agl_shell interface
until to this point, specifically, the activate_app request, and the
events that were adedd with version 3 of the agl-shell protocol.

Also the implementation uses the Reactor pattern, with Callback service
that greatly simplifies the async version and avoids putting locks to
to handle multiple clients. This should allow multiple clients being
connected to the gRPC server and receive events / send requests.

Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie870da3caa138394d8dd30f9d22a5552d585d63a

16 months agoshell: Not not override the agl_shell interface resources 70/28070/2
Marius Vlad [Wed, 26 Oct 2022 15:07:47 +0000 (18:07 +0300)]
shell: Not not override the agl_shell interface resources

This redoes a bit the way we assigned wl_resources created in case we got
a bound_ok or bound_fail event.

Previously, even if we get a 'bound_fail' event we would override the
shell_client.resource which would make activation of the legitimate
shell client impossible, so this change would make the shell_client.resource
not being set if that happens.

Secondly, this includes a reset change in the agl_shell destructor, a
reset which is implicitly being done when the correct operations for the
protocol specifications have been applied.

Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ie87ce3b937f041a5704407593f580895f188ef56

16 months agoshell: Add a wrappers for sending events with agl-shell 69/28069/2
Marius Vlad [Tue, 18 Oct 2022 20:32:40 +0000 (23:32 +0300)]
shell: Add a wrappers for sending events with agl-shell

As we now have one more (shell) client that can bind to agl-shell, add a
wrapper for sending the events and include it as well.

Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I869b036d6f24beeb3089bfd24b8d233c5fada71f

16 months agocompositor: Allow to start other clients 68/28068/2
Marius Vlad [Mon, 10 Oct 2022 14:03:15 +0000 (17:03 +0300)]
compositor: Allow to start other clients

This introduces shell-client-ext as a new section entry to add to allow
starting the gRPC server helper client.

Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I41d62c932648699aa21837afc2de5103912c370d

16 months agoagl-shell.xml: Introduce a new interface 67/28067/2
Marius Vlad [Sat, 8 Oct 2022 18:06:18 +0000 (21:06 +0300)]
agl-shell.xml: Introduce a new interface

In order to allow another other client bind to agl_shell interface, this
introduces a new specific interface which the client would bind to
first, issue a doas_shell_client request, wait for a response, and
proceeed further if the event received was successful. Afterwards, the
client can bind to agl_shell protocol (and assuming it got 'bound_ok'
event back) can further use the agl_shell protocol as it happens with
the shell client.

This approach avoids adding a new protocol interface and instead re-uses
the same interface, with the note that the shell client is still in
charge of handling background and panels.

Bug-AGL: SPEC-4503
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iac1d840a5f917b2a92fdfbdcdc583144d3942a1c

17 months agocompositor: Handle output destruction deferral 02/28202/1
Marius Vlad [Fri, 25 Nov 2022 20:18:10 +0000 (22:18 +0200)]
compositor: Handle output destruction deferral

weston_head_detach() already handles the disable of the output if it's
the last one.

See also: https://gitlab.freedesktop.org/wayland/weston/-/issues/697

Bug-AGL: SPEC-4625
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I542b14905b7b6aa220142d0d2dd5cec922c4fc33

17 months agolayout: Allow background surface roles (to) be activated 63/28163/2
Marius Vlad [Mon, 14 Nov 2022 14:28:28 +0000 (16:28 +0200)]
layout: Allow background surface roles (to) be activated

While nothing technically prevents the background surface role to
be activated, it turns out we don't actually track it so we a) couldn't
find it, and b) we attempted to resize it to an incorrect dimension.

Another small follow-up commit from 'Add manual activation area
configuration option' and with with commit 'agl-shell: Add support for
defining an activation area', which introduced the ability to designate
a certain area as the activation area.

v2: Keep the background surface always mapped

We now have more than one active surfaces at the same time, so we can't
unmap it as it needs to be always displayed.

Bug-AGL: SPEC-4594
Reported-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2561ce2c4c1c96c796fb8ee1c8ca9a30772b71f9

18 months agoagl-shell: Add support for defining an activation area 02/28102/1
Marius Vlad [Tue, 1 Nov 2022 15:42:43 +0000 (17:42 +0200)]
agl-shell: Add support for defining an activation area

This introduces a new request, 'set_activate_region' that hints to the
compositor to use a defined rectangle area, rather than to infer it.

This is a follow-up from commit 924473ef016ba8dcfa863, 'Add manual
activation area configuration option' which brough in the same feature
but by using the ini configuration file.

Bug-AGL: SPEC-4594
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: If9395268e68de6b0d01f04b90822e06603808299

18 months agoAdd manual activation area configuration option 52/28052/2
Scott Murray [Tue, 11 Oct 2022 20:46:26 +0000 (16:46 -0400)]
Add manual activation area configuration option

Add a per-output "activation-area" configuration option that can be
used to define the activation area for applications that are not
using panels.

Notes:
- A new surface is not created for the given activation area, so
  apps that are not opaque will show the background.  After some
  thought, this seems like acceptable behavior, but it is possible
  that I am missing something.
- At present setting the activation area explicitly disables use of
  any panels, this may not need to be the case and some discussion
  with the AGL community with respect to requirements is likely
  needed.
- It is likely that this feature should be done via a agl-shell
  protocol call instead of via configuration, but doing so will
  require some thought as to the interaction with panels and how
  configuration errors would be communicated back to a client.

Bug-AGL: SPEC-4588

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I6cdae659f5f7636dc94121a69666b905abda3be3

19 months agocompositor: Use sigaction to trap SIGINT 24/28024/1
Marius Vlad [Wed, 21 Sep 2022 14:29:39 +0000 (17:29 +0300)]
compositor: Use sigaction to trap SIGINT

signalfd interacts badly with gdb's signal trapping - when hitting
ctrl-c in a debugger attached to weston, weston will receive the
signal. This results in weston exiting cleanly when the intent
was to use gdb to interfere with its operation.

Trapping SIGINT was introduced in commit 50dc6989 which ensured we
would call wl_display_terminate() on SIGINT or SIGTERM to clean
up our socket.

Killing weston with SIGINT is quite common for several developers,
so it's important to preserve this clean shutdown behaviour, so
we can't naively stop trapping SIGINT entirely.

Instead, use the sigaction() function to trap SIGINT, and have
the SIGINT handler send weston SIGUSR2 (SIGUSR1 is already
used by xwayland). SIGUSR2 can be trapped in the proper wayland
way via wl_event_loop_add_signal(). This way we can properly
break our event loop and clean up on SIGINT, but we can also
have gdb intercept SIGINT.

There are other ways around this, but I'm hoping this one allows
people to continue using ctrl-c to stop weston, and doesn't
require additional project specific gdb knowledge.

Bug-AGL: SPEC-4570

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I42fc186296856861c8b6aee54a302c7c0574a88d

19 months agocompositor: Add missing SIGCHLD handler 23/28023/1
Marius Vlad [Tue, 20 Sep 2022 11:34:31 +0000 (14:34 +0300)]
compositor: Add missing SIGCHLD handler

We seem to be missing a SIGCHLD signal handlers so this patch
adds one similarity to what weston has.

Bug-AGL: SPEC-4570

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I137af4199c3d543fed940bbe289989095b114b74

19 months agocompositor: Stop trapping SIGQUIT 22/28022/1
Marius Vlad [Tue, 20 Sep 2022 08:45:09 +0000 (11:45 +0300)]
compositor: Stop trapping SIGQUIT

We've been trapping SIGQUIT for a "clean shutdown" since commit 3cad436a

However, sources such as:
http://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html

indicate we probably shouldn't be trapping it at all, as the intent of
SIGQUIT is to leave a core file and debug artifacts from the run.

We should perform the minimal amount of clean up to ensure the system isn't
left in an unusable state - but these days that's performed by other
software such as logind.

We can safely stop trapping SIGQUIT entirely.

(Based on work from https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/817)

Bug-AGL: SPEC-4570

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Icf7d4f3e76a58e781bad911a966b65e2798266d0

19 months agoshell: Rewrite client_exec as client_launch 21/28021/1
Marius Vlad [Tue, 20 Sep 2022 07:10:01 +0000 (10:10 +0300)]
shell: Rewrite client_exec as client_launch

This patch is a major rewrite of the client_exec which fixes a couple of
issues found by upstream.

Specifically this address the following two issues:

- Do not weston_log() after fork()
- Own the session for the launched client

These two issues were integrated into this single patch.

It makes use of previously added wrappers to handle custom environment
being passed to the (shell) client being executed.

(Based on the work from https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/954
and from https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/817)

Bug-AGL: SPEC-4509

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I29d4bcacba3671f67bb915bdb55a80b556e143ac

19 months agoprocess-util: Move Xwayland fork helpers to shared 20/28020/1
Marius Vlad [Mon, 19 Sep 2022 19:57:13 +0000 (22:57 +0300)]
process-util: Move Xwayland fork helpers to shared

We'll want to reuse these inside desktop-shell as well as the Weston
frontend.

(Based on the work from
 https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/954)

Bug-AGL: SPEC-4510

Signed-off-by: Daniel Stone <daniel.stone@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ife13dce545928cf53e4f49a657b756ed88ee742f

19 months agoshared: add str_printf() 26/28026/1
Marius Vlad [Mon, 19 Sep 2022 19:56:43 +0000 (22:56 +0300)]
shared: add str_printf()

asprintf() has the problem that it leaves *strp undefined when it
fails. Here is a simple wrapper that ensures NULL if asprintf() fails,
which is much more convenient to use.

This will be useful in future patches, where one needs to return error
messages from maybe failing functions, and more.

Bug-AGL: SPEC-4510

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2e689551797da525d110a51b02fd608c9e07c567

19 months agoshared: introduce os_fd_clear_cloexec() 25/28025/1
Marius Vlad [Mon, 19 Sep 2022 19:56:12 +0000 (22:56 +0300)]
shared: introduce os_fd_clear_cloexec()

This function will be used between fork() and exec() to remove the
close-on-exec flag. The first user will be compositor/xwayland.c.

Bug-AGL: SPEC-4510

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ib2245394654651583f9d59785540962ae4cb8a28

19 months agodesktop: Do not attempt to send terminate event 15/28015/1
Marius Vlad [Wed, 21 Sep 2022 16:44:52 +0000 (19:44 +0300)]
desktop: Do not attempt to send terminate event

For cases where the shell client itself is stopped/terminated
or the compositor is taken down, and implicitly with it, the shell
client we won't really have a reasource available.  Use the shell_ready
flag to verify that.

Fixes: 0512e7251611e7040c55

Bug-AGL: SPEC-4528
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I78b4fb39a76402535e642dda9cf284b57856376d

19 months agoprotocol/agl-shell.xml: Add an app_state event -- app state notification 67/27967/2
Marius Vlad [Thu, 1 Sep 2022 12:19:59 +0000 (15:19 +0300)]
protocol/agl-shell.xml: Add an app_state event -- app state notification

This protocol bump will notify the client binding to the agl-shell protocol
when a particular application changed its state.

This includes four (4) different events:

- started
- terminated
- activated
- deactivated

This should allow orchestrating start-up with activation as we don't
really know when it would be the proper time to activate an application
when starting up (for the first time). A started event will notify the
shell client we it can do that. These events are not sticky such that
the shell would be responsabile for keep  track of the state, if it
wants to.

Bug-AGL: SPEC-4528
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id162874fa68946bb9b1db9fa356dd617a0db9eb7

19 months agolayout: Handle dynamic application/surface movement between outputs 54/27954/3
Marius Vlad [Fri, 26 Aug 2022 19:59:09 +0000 (22:59 +0300)]
layout: Handle dynamic application/surface movement between outputs

This patch takes care of dynamically moving applications from
one output to another, by tracking the output which was used activation
finalisation. It also logs when we detect that we keep having the same
surface active on the output.

Bug-AGL: SPEC-4516
Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic4ce7d56fa360f2bddc087a1af83fc32728cc95d

19 months agoshell: Remove the black curtain installed on outputs 53/27953/3
Marius Vlad [Thu, 25 Aug 2022 16:04:29 +0000 (19:04 +0300)]
shell: Remove the black curtain installed on outputs

Upon completion of activation we might have an output without
a background surface set-up on that particular output, so this patch
either uses the black curtain as a background surface (useful for
transparent applications, which need it) or we remove it entirely in case
the shell client has one installed.

The patch renames the black_surface to black_curtain to better reflect
its name. Also output filtering would need renaming
(desktop_surface_check_last_surfaces)

Bug-AGL: SPEC-4516
Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I6071b07664772d891a4d8c33a7603573ec2069fa

19 months agolayout: Detect when an application should be migrated to other outputs 52/27952/3
Marius Vlad [Thu, 25 Aug 2022 14:42:34 +0000 (17:42 +0300)]
layout: Detect when an application should be migrated to other outputs

This patch adds a way to determine when to move out/migrate the window to another
output, different than one set previously, or where it was initially added.

This patch only adds support for resizing with a later patch touch the
final activation part.

Uses new output variable to track it the outputs. We send new dimensions
of the output if they do not match the previous/older recorded one.

Bug-AGL: SPEC-4516
Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ic5b6b9c1676543fa5ff1524f58e014ad8abb632b

19 months agodesktop: Avoid sending the dimensions for the first output 05/27905/4
Marius Vlad [Mon, 15 Aug 2022 16:45:53 +0000 (19:45 +0300)]
desktop: Avoid sending the dimensions for the first output

Rather than sending the first available output we have in the system,
use explicitly the output that we specified in the configuration for
that particular appid. If we didn't do that, we would first send the
dimension for the first output, after which we send the dimensions for
the correct output, resulting in a few configure exchanges between the
client and the compositor.

This fixes that by using the correct output from the beginning.

Bug-AGL: SPEC-4520
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: If796f1ce8ba069d4fd2c73a7bdfd42e94c9e0418

19 months agolayout: State explicity the output 04/27904/3
Marius Vlad [Mon, 15 Aug 2022 14:19:56 +0000 (17:19 +0300)]
layout: State explicity the output

No functional changes, just print out in the logs what output is being
explicitly used.

Bug-AGL: SPEC-4520
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I39d3645f287e16c99ded6f0246a6f0d8929fa6eb

19 months agolayout: Use view's mapping once we placed the view in the hidden layer 03/27903/3
Marius Vlad [Mon, 15 Aug 2022 13:01:52 +0000 (16:01 +0300)]
layout: Use view's mapping once we placed the view in the hidden layer

This avoids re-sending the dimensions until the client acks the new
dimensions. It avoids some innocuous logging.

Bug-AGL: SPEC-4520
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Icc8d7a2d8effc09ffe9dc5bee9b586f752e2bfcd

19 months agodesktop: Install a black background for REMOTE roles 01/27901/5
Marius Vlad [Fri, 12 Aug 2022 14:38:04 +0000 (17:38 +0300)]
desktop: Install a black background for REMOTE roles

A while back we added the ability to install a black curtain if there no
applications running. This way it provides a visual cue and it signifies
that the applications is no longer running.

While the idea was to install a remote black background for the REMOTE
role, it turns out this would only happened if we were using the Waltham
output type, which is excluding the REMOTE role. Adds an explicit check
for Waltham to still allow for cases where just the REMOTE role is used.

Bug-AGL: SPEC-4520
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I42951faa7cfb6932fa0e42e75f79245a82181f06

19 months agodesktop: Include REMOTE role in initial configuration 00/27900/4
Marius Vlad [Fri, 12 Aug 2022 14:20:01 +0000 (17:20 +0300)]
desktop: Include REMOTE role in initial configuration

The REMOTE role is identical to the DESKTOP one (its merely a tag), so it
should go in the same category.

Fixes 13ac8bab43fffd00.

Bug-AGL: SPEC-4520
Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iddf7b5ba644cb7317c5f5ac6645c0f149ab1d05d

20 months agoagl-shell: Add bound_ok and bound_fail events and a default destructor 59/27859/4
Marius Vlad [Wed, 3 Aug 2022 13:14:17 +0000 (16:14 +0300)]
agl-shell: Add bound_ok and bound_fail events and a default destructor

As we're increasing the amount of combinations we could have in the AGL
platforms, in which we're mixing various platforms, we require a way
to tell clients that there's already a shell client which in charge.

We can't really have multiple shell clients managing the windows and
surfaces, but in the same time we don't want to sever the wayland
connection the way it happens currently. Racy alternatives might exist,
which  avoid advertising the interface altogether once a
client did bind to the interface but that's not really a
viable solution.

So instead of doing that, this patch introduces two new events which
tells the client that it was either successful, and it can continue
issue requests and receive events or a that it the bind failed. The
client can chose to wait and try later and abandon to bind to the
agl_shell intefface, and behave like a regular client.

While doing an update to protocol to add those two events this patch add
also a default destructor for the protocol.

Bug-AGL: SPEC-4502
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iacb86a668d1c4630724eecdb18e4b4c2d4e8e34a

21 months agoFix typo in README 77/27777/1 13.93.0 needlefish/13.93.0 needlefish_13.93.0
chintsung [Mon, 18 Jul 2022 03:38:50 +0000 (11:38 +0800)]
Fix typo in README

- Fix brackets of link

Signed-off-by: chintsung <chichon.tw@gmail.com>
Change-Id: I1f96362bf02919b5bffea9977883f58dd2fa66ac

22 months agolayout: Add a wrapper for adding the view to the hidden layer 84/27684/2
Marius Vlad [Tue, 21 Jun 2022 11:13:56 +0000 (14:13 +0300)]
layout: Add a wrapper for adding the view to the hidden layer

And with it, use it *as well* when detecting a surface shouldn't be
presented if activate-by-default is disabled. The reason for doing that
is to allow application the resize and receive frame events right after
the client shell has been started.

Doing it a later point it time, right when a potential activation could
come from a client, wouldn't really be useful as the client won't react
to configure events. This particular fix is for cases where the
activate by default is disabled and the application itself was added
*before* the client shell sent the ready request.

Bug-AGL: SPEC-4423
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Change-Id: I5b08d2ff65fca28126608c2677ec9b558a34caa1

22 months agoshell: Fix a typo when adding surface to pending list 81/27681/1
Marius Vlad [Mon, 20 Jun 2022 13:16:13 +0000 (16:16 +0300)]
shell: Fix a typo when adding surface to pending list

As both names are similar this was probably a typo, and instead of using
the iterator for the list we should use the item itself. This was pretty
hard to track as initially everything was set-up alright.

We were still getting empty lists of pending remote surfaces, when I
observed that we were using the iterator rather than the new item we
just create in that function.

Bug-AGL: SPEC-4445
Reported-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I77c4c6721eb4a4e3e8e66faa4fa0584b136d322e

22 months agocompositor: Allow passing continue-without-input 89/27589/2
Marius Vlad [Wed, 1 Jun 2022 09:12:49 +0000 (12:12 +0300)]
compositor: Allow passing continue-without-input

We can specify over cmd line if we don't have any input devices.
Found while investigating xdg-shell and keyboard activation.

Bug-AGL: SPEC-4415
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I54be16e38922c5216f8075074bd1d47468ec07a3

22 months agoshell: Make sure that app_id is valid before checking it 73/27573/2
Marius Vlad [Mon, 30 May 2022 18:36:30 +0000 (21:36 +0300)]
shell: Make sure that app_id is valid before checking it

Bug-AGL: SPEC-4412
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I427c2920315b223432f273d08a69a069d66310c9

22 months agolayout: Keep track of popup state to handle activation 72/27572/2
Marius Vlad [Mon, 30 May 2022 17:17:36 +0000 (20:17 +0300)]
layout: Keep track of popup state to handle activation

Upon deactivation explicitly mark the surface as unmapped, and keep
track of the state using the enum already added for that.

Further more, at remap, we need to perform a transform update, so this
adds that as well.

Together with these changes, we now can activate/hide the pop-up window
correctly.

Bug-AGL: SPEC-4412
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I4dda48dbda265d19df9c7fb4a25773afa8245cf3

22 months agocompositor: Perform activation from keybindings 95/27595/2
Marius Vlad [Wed, 1 Jun 2022 12:48:53 +0000 (15:48 +0300)]
compositor: Perform activation from keybindings

Now that we have common function that peforms surface activation
(xdg-shell and input one) use it for touch and keyboard.

Bug-AGL: SPEC-4413
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I325e33da4c48f2741a7bb8f5ac706f838f9dabc4

22 months agocompositor: Pass flags when adding keybindgs 94/27594/2
Marius Vlad [Wed, 1 Jun 2022 12:18:06 +0000 (15:18 +0300)]
compositor: Pass flags when adding keybindgs

Although we don't really use these flags make it so we
deliever them to libweston.

Bug-AGL: SPEC-4413
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Idbbf2278c5fcaf75a8ef2f89499f7815d4a9e88f

22 months agolayout: Add a way common way activate views 93/27593/2
Marius Vlad [Tue, 31 May 2022 12:40:43 +0000 (15:40 +0300)]
layout: Add a way common way activate views

We install a common function which is being used to de-couple
keyboard presence from input and xdg-shell activation. We also
also use it at surface removal/destruction.

Bug-AGL: SPEC-4413
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2686e5a4aab3e95fbeaa4100faa2dc0051881f24

22 months agoshell: Extract some common functions 92/27592/2
Marius Vlad [Tue, 31 May 2022 11:44:49 +0000 (14:44 +0300)]
shell: Extract some common functions

For instance this exports retreiving a ivi_seat from weston_seat, and
they are useful in other parts as well.

Bug-AGL: SPEC-4413
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I838823570792761dfb5ac4beea635e843dd5cd22

22 months agoinput: Migrate ivi_seat to ivi_compositor header 91/27591/2
Marius Vlad [Sat, 19 Feb 2022 19:52:00 +0000 (21:52 +0200)]
input: Migrate ivi_seat to ivi_compositor header

We might need to retrieve the seat in from different places to make it
available.

Bug-AGL: SPEC-4413

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I76343fe6039ae088356ddc33364e917d67dd414b

22 months agoinput: Remove keyboard listener keyboard focus activation 90/27590/2
Marius Vlad [Sat, 19 Feb 2022 19:45:59 +0000 (21:45 +0200)]
input: Remove keyboard listener keyboard focus activation

This is part of the bigger series to remove the need to have a keyboard
present to activate views/surfaces. This clean-ups any keyboard
listener we had installed previously.

Bug-AGL: SPEC-4413

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Iacd63a857cfe4d17c665f37dc8338cd790b7d16f

23 months agocompositor: Properly dispose of fullscreen views at shutdown 96/27596/1
Marius Vlad [Fri, 3 Jun 2022 08:56:29 +0000 (11:56 +0300)]
compositor: Properly dispose of fullscreen views at shutdown

While we can have multiple outputs, each with its own fullscreen view,
we have a layer-per-output hence we can't really call layer_fini()
in the output destruction as that what would result in an invalid
link access.

Handle those views destruction and with it, the fullscreen layer fini,
in the finalize bit where all others are handled as well.

This fixes a crash at shutdown, which could be seen when using multiple
outputs, and probably quite problematic when handling a restart.

Fixes: 43bdf9a42bac33df174d6ac7ff1ab2e15441c7b5

Bug-AGL: SPEC-4420
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I773890a24ad8ca2556c1d4ddda7f37ebae02c9de

2 years agoshell: Do not set none role for applications w/o appid 43/27443/1
Marius Vlad [Wed, 4 May 2022 08:12:54 +0000 (11:12 +0300)]
shell: Do not set none role for applications w/o appid

With commit 'layout: Send dimensions when setting up property as
fullscreen' we made so that fullscreen applications will receive the
configure event right from the beginning but that changed a bit the way
we handled applications that do not set-up an appid before doing the
initial wl_surface.commit.

Avoid doing that such that applications do not need to go through a
resize.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I91a9ab97ff5e30d3a86cda499d394c1a9fcde338

2 years agoshell: Let the output destroy handler handle layer fini 42/27442/1
Marius Vlad [Wed, 4 May 2022 06:54:20 +0000 (09:54 +0300)]
shell: Let the output destroy handler handle layer fini

This way we don't race with it. Part of 'shell: Added missing layer fini
calls'.

Bug-AGL: SPEC-4351
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I366364ba128ca1dacd3d3639a1b74b02f3ceef21

2 years agodesktop: Document the repaint schedule 41/27441/1
Marius Vlad [Wed, 4 May 2022 08:21:42 +0000 (11:21 +0300)]
desktop: Document the repaint schedule

Add some further comment why we could still potential need it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I510cd60d5feeccf7d8b9b34fb73e0e272fac5c6a

2 years agoRevert "desktop: No need to schedule a compositor repaint" 40/27440/1
Marius Vlad [Wed, 4 May 2022 07:27:21 +0000 (10:27 +0300)]
Revert "desktop: No need to schedule a compositor repaint"

This reverts commit 8f85581e96bc71512cbef015ff12dc6441c07d9c.

I incorrectly assumed that we don't need to schedule a repaint, but
applications that do not set-up an appid would still need to go through
a resize and we need to continue to allow doing that.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I3702fa0a9c29290746250992d8921f777daa9fbf