Commit Graph

323 Commits

Author SHA1 Message Date
Derek Foreman
f7ddaa142a libweston: Replace weston_output_damage() with a flag
In the future we'd like to have multiple overlapping outputs.

weston_output_damage() currently adds damage to the output's coordinates
on the primary plane. This plane is shared between all outputs, so it
would result in damaging more than the intended output.

Eventually, plane damage will go away and be replaced by paint node damage,
and damaging the entire output would involve adding damage to a list of
paint nodes.

Instead, use a flag to indicate the output must be fully redrawn, and add
the damage during the repaint loop.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Daniel Stone
fc776c3b59 view: Add weston_view_add_transform and weston_view_remove_transform
They do what they say on the box, and inflict damage where required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
7d2c5e0c33 view: Add weston_view_set_alpha()
Does what it says on the box: sets the view's alpha, also inflicting
damage where required.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
bf228370ff view: Add view_list_needs_rebuild member
Most of the time when we're changing things about views, we don't need
to throw away the view list and rebuild it from scratch. The only times
when we need to do this are when views have been added to or removed
from the scene graph, or have been restacked within it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
c859dd1b9e surface: Only rebuild subsurface lists when necessary
There's no need to go through and rebuild the subsurface list every
time. In addition to being unnecessary work, it complicates things like
damage tracking.

Track a new surface dirty status indicating that the subsurface tree has
changed in some way, and only rebuild subsurface stacking when this has
occurred.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
0f99e081c4 surface: Add input-region dirty flag
Used when the input region changes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
3bba90764e surface: Add buffer-params dirty flag
This indicates that more than just the content changing, the form of the
buffer has changed in a way which may not be like-for-like to the
previous buffer but require significant reinterpretation. Examples
include the format, opacity, colour state, etc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
d8669679c4 surface: Add position dirty member
This is used when a surface is repositioned via offsets.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
3c1e2e5c32 surface: Add comments to weston_surface_status member
Explain what each member implies.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
6526346b72 surface: Replace viewport.changed with weston_surface_status
Instead of having an individual bool, reuse the surface state's dirty
status for viewport changes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
8255274a92 surface: Replace newly_attached with weston_surface_status
Instead of having a bool for whether or not a buffer has been attached
in this commit cycle, use a status bitmask.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-07-04 15:52:21 +01:00
Daniel Stone
7e1d446279 libweston: Add weston_view::map_signal
It fires when a view is mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone
07103d1842 weston-desktop: Match desktop-shell view mapping semantics
Preserve the same order as desktop-shell for handling view (un)mapping,
so we can move these into a shared helper. These should have no
functional effect but provide a helpful bisect point.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone
2f2e20f3a3 weston_surface: Add map and unmap signals
These signals are emitted when the surface becomes mapped or unmapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone
8532c28761 surface: Start tracking weston_surface_status
Akin to the paint_node_status we already have, start also tracking a
surface dirty status. This will allow us to minimise the updates we need
to make.

Currently this is only collected, with no functional change made.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone
f6d81e42d4 surface: Convert a couple of ints to bools
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-21 08:02:59 +00:00
Daniel Stone
579019a78d libweston: Add weston_compositor.shutting_down
It does what it says on the box: is true when the compositor is in the
process of shutting down.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone
104676ec1f xwayland: Remove process exit status from libweston API
This shouldn't be relevant to the core.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone
e64232a808 xwayland: Only pass Xwayland wl_client to libweston
Remove all handling of process/PID internals from libweston's Xwayland
launcher, and keep this only in the frontend. libweston now only sees
the wl_client and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Derek Foreman
2ac566d281 libweston: Add more weston_coord arithmetic helpers
Until now we've only had the unadorned arithmetic functions, but they're
easy to abuse and tedious to use.

For now, we just add weston_coord_global_add/sub functions and use them
where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
d961e59d4a libweston: Add getters for view position/offset
This is stored as an unadorned weston_coord internally, but with getter
functions we can put together the appropriate global or surface
coordinate.

Use them where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
1f81c082b5 libweston: Add weston_coord_truncate()
Truncating a weston coord to integer values is something we do
frequently enough to warrant a helper function.

