Commit Graph

810 Commits

Author SHA1 Message Date
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
Daniel Stone 6b466f25af compositor-drm: Move state helpers to separate file
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>
2019-06-26 23:08:36 +01:00
Daniel Stone 7580b3c09e compositor-drm: Move FB handling to a separate file
Move everything to do with creation, destruction, and reference handling
of drm_fbs to a new file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00
Daniel Stone 4c2fc7058a compositor-drm: Move KMS API use to separate file
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>
2019-06-26 23:08:36 +01:00
Daniel Stone fbe6c1db7b compositor-drm: Move mode handling to separate file
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>
2019-06-26 23:08:36 +01:00
Daniel Stone 3448cfce0f compositor-drm: Pull EDID extraction into helper
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>
2019-06-26 23:08:36 +01:00
Daniel Stone dd1bc50ba2 compositor-drm: Create header for backend internals
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>
2019-06-26 23:08:36 +01:00
Daniel Stone df2095fa35 gl-renderer: Support EGL_KHR_partial_update
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.txt

Fixes: #134

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone 0a86a81cc2 gl-renderer: Add EGL_EXT_partial_update query
Query for the extension itself and the core entrypoint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone f1cecef2f8 gl-renderer: Demystify output repaint slightly
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>
2019-06-26 12:28:03 +01:00
Daniel Stone 30f5863756 gl-renderer: Rename buffer_damage variable
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>
2019-06-26 12:28:03 +01:00
Daniel Stone dad2f4046d gl-renderer: Rename border_damage variable
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>
2019-06-26 12:28:03 +01:00
Daniel Stone 55bcb93fef gl-renderer: Use helper for conversion to EGL rects
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>
2019-06-26 12:28:03 +01:00
Daniel Stone a7722ee92a gl-renderer: Don't use swap_buffers_with_damage with fan debug
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>
2019-06-26 12:28:03 +01:00
Daniel Stone 8e3c8c4b88 gl-renderer: Convert remaining pseudo-bools to real bool
Use the actual boolean type instead of an integer for variables which
only hold true or false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone d83c1eca92 gl-renderer: Convert extension pseudo-bools to real bool
Use the actual boolean type instead of an integer for variables which
only hold true or false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone bc4ccc2085 pixel-formats: Remove duplicate doc string
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>
2019-06-26 12:27:14 +01:00
Marius Vlad 9fdda7f5eb libweston: Add ingroup tag for weston_compositor
This is a continuation of "e2cc7aa40fd: libweston: Define head, output and
compositor group".

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad 55d8736ed1 libweston: Add ingroup tag for weston_output
This is a continuation of "e2cc7aa40fd: libweston: Define head, output and
compositor group".

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad 78984ee971 libweston: Define head, output and compositor group
Also, add tag symbols related to 'weston_head'.

The bridge between sphinx and doxygen (breathe) has a useful directive:
doxygengroup. By using it we can scoop out symbols we'd like to display
documentation from/of.

At the same time some bits of the code has been using '\memberof' (a
doxygen command useful in C code to establish class like
relationship between objects and functions) but this seems not to be
recognized by the sphinx bridge.

Until we find a better solution, we replace '\memberof' command with
'\ingroup' one as to tag the symbols with an "object". This patch does
that for 'weston_head' object.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad eeabe17e7c pixel-formats: Fix doxygen warnings about missing format
We already have documentation in header which conflicts with the one
the source code. Remove it entirely as it confuses user as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad a2dace23ae libweston: Fix/clean-up doxygen warnings
This fixes warnings for weston-debug, input, compositor, log and
linux-explicit-sync. Warnings range from swapping '[in]', '[out]' with
the function arguments to wrong parameter names.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Daniel Stone 31838bf17e compositor-drm: Remove legacy plane and vblank usage
As of the previous commit, we never create state which uses overlay
planes on non-atomic drivers. We can thus remove the calls to
drmModeSetPlane.

