Commit Graph

810 Commits

Author SHA1 Message Date
Marius Vlad 5f6bee49ed libweston: Add a new helper weston_view_has_valid_buffer
Helper to determine if the buffer attached to the view is valid.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-11 16:51:48 +00:00
Marius Vlad e83e750183 backend-drm: Hard-code zpos values if HW doesn't exposes them
This is based on the assumption that overlays are in between cursor and
primary plane and it is required to be able to assign views to planes,
even if the driver doesn't not expose such property.

As we hard-code them as immutable the commit part would not need any
further modifications.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-11-11 16:51:48 +00:00
Marius Vlad 3dea57a9d5 backend-drm: Add a helper to display plane type as a 'string'
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-11 16:51:48 +00:00
Marius Vlad cdd6fa2717 backend-drm: Add zpos DRM-property
Functional no change, as nobody makes use of it. Only apply the zpos
value if the zpos property is mutable (that is, zpos_max and zpos_min
are not the same).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-11 16:51:48 +00:00
Marius Vlad 1accffe053 backend-drm: Teach drm_property_info_populate() to retrieve range values
Useful for zpos range values.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-11-11 16:51:48 +00:00
Daniel Stone 2cb926c558 Revert "backend-drm: Teach drm_property_info_populate() to retrieve range values"
Due to an error in driving GitLab, this commit erroneously contained the
entirety of !267 (zpos support in the KMS backend) squashed into one
single commit, pushed into master.

In order to keep the history clean, this is being reverted; a rebased
version of !267 with the clear individual commits which were already
present will be applied in its place.

This reverts commit 95e3b0deae.
2019-11-11 16:48:54 +00:00
Marius Vlad 95e3b0deae backend-drm: Teach drm_property_info_populate() to retrieve range values
Useful for zpos range values.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-11-11 15:24:25 +00:00
Stefan Agner 04eebc7f07 weston-launch: use exec to ensure signal delivery
Use exec to make sure the direct child process of weston-launch is
weston. This makes sure that signal delivery (SIGINT/SIGTERM) is
properly forwarded to weston.

Fixes ff3230952a ("weston-launch: Run weston in the user login shell")
Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-11-09 00:56:06 +01:00
Stefan Agner a8b4ddaec2 weston-launch: show when a signal is sent to a child
In verbose mode, print when a signal is sent to the child process.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-11-09 00:50:10 +01:00
Marius Vlad f68ee07880 weston-log: Avoid prefix-matching the scope name when checking for a
pending subscription

It limits to scope name to an exact match.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-05 17:08:17 +02:00
Marius Vlad 3a2f829983 libweston: Init weston_output's 'destroy_signal' before timeline has a chance to emit a
timeline subscription

When subscribing over the command line to the 'timeline' scope we hit
the situation where we could emit a timeline message but without the
weston_output object being (fully) enabled.  The timeline subscription
object requires to install its own callback on the 'destroy_signal' but
at that time, the 'destroy_signal' is not initialized.

This moves 'destroy_signal' initialization before timeline has a chance
to emit a timeline subscription message for that weston_output.

While at it, move also 'frame_signal' initialization before any function
call to keep them nicely organized.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-05 13:58:36 +02:00
Sebastian Wick abec512883 input: use ro_anonymous_file to minimize duplication of keymap files
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>
2019-11-04 15:10:05 +01:00
Sebastian Wick da50a2a532 input: bump wl_seat version to 7
Version 7 only restricts how the client can mmap the keymap fd so
bumping this is safe.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-11-04 15:10:05 +01:00
Sebastian Wick fcc6ff74d4 input: bump wl_seat version to 6
New in version 6 are touch shape, touch orientation and axis source
wheel tilt. Weston doesn't support any of them yet but simply not
sending the new events and new enum value is sufficient to claim to
support this version.

Also bump the Wayland requirement to 1.17 to ensure both version 6 and 7
definitions are in the XML.

The reason for bumping to v6 without implementing the new features is
that we must support v7 to make use of struct ro_anonymous_file
introduced in the previous commit.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
2019-11-04 15:10:04 +01:00
Stefan Agner ccf24076dd backend-drm: make GBM optional
Make GBM optional in case GL renderer is disabled. This allows to
build Weston with DRM backend without Mesa dependencies.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-25 15:32:07 +02:00
Stefan Agner 3654c673f8 backend-drm: separate out DRM virtual support
Move DRM virtual support into a separate file. Use the remoting
compile time option to disable DRM virtual support since this is the
only user of DRM virtual support currently. This will make it easier
to build the DRM backend without GBM support.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-25 15:32:07 +02:00
Stefan Agner 4a18f30225 backend-drm: use DRM_ constants everywhere
Use DRM_ constants for pixel formats in all cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-25 14:30:40 +02:00
Pekka Paalanen d1ace4c97f backend-rdp: work around unresolved symbols
This is preparation for disallowing unresolved symbols project-wide.