Use this in the kiosk and desktop shells where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
0bf2d82e0c libweston: Use weston_coord in struct weston_touch
Convert the grab coordinate to a weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:58:17 -05:00
Derek Foreman
e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman
244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Marius Vlad
4bc7bd73d7 libweston/weston-log: Add a iterator helper for debug scope
This adds three new helpers: one to iterate over all debug scopes
created/added and other two are for simpler getters for the scope name
and the description.

Included with this change is also a simple test to retrieve them.

This is an alternative to using the debug scope list advertised when
using the weston-debug private extension. libweston users can use this
directly to know which scopes they can subscribe to, and there's no need
to have a client implementation for the weston-debug protocol.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-30 11:05:14 +00:00
Sergio Gómez
4aafd872d0 libweston: Introduce WESTON_ACTIVATE_FLAG_FULLSCREEN in weston_activate_flag
This will be used to let know the constraints code that the reason for
activation is that the client has requested to set the surface to fullscreen.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-05-25 12:07:03 +03:00
Sergio Gómez
ed012ee505 libweston: Store view instead of surface, and add flags, to activation data
Since we want to pass the view to the surface activation listener inside the
constraints code, and the surface is reachable from the view anyway.

The flags field will let us pass the reason for activation to the constraints
code, which will then handle especially the fullscreen case.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-05-25 12:07:03 +03:00
Philipp Zabel
dfa821d4c0 backend-pipewire: pass backend to weston_pipewire_output_api::create_head()
Pass the backend instead of the compositor to the PipeWire output API
create_head() method and increment the API version.

That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-19 13:36:45 +00:00
Philipp Zabel
ebc3a22b09 backend-pipewire: add PipeWire backend
Add a separate PipeWire backend based on the PipeWire plugin. The backend
requires PipeWire 0.3.x.

The PipeWire backend can be used as a standalone-backend backend for streaming
and composing Wayland clients to PipeWire.

The backend supports the on-demand creation of heads via the
weston_pipewire_output_api_v1. It also supports per-output pixel format
configuration via a gbm-format option.

Multiple PipeWire outputs can be created by setting the num-outputs option in
the [pipewire] section.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-04-18 10:48:50 +00:00
Philipp Zabel
7d2112c713 libweston: pass backend to weston_windowed_output_api::create_head()
Pass the backend instead of the compositor to the windowed output API
create_head() method and increment the API version.

That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-17 09:38:50 +02:00
Daniel Stone
6f9c27ac07 input: Consistently use enums for modifier/axis/state
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-03 20:58:06 +03:00
Michael Olbrich
9eab270de5 tablet: Add binding to activate surfaces using the tablet tool
Based on patches from:
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>
Bastian Farkas <bfarkas@de.adit-jv.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul
6a06669b58 clients: Add support for tablet cursor motion to window frames in libtoytoolkit
When it comes to a window frame, a tablet tool and cursor act almost
identical; they click things, drag things, etc. The tool type and extra
axes don't serve any use in the context of a window frame, so tablet
pointers share the frame_pointer structures used for the mouse pointer.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich
818c1c275c libweston: handle tablet cursors in the compositor
The tablet is given a separate cursor. Most tablet interaction is an absolute
interaction and shouldn't need a cursor at all, but usually the cursor is used
to indicate the type of virtual tool currently assigned.

Based on patches from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>
Bastian Farkas <bfarkas@de.adit-jv.com>
Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich
ce99b181a3 libinput: hook up tablet events
Based on a patches from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich
578922797b input: add weston grab interfaces for tablet tools
Based on a patch from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich
d24af43233 input: add tablet focus handling
Closely modelled after the pointer focus handling

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>

Based on a patch from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich
03596a9d06 libweston: Add initial tablet support to weston
Introduces three new structs, weston_tablet and weston_tablet_tool for the
respective devices, with the respective information as it's used on the protocol.
And weston_tablet_tool_id to track the tools of a tablet.

Note that tools are independent of tablets, many tools can be used across
multiple tablets.

The nesting on the protocol level requires a global tablet manager, a tablet
seat nested into weston_seat. The list of tablets and tools are also part of
the weston_seat.

Most functions are stubs except for the actual tablet and tablet tool
creation and removal.

