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>
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>
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>
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>
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
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
This protocol allows a client to ask the compositor to only allow it to
be displayed on a "secure" output. This initial version of the protocol
supports HDCP.
This is loosely based on the chromium secure-output protocol [1].
This protocol is mostly useful for closed system, where the client can
trust the compositor, such as set-top boxes. This is not a way to
implement any kind of Digital Rights Management on desktops. The
compositor would be free to lie to the client, anyway.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
[1]
https://chromium.googlesource.com/chromium/src/+/master/third_party/wayland-protocols/unstable/secure-output/secure-output-unstable-v1.xml
weston_desktop_surface_unlink_view() does now call weston_view_destroy() so the
weston_view is not destroyed here. This is a problem because the view remains in
the weston_layer view_list. If ivi_view_destroy() is called from
ivi_layout_surface_destroy() and the view list is rebuilt in the 'removed'
signal, then the list gets corrupted when the view is destroyed immediately
afterwards.
Fix this by calling weston_view_destroy() unconditionally for all view.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Whenever shell_surface_send_configure() is called
weston_desktop_surface_set_size() should be used instead for desktop
surfaces. It is already done for IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY, do
it everywhere else too.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Unfortunate left over which was not removed once we had the script in
place to regenerate the documentation. A side-effect was the fact that
we still ran the script even if 'docs' target was called, effectively
nullifying the fact that 'docs' target was ran at all. For instance,
'install' would've been executing the script even if 'docs' target
was called before.
This removes the doxygen_target entirely and the depends of sphinx
target on it, makes building and installing docs a bit faster.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
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>
With the introduction of the 'docs' target we make sure that we always
build the documentation, but currently breathe is unaware of the fact
that the doxygen XML database was changed in between runs. It is obvious
when changing only source code not rST bits.
This patch makes sphinx ignore the saved environment and always
rebuild the docs.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
wl_shell is deprecated, and using xdg_shell allows the client to run on
compositors which do not implement the old protocol. Functionality
should be identical.
Signed-off-by: Astatos Aner <random.bored.human@gmail.com>
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>
Most of the state helpers (create, destroy, duplicate, etc) state, are
relatively straightforward and can live in a separate file.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Create a new file which handles most of the actual KMS API use. This
covers the property handling (in which we map between KMS properties and
our internal representations), as well as actually applying state
through atomic modesetting or the legacy SetCrtc/PageFlip/DPMS APIs.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Create a new file for the DRM backend's handling of output modes, e.g.
resolution, aspect ratio, preferred mode selection, EDID parsing.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Create a helper function which populates a drm_head with the information
extracted from its connector's EDID and any other properties we can
find, such as physical size and connection status.
This is currently quite small, but may become more complex in future as
we parse EDID better. It also prepares to move this function into
another file in the next commit.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Create a new header called drm-internal.h, and move many of drm.c's
declarations and helpers to it.
This will allow us to split the DRM backend into multiple files.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Pads launchers with the empty space that used to be around them. Moving
pointer to 0,0 and clicking launches the preferred app. First launcher
has more padding at its start to look nice.
Moves the clock to the right edge with same padding. Keeps one of the
two values for text extents that the code was already retrieving but
never read. Horizontal panel position centers the clock.
Sets text in the panel, meaning tooltips and the clock, to consistent 14
units of the default system font at 85% of the max brightness, so it's
less tiring on eyes.
partial_update is an EGL extension which allows us to inform the driver
ahead of time the limits of the areas we'll be writing to. This helps
performance for GPU hardware which renders into a local tile buffer:
informing the driver of the rendering extents means it can avoid
fetching unchanged tiles into the tile buffer and subsequently writing
them out.
The extension complements rather than replaces EGL_EXT_buffer_age (used
before partial_update to know which areas we need to update) and
EGL_KHR_swap_buffers_with_damage (used after partial_update to inform
the winsys of the changed region).
Note however that partial_update deals in buffer-damage regions ('what
has changed since the last time I used _this_ buffer?'), whereas
swap_buffers_with_damage deals in surface-damage regions ('what has
changed since the last time I rendered?'). An explanatory diagram can be
found in the specification:
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_partial_update.txtFixes: #134
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add some comments in the function to make it clear what's going on,
especially as we twist and turn between a lot of things called 'damage'
meaning different things in different co-ordinate spaces.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The buffer_damage variable stores accumulated damage from previous
frames. This is the area that, before considering our current repaint
request, we need to repaint in order to bring the older buffer up to
date with the last buffer we rendered into.
Rename to previous_damage so it's a bit more clear what this refers to.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Technically it is storing which areas of the border are damaged.
However, we already have damage-region variables which need to be
translated by the border region. Rename the variable to not contain the
word 'damage' to reduce confusion.
Signed-off-by: Daniel Stone <daniels@collabora.com>
eglSwapBuffersWithDamage has to convert a damage region from Weston's
global co-ordinate space, into the co-ordinate space for EGL rendering
into a buffer for that output.
The conversion from the global co-ordinate space in logical pixels to
the output space in buffer pixels is slightly long and error-prone,
involving translating by the output's offset within the global
co-ordinate space, multiplying by output scale, and also translating to
allow for any borders we paint around the output.
After this is done, we need to flip the co-ordinates in the Y axis to
account for the lower-left-origin co-ordinate space used by EGL.
Since we want to reuse this for partial_update, but using a different
source region, extract this conversion into a well-commented helper we
can reuse.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fan debug mode repaints the whole surface in order to clear any 'trails'
left over from previous fan paints. If this happens, fall back to using
regular eglSwapBuffers rather than eglSwapBuffersWithDamageEXT, since
the damage region we would pass will be too small.
Signed-off-by: Daniel Stone <daniels@collabora.com>
pixel_format_get_info() is already documented in the headers; no need to
also document it next to the code.
Signed-off-by: Daniel Stone <daniels@collabora.com>
These definitions were just set to the default (off), but their presence
causes Fedora's Doxygen to emit a warning as it is not compiled with
Clang support.
Remove them as they are no-ops anyway.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes 0a13641ff: "gitlab-ci: Enable gitlab page for publishing documentation",
to point to correct sphinx documentation.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>