This is a temporary fix that should be reverted and fixed properly later.

/usr/bin/ld: libweston/backend-rdp/13a5658@@rdp-backend@sha/rdp.c.o: in function `rdp_peer_context_new':
/home/pq/build/weston-meson/../../git/weston/libweston/backend-rdp/rdp.c:748: undefined reference to `Stream_New'
/usr/bin/ld: libweston/backend-rdp/13a5658@@rdp-backend@sha/rdp.c.o: in function `rdp_peer_context_free':
/home/pq/build/weston-meson/../../git/weston/libweston/backend-rdp/rdp.c:781: undefined reference to `Stream_Free'
/usr/bin/ld: libweston/backend-rdp/13a5658@@rdp-backend@sha/rdp.c.o: in function `xf_input_keyboard_event':
/home/pq/build/weston-meson/../../git/weston/libweston/backend-rdp/rdp.c:1220: undefined reference to `GetVirtualKeyCodeFromVirtualScanCode'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/libweston/backend-rdp/rdp.c:1224: undefined reference to `GetKeycodeFromVirtualKeyCode'
/usr/bin/ld: libweston/backend-rdp/13a5658@@rdp-backend@sha/rdp.c.o: in function `weston_backend_init':
/home/pq/build/weston-meson/../../git/weston/libweston/backend-rdp/rdp.c:1469: undefined reference to `winpr_InitializeSSL'

See also #262

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:40:51 +03:00
Pekka Paalanen 9adfe7b91c build: reduce sub-dependencies of libweston
Make the libweston dependency objects pull in only those secondary dependencies
that are actually used in the API. This way in-tree users of libweston link to
fewer libraries needlessly, and it matches better what external users get via
pkg-config.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Pekka Paalanen 20b092d8b4 backend-x11: need libdrm headers in build
9ddb3bc315 started using drm_fourcc.h but forgot
to add libdrm headers to the dependencies.

This fixes the build for build-native-meson-no-gl-renderer when a future patch
reduces the dependencies pulled in by the libweston dependency object.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Pekka Paalanen d2332b8bba build: link libdl explicitly to DRM backend
In the future libweston will stop providing it for its users, since it's not
part of libweston API.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Pekka Paalanen 5e734ba308 build: link libm explicitly
In the future libweston will stop providing it for its users, since it's not
part of libweston API.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Pekka Paalanen 71ff95a544 build: separate deps for int and ext libweston users
We have two kinds of libweston users: internal and external. Weston, the
frontend, counts as an external user, and should not have access to libweston
private headers. The shell plugins are external users as well, because we
intend people to be able to write them. Renderers, backends, and some plugins
are internal users who will need access to private headers.

Create two different Meson dependency objects, one for each kind.

This makes it less likely to accidentally use a private header.

Screen-share is a Weston plugin and therefore counts as an external user, but
it needs the backend API to deliver input. Until we are comfortable exposing
public API for that purpose, let it use internal headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Stefan Agner 70e6356415 backend-headless: fix build issue without gl-renderer
If the gl-renderer is disabled build fails with:
  ../libweston/backend-headless/headless.c:394:9: error:
  ‘EGL_PLATFORM_SURFACELESS_MESA’ undeclared (first use in this function)

Fix this by including shared/weston-egl-ext.h.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-24 09:09:33 +00:00
Marius Vlad 23d01c67a3 doc/sphinx: Add some documentation about timeline points
Use doxygen ingroup command as to show the symbols in the sphinx
documentation.

Include some basic comments and document the exported functions from
timeline.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 21:42:25 +03:00
Marius Vlad 5de9297df2 libweston: Notify timeline of object modification
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>
2019-10-17 21:42:25 +03:00
Marius Vlad 3203ff68ad libweston: Convert timeline points to use the timeline scope
With the timeline scope being created it is time to convert TL_POINT()
to use the timeline scope through the compositor instance.

This patch removes the global variable allowing to run the new timeline
code.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 21:42:25 +03:00
Marius Vlad da104ebe5b libweston: Create the 'timeline' scope
With everything now in place, it is time to create the timeline scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 21:42:25 +03:00
Marius Vlad fb10ed768b libweston: Introduce timeline subscription and timeline subscription object
An object based on 'weston_timeline_subscription' will be created for
each subscription created. It contains the next object ID and list of
'weston_timeline_subscription_object'.

It will automatically be cleaned by the logging framework when the
subscription gets destroyed, or use the object destroy signal to trigger
the destruction of the timeline subscription (@pq), when the object
itself is being destroyed.

This class will hanged-off the subscription, such that we can
retrieve it when going over all the subscriptions.