This is based on patches from Peter Hutterer <peter.hutterer@who-t.net> and
Bastian Farkas <bfarkas@de.adit-jv.com>.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Jonas Ådahl
cc3d30c28b shell: Keep window 'activated' state if child has focus
Popups should have keyboard focus when active, but the toplevel window
should still appear "active". Make sure this is the case by changing the
"active" tracking to see whether any child surface has keyboard focus.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Daniel Stone
28b3529ca8 Revert "input: Consistently use enums for modifier/axis/state"
This reverts commit 9248340db0.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 18:00:05 +01:00
Daniel Stone
9248340db0 input: Consistently use enums for modifier/axis/state
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 17:49:17 +01:00
Marius Vlad
1e867c189f libweston: Skip views without a parent
This prevents to trigger an assert within
weston_view_set_rel_position(), introduced with commit 'libweston: Split
weston_view_set_position() into rel and abs variants', which is hit when
a subsurface attempts to commit without having a parent surface set.

Fixes: #730

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Colin Kinloch <collin.kinloch@collabora.com>
2023-03-30 14:59:52 +00:00
Sergio Gómez
e3079393c4 libweston: Add view unmap listener to pointer constraints
Since the logic of pointer constraints assumes a valid view throughout, add a
signal to disable constraints when its current view is unmapped by Weston.

The assumption that a previously unmapped view is valid already leads to the
constraints code crashing. This can happen when attaching a NULL buffer to the
surface and commiting, which effectively unmaps the view with the side effect of
clearing the surface's input region, which is then assumed valid inside
maybe_warp_confined_pointer().

Fixes: #721

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-13 15:16:17 -05:00
Sergio Gómez
64da736d37 libweston/input: Remove redundant surface destroy listener in constraints
Currently, the surface destroy listener in pointer constraints is redundant,
since surface destruction already handles pointer constraints destruction (see
libweston/compositor.c:weston_surface_unref()).

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-13 15:16:17 -05:00
Derek Foreman
ff00ae4218 compositor: Rename position.set to position.changed
This is a flag used to track whether the position has changed, not
whether the position is set.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-03-07 14:45:48 -06:00
Michael Tretter
3c6cfe6bf4 backend-drm: add additional-devices to support multi GPU
Add the --additional-devices parameter to Weston to add secondary drm devices
that will only be used as outputs, but not for rendering.

We can only fail the repaint for the entire backend, but not for single
devices. Thus, if one of the devices fail, we have to fail the repaint for the
entire backend.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Derek Foreman
aef2da675b libweston: Convert weston_output_move to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman
59a0bd99bd libweston: Use weston_coord in surface committed handler
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman
5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman
989cdcb86e libweston: Convert struct weston_subsurface to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Rajendraprasad K J
342243e8b9 libweston: Add support to force an output power state to off
In IVI, there are several displays connected to a SoC. These displays
are just driven by differential pairs (LVDS, FPD-Link, GMSL) and powered
centrally. To reduce power comsumption when user inactivity timeout
happended on the display, there is a need to cut down pixel clock from
SoC. Then, if any input events happend on the display, it should become
active again.

Currently, controlling the compositor outputs doesn't happen independently
but rather globally, and outputs repaints are based on the compositor state

This is necessary to have an API that can force the power state of an
output to off via DPMS mode while all other compositor outputs remain
unaffected.

Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-02-23 11:44:30 +00:00
Derek Foreman
583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman
3bb09ea3cb input: Use weston_coord for weston_touch functions
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman
f7e936ae2a input: Convert weston_pointer_motion_to_abs() to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman
c3cd8306c9 libweston: Pass weston_coords to weston_compositor_pick_view
Continuing to convert things to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman
69908000e3 input: Convert weston_pointer_motion_event to weston_coord
This struct has a lot of members that can be converted to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Tran Ba Khang(MS/EMC31-XC)
7ba87d7062 libweston: support API to detect an unmapping commit of surface
Add the weston_surface_is_unmapping() api, this will help the shell
to detect the commit of a surface is unmapping or not.

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:03:10 +02:00
Derek Foreman
974a707add libweston: Add support for tearing-control
Add core support for tearing control.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
ac04199db1 libweston: Remove old coordinate conversion functions
We don't need these anymore, as all users have been moved to the
weston_coord equivalents.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
e1b4ad7d0b matrix: Introduce weston_coord
All through weston we have code that passes int x, y or
float x, y or wl_fixed_t x, y pairs. These pairs are frequently
converted to/from wl_fixed_t and other types.

