platform/upstream/weston.git
5 years agoclients: fix len-string formatting
Pekka Paalanen [Mon, 23 Sep 2019 14:24:50 +0000 (17:24 +0300)]
clients: fix len-string formatting

All these have the printf format string wrong. "%*s" sets the field width but
does not limit the string to len bytes. You need to set precision instead to
limit to len bytes: "%.*s".

Found by grepping, after wondering why my WIP prints printed garbage at the
end.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-headless: make renderer type an enum
Pekka Paalanen [Thu, 12 Sep 2019 14:21:12 +0000 (17:21 +0300)]
backend-headless: make renderer type an enum

Helps adding one more type.

No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-headless: refactor into headless_output_disable_pixman
Pekka Paalanen [Thu, 12 Sep 2019 14:17:55 +0000 (17:17 +0300)]
backend-headless: refactor into headless_output_disable_pixman

Pure refactoring. Preparing for adding GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-headless: refactor into headless_output_enable_pixman
Pekka Paalanen [Thu, 12 Sep 2019 14:13:20 +0000 (17:13 +0300)]
backend-headless: refactor into headless_output_enable_pixman

Pure refactoring. Preparing for adding GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-headless: fix comment on use_pixman
Pekka Paalanen [Thu, 12 Sep 2019 13:43:11 +0000 (16:43 +0300)]
backend-headless: fix comment on use_pixman

The default is no-op, not GL. It doesn't even support GL.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agolibweston: Bring back 'weston_output_move'
sichem [Fri, 13 Sep 2019 08:57:31 +0000 (08:57 +0000)]
libweston: Bring back 'weston_output_move'

For supporting output layout, compositors need the ability to manually set the
'weston_output' by 'weston_output_move'.

Signed-off-by: sichem <sichem.zh@gmail.com>
5 years agobackend-drm: Check for HDCP Content Type property before setting
Ankit Nautiyal [Fri, 30 Aug 2019 14:10:46 +0000 (19:40 +0530)]
backend-drm: Check for HDCP Content Type property before setting

Currently, a check is missing for the case if the HDCP Content Type
property is requested, but is not supported by the driver.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agoman: Declare drm-backend support for HDCP
Ankit Nautiyal [Mon, 5 Aug 2019 08:20:37 +0000 (13:50 +0530)]
man: Declare drm-backend support for HDCP

Modify weston.ini man page to update that drm-backend supports HDCP.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Notify the client, when output recording is started/stopped
Ankit Nautiyal [Mon, 8 Jul 2019 09:42:19 +0000 (15:12 +0530)]
libweston: Notify the client, when output recording is started/stopped

In case of enforced protection mode, the renderer takes care of
censoring the protected content when the output recording is going on.
But in case of relaxed protection mode, the client must be notified to
avoid showing the protected content, if the output recording is on.

This patch handles the case, where the content-protection is enabled
with relaxed protection mode, and notifies the client, whenever the
recording is started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agogl-renderer: Censor protected views when output is recorded
Harish Krupo [Fri, 5 Jul 2019 14:11:38 +0000 (19:41 +0530)]
gl-renderer: Censor protected views when output is recorded

Contents on an ouput are captured when screenshooter/recorder/screen
sharing is enabled. In such cases the protected content must
be censored to ensure that it is not recorded along with unprotected
content. This is a required only when the surface protection is in
enforced mode.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Add function to schedule idle task for updating surface protection
Ankit Nautiyal [Mon, 8 Jul 2019 07:53:24 +0000 (13:23 +0530)]
libweston: Add function to schedule idle task for updating surface protection

Currently, the idle task for updating surface protection is scheduled
in case of change in the output mask of a surface or in case of change
in protection status of an output.
This patch adds a function for reusing the code to schedule the
idle-tasks, that can be called whenever there is a chance of a change
in the protection status of a surface.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Add functions to modify disable_planes counter for an output
Ankit Nautiyal [Mon, 8 Jul 2019 06:16:42 +0000 (11:46 +0530)]
libweston: Add functions to modify disable_planes counter for an output

The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agobackend-drm: Add support for content-protection
Ankit Nautiyal [Tue, 14 May 2019 13:06:08 +0000 (18:36 +0530)]
backend-drm: Add support for content-protection

Currently drm-layer supports HDCP1.4 using connector property:
Content Protection. This property if available for a platform, can be
read and set for requesting content-protection.
Also, the patch series [1] adds HDCP2.2 support in drm, and patch [2]
adds support to send udev events for change in connector properties,
made by the kernel.

This patch adds these HDCP connector properties in weston, and exposes
the content-protection support to the client for drm-backend.

It adds the enums to represent 'Content Protection' and 'Content Type'
connector properties exposed by drm layer. It adds a member
'protection' in drm_output_state, to store the desired protection
from the weston_output in the drm-backend output-repaint cycle. This
is then used to write the HDCP connector properties for the drm_heads
attached to the drm_output.

