Since version 7 clients must use MAP_PRIVATE to map the keymap fd so we
can use memfd_create in os_ro_anonymous_file_get_ref using
RO_ANONYMOUS_FILE_MAPMODE_PRIVATE, for older version we use
RO_ANONYMOUS_FILE_MAPMODE_SHARED to be compatibile with MAP_SHARED.
Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
We notify the timeline of the fact that the object suffered
modifications through the 'set_label' function. Remove the old
refresh variable.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Helper to retrieve next available subscription as to avoid exposing the
subscription, which is an opaque (internal) class of the logging
framework.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
As 'new_subscription' can create additional objects, 'destroy_subscription'
will be needed when cleaning up.
As this requires a libweston_major bump (noticed by @pq), bump it up to
8.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
The callback is executed when the subscription is created, so it doesn't
really have a proper name.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Use the surfaceless platform in the headless backend to initialize the
GL-renderer and create pbuffer outputs. This allows headless backend to use
GL-renderer, even hardware accelerated.
This paves way for exercising GL-renderer in CI and using the Weston test suite
to test hardware GL ES implementations.
Relates to: https://gitlab.freedesktop.org/wayland/weston/issues/278
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>