We also have struct vec2d and struct weston_geometry which also
contain coordinate pairs.

Let's create a family of coordinate vector structures for coordinate
pairs and use it anywhere we sensibly can.

This has a few benefits - it helps remove intermediate conversion
between fixed/float/int types. It lets us roll the homogenous
coordinate normalization bits into helper functions instead of
needing them open coded throughout the source.

Possibly most importantly, it also allows us to do some compile time
validation of what coordinate space we're working in.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
fe4d5711bf libweston: Split weston_view_set_position() into rel and abs variants
One variant is used when a view is being positioned relative to a parent,
the other is when the view is being given an absolute position in the
global space.

This will help later when surface and global coordinates are different
data types, but for now the two functions do essentially the same thing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
31b3527418 libweston: Factor out transform matrix setup code
We want to use this in other places too, instead of open coding it
multiple times.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:01:54 +00:00
Hideyuki Nagase
70b03b2928 rdp: Add preliminary rdp multihead support
This sets up monitor layout callbacks, and enables input event translation
between the RDP space and the weston desktop. The RDP backend now uses
a heads changed callback instead of the simple head configurator.

We only allow a single monitor for now, but in the future RAIL will make
use of multi-head.

As a side effect, scaling is now supported in RDP sessions.

It should be noted that due to differences between RDP and wayland
representation of their global coordinate spaces, mixing DPI leads to
RDP monitor layouts that can't properly be represented in weston.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2023-01-10 12:12:49 +00:00
Derek Foreman
0e71aff8ea libweston: Make weston_head_set_device_changed public
Some backends have special head specific state that doesn't fit into the
existing generic head setter functions, and is too specific to make more
functions for.

RDP's primary output flag is an example.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-10 12:12:49 +00:00
Daniel Stone
54356be853 backend-vnc: Add renderer parameter to backend config
Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
6a45ae871c backend-rdp: Add renderer parameter to backend config
Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
53a32e7888 backend-x11: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to
force Pixman on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
0a5bb7acff backend-wayland: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to
force Pixman on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
b846c26d97 backend-headless: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than two
mutually-exclusive booleans to not use the no-op renderer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
c683ebdea3 backend-drm: Use renderer enum type for config selection
When we're selecting our renderer, use the enum rather than a boolean to
force Pixman on.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
e1da6c6615 libweston: Add WESTON_RENDERER_AUTO type
Add an 'auto' or unspecified renderer type, so we can use enum
weston_renderer_type during the configuration stage, where the target
renderer may be unspecified or unknown.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Daniel Stone
ca4bdae05f libweston: Expose weston_renderer_type as ABI
Similar to the backend type, also expose the renderer type enum as ABI.
This makes it possible to implement a more consistent config API, as
opposed to every backend hand-rolling its own use-the-other-one bool.

The enums are explicitly numbered to avoid 0, so 0 can be used as a
'not-specified' sentinel value to allow backwards compatibility with the
old config interfaces.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-01-10 10:59:04 +02:00
Marius Vlad
6293ab1f90 libweston, shared: Move out weston_shell_get_binding_modifier
This doesn't really belong into shell-utils,  so better move it out to
shared/config-parser. Renamed to weston_config_get_binding_modifier
to maintain the same namespace.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Marius Vlad
58c3e263a0 shell-utils: Add missing macros and C++ compat/install header
Allow C++ access from within C code and add macros to avoid
multiple inclusion of the header. Also, install the header for other
users of libweston to actually make use of it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Marius Vlad
19d32da742 shell-utils: Integrate shell-utils into libweston
These shell utils functions are potentially useful to other shells as
well, so make them widely available.

Renamed all functions to weston_shell_utils namespace.

No functional change, copied ad litteram.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Philipp Zabel
746a03068e libweston, backends: store backend pointer in struct weston_head
Compositor code can use opaque pointer comparison to determine whether
a head belongs to a given backend. Store a backend pointer in struct
weston_head to enable the compositor to select the correct backend
specific output configuration code.