The only time we ever waited for vblank events was when we had called
drmModeSetPlane and needed to make sure we waited until it was active.
We can thus also remove all the vblank event machinery.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
Daniel Stone 87fab1ca4e compositor-drm: Only assign planes with atomic
Without atomic modesetting, we have no way to know whether or not our
desired configuration is usable. It might fail for a number of reasons:
scaling limits, bandwidth limits, global resource (e.g. decompression)
unit contention, or really just anything.

Not only this, but there is no good way to ensure that our configuration
actually lands together in the same refresh cycle - hence the 'atomic'
in atomic modesetting. Some drivers implement a synchronously blocking
drmModeSetPlane, whereas others return immediately. Using overlay planes
can thus decimate your framerate.

The pre-atomic API is not extensible either, so we need numerous out
clauses: fail if we're cropping or scaling (sometimes), or changing
formats, or fencing, or ...

Now we've had atomic support stable for a couple of releases, just
remove support for doing anything more fancy than displaying our
composited output and a cursor with drivers which don't support atomic
modesetting.

Support for using overlay planes was already disabled by default when
using the legacy API, and required a debug key combination to toggle it
on by flipping the sprites_are_broken variable. We can ensure that we
never try to use it on legacy by simply ignoring the hotkey when in
legacy mode.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
Stefan Agner b0e16d4c53 backend-rdp: allow to force compression off
By default the client communicates its preference with regards to
compression to the server. However, some clients always use
compression, which is not ideal for certain environments (e.g.
low performance embedded devices in a local network with plenty
of bandwidth). Allow to disable compression server-side which will
override the clients request for compression.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-06-20 16:39:13 +02:00
Stefan Agner d93c0f7059 backend-rdp: fix memory leak
Free command data after all rects have been updated. This fixes a
rather huge memory leak when using the RDP backend.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-06-20 09:04:12 +02:00
Robert Beckett 8d23ab78bd backend-drm: handle multiple drm nodes with logind
When using logind launcher, we receive a PauseDevice "gone" message
from logind session management for each device we close while looking
for KMS devices.

Make logind notify the backend of the device add/remove so that the
backend can decide what to do, instead of assuming that if it is a
DRM_MAJOR device the session should be (de)activated. The backend can
then react to its specific device.

Fixes #251

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
2019-06-13 18:40:56 +01:00
Tomohito Esaki 68d49d772c compositor-drm: run finish_frame when dpms is turned off in update_complete
A output repaint loop isn't scheduled beacuse the output repaint_status
is AWAITING_COMPLETION when dmps is turned off in update_complete().
Therefore, the display attached to the output is remain inactive even if
weston wakes up. By going through finish_frame, the output
repaint_status is fixed to correct status.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2019-06-13 10:13:59 +00:00
Daniel Stone 82c8ca1628 dbus: Don't return value from void function
Just discard the value, rather than trying to return a value from a void
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-11 11:31:04 +01:00
Pekka Paalanen c8acc5f23d backend-fbdev: more into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 526b85401e backend-x11: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 4f1573e48e backend-wayland: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen b70ee941b5 backend-rdp: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 8059d317a5 backend-headless: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen f0f37bcaa1 backend-drm: move into new subdir
Move the DRM-backend into a new sub-directory to make it stand out from
libweston core. This facilitates splitting drm.c into more files later.

vaapi-recorder is used only by DRM-backend, move that too.

libbacklight is used only by DRM-backend and a manual test program, and is
moved as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 6bc50b12f8 build: make backlight a helper lib
Right now only used by the DRM-backend, but there is a test program that should
use this as well.

This helps with building the test program and moving DRM-backend into a
subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen b40e051858 build: make libinput-backend a helper lib
Rather than having fbdev and drm backends include the libinput files ad hoc,
wrap them in a static library. Using the dependency object for that helper
library will then automatically pull in any necerray include dirs for the
users.