An object based on 'weston_timeline_subscription_object' will help
maintain the state of the objects seen and will be created when a new
object will be emitted for a particular 'weston_timeline_subscription'.

Adds wrappers for ensuring the timeline subscription object is created
or has to be searched in order to be found, as to avoid duplicated code.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-10-17 21:41:09 +03:00
Marius Vlad 2a1b7865dd libweston: Clean-up timeline to make room for a new approach
With it this removes the parts responsible for creating the file,
timeline_log class, removes the debug key binding when creating the
compositor instace, keeping only what can be re-used.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 19:42:55 +03:00
Marius Vlad d0d89d0d5f weston-log: Add a subscription iterator
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>
2019-10-17 19:42:55 +03:00
Marius Vlad 410d0bc0b2 weston-log-internal: Allow to hang-off data over the subscription
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 19:42:55 +03:00
Marius Vlad 9bb1c3a3c2 weston-log: Add 'destroy_subscription' callback for the subscription
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>
2019-10-17 19:42:55 +03:00
Marius Vlad 0c7beb0b67 weston-log: 'new_subscriber' is actually 'new_subscription'
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>
2019-10-17 19:42:54 +03:00
Marius Vlad 413cda58d6 libweston: Fix rename of weston_compositor_destroy() reference
Commit 284d5345ad introduced a new tear_down function for the
compositor, it seems we missed a comment reference for it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-10-17 19:42:54 +03:00
Adam Jackson 3c3f3b1cc3 libweston: Fix integer underflow in weston_layer_mask_is_infinite
ubsan doesn't like what we were doing here:

../libweston/compositor.c:3021:21: runtime error: signed integer overflow: -2147483648 + -1 cannot be represented in type 'int'

Rather than try to be clever in invoking weston_layer_set_mask, just build the
maximal mask explicitly.
2019-10-16 16:02:59 -04:00
Loïc Yhuel 267b16e8f4 libweston: fix possible crash after a view is removed the layer
weston_compositor_build_view_list can reconstruct the view_list without a view which was
previously in it. The existing pointers in view->link are left unchanged, which could
lead to corruption or access to released memory in wl_list_remove, depending of the
order of destruction of the views.

This can happen at least with the black view created by the desktop shell for fullscreen
surfaces, when it is hidden in lower_fullscreen_layer.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2019-10-16 14:10:35 +00:00
Pekka Paalanen 5104d7b2af headless, gl-renderer: support pbuffer outputs
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>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 209187491b noop-renderer: zero-initialize struct
This ensures that all function pointers we do not fill in will be NULL.

I had a crash in the Xwayland test with
https://gitlab.freedesktop.org/wayland/weston/merge_requests/274 without this,
because import_dmabuf was garbage.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen ecdf50d38e gl-renderer: add EGL surfaceless platform support
This allows passing EGL_PLATFORM_SURFACELESS_MESA to
gl_renderer_display_create(). It is not useful on its own, because the
surfaceless platform has no window surfaces.

This feature will be used by the headless backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 53b7fd70b8 gl-renderer: document output_window_create
Even if it is internal, it is a non-trivial interface and deserves
documentation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 0010f8380a gl-renderer: document display_create
Some of this is a little convoluted to figure out from the code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 411a7cfe67 gl-renderer: display_create needs surface type
In case the base EGLConfig is needed, gl_renderer_display_create() needs to
know it should use EGL_WINDOW_BIT or EGL_PBUFFER_BIT.

The PBUFFER case is added for when the headless backend will grow GL-renderer
support.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Stefan Agner 24756a8965 backend-rdp: don't use shadow buffer for the RDP backend
Since the RDP backend allocates regular memory already as hw buffer
anyway, a shadow buffer is not required. The read_pixels interface
anyway renders directly into the hardware buffer, hence this does
not make a performance difference in practise. It avoids allocating
an unnecessary buffer.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-09 21:44:58 +00:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen c232f8d934 Unify the include style of shared/ headers
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.

This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.

This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with

	#include "libweston/dbus.h"

or even

	#include <libweston/dbus.h>

IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.

The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 16:04:48 +03:00
Pekka Paalanen b6c7a3020c build: use dependency for matrix.c
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 15:55:55 +03:00
Pekka Paalanen 2f83c02e88 gl-renderer: use EGLConfig printer for window outputs
Replace the old config printer with the new fancy one: less duplicate code,
more details logged.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:18:11 +03:00
Pekka Paalanen f2aa6408ea gl-renderer: print detailed EGLConfig list
Print details of all available EGLConfigs in case none match what we are
looking for. This helps debugging.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:18:11 +03:00
Pekka Paalanen 6aadac7144 gl-renderer: improve get_egl_config errors
Listing exactly what we were looking for but did not find should help debugging
failures.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 12:17:18 +03:00