This also allows to use the backend pointer instead of the opaque
backend_id pointer to check whether a head belongs to a backend, so
replace the checks in all to_xyz_head() functions and drop backend_id.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-12 15:21:16 +01:00
Philipp Zabel
dfa845b1dd libweston: add missing struct weston_renderer forward declaration
struct weston_renderer is defined in libweston-internal.h, which is not
included from libweston.h. Add the missing forward declaration for the
renderer pointer stored in struct weston_compositor.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-12-09 17:04:01 +01:00
Pekka Paalanen
3746e163ab backend-headless: add option for output decorations
When the new option is enabled, headless backend will draw decorations
around its outputs. This makes the actual "framebuffer" larger by the
thickness of the decorations to keep the video mode area free for
clients.

This will be needed for a future test, that will ensure that GL-renderer
will paint the output decorations correctly.

The output title is deliberately NULL, because text rendering is
unpredictable and depends on e.g. what fonts are installed in the
system. Therefore screenshot testing of any text would be really
painful, so let's avoid that.

The decorations setup code is mostly copied from wayland-backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-12-02 13:36:25 +00:00
Pekka Paalanen
fdaf4cf320 libweston: deprecate weston_screenshooter_shoot()
Nothing in-tree uses this function, and its functionality has been
replaced with the weston-output-capture protocol extension which is
implemented in libweston core.

Users of this function should migrate to
weston_compositor_add_screenshot_authority() and replace custom
screenshooting protocols with weston-output-capture.xml installed by
libweston.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:12:32 +02:00
Pekka Paalanen
3700c78131 libweston: implement new screenshooting protocol base
This implements the basics of the new screenshooting protocol. The
actual pixel operations will be implemented separately in the renderers
and DRM-backend.

See the previous commit "protocol: new screenshooter protocol" for why.

If DRM-backend needs more from weston_capture_task when it implements
writeback screenshooting, it will be easy to add user_data or expose
weston_capture_task::link for the backend to use. Those were not added
yet because it is uncertain what is actually needed.

The DRM-backend no-damage optimization requires special handling here as
well. See also 7f1a113c89 .

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:00:52 +02:00
Derek Foreman
ca6f30d5de libweston: Fix comment
We now depend on the matrices in weston_view being correct even when the
transform isn't enabled.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-28 10:32:44 +00:00
Derek Foreman
92a9860e1d libweston: Add function to find the output transform of a matrix
When we build up a matrix from a series of operations, it's very useful
to know if the combined operations still result in something that matches
a wl_output_transform.

This adds a function to test if a matrix leads to a standard output
transform, and returns the transform if it does.

Tests are provided that check if complex series of operations return
expected results - the weston_matrix_needs_filtering function is tested
at the same time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-25 08:29:05 -06:00
Derek Foreman
0e2136df7b libweston: Add a function to test if transformed images need filters
If a transformation matrix causes a scale, a rotation not a multiple of 90
degrees or a non-integral translation then textures rendered with
it would benefit from bilinear filtering.

This test is done in a lazy fashion by examining elements of the matrix
to check for a simple pattern that indicates these conditions are met.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-25 08:25:53 -06:00
Philipp Zabel
1a027e63cb backend-vnc: enable TLS support
Add TLS key and certificate parameters to enable encryption support.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-11-23 11:04:19 +01:00
Marius Vlad
bf0c99f519 libweston/desktop, desktop-shell: Add getters for pending state
This introduces a few getters to retrieve the pending state from
libweston-desktop, now just libweston, and makes use of it,
specifically get_pending_maximized to avoid sending invalid
dimensions to the client in the particular use case
set_maximized/unset_fullscreen.

These pending state getters are useful to query/poke a not-applied
yet state, and could be useful where we don't have a buffer attached
where the client might be set-up as maximized, but internally libweston
hasn't yet applied that pending state.

Fixes #645

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-11-10 13:06:07 +02:00
Derek Foreman
771bd8acff libweston: Use weston_log_paced for unmapped surface or view warning
Copy the existing behaviour with the new paced logging mechanism.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-08 08:32:26 -06:00
Derek Foreman
6428fd13b7 pixman-renderer: Use paced logger for overdraw warning
Mimic the existing behaviour of logging once, but make it once
per output instead of per run.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-08 08:32:26 -06:00
Derek Foreman
a82cb25108 libweston: Use paced logger for presentation clock read failure
The current code only prints this once, and this is a probably a sensible
thing to do, as a clock read failure is probably not a condition that will
correct itself.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-08 08:32:26 -06:00
Derek Foreman
f9b57c5234 libweston: Use paced logger for bad repaint delays
Ideally we'd like to see this more than just a single time, but we'd also
like to prevent it from triggering endlessly. Let's also make this happen
per output.