This helps with moving the backends into subdirectories.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Marius Vlad 4e53814180 build: libweston doesn't need -export-dynamic
According to https://gitlab.freedesktop.org/wayland/weston/merge_requests/159#note_148104
it doesn't make sense to use export-dynamic on libraries.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-14 17:29:57 +03:00
Marius Vlad f4f4c2bcf1 libweston: Add weston-debug header to libweston
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 6f098663c0 weston-debug: Remove weston_compositor from weston_log_context
This is no longer needed. Also assert if the context passed is NULL and
compositor log context is already set.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 7e4db95373 libweston: Rename weston_debug_scope_ to weston_log_scope_
Rename also the functions which work on weston_log_scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 5d5e335845 libweston: Rename weston_debug_scope to weston_log_scope
This is a continuation of the previous patch to align more closely to
the weston log framework.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 3d7d978c21 libweston: Rename weston_debug_compositor to weston_log_context
As we transition towards a more generic API for weston loggging
framework rename weston_debug_compositor to weston_log_context to show
the fact that this is not really debug but a logging context.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 1e2fda2ea1 compositor: Convert weston-debug framework to use weston_debug_compositor
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:01:59 +00:00
Marius Vlad 880b485d76 libweston: Decouple weston_debug_compositor from weston_compositor
This patch allows initialization of weston-debug/log framework much earlier
than weston_compositor, which in turn will provide the option start
logging before weston_compositor has been created.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:01:59 +00:00
Antonio Borneo 3957863667 log: remove "%m" from format strings by using strerror(errno)
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.

In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.

Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-05-02 22:10:30 +02:00
Marius Vlad 38c66ccb21 weston-launch: Fix warning on error() not being avaiable due to removal of header
Commit a1450a8a7 removed errno header but forgot to remove all error()
calls.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-04-22 17:24:52 +03:00
Randy Li a1450a8a71 make error() portable
error() is not posix but gnu extension so may not be available on all
kind of systemsi e.g. musl.

Signed-off-by: Randy 'ayaka' Li <ayaka@soulik.info>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2019-04-22 10:46:42 +00:00
Harish Krupo 737ac0d4b3 data-device: send INVALID_FINISH when operation != dnd
The documentation of wl_data_offer::finish states that it should be
used to signify that a drag and drop operation is completed. So send
WL_DATA_OFFER_ERROR_INVALID_FINISH when the client calls the finish
request but the operation isn't dnd.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 22:06:37 +05:30
Pekka Paalanen 81475a5c15 libweston: move gl-renderer into a subdir
GL-renderer is expected to grow more files, both by addition and by splitting.
Moving them into a new subdirectory helps people to understand which files are
relevant.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:52:41 +03:00
Pekka Paalanen 3a2c67aa51 gl-renderer: does not need matrix.c
The symbols of matrix.c are already exported by libweston, no need to build
them again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen 4b5727375c libweston: export weston_linux_sync_file_read_timestamp()
This is an internal export for GL-renderer, so that it does not need to build
linux-sync-file.c a second time. This follows the example of
linux-explicit-synchronization.c which is also used by GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

This should help with moving GL-renderer into a new subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen cda1488ce0 Rename version.h to libweston/version.h
This is an installed public header, and without the subdir would surely
conflict with something else.

include/libweston/meson.build is necessary for putting the generated header in
the right subdirectory so that '#include <libweston/version.h>' can work.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen ecbdcfd373 Rename zalloc.h to libweston/zalloc.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 91b1010de9 Rename config-parser.h to libweston/config-parser.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 96dc449259 Rename matrix.h to libweston/matrix.h
matrix.h is a public installed header and even used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 9eda0ea825 Rename windowed-output-api.h to libweston/windowed-output-api.h
See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 27b377f51f Rename plugin-registry.h to libweston/plugin-registry.h
See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 7571027f17 Rename public backend headers
The backend headers are renamed from compositor-foo.h to backend-foo.h to
better describe their purpose. These headers are public libweston API for each
specific backend.

The headers will also be used like

 #include <libweston/backend-drm.h>

instead of

 #include <compositor-drm.h>

to give them a more explicit namespace.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 3d5d9476e3 Rename compositor.h to libweston/libweston.h
The main idea is to make libweston users use the form

 #include <libweston/libweston.h>

instead of the plain

 #include <compositor.h>

which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen a78cf77582 Rename timeline-object.h to libweston/timeline-object.h
This patch sets up the stage for similarly renaming compositor.h which will
justify this. That patch will be big, so moving timeline-object.h first makes
it easy to see the changes to the build and install directives.

