Commit Graph

720 Commits

Author SHA1 Message Date
Marius Vlad 3d3ba9594e weston-log: Removed compositor_destroy_listener from the log context
Nobody is using it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad 4e03629f44 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>
2019-07-18 13:34:04 +03:00
Marius Vlad 3ee9d8e2d2 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>
2019-07-18 13:34:04 +03:00
Marius Vlad 9c3804f8d5 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>
2019-07-18 13:34:04 +03:00
Marius Vlad ef4c268f68 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>
2019-07-18 13:34:04 +03:00
Marius Vlad 284d5345ad 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>
2019-07-18 13:34:04 +03:00
Marius Vlad 8b3ab3cd9b 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>
2019-07-18 13:34:04 +03:00
Marius Vlad dad882a12e 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>
2019-07-18 13:32:23 +03:00
Marius Vlad 5ae0e621be 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>
2019-07-18 10:49:39 +03:00
Marius Vlad 9f71a4ad85 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>
2019-07-18 10:49:39 +03:00
Marius Vlad c901e8913e 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>
2019-07-18 10:49:39 +03:00
Marius Vlad 967a6c2d4e 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>
2019-07-18 10:49:39 +03:00
Marius Vlad 69e7571e63 weston-debug: Migrate weston_debug_stream to weston_log_wayland file
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 10:49:39 +03:00
Marius Vlad 8f329e25f7 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>
2019-07-18 10:49:39 +03:00
Marius Vlad 7814f301d1 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>
2019-07-18 10:49:39 +03:00
Marius Vlad e0a858a5f2 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>
2019-07-18 10:49:39 +03:00
Pekka Paalanen e48bfc7c0c libweston: Move 'struct weston_backend' to the internal backend header
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 5d649b611a 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>
2019-07-18 06:43:38 +00:00
Marius Vlad 63ef078ada libweston: Migrate functions that operate on 'weston_output' into backend header
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad e41c1bff11 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>
2019-07-18 06:43:38 +00:00
Marius Vlad 0260fed3c7 libweston: Migrate what is left out the libweston public header
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad a9b69b4b2a libweston: Migrate content_protection from public header
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 3ff296e934 libweston: Migrate functions that perform various transformations
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 7e4f58faa3 libweston: Migrate functions that operate on 'weston_view'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 4e1d0973f5 libweston: Migrate functions that operate on 'weston_spring'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad f1a6594ad7 libweston: Migrate functions that operate on 'weston_surface'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 9eb2064b85 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>
2019-07-18 06:43:38 +00:00
Marius Vlad 0bf3f5ac2c libweston: Migrate functions that operate on 'weston_seat'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 58cac08c22 libweston: Migrate functions that operate on 'weston_plane'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 56f3a68a01 libweston: Migrate functions that operate on 'weston_compositor'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad a72e3716e8 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>
2019-07-18 06:43:38 +00:00
Marius Vlad 4d79283248 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>
2019-07-18 06:43:38 +00:00
Robert Beckett 49dc32013e 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>
2019-07-18 06:35:41 +00:00
Robert Beckett c569bdc236 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>
2019-07-18 06:35:41 +00:00
Antonio Borneo c90fccc256 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
2019-07-12 17:16:52 +00:00
Daniel Stone 9c81224eb3 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>
2019-07-12 17:00:32 +00:00
Daniel Stone 3ebd870487 gl-renderer: Account for offset in output region translation
In 55bcb93fef ("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>
2019-07-12 17:00:32 +00:00
Stefan Agner 974390a5fa 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>
2019-07-08 23:53:30 +02:00
Stefan Agner 5dd3e9996a 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>
2019-07-08 00:35:06 +02:00
Stefan Agner 0bfebebbdb 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>
2019-07-08 00:30:44 +02:00
Harish Krupo 62626cbfec 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>
2019-07-05 14:13:30 +05:30
Ankit Nautiyal 2844f8eaaf 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>
2019-07-05 14:13:30 +05:30
Ankit Nautiyal f74c35b1f4 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>
2019-07-05 14:13:24 +05:30
Ankit Nautiyal 5cfe03c863 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>
2019-07-04 14:18:50 +05:30
Ankit Nautiyal 4b6e73d617 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>
2019-07-04 14:18:50 +05:30
Ankit Nautiyal 4f64ff8b2f libweston: Compute current protection for weston_output and weston_head
The actual protection status for a given weston_head depends upon the
corresponding drm_head's connector HDCP properties. On the other hand,
the actual protection for a weston_output is the minimum of the
protection status of its attached heads.
As a head's protection changes, the current protection of the output
to which the head is attached is recomputed.

This patch adds the support to keep track of the current
content-protection for heads and the outputs.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-07-04 14:18:50 +05:30
Ankit Nautiyal 2690a77088 libweston: Add support to set content-protection for a weston_output
For making an output secure, the content-protection should be set for
each of head attached to that output. So whenever the protection for
a weston_output is desired, it means that protection is desired for
each of the weston_head attached to that weston_output.

This patch introduces a new enum in libweston to represent the
requested/current protection statuses, equivalent to the type enum
defined by the weston-secure-output protocol. The new enum helps to
extend the content-protection status and requests to libweston and
the backends.
This patch also adds a new member desired_protection to store the
desired protection for an output in weston_output.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-07-04 14:18:50 +05:30
Roman Gilg e97391c49f compositor: Support xdg_output_unstable_v1
The xdg-output resources are listed in each head struct. They become idle when
the respective weston_output has been removed again. The client is supposed to
destroy them explicitly afterwards.

After starting an XWayland client xrandr displays the logical size as expected.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
2019-07-01 08:24:25 +00:00
Tomohito Esaki 29beeafde9 backend-drm: make linear modifier to default
Make the linear modifier to the default of DRM format modifiers if
supported modifiers isn't get from kernel driver.
2019-07-01 10:57:25 +09:00
Daniel Stone e404b72fd5 compositor-drm: Split assign_planes() into separate file
drm_assign_planes() is called to separate views out and decide what will
be taken out for plane composition and what will be left for the
renderer to compose.

It calls drm_output_propose_state() in order to find a good
configuration, which itself has a number of helpers that it calls. Break
these out into a separate file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00