While we're here, use the word "abnormal" instead of "insane"

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-08 08:32:26 -06:00
Derek Foreman
8e661b3c93 libweston: Add weston_log_paced()
We have a few places where we log messages only the first time they occur.
Provide a log throttling implementation so we don't have to open code this
in all the places that need it.

Instead of just logging a single time, allow some finer control. We allow
logging of a specified number of events. Additionally, we have an optional
timeout after which the event count is reset so we can log at most N
events in M ms.

The first new event printed after the timeout expires will also include a
count of suppressed events.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-08 08:32:26 -06:00
Emmanuel Gil Peyrot
1c5ce4c2cc DRM: Add support for HDMI content type
Some monitors expose a selector for the kind of content that will get
displayed, allowing them to optimise their settings for this particular
content type.

I got access to such a monitor, sadly even setting it to game mode
didn’t lower its atrocious latency, but drm_info[1] reports it to be set
correctly so hopefully it’ll work better with other monitors.

[1] https://github.com/ascent12/drm_info

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2022-11-03 15:40:00 +00:00
Derek Foreman
4d141a7881 libweston: Don't return coordinates from weston_compositor_pick_view
Sometimes callers don't want them, and sometimes (when view is NULL) the
coordinate is invalid.

Waste a tiny bit of time calculating them as needed in the callers
instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Derek Foreman
eed00f679e input: Don't pass surface coordinates to weston_pointer_set_focus
We're always passing pointer->x, y converted to surface coordinates, or
garbage if view is NULL. Let's just stop passing those coordinates
entirely and calculate them in the function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-02 10:25:15 +00:00
Stefan Agner
12f7665310 backend-vnc: add VNC support using Neat VNC library
This adds basic VNC protocol support using the Neat VNC library
(https://github.com/any1/neatvnc). Neat VNC depends on the AML main
loop library. The backend makes use of AML's integrated epoll backend
and connects AML via file descriptor with the Wayland event loop.

This implementation does not support authentication and hardcodes the
pixel format currently.

Co-authored-by: Philipp Zabel <p.zabel@pengutronix.de>
Co-authored-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Stefan Agner <stefan@agner.ch>
[r.czerwinski@pengutronix.de:
 - use new (as of 0.5.0) Neat VNC buffer API, with a buffer pool]
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
[p.zabel@pengutronix.de:
 - transform repaint damage to output coordinates
 - transform pointer coordinates into global space
 - check that outputs and heads are in fact ours, see aab722bb1785..060ef82d9360
 - track damage across multiple frame buffers
 - choose pixel format by drm_fourcc, see 8b6c3fe0ad
 - enable ctrl and alt modifiers
 - fix frame timing to achieve a constant repaint rate
 - pass initial size explicitly, see f4559b0760
 - use resize_output with pixman-renderer, see 55d08f9634e8..84b5d0eb4bee
 - allow configuring the refresh rate]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-10-18 07:31:42 +02:00
Michael Olbrich
5448580111 input: send touch frame event after up event
Currently the frame event gets lost: The touch focus is removed in the 'up'
event. So the focus is gone when the frame event arrives so it is never sent to
the clients.

To avoid this, keep the touch focus until the frame is handled.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-09-24 13:54:57 +02:00
Derek Foreman
bb8ef7d271 libweston: Refactor point in output test
This is arguably a little nicer without calling the pixman functions
directly.

In the future when we have different datatypes for coordinates in different
spaces, this test will only be valid on global coordinates, so this change
is also a precursor to stronger type validation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 12:08:34 +00:00
Derek Foreman
5c352b8f4f compositor: Remove output dirty bit
This was actually introduced as part of desktop zoom. We no longer have
use of it.

This makes a subtle functional change - the output's matrices will now be
up to date immediately in cases where previously that update could have
been deferred.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 12:04:00 +00:00
Derek Foreman
3a61976af7 matrix: Make matrix const in weston_matrix_transform
This function doesn't need to change the matrix, so we might as well
enforce that.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 12:00:59 +00:00
Marius Vlad
eaf2de3441 compositor: Use weston_load_module
Except the module dir path, they're one and the same. This change
warrants a libweston version bump, if it hasn't been done already.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:47:40 +00:00