This and all the following moves essentially break the API, so libweston major
is bumped.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:45 +03:00
Pekka Paalanen cb74afd482 build: declare separate dependency for compositor.h
These are not specific to the launchers but to compositor.h, so name them that
way.

Once we can rely on the mentioned Meson PR, we can simplify this further.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:30:03 +03:00
Marius Vlad 3a28bd66ff meson.build/libweston: Fix clang warning for export-dynamic
Identical to 8a8558dd, where we need to pass `-Wl` as linker args.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-04-16 17:38:13 +03:00
Pekka Paalanen 651566af2d build: add missing dep to x11 backend
All other backends already link to libweston, x11 backend should too.

This fixes a build failure:

[1/50] Compiling C object 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o'.
FAILED: libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o
cc -Ilibweston/2b98b6d@@x11-backend@sha -Ilibweston -I../../git/weston/libweston -Ilibweston/.. -I../../git/weston/libweston/.. -Ilibweston/../shared -I../../git/weston/libweston/../shared -Iprotocol -I/home/pq/local/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -fvisibility=hidden -fPIC  -MD -MQ 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o' -MF 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o.d' -o 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o' -c ../../git/weston/libweston/compositor-x11.c
../../git/weston/libweston/compositor-x11.c:51:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
 #include <xkbcommon/xkbcommon.h>

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-29 13:40:12 +02:00
Marius Vlad 253ba9a6db compositor: Fix missing new line when displaying buffer type for EGL buffer
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-03-28 12:30:25 +00:00
Marius Vlad a6acfa8346 compositor: Fix invalid view numbering in scene-graph
With the addition of patch 433f4e77b7 we display the same view id (0)
for every view as we're modifying the local variable.

Displaying sub-surfaces based views is also problematic. The caller need
to modify the view number as well, so we instead we pass the address as
to allow that to happen. Otherwise we end up repeating the same number
for views without sub-subrfaces once those have been printed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-03-28 12:30:25 +00:00
Pekka Paalanen fc76388fa1 Remove autotools build
Weston 6.0.0 was released with both autotools and Meson build systems. That
should be enough for downstream to migrate to Meson build on their on pace.

Maintaining two build systems is a hassle, keep the one that is easier to work
with and let the other one go.

doc/dozygen/tool*.doxygen.in are not deleted, because they have not been
integrated with Meson yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 13:56:44 +02:00
Pekka Paalanen 779db046b9 meson: dep fix for compositor.h needing xkbcommon.h
This fixes:

[    5s] cc -Ilibweston/2b98b6d@@session-helper@sta -Ilibweston -I../libweston -Ilibweston/.. -I../libweston/.. -Ilibwes
ton/../shared -I../libweston/../shared -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/dbus-1.0 -I/usr/lib6
4/dbus-1.0/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wno-unused-parameter -Wno-shift-n
egative-value -Wno-missing-field-initializers -fvisibility=hidden -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong
 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC  -MD -MQ 'libweston/2b98b6d@@session-hel
per@sta/launcher-util.c.o' -MF 'libweston/2b98b6d@@session-helper@sta/launcher-util.c.o.d' -o 'libweston/2b98b6d@@sessio
n-helper@sta/launcher-util.c.o' -c ../libweston/launcher-util.c
[    5s] In file included from ../libweston/launcher-util.c:29:
[    5s] ../libweston/compositor.h:39:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
[    5s]  #include <xkbcommon/xkbcommon.h>

For completeness, also add the same for wayland-server.h.

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 12:52:00 +02:00
Deepak Rawat 46a1c729b8 compositor-drm: Set damage for scanout plane
Copy the damage region to scanout drm_plane_state which will be sent to
kernel during atomic state update.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2019-03-28 10:19:13 +00:00
Deepak Rawat 009b3cfa6f compositor-drm: Add support for drm plane FB_DAMAGE_CLIPS property
The plane property FB_DAMAGE_CLIPS provides a way to mark damaged
regions on the plane in framebuffer coordinates of the framebuffer
attached to the plane.

This patch adds a new member "damage" to compositor version of
drm_plane_state and set FB_DAMAGE_CLIPS property whenever damage is
available.