The kernel sends uevents to the user-space for any change made by it
in the "Content Protection" connector property. No event is sent in
case of change in the property made by the user-space.
It means, when there is a change of the property value from "DESIRED"
to "ENABLE" i.e. successful authentication by the kernel, a uevent
will be generated, but in case of userspace requesting for disabling
the protection by writing "UNDESIRED" into the property, no uevent
will be generated.

This patch also adds support for handling new udev events for HDCP
connector property changes. Any such change, triggers change in the
weston_head's current_protection.

[1] https://patchwork.freedesktop.org/series/57233/#rev7
[2] https://patchwork.freedesktop.org/patch/303903/?series=57233&rev=7

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agobuild: reopen master for regular development
Simon Ser [Fri, 23 Aug 2019 21:14:35 +0000 (00:14 +0300)]
build: reopen master for regular development

5 years agobuild: bump to version 7.0.0 for the official release
Simon Ser [Fri, 23 Aug 2019 20:58:15 +0000 (23:58 +0300)]
build: bump to version 7.0.0 for the official release

5 years agobackend-drm: Enforce content protection for hardware planes
Daniel Stone [Mon, 19 Aug 2019 15:53:40 +0000 (16:53 +0100)]
backend-drm: Enforce content protection for hardware planes

62626cbfec08 ensures that the GL render will not render a view's content
to the screen when the surface has requested a higher content-protection
level than the output currently offers.

When the HDCP MR was split into the core content-protection support in !83
and specific DRM support for HDCP in !48 (not yet landed), this opened a
hole where the DRM backend could promote a view to a hardware plane,
even if the output offered a lower protection level than the surface
wanted to enforce.

In the DRM backend, check the desired protection level, and refuse to
promote the view to a hardware plane if the output does not offer
sufficient protection. This will lead to presentation falling back to
the renderer, which may censor the content, reduce quality, etc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: 4b6e73d61767 ("libweston: Add support to set content-protection for a weston_surface")
5 years agoweston-terminal: Ignore SIGPIPE
Manuel Stoeckl [Mon, 19 Aug 2019 15:53:35 +0000 (11:53 -0400)]
weston-terminal: Ignore SIGPIPE

This ensures that the default signal action doesn't kill weston-terminal
when the terminal tries to paste into a pipe whose read end has already
been shut down. (For example, a pipe from a misconfigured program or from
one which crashes/exits before the terminal calls write().)

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
5 years agomake weston_binding_destroy public
sichem [Fri, 23 Aug 2019 11:47:44 +0000 (11:47 +0000)]
make weston_binding_destroy public

5 years agocompositor: Return the number of bytes written as to format properly
Marius Vlad [Tue, 6 Aug 2019 14:38:40 +0000 (17:38 +0300)]
compositor: Return the number of bytes written as to format properly

Otherwise 'log_extensions()' will not know how to properly format the
data.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoweston-log: Return bytes written for 'printf()' and 'vprintf()' functions
Marius Vlad [Tue, 6 Aug 2019 14:37:51 +0000 (17:37 +0300)]
weston-log: Return bytes written for 'printf()' and 'vprintf()' functions

Information is needed for 'vlog()' and 'vlog_continue()' (others
depend on them).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobuild: bump to version 6.0.93 for the RC1 release
Simon Ser [Fri, 16 Aug 2019 15:48:51 +0000 (18:48 +0300)]
build: bump to version 6.0.93 for the RC1 release

5 years agoscreen-share: use pixman_image_composite32 instead of pixman_blt
Stefan Agner [Thu, 20 Jun 2019 09:45:36 +0000 (11:45 +0200)]
screen-share: use pixman_image_composite32 instead of pixman_blt

The function pixman_blt may return false in case there is no
accelerated blit function available. In this case the remote shared
screen stays black.

This has been observed on Weston compiled for aarch64. In currrent
pixman 0.38.4 there is no accelerated pixman_blt function for
aarch64 available.

Use pixman_image_composite32 instead which is guaranteed to have a
working fallback implementation.

Fixes: #253
Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoscreen-share: move damage calculation after screen resize
Stefan Agner [Thu, 20 Jun 2019 08:57:27 +0000 (10:57 +0200)]
screen-share: move damage calculation after screen resize

Calculate damage region after resizing the cache image. This
avoids unnecessary calculation of damaged regions on resize,
makes sure that the whole screen is considered damaged on
resize and simplifies error handling.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoscreen-share: fix error handling
Stefan Agner [Thu, 20 Jun 2019 08:55:14 +0000 (10:55 +0200)]
screen-share: fix error handling

Make sure damage region gets properly unreferenced in error cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoscreen-share: align read_pixels call with screenshooter
Stefan Agner [Sun, 16 Jun 2019 19:24:21 +0000 (21:24 +0200)]
screen-share: align read_pixels call with screenshooter

Calculate y_orig separately first makes it easer to understand the
code and aligns with how pixels are read in screenshooter.c.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoFix a crash when closing an X11 window with a selection
Emmanuel Gil Peyrot [Thu, 15 Aug 2019 12:02:22 +0000 (14:02 +0200)]
Fix a crash when closing an X11 window with a selection

This was caused by weston_wm_handle_xfixes_selection_notify() calling
weston_seat_set_selection() with a NULL source, apparently only
sometimes when closing an Xwayland window.

5 years agoclients/simple-egl: Exit when display has an error
Manuel Stoeckl [Thu, 8 Aug 2019 03:21:16 +0000 (23:21 -0400)]
clients/simple-egl: Exit when display has an error

Check return values for wl_display_dispatch_* functions, so that
the program stops running when the compositor that it is connected
to crashes.

Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
5 years agocompositor: Bring back the old timestamp format for the log scope
Marius Vlad [Tue, 6 Aug 2019 08:52:57 +0000 (11:52 +0300)]
compositor: Bring back the old timestamp format for the log scope

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoshared/: Please compiler when passed certain compile flags
Marius Vlad [Tue, 6 Aug 2019 17:06:02 +0000 (20:06 +0300)]
shared/: Please compiler when passed certain compile flags

Fixes the following warn/error when using combination of flags like
building with debug, when disabling optimization and/or when enabling ASAN:

../shared/option-parser.c:61:1: error: control reaches end of non-void function [-Werror=return-type]

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Use only 'log' scope to print libwayland messages
Marius Vlad [Tue, 6 Aug 2019 11:33:25 +0000 (14:33 +0300)]
compositor: Use only 'log' scope to print libwayland messages

No need to duplicate messages.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobuild: bump to version 6.0.92 for the beta release
Simon Ser [Fri, 2 Aug 2019 16:11:52 +0000 (19:11 +0300)]
build: bump to version 6.0.92 for the beta release

5 years agoreleasing: update for the new release process
Simon Ser [Fri, 19 Jul 2019 17:21:48 +0000 (20:21 +0300)]
releasing: update for the new release process

A few things have changed:

- Meson is used instead of autotools
- Wayland and Weston releases are not synchronized anymore
- Artifact deployment happens via wayland.freedesktop.org's Git repo

While at it, also convert the file to Markdown. Instructions to locally install
Xwayland/libinput have been dropped.

Signed-off-by: Simon Ser <contact@emersion.fr>
5 years agolibweston: Advertise minor version 2 of zwp_linux_explicit_synchronization_v1
Alexandros Frantzis [Fri, 2 Aug 2019 13:29:57 +0000 (16:29 +0300)]
libweston: Advertise minor version 2 of zwp_linux_explicit_synchronization_v1

Although we already supported minor version 2 of the explicit sync
protocol, we couldn't advertise it previously, since it was not in any
released version of wayland-protocols. With the release of
wayland-protocols 1.18, which includes minor version 2 of this protocol,
and the recent update in weston to require 1.18, we can now safely
advertise minor version 2.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
5 years agoprotocol/meson.build: Bump wayland-protocol requirement to 1.18
Jonas Ådahl [Thu, 25 Jul 2019 11:05:05 +0000 (13:05 +0200)]
protocol/meson.build: Bump wayland-protocol requirement to 1.18

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
5 years agopixman: avoid unnecessary y-flip for screen capture
Stefan Agner [Sun, 16 Jun 2019 21:28:15 +0000 (23:28 +0200)]
pixman: avoid unnecessary y-flip for screen capture

Commit 4fc5dd0099c2 ("compositor: add capability CAPTURE_YFLIP")
introduced a capability flag which indicates whether y-flipping is
necessary. As already indicated in that commit message, it seems
that pixman flipps the y-axis only due to historic reasons.

Drop y-flipping and use the WESTON_CAP_CAPTURE_YFLIP flag to
indicate that y-flipping is not necessary. This simplifies code
and improves screen share performance (on my test by about 3% down
to 18% CPU load on the sharing instance of Weston).

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agomeson: Use libweston-major versioning on protocols directory
Quentin Glidic [Mon, 22 Jul 2019 20:11:38 +0000 (22:11 +0200)]
meson: Use libweston-major versioning on protocols directory

To fully allow parallel-installation of libweston, we have to make sure
anything that is implemented in libweston is in a versioned directory.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
5 years agoshared/platform: avoid build warning when building without gl-renderer
Stefan Agner [Fri, 26 Jul 2019 11:44:47 +0000 (13:44 +0200)]
shared/platform: avoid build warning when building without gl-renderer

