Commit Graph

228 Commits

Author SHA1 Message Date
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