v2: Rebase, check if plane support FB_DAMAGE_CLIPS property before
setting it.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2019-03-28 10:19:13 +00:00
Pekka Paalanen fe6dd7bcef meson: DRM-backend demands GBM
All the GBM code is unconditional in compositor-drm.c, so while disabling the
GL-renderer would stop GBM from being used, GBM headers would still be needed
for building and GBM library for linking.

Leave a note to fix it properly later. At least we now check for GBM and do not
mislead with the error message.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 09:47:02 +00:00
Philipp Zabel 5c8eef147c compositor-drm: clear gbm_surface pointer after destroying the GBM surface
Since commit ee1d968e64 ("compositor-drm: Fall back if GBM surface fails with
modifiers"), drm_output_init_egl requires output->gbm_surface to be NULL, or
gbm_surface_create will not be called if HAVE_GBM_MODIFIERS is enabled but no
modifiers are supported by the plane. This could happen if _init_egl is called
after drm_ouptut_fini_egl drom drm_output_switch_mode.

Add an assert to guarantee the requirement and clears the gbm_surface pointer
after the surface is destroyed.

Signed-off-by: Philipp Zabel <p.pzabel@pengutronix.de>
2019-03-06 11:26:42 +01:00
Philipp Zabel 1c49b5445e compositor-drm: fix gbm_bo_get_handle_for_plane error handling
gbm_bo_get_handle_for_plane returns -1 on error, not 0.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-02-25 17:19:54 +01:00
Daniel Stone 2914a6da8b compositor-drm: Add missing newline to debug print
The 'created new mode blob' print was missing a newline, unlike all the
others.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-02-22 13:43:22 +00:00
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01:00
Marius Vlad 433f4e77b7 compositor: Fix scene-graph debug scope missing views based on sub-surfaces
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 16:48:37 +02:00
Marius Vlad d4c7bc58ab compositor-drm: Print pixel format in human-friendly form when failing to assign view to a overlay plane
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 16:19:58 +02:00
Marius Vlad 0a9c953825 meson: Remove freerdp1 as it no longer builds
../libweston/compositor-rdp.c: In function ‘rdp_peer_refresh_rfx’:
../libweston/compositor-rdp.c:213:25: error: invalid type argument of unary ‘*’ (have ‘SURFACE_BITS_COMMAND’ {aka ‘struct _SURFACE_BITS_COMMAND’})
  memset(&cmd, 0, sizeof(*cmd));

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 10:46:10 +00:00
Daniel Stone ee1d968e64 compositor-drm: Fall back if GBM surface fails with modifiers
If we cannot create a gbm_surface using a list of modifiers, fall back
to using the old pre-modifier version.

This fixes initialisation on systems where KMS supports modifiers but
the GBM driver does not, such as old i915 systems like Pine View using
the unified KMS driver but the old i915 Mesa driver.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-02-16 11:05:40 +00:00
Philipp Zabel cca7346557 meson: add missing libweston EGL dependency if renderer-gl is enabled
If the 'renderer-gl' option is enabled, ENABLE_EGL is defined, and
libweston/pixel-formats.c includes EGL/egl.h. This requires an egl
dependency, as X11-less platforms need the MESA_EGL_NO_X11_HEADERS
define from egl.pc cflags:

  In file included from /usr/include/EGL/egl.h:39:0,
                   from ../libweston/pixel-formats.c:42:
  /usr/include/EGL/eglplatform.h:124:10: fatal error: X11/Xlib.h: No such file or directory
  compilation terminated.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-02-15 23:26:16 +01:00
ant8me 30a285748d compositor-wayland: use xdg_shell stable instead of v6
Better to excercise the current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- fix continued line alignment

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 11:18:38 +00:00
Pekka Paalanen 1ed3506b70 libweston: export weston_config API
Make it official that libweston will export the weston_config API, as requested
in https://gitlab.freedesktop.org/wayland/weston/merge_requests/29 .

There is no other way third party helper clients could access the API.

The autotools build has been accidentally exporting it all the time, but the
Meson build needed fixing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-06 16:50:21 +02:00
Alexandros Frantzis 676296749a libweston: Support zwp_surface_synchronization_v1.get_release
Implement the get_release request of the zwp_surface_synchronization_v1
interface.

This commit implements the zwp_buffer_release_v1 interface. It supports
the zwp_buffer_release_v1.fenced_release event for surfaces rendered by
the GL renderer, and the zwp_buffer_release_v1.immediate_release event
for other cases.

Note that the immediate_release event is safe to be used for surface
buffers used as planes in the DRM backend, since the backend releases
them only after the next page flip that doesn't use the buffers has
finished.

Changes in v7:
  - Remove "partial" from commit title and description.
  - Fix inverted check when clearing used_in_output_repaint flag.

Changes in v5:
  - Use the new, generic explicit sync server error reporting function.
  - Introduce and use weston_buffer_release_move.
  - Introduce internally and use weston_buffer_release_destroy.

Changes in v4:
  - Support the zwp_buffer_release_v1.fenced_release event.
  - Support release fences in the GL renderer.
  - Assert that pending state buffer_release is always NULL after a
    commit.
  - Simplify weston_buffer_release_reference.
  - Move removal of destroy listener before resource destruction to
    avoid concerns about use-after-free in
    weston_buffer_release_reference
  - Rename weston_buffer_release_reference.busy_count to ref_count.
  - Add documentation for weston_buffer_release and ..._reference.

Changes in v3:
  - Raise NO_BUFFER for get_release if no buffer has been committed,
    don't raise UNSUPPORTED_BUFFER for non-dmabuf buffers,
    so get_release works for all valid buffers.
  - Destroy the buffer_release object after sending an event.
  - Track lifetime of buffer_release objects per commit, independently
    of any buffers.
  - Use updated protocol interface names.
  - Use correct format specifier for resource ids.

Changes in v2:
  - Raise UNSUPPORTED_BUFFER at commit if client has requested a
    buffer_release, but the committed buffer is not a valid linux_dmabuf.
  - Remove tests that are not viable anymore due to our inability to
    create dmabuf buffers and fences in a unit-test environment.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis acff29b3b3 libweston: Support zwp_surface_synchronization_v1.set_acquire_fence
Implement the set_acquire_fence request of the
zwp_surface_synchronization_v1 interface.

The implementation uses the acquire fence in two ways:

1. If the associated buffer is used as GL render source, an
   EGLSyncKHR is created from the fence and used to synchronize
   access.
2. If the associated buffer is used as a plane framebuffer,
   the acquire fence is treated as an in-fence for the atomic
   commit operation. If in-fences are not supported and the buffer
   has an acquire fence, we don't consider it for plane placement.

If the used compositor/renderer doesn't support explicit
synchronization, we don't advertise the protocol at all. Currently only
the DRM and X11 backends when using the GL renderer advertise the
protocol for production use.

Issues for discussion
---------------------

a. Currently, a server-side wait of EGLSyncKHR is performed before
   using the EGLImage/texture during rendering. Unfortunately, it's not clear
   from the specs whether this is generally safe to do, or we need to
   sync before glEGLImageTargetTexture2DOES. The exception is
   TEXTURE_EXTERNAL_OES where the spec mentions it's enough to sync
   and then glBindTexture for any changes to take effect.

Changes in v5:
  - Meson support.
  - Make explicit sync server error reporting more generic, supporting
    all explicit sync related interfaces not just
    wp_linux_surface_synchronization.
  - Fix typo in warning for missing EGL_KHR_wait_sync extension.
  - Support minor version 2 of the explicit sync protocol (i.e., support
    fences for opaque EGL buffers).

Changes in v4:
  - Introduce and use fd_clear and and fd_move helpers.
  - Don't check for a valid buffer when updating surface acquire fence fd
    from state.
  - Assert that pending state acquire fence fd is always clear
    after a commit.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to just the
    renderer.
  - Check for EGL_KHR_wait_sync before using eglWaitSyncKHR.
  - Dup the acquire fence before passing to EGL.

Changes in v3:
  - Keep acquire_fence_fd in surface instead of buffer.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to both backend and
    renderer.
  - Move comment about non-ownership of in_fence_fd to struct
    drm_plane_state definition.
  - Assert that we don't try to use planes with in-fences when using the
    legacy KMS API.
  - Remove unnecessary info from wayland error messages.
  - Handle acquire fence for subsurface commits.
  - Guard against self-update in fd_update.
  - Disconnect the client if acquire fence EGLSyncKHR creation or wait
    fails.
  - Use updated protocol interface names.
  - User correct format specifier for resource ids.
  - Advertise protocol for X11 backend with GL renderer.

Changes in v2:
  - Remove sync file wait fallbacks.
  - Raise UNSUPPORTED_BUFFER error at commit if we have an acquire
    fence, but the committed buffer is not a valid linux_dmabuf.
  - Don't put buffers with in-fences on planes that don't support
    in-fences.
  - Don't advertise explicit sync protocol if backend does not
    support explicit sync.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis c0e2f9261f libweston: Introduce an internal linux sync file API
Introduce an internal API for dealing with linux sync files,
and use it in the codebase to replace ad-hoc sync file management.

The linux_sync_file_is_valid function is not currently used, but will be
utilized in upcoming commits to implement the
zwp_linux_explicit_synchronization_unstable_v1 protocol.

Changes in v5:
  - Meson support.

Changes in v3:
  - Use parameter name in function documentation.
  - Move kernel UAPI to separate header file.

Changes in v2:
  - Add function documentation
  - Remove linux_sync_file_wait()

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis 27d7c395c7 libweston: Introduce zwp_linux_explicit_synchronization_v1
Introduce support for the zwp_linux_explicit_synchronization_unstable_v1
protocol with an implementation of the zwp_linux_explicit_synchronization_v1
interface.

Explicit synchronization provides a more versatile notification
mechanism for buffer readiness and availability, and can be used to
improve efficiency by integrating with related functionality in display
and graphics APIs.

In addition, the per-commit nature of the release events provided by
this protocol potentially offers a solution to a deficiency of the
wl_buffer.release event (see
https://gitlab.freedesktop.org/wayland/wayland/issues/46).

Support for this protocol depends on the capabilities of the backend, so
we don't register it by default but provide a function which each
backend will need to call. In this commit only the headless backend when
using the noop renderer supports this to enable testing.

Note that the zwp_surface_synchronization_v1 interface, which contains
the core functionality of the protocol, is not implemented in this
commit. Support for it will be added in future commits.

Changes in v7:
  - Added some information in the commit message about the benefits of
    the explicit sync protocol.

Changes in v6:
  - Fall back to advertising minor version 1 of the explicit sync protocol,
    although we support minor version 2 features, until the new
    wayland-protocols version is released.

Changes in v5:
  - Meson support.
  - Advertise minor version 2 of the explicit sync protocol.

Changes in v4:
  - Enable explicit sync support in the headless backend for all
    renderers.

Changes in v3:
  - Use wl_resource_get_version() instead of hardcoding version 1.
  - Use updated protocol interface names.
  - Use correct format specifier for resource id.
  - Change test name to 'linux-explicit-synchronization.weston'
    (s/_/-/g).

Changes in v2:
  - Move implementation to separate file so protocol can be registered
    on demand by backends.
  - Register protocol in headless+noop backend for testing purposes.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Pekka Paalanen 91d0f08bce meson: remind about weston-launch suid
Since the Meson install step is not written to try to set the suid bit
automatically, remind the user that weston-launch needs to be
setuid-root to work.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2019-02-01 15:43:36 +00:00
Scott Anderson f0d3197fa5 meson: Fix deprecation warning for pkgconfig
Meson 0.49 now issues a warning for libraries being passed into the
'libraries' keyword argument. Now they should be passed as a positional
argument.

See
https://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-02-01 12:17:01 +13:00
n3rdopolis fa2742b380 libweston: fbdev: Force the Framebuffer devices to be activated.
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on qemu
with two virtual QXL cards. This is a more precise way to activate
framebuffer devices with the ioctl
2019-01-31 09:46:42 +00:00
Thomas Zimmermann ea54c2fda6 weston: Store use_pixman as `bool` type
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-01-31 08:57:54 +00:00
Scott Anderson 99553750db compositor-drm: Don't set linear modifier when not supported
This will cause gbm_surface_create_with_modifiers to fail on drivers
where modifiers are not yet supported (e.g. amdgpu). We need to make
sure we only end up using gbm_surface_create in this case.

This fixes the remoting plugin on these drivers.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-01-29 16:21:07 +13:00
Marius Vlad be57857af6 compositor-drm: Add an environmental variable to force RENDER-only mode of compositing
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-25 12:56:24 +02:00
Marius Vlad c91cf30154 compositor-drm: Forgot to use mode variable when using render only mode of composition
In patch 5d767416c1 we simplified a bit the way in which the
compositing mode was being printed with the purpose to improve
weston-debug.  It seems we forgot to use the mode when RENDER-only mode
is being used, so this patch fixes that.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2019-01-25 12:47:16 +02:00
Philipp Zabel 619958e382 compositor-drm: fix drm_output_prepare_overlay_view for non-matching format
Add missing drm_plane_state_put_back in case the view's pixel format
does not match any of the tested plane's supported formats.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-01-23 15:46:39 +00:00
Marius Vlad 1ca025cc5d compositor-drm: Display the pixel format of the framebuffer used by the plane
With this patch we also display the format in usage by the HW-plane.
This touches both legacy and atomic paths.
2019-01-23 16:28:26 +02:00
Marius Vlad 2ce2339045 pixel-formats: Document pixel format human-friendly conversion methods
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-23 16:28:21 +02:00
Marius Vlad f5ca2f1424 compositor-drm: Print DRM FB pixel format of the view in human-friendly form
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-23 16:08:43 +02:00
Pekka Paalanen 13dda10f1c meson: better errors for VA-API deps
Helps people avoid libva if they don't want it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 3b6b1e9128 meson: better error for drm+gl deps
Helps people avoid GBM if they don't have it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 83a46ca980 meson: better error for x11+gl deps
Helps people avoid egl in the rare case they don't have it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 43a42920cf meson: better error for wayland-backend wl-egl dep
Helps people avoid wayland-egl if they don't want it.

Makes the check for wayland-egl explicit on the site instead of relying
on gl-renderer checking for it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen a18bd3432d meson: better errors for gl-renderer egl and glesv2
Helps people to avoid EGL and GLESv2 if they do not want them.

Stops using dep_egl and dep_glesv2 so that the human friendly error
message is alongside the dependency() statement, so that the message and
the statement can later be merged together once Meson offers the custom
error messages feature or something even more sophisticated.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 16487ebc06 meson: better errors for x11-backend deps
Helps people avoid X11 related dependencies if they don't want them.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen c529d0b919 meson: better error for freerdp
Helps people to avoid freerdp if they don't want it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 9adcf44077 meson: better error for logind deps
Helps people to disable logind support if they do not want the
dependencies.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pablo Castellano f0ba93c194 compositor-fbdev: add support for ABGR
Make fbdev work with some Android downstream kernels, like the
asus-grouper (Google Nexus 7 2012).

Signed-off-by: Oliver Smith <ollieparanoid@bitmessage.ch>
2018-12-20 07:58:20 +00:00
Marius Vlad a0d9cc64f6 libweston/screnshooter: Fix weston screenshot event done if there's no client running
The 'done' event sent back to client with the weston screenshot interface
is not being sent if there is no damage on the plane. This patch (re-uses just
like recording part) weston_output_damage() to achieve that.

Otherwise the client will have to wait (and be blocked) until some
damage on the plane is being done.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad d9bcc0b171 libweston/weston-debug: Add a easy way to determine if the debug protocol has been enabled
This allows additional debug features to depend on the debug protocol being enabled

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad 748f09efe5 libweston/compositor-drm: Add missing debug message for scanout_view
Print debug message when the fb coudn't be retrieved for the primary
plane.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:12 +02:00
Marius Vlad 94698d2a83 libweston/compositor-drm: No need to test for invalid alpha for the view
This is redundant and is already being checked drm_fb_get_from_view()

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:12 +02:00