When building without GL renderer the compiler prints the following
warning:
  ../clients/subsurfaces.c: In function ‘egl_state_create’:
  ../clients/subsurfaces.c:225:35: warning: passing argument 1 of
  ‘weston_platform_get_egl_display’ makes pointer from integer without a
  cast [-Wint-conversion]
    225 |   weston_platform_get_egl_display(EGL_PLATFORM_WAYLAND_KHR,
        |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
        |                                   |
        |                                   int
...

Define the fallback implementation of weston_platform_get_egl_display
to take an integer which is the underlaying datatype of EGLenum.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoscreen-share: destroy seat on remove
Stefan Agner [Thu, 20 Jun 2019 22:31:59 +0000 (00:31 +0200)]
screen-share: destroy seat on remove

Destroy seats when they get removed. This makes sure that seats
properly disappear when screen-share RDP clients disconnect.
There will be no excessive amount of mouse pointer anymore after
several client connection/disconnections.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoman: Update weston.ini, that no backend supports HDCP as yet
Ankit Nautiyal [Mon, 22 Jul 2019 06:28:50 +0000 (11:58 +0530)]
man: Update weston.ini, that no backend supports HDCP as yet

Currently, the HDCP support in drm-backend is under review and no
other backend supports HDCP yet. This patch is just to update the
weston.ini with this information.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agobuild: bump to version 6.0.91 for the alpha release
Simon Ser [Fri, 19 Jul 2019 16:03:05 +0000 (19:03 +0300)]
build: bump to version 6.0.91 for the alpha release

5 years agoAdd pipewire plugin
Michael Olbrich [Tue, 23 Apr 2019 10:34:05 +0000 (12:34 +0200)]
Add pipewire plugin

It is quite similar to the remoting plugin. It just exports the frames via
pipewire instead of the builtin GStreamer pipeline.
It implements the same virtual output API. Virtual outputs can be created
by adding 'pipewire-output' sections to weston.ini.

The generated frames can be accessed with any pipewire client. e.g. with
GStreamer:

gst-launch-1.0 pipewiresrc ! video/x-raw,format=BGRx ! ...

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
5 years agogitlab-ci: switch to buster
Michael Olbrich [Sun, 12 May 2019 09:47:25 +0000 (11:47 +0200)]
gitlab-ci: switch to buster

This is needed for pipewire.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
5 years agodoc/sphinx: Add documentation for the logging/debugging framework
Marius Vlad [Thu, 27 Jun 2019 15:42:21 +0000 (18:42 +0300)]
doc/sphinx: Add documentation for the logging/debugging framework

This details the logging/debugging framework with the latest changes,
making use of the groups added by "weston-log: Start adding
documentation" and "libweston/log: Add 'wlog' group".

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston/log: Add 'wlog' group for weston_log() related functions
Marius Vlad [Fri, 28 Jun 2019 11:08:24 +0000 (14:08 +0300)]
libweston/log: Add 'wlog' group for weston_log() related functions

This allows a better integration with the documentation of logging
framework.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Start adding documentation for the logging/debugging framework
Marius Vlad [Thu, 27 Jun 2019 15:34:03 +0000 (18:34 +0300)]
weston-log: Start adding documentation for the logging/debugging framework

Adds initial grouping for sphinx/breathe for the logging/debugging
framework. We add a few groups: log (public API), internal-log (private API,
not exported) and debug-protocol, specific to the weston
debug protocol.

In latest version of breathe, '\memberof' command is recognized as such.
But it conflicts with '\ingroup' command and can't be used in the same
time (leading to duplicate symbols), so we follow a simple rule: object
tagging with '\ingroup' then use '\memberof' command for the functions
that work on that object.

There's also a caveat here: we have objects that are private (opaque)
but the functions are public. For those cases we resort to using
'internal-log' for the object (class) and 'log' for the functions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Removed compositor_destroy_listener from the log context
Marius Vlad [Thu, 11 Jul 2019 14:54:55 +0000 (17:54 +0300)]
weston-log: Removed compositor_destroy_listener from the log context

Nobody is using it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Remove internal weston-log set-up function out of public header
Marius Vlad [Mon, 8 Jul 2019 21:36:20 +0000 (00:36 +0300)]
libweston: Remove internal weston-log set-up function out of public header

We have dedicated header for the internal parts of the logging
framework, use that for the set-up part instead of the libweston public
API header.

Further more this removes weston_vlog() from public header as well and
moves them to weston-log-internal.h file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Remove from main displaying available log scopes
Marius Vlad [Mon, 8 Jul 2019 10:20:02 +0000 (13:20 +0300)]
compositor: Remove from main displaying available log scopes

Place the subscribe parts and displaying of available scopes out of
main as it makes no sense to keep them there.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Add debug key-binding to display/dump flight recorder contents
Marius Vlad [Thu, 27 Jun 2019 16:19:26 +0000 (19:19 +0300)]
compositor: Add debug key-binding to display/dump flight recorder contents

Uses (debug key-binding mod+shift+space) KEY_D to display/dump
the contents of the flight recorder.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Put back weston_compositor_add_debug_binding() as public
Marius Vlad [Thu, 18 Jul 2019 08:01:51 +0000 (11:01 +0300)]
libweston: Put back weston_compositor_add_debug_binding() as public

The ability to install debug keybinds is useful so bring it back to the
public libweston API.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Plug-in the flight recorder
Marius Vlad [Mon, 24 Jun 2019 10:27:44 +0000 (13:27 +0300)]
compositor: Plug-in the flight recorder

Create a flight recorder subscriber and allow subscribring to scopes
over the command line.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log-flight-rec: Introduce flight recorder stream
Marius Vlad [Sun, 23 Jun 2019 20:24:34 +0000 (23:24 +0300)]
weston-log-flight-rec: Introduce flight recorder stream

Like a black box in an airplane, the flight recorder can be used to
accumulate data and, when needed, to display its contents.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Remove weston_log() calls from weston-log
Marius Vlad [Sun, 23 Jun 2019 12:48:54 +0000 (15:48 +0300)]
weston-log: Remove weston_log() calls from weston-log

Avoids a potential dependency on the log scope being set-up before
actually creating the scope. Destroy part of the log context could
suffer from the same issue if the log scope is destroyed before.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Create the 'log' scope much earlier
Marius Vlad [Wed, 3 Jul 2019 09:41:47 +0000 (12:41 +0300)]
compositor: Create the 'log' scope much earlier

Logging should start as early as possible so create the log scope as
early as possible, before subscribing to it.

Open the logfile before creating the 'logger' subscriber, making sure
we're logging to the file properly.

Also migrate `weston_log_set_handler()` to avoid potential calls to
`weston_log` before installing the log handler.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Destroy the compositor before the log scope
Marius Vlad [Mon, 24 Jun 2019 09:00:47 +0000 (12:00 +0300)]
compositor: Destroy the compositor before the log scope

Destroying the compositor after destroying the log scope will not print
out the messages in the tear down/clean-up phase of the compositor, so
add a new tear_down function which allows keeping a valid reference to
the compositor. This way we can destroy the compositor before destroying
the scope and keep the debug messages.

While at it remove the log context destroy part from the clean-up
of the compositor and make it stand on its own.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agocompositor: Plug-in the file stream
Marius Vlad [Sat, 22 Jun 2019 20:39:19 +0000 (23:39 +0300)]
compositor: Plug-in the file stream

Pass log scopes from the command line to subscribe log scopes
dynamically to the 'logger' subscriber.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log-file: Introduce file type of stream
Marius Vlad [Sat, 22 Jun 2019 17:12:24 +0000 (20:12 +0300)]
weston-log-file: Introduce file type of stream

With the logging infrastructure in place this patch add a new user: file
type of stream backed-up by a std file descriptor.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Rename scope's 'begin_cb' callback to 'new_subscriber'
Marius Vlad [Wed, 17 Jul 2019 12:43:53 +0000 (15:43 +0300)]
weston-log: Rename scope's 'begin_cb' callback to 'new_subscriber'

Rather than using 'begin_cb' rename it to a more suitable name.

Further more instead of using the scope use the subscription to pass as
an argument. The source scope is attached to the subscription when
creating it so we can access it that way.

This also adds a _complete and a _printf method for the subscription
such that the callbacks can use to write data to only _that_
subscription and to close/complete it, otherwise writing to a scope
results in writing to all subscriptions for that scope which is not
correct.

In the same time, the scope counter-parts of _write and _complete will
now use the subscription function as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniels@collabora.com>
5 years agoweston-log/weston-log-wayland: Inline private subscription functions
Marius Vlad [Thu, 11 Jul 2019 14:44:50 +0000 (17:44 +0300)]
weston-log/weston-log-wayland: Inline private subscription functions

This avoids duplicated bits, by calling the scopes's callback (if any)
and adding the subscription to the scope's subscription list. Further
more, the scope's name when creating the subscription is not needed so
removed that as well.

In mirror, also inline removing of subscription for scope's subscription
list. Fix a potential corner case when the user can request a
subscription to an invalid scope in stream_destroy().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Introduce subscribe functionality
Marius Vlad [Fri, 21 Jun 2019 21:29:31 +0000 (00:29 +0300)]
weston-log: Introduce subscribe functionality

As described in e10c9f89826bb: "weston-debug: Introduce...", the
subscriber object need further functionality to make use of it.

Current form of the weston-debug protocol would not need this, as it
creates underneath a new subscriber each time a client connects and
subscriptions are created/destroyed automatically with the help of
wayland protocol. For other types of streams, we require to manually
create a subscriber and to subscribe to log scopes.

This patch introduces the ability to create subscriptions, and
implicitly to subscribe to (previously created) scopes.

In the event the scope(s) are not created we temporary store the
subscription as a pending one: a subscription for which a scope doesn't
exist at the time of the subscription. When the scope for which the
subscription has been created we take care to create the subscription as
well.

While at it the documentation bits are modified accommodate the subscribe
method and its further functionality.

Lastly, it removes an unlikely case when a scope is not created so we
avoid any kind of dandling (pending) subscription in case there is
subscription to it. We can only do something about in the destroy part
of the scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoweston-debug: Rename weston-debug to weston-log to better reflect its purpose
Marius Vlad [Fri, 21 Jun 2019 19:49:18 +0000 (22:49 +0300)]
weston-debug: Rename weston-debug to weston-log to better reflect its purpose

No changes in functionality have been made.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log-wayland: Rename weston_debug_stream to weston_log_wayland
Marius Vlad [Fri, 21 Jun 2019 18:13:15 +0000 (21:13 +0300)]
weston-log-wayland: Rename weston_debug_stream to weston_log_wayland

No changes in functionality have been made.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-debug: Migrate weston_debug_stream to weston_log_wayland file
Marius Vlad [Tue, 25 Jun 2019 10:29:57 +0000 (13:29 +0300)]
weston-debug: Migrate weston_debug_stream to weston_log_wayland file

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-debug: Make it easier to separate weston_debug_stream
Marius Vlad [Fri, 21 Jun 2019 11:57:02 +0000 (14:57 +0300)]
weston-debug: Make it easier to separate weston_debug_stream

This way we can split easier weston_debug_stream into a separate file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-debug: Convert weston_debug_stream to use the subscriber base class
Marius Vlad [Fri, 21 Jun 2019 11:20:15 +0000 (14:20 +0300)]
weston-debug: Convert weston_debug_stream to use the subscriber base class

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoweston-debug: Introduce weston_log_subscription and weston_log_subscriber objects
Marius Vlad [Tue, 25 Jun 2019 09:48:56 +0000 (12:48 +0300)]
weston-debug: Introduce weston_log_subscription and weston_log_subscriber objects

Adds a minimalistic API for managing the subscription object. The
subscribe functionality will be brought in once we re-organize a bit
weston-debug-stream and split it properly. It extends the logging
context with a linked list of potential subscription and adds a linked
list of subscriptions in the log scope.

This patch represents the start of a logging framework for weston. It's
being built around weston-debug, with the intent to superseded it, and
make weston-debug a client of the framework. Further more the logging
framework should replace current logging handler and allow other types
of streams to be used.

Currently present in libweston under weston-debug we have log scopes, debug
streams and a logging context.

With this patch, two (internal) objects are being added: the concept of
a subscriber and the concept of subscription.  The subscription object
is a ephemeral object, implicitly managed which is created each time one
would want to a subscribe to a scope. The scope will maintain a list of
subscriptions and will continue to be explicitly managed.

The streams will use the subscriber object as a base class to extend
upon. By doing so it allows to customize the stream with specific
functions that manipulate the underlaying storage. The subscriber object
will require a subscribe function and specific stream functions and like
the scope, will be explicitly managed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agolibweston: Move 'struct weston_backend' to the internal backend header
Pekka Paalanen [Tue, 16 Jul 2019 21:09:06 +0000 (00:09 +0300)]
libweston: Move 'struct weston_backend' to the internal backend header

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_seat'
Marius Vlad [Tue, 16 Jul 2019 20:44:21 +0000 (23:44 +0300)]
libweston: Migrate functions that operate on 'weston_seat'

All 'notify_()*' belong in the private backend header file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_output' into backend header
Marius Vlad [Tue, 16 Jul 2019 20:34:14 +0000 (23:34 +0300)]
libweston: Migrate functions that operate on 'weston_output' into backend header

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Introduce backend.h
Marius Vlad [Tue, 16 Jul 2019 20:11:25 +0000 (23:11 +0300)]
libweston: Introduce backend.h

Introduce a new private header file that only internal backends are
allowed to use. Starts by migrating functions that operate on the
'struct weston_head'.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate what is left out the libweston public header
Marius Vlad [Thu, 11 Jul 2019 11:54:46 +0000 (14:54 +0300)]
libweston: Migrate what is left out the libweston public header

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate content_protection from public header
Marius Vlad [Wed, 10 Jul 2019 18:31:20 +0000 (21:31 +0300)]
libweston: Migrate content_protection from public header

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that perform various transformations
Marius Vlad [Wed, 10 Jul 2019 18:27:49 +0000 (21:27 +0300)]
libweston: Migrate functions that perform various transformations

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_view'
Marius Vlad [Wed, 10 Jul 2019 18:06:15 +0000 (21:06 +0300)]
libweston: Migrate functions that operate on 'weston_view'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_spring'
Marius Vlad [Wed, 10 Jul 2019 17:56:04 +0000 (20:56 +0300)]
libweston: Migrate functions that operate on 'weston_spring'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_surface'
Marius Vlad [Wed, 10 Jul 2019 17:42:45 +0000 (20:42 +0300)]
libweston: Migrate functions that operate on 'weston_surface'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on input objects
Marius Vlad [Wed, 10 Jul 2019 15:23:43 +0000 (18:23 +0300)]
libweston: Migrate functions that operate on input objects

This include 'weston_keyboard', 'weston_touch', 'weston_pointer' and
other released classes.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_seat'
Marius Vlad [Wed, 10 Jul 2019 14:32:42 +0000 (17:32 +0300)]
libweston: Migrate functions that operate on 'weston_seat'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_plane'
Marius Vlad [Wed, 10 Jul 2019 13:29:05 +0000 (16:29 +0300)]
libweston: Migrate functions that operate on 'weston_plane'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate functions that operate on 'weston_compositor'
Marius Vlad [Wed, 10 Jul 2019 11:48:39 +0000 (14:48 +0300)]
libweston: Migrate functions that operate on 'weston_compositor'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Introduce libweston-internal.h
Marius Vlad [Wed, 10 Jul 2019 10:46:39 +0000 (13:46 +0300)]
libweston: Introduce libweston-internal.h

Introduce a new private header file that only internal parts of the
library are allowed to use and shouldn't be exposed in the public header
of libweston.

Start by adding by adding functions that operate on the 'weston_buffer*'.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Removed unused tty_* functions
Marius Vlad [Wed, 3 Jul 2019 17:12:46 +0000 (20:12 +0300)]
libweston: Removed unused tty_* functions

These are nowhere defined, so it seems the we're only left with these
declarations.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Migrate weston_environment_get_fd() to weston-launch header
Marius Vlad [Tue, 9 Jul 2019 13:31:35 +0000 (16:31 +0300)]
libweston: Migrate weston_environment_get_fd() to weston-launch header

This is private so it doesn't belong to public libweston API header.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: do not include config-parser.h
Pekka Paalanen [Thu, 18 Apr 2019 10:54:38 +0000 (13:54 +0300)]
libweston: do not include config-parser.h

config-parser.h is a helper API that libweston core must never depend on. Using
it is a compositor frontend decision.

Including it in libweston.h would give the wrong message.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-drm: dont emit sesion signal if already at same state
Robert Beckett [Tue, 2 Jul 2019 15:31:22 +0000 (16:31 +0100)]
backend-drm: dont emit sesion signal if already at same state

logind will send a device changed at start of day, prompting a session
active change, but the session will already be active from compositor
creation.

Avoid unnecessary signal emition and drm state invalidation.

The logind launcher sets the session active when the graphics device is
assigned to weston from systemd. Unfortunately 8d23ab78 didnt check whether the
session was already active before setting it active and emitting the session
active signal.
The handler for that signal then proceeds to invalidate the entire graphics
state, causing the next redraw to reconfigure all outputs (to the same routing
as they were already).
This then massively increases the likelihood of trying to configure a crtc that
has a commit already in flight.

Add the old behaviour of only emitting a signal on a changed state.
This avoids the issue for now by reducing the chances of a clash. Future
work will need to fix the issue properly (better handling of state_invalid e.g.
wait for quiescence, better monitoring for crtc usage clashes etc).

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
5 years agolibweston: make session_active a bool
Robert Beckett [Wed, 10 Jul 2019 15:40:12 +0000 (16:40 +0100)]
libweston: make session_active a bool

compositor->session_active should be a bool as it tracks a boolean
condition.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
5 years agocontributing: add copy of DCO
Pekka Paalanen [Mon, 4 Feb 2019 11:17:28 +0000 (13:17 +0200)]
contributing: add copy of DCO

The DCO was fetched from https://developercertificate.org/ on Feb 4, 2019.
DCO-1.1.txt is a verbatim copy of it.

We should carry a copy of this legal document to be explicit on what wording we
refer to. A link to the URL is not enough, because it may go stale or change
contents without notice.

This clarifies on what the S-o-b actually means. The meaning itself is the same
as before.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-drm: fix race during system suspend
Antonio Borneo [Sun, 30 Jun 2019 13:51:10 +0000 (15:51 +0200)]
backend-drm: fix race during system suspend

Depending on system loading, weston-launcher could drop the drm
master access before the compositor and all the clients receive
the notification. In this case, some commit could be sent to the
drm driver too late and get refused with error EACCES.
This error condition is not properly managed and causes weston to
hang.

Change the return type of start_repaint_loop() and repaint_flush()
from void to int, and return 0 on success or -1 if the repaint has
to be cancelled.
In the callers of start_repaint_loop() and repaint_flush() handle
the return value and cancel the repaint when needed.
In backend-drm detect the error EACCES and return -1.
Note: to keep the code cleaner, this change inverts the execution
order between weston_output_schedule_repaint_reset() and
repaint_cancel().

No need to wait for suspend or for any notification; in case the
weston reschedules a repaint, it will get EACCES again.
At resume, damage-all guarantees a complete repaint.

This fix is for atomic modeset only.
Legacy modeset suffers from similar problems, but it is not fixed
by this change. Since drm_pending_state_apply() never returns
error for legacy modeset, this change has no impact on legacy
modeset.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/117
5 years agogl-renderer: Don't leak transformed region
Daniel Stone [Tue, 2 Jul 2019 10:52:09 +0000 (11:52 +0100)]
gl-renderer: Don't leak transformed region

Unfortunately, our y_invert helper also forgot to free the region it
transformed to. Clean up our allocation before we exit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
5 years agogl-renderer: Account for offset in output region translation
Daniel Stone [Mon, 1 Jul 2019 16:44:20 +0000 (17:44 +0100)]
gl-renderer: Account for offset in output region translation

In 55bcb93fefd6 ("gl-renderer: Use helper for conversion to EGL rects"),
we extracted and lovingly commented the transformation from global to
output co-ordinate space used for EGL_KHR_swap_buffer_with_damage, into
a new helper function.

The commenting correctly noted the steps we need to perform the
transformation: shifting by the output's offset into global space,
followed by applying the output's scale and rotation transformations.

Unfortunately, the code did not live up to the high standards of the
comment, and forgot to translate by the output's offset. This meant that
for multiple outputs, we would probably end up with wildly out-of-bounds
co-ordinates.

Fix the code to first translate by the output's offset in global space,
ensuring that both our swap_buffers_with_damage, and our partial_update
co-ordinate sets, can spark joy for those blessed with more than one
output.

Signed-off-by: Daniel Stone <daniels@collabora.com>
5 years agoremoting: make a gstreamer pipeline configurable
Tomohito Esaki [Wed, 22 May 2019 03:21:32 +0000 (12:21 +0900)]
remoting: make a gstreamer pipeline configurable

Allow a gstreamer pipeline to be configurable via an weston.ini. It is
necessary that source is appsrc, its name is "src", and sink name is
"sink" in pipeline. Also, remoting plugin ignore port and host
configuration if the gst-pipeline is specified.

5 years agobackend-drm: get handle in gbm specific code
Stefan Agner [Sun, 7 Jul 2019 22:42:05 +0000 (00:42 +0200)]
backend-drm: get handle in gbm specific code

Get GBM BO handle in GBM specific code. This allows to compile
drm_output_set_cursor without GBM.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agobackend-drm: drop gbm.h from c files
Stefan Agner [Sun, 7 Jul 2019 22:35:06 +0000 (00:35 +0200)]
backend-drm: drop gbm.h from c files

The header file is anyway included in drm-internal.h, we can safely
drop it from the c files.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agocompositor-drm: use DRM constants
Stefan Agner [Sun, 7 Jul 2019 22:30:44 +0000 (00:30 +0200)]
compositor-drm: use DRM constants

The GBM and DRM constants have the same meaning. In preparation
to make the DRM backend compile without libgbm, prefer the DRM
constants where GBM is not needed.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoclients: Add content-protection client app
Ankit Nautiyal [Tue, 8 Jan 2019 12:15:35 +0000 (17:45 +0530)]
clients: Add content-protection client app

This patch adds a client app which can be used to show the
implementation of weston content-protection protocol. The app can
request for Type-0 and Type-1 content or request for disabling
content-protection to the content-protection server.
It listens for the content-protection status change event from the
server and accordingly display the required content.

The content Type-0, Type-1 and unprotected contents are prepared
using cairo surface, with different color and text to distinguish
between the contents.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agogl-renderer: Obscure protected content on unprotected display
Harish Krupo [Fri, 7 Jun 2019 05:39:56 +0000 (11:09 +0530)]
gl-renderer: Obscure protected content on unprotected display

The content protection protocol requires that in enforced mode, parts of the
surfaces which lie on outputs with protection level lower than that of the surface
be censored. This patch uses a solid shader to color such regions with
dark red.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
5 years agocompositor: Enable HDCP for an output using weston.ini
Ankit Nautiyal [Wed, 3 Apr 2019 04:44:59 +0000 (10:14 +0530)]
compositor: Enable HDCP for an output using weston.ini

This patch enables a user to opt for HDCP per output, by writing into
the output section of weston.ini configuration file. HDCP is always
enabled by default for the outputs.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Notify client for change in content-protection status
Ankit Nautiyal [Wed, 3 Apr 2019 13:51:58 +0000 (19:21 +0530)]
libweston: Notify client for change in content-protection status

The change in an output's content-protection may trigger a change in
the surface's content-protection status, and inturn the
content-protection available for the client.

This patch recomputes the content-protection level for a surface,
in case there is a change in content-protection level of an output,
showing the surface. In case of a change in the surface's
content-protection, the client associated with that surface is
notified.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Add content-protection protocol implementation
Ankit Nautiyal [Thu, 28 Mar 2019 09:35:42 +0000 (15:05 +0530)]
libweston: Add content-protection protocol implementation

This patch adds the content-protection protocol implementation, to
enable a weston client application to request for content-protection
for its content via HDCP.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
5 years agolibweston: Add support to set content-protection for a weston_surface
Ankit Nautiyal [Tue, 26 Mar 2019 08:07:12 +0000 (13:37 +0530)]
libweston: Add support to set content-protection for a weston_surface

The protection requested for a given surface, must reach through the
weston_surface::pending_state, in the commit-cycle for the
weston_surface, so that it gets updated in the next commit.

As some protection is requested for a given weston_surface, it means
protection must be set for each of the outputs which show the surface.

While setting the protection of a weston_output, care must be taken
so as to avoid, degrading the protection of another surfaces, enjoying
the protection. For this purpose, all the weston_surfaces that are
shown on a weston_output are checked for their desired protection.
The highest of all such desired protections must be set for the
weston_output to avoid degrading of existing protected surfaces.
A surface requesting protection for a lower content-type can still be
provided protection for a higher type but the converse cannot be
allowed.

This patch adds support to set content-protection for a suface, which
inturn sets the content-protection for each of the outputs on which
it is shown, provided, none of the existing surface's protection
request is downgraded.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>