platform/upstream/weston.git
5 years agolibweston: Add the ability to determine if a dmabuf is scanout-capable
Marius Vlad [Sat, 16 Nov 2019 18:26:52 +0000 (20:26 +0200)]
libweston: Add the ability to determine if a dmabuf is scanout-capable

Adds a new callback 'can_scanout_dmabuf' in weston_backend, which
can be set by the back-end do determine if the buffer supplied can be
imported directly by KMS.

This patch adds a wrapper over it, 'weston_compositor_dmabuf_can_scanout'
which is called before importing the dmabuf in the GPU if the
direct_display dmabuf is being set. If that's true and the check
failed, we refuse to create a wl_buffer.

This patch avoids importing in the GPU.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Add weston-direct-display server side implementation
Marius Vlad [Sat, 16 Nov 2019 17:22:48 +0000 (19:22 +0200)]
libweston: Add weston-direct-display server side implementation

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoprotocol: Add weston-direct-display extension
Marius Vlad [Sat, 16 Nov 2019 16:55:17 +0000 (18:55 +0200)]
protocol: Add weston-direct-display extension

Weston extension to assure clients that the dmabuf buffer will be
forwarded directly to the display controller.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: drop a misleading dmabuf comment
Pekka Paalanen [Thu, 14 Nov 2019 13:23:42 +0000 (15:23 +0200)]
libweston: drop a misleading dmabuf comment

This comment was added in 230f3b1bf896fcf3fa76b4d7093122b3361f7e36 with the
intent that if we had an information table about pixel formats (which we do
have today), we could implement more sanity checks like ensuring that width
pixels fit into stride.

Daniel Vetter said on #dri-devel IRC recently:

< danvet> since userspace shouldn't look at stride for buffers with
modifiers, only pass it around unchanged

I asked for clarification. It was expected that userspace would not do any kind
of sanity checks as modifiers could change everything.

Let's remove the misleading code comment so that people don't get the idea of
adding more well-intended but ill-advised sanity checks. If more checks are
added, they must take the modifier into account, which the existing checks do
not do.

After 5 years, it is far too late to remove our existing sanity checks, but we
can attempt to not cause any more damage that would restrict what people can do
in the kernel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agocompositor: Fix some warning when passing debugoptimized to meson
Marius Vlad [Wed, 13 Nov 2019 09:40:26 +0000 (11:40 +0200)]
compositor: Fix some warning when passing debugoptimized to meson

Increase the buf size such it can accomodate sufficiently large local
buffers. Spotted whilst looking for something else.

../compositor/main.c:157:22: warning: ‘%s’ directive output may be
truncated writing up to 511 bytes into a region of size 128
[-Wformat-truncation=]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                      ^~             ~~~~~~~
../compositor/main.c:157:21: note: directive argument in the range
[-92233720368547759223372036854775]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                     ^~~~~~~~~~~~~~
../compositor/main.c:157:2: note: ‘snprintf’ output between 7 and 659
bytes into a destination of size 128
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158 |    timestr, (tv.tv_usec / 1000));
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoAdd include for missing symbols
Eero Tamminen [Wed, 13 Nov 2019 11:34:30 +0000 (11:34 +0000)]
Add include for missing symbols

Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/303
5 years agobackend-drm: Added support for legacy fd_import
Nicholas Niro [Wed, 30 Oct 2019 02:13:09 +0000 (22:13 -0400)]
backend-drm: Added support for legacy fd_import

This patch reenables the function drm_fb_get_from_dmabuf but with legacy
fd_import support for gbm/mesa < 17.1.

5 years agobackend-drm: Fix for gbm modifiers when they are not available.
Nicholas Niro [Wed, 30 Oct 2019 01:50:54 +0000 (21:50 -0400)]
backend-drm: Fix for gbm modifiers when they are not available.

When the HAVE_GBM_MODIFIERS is unset, make the code drop back
to a single plane version like other places in the code.

5 years agosimple-dmabuf-egl: update to xdg-shell stable
Drew DeVault [Tue, 12 Nov 2019 16:22:17 +0000 (11:22 -0500)]
simple-dmabuf-egl: update to xdg-shell stable

5 years agobackend-drm: Print whenever a view could not placed on the primary due to
Marius Vlad [Sat, 19 Oct 2019 15:18:38 +0000 (18:18 +0300)]
backend-drm: Print whenever a view could not placed on the primary due to
invalid size

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Print whenever a view will reach the renderer region
Marius Vlad [Mon, 14 Oct 2019 20:15:49 +0000 (23:15 +0300)]
backend-drm: Print whenever a view will reach the renderer region

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Move plane's availability in drm_output_try_view_on_plane()
Marius Vlad [Fri, 1 Nov 2019 21:49:21 +0000 (23:49 +0200)]
backend-drm: Move plane's availability in drm_output_try_view_on_plane()

It makes much more sense to be there. It adds some additional drm_debug()
statements to provide reason for failing to place the view in the HW
plane. Makes the reason for failing more accurate.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
5 years agobackend-drm: Pass the drm_fb to each prepare_overlay/scanout_view functions
Marius Vlad [Thu, 31 Oct 2019 10:48:35 +0000 (12:48 +0200)]
backend-drm: Pass the drm_fb to each prepare_overlay/scanout_view functions

Avoids the need to retrieve the DRM framebuffer in each function and
re-uses the one got before constructing the zpos candidate list.

Takes another reference for the scanout as to live the state, like
there's one for the overlay bit.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Pass the plane to prepare_overlay_view
Marius Vlad [Thu, 24 Oct 2019 21:07:37 +0000 (00:07 +0300)]
backend-drm: Pass the plane to prepare_overlay_view

As we already have a potential plane available to use, pass it
over the _prepare_overlay_view instead of trying to find one
from the backend plane list.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
5 years agobackend-drm: Allow for views to reach overlays/underlays planes
Marius Vlad [Wed, 11 Sep 2019 15:21:59 +0000 (18:21 +0300)]
backend-drm: Allow for views to reach overlays/underlays planes

In this manner we will allow views to reach the overlay (or underlays)
even if the damage tracking will detect that the new view will
occlude the view underneath it.

Renames occluded_region to planes_region, and uses occluded_region
to represent the region where we add each view's visible-and-opaque region.
Sprinkle some comments about each region.

Re-uses the view's clipped region to determine visible-and-opaque region
which is accumulated (for both renderer and HW planes cases) into
occluded_region. The current view's clipped_region is then checked against
occluded_region.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
5 years agobackend-drm: Check pixel format before constructing the zpos candidate list
Marius Vlad [Thu, 24 Oct 2019 11:49:33 +0000 (14:49 +0300)]
backend-drm: Check pixel format before constructing the zpos candidate list

We can determine if the pixel format used by the clients buffer is
scan-out capable much sooner, so do it when constructing the zpos
candidate list. It also removes the checks in their respective
prepare_ functions.

Avoids the situation where we'd need to retrieve the DRM framebuffer each time
when checking the pixel format.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Place pixel format checks for the cursor plane in its own
Marius Vlad [Sun, 13 Oct 2019 21:29:18 +0000 (00:29 +0300)]
backend-drm: Place pixel format checks for the cursor plane in its own
function

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Place pixel format checks for the overlay plane in its own
Marius Vlad [Sun, 13 Oct 2019 21:27:05 +0000 (00:27 +0300)]
backend-drm: Place pixel format checks for the overlay plane in its own
function

The idea is to place pixel the format checks in a common part and until
then, to make it available as a function so we can re-use easily.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Construct a zpos candidate list of planes
Marius Vlad [Mon, 14 Oct 2019 08:05:30 +0000 (11:05 +0300)]
backend-drm: Construct a zpos candidate list of planes

In order to better optimize view assignment to HW planes, we construct
an intermediary zpos candidate list which is used aggregate all suitable
planes for handling scan-out capable client buffers.

We go over it twice: once to construct it and once to pick-and-choose a
suitable plane based its highest zpos position.

In order to maintain the view order correctly we track current zpos
value being applied to the plane state and use it when trying to place
a view into a plane.

Pass the computed zpos value to be applied to the plane state.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
5 years agolibweston: Add a new helper to check if the view spawns the entire
Marius Vlad [Wed, 11 Sep 2019 13:53:08 +0000 (16:53 +0300)]
libweston: Add a new helper to check if the view spawns the entire
output

Helpful to determine if the view can go through the scanout or not.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Add a new helper weston_view_has_valid_buffer
Marius Vlad [Wed, 11 Sep 2019 13:41:04 +0000 (16:41 +0300)]
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>
5 years agobackend-drm: Hard-code zpos values if HW doesn't exposes them
Marius Vlad [Tue, 29 Oct 2019 15:29:37 +0000 (17:29 +0200)]
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>
5 years agobackend-drm: Add a helper to display plane type as a 'string'
Marius Vlad [Fri, 27 Sep 2019 17:45:41 +0000 (20:45 +0300)]
backend-drm: Add a helper to display plane type as a 'string'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agobackend-drm: Add zpos DRM-property
Marius Vlad [Thu, 29 Aug 2019 17:42:00 +0000 (20:42 +0300)]
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>
5 years agobackend-drm: Teach drm_property_info_populate() to retrieve range values
Marius Vlad [Fri, 1 Nov 2019 10:00:09 +0000 (12:00 +0200)]
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>
5 years agoRevert "backend-drm: Teach drm_property_info_populate() to retrieve range values"
Daniel Stone [Mon, 11 Nov 2019 16:48:54 +0000 (16:48 +0000)]
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 95e3b0deae85a9c5b96097da843ce3c254cfcee1.

5 years agobackend-drm: Teach drm_property_info_populate() to retrieve range values
Marius Vlad [Mon, 11 Nov 2019 15:24:25 +0000 (15:24 +0000)]
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>
5 years agoremoting: Use DRM FourCC formats instead of GBM formats
Daniel Stone [Mon, 11 Nov 2019 09:40:27 +0000 (09:40 +0000)]
remoting: Use DRM FourCC formats instead of GBM formats

The remoting plugin currently has a set_gbm_format() hook, which accepts
GBM_FORMAT_* tokens from the host to set as a supported format.
GBM_FORMAT_* values are strictly aliased with DRM_FORMAT_*.

In order to avoid an extra unnecessary dependency from the remoting
plugin on GBM, switch to using the formats from libdrm instead.

This fixes a compile error seen when the remoting plugin is enabled:

    ../remoting/remoting-plugin.c:39:10: fatal error: gbm.h: No such file or directory
       39 | #include <gbm.h>
          |          ^~~~~~~
    compilation terminated.

The error was caused by not having any dependency at all on GBM from
the remoting backend, which is fixed here by adding a new dependency on
the libdrm headers for drm_fourcc.h.

Signed-off-by: Daniel Stone <daniels@collabora.com>
5 years agoweston-launch: use exec to ensure signal delivery
Stefan Agner [Fri, 8 Nov 2019 23:51:29 +0000 (00:51 +0100)]
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 ff3230952a68 ("weston-launch: Run weston in the user login shell")
Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoweston-launch: show when a signal is sent to a child
Stefan Agner [Fri, 8 Nov 2019 23:50:10 +0000 (00:50 +0100)]
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>
5 years agoweston-log: Avoid prefix-matching the scope name when checking for a
Marius Vlad [Tue, 5 Nov 2019 15:08:17 +0000 (17:08 +0200)]
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>
5 years agocompositor: Pass the entire string in one-shot when writting logger data
Marius Vlad [Fri, 1 Nov 2019 12:28:22 +0000 (14:28 +0200)]
compositor: Pass the entire string in one-shot when writting logger data

This fixes the situation where the same logger scope is passed multiple
times and the timestamp is being sent before the log mesasge.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agolibweston: Init weston_output's 'destroy_signal' before timeline has a chance to...
Marius Vlad [Mon, 4 Nov 2019 15:53:46 +0000 (17:53 +0200)]
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>
5 years agocompositor: Allow protocol to be displayed when asked for, even if we're not supplyin...
Marius Vlad [Fri, 1 Nov 2019 11:45:55 +0000 (13:45 +0200)]
compositor: Allow protocol to be displayed when asked for, even if we're not supplying debug argument

This wasn't intentional it just kept the way it was done before.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoinput: use ro_anonymous_file to minimize duplication of keymap files
Sebastian Wick [Fri, 1 Nov 2019 01:38:45 +0000 (02:38 +0100)]
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>
5 years agoclients/window: bump wl_seat version to 7
Sebastian Wick [Fri, 1 Nov 2019 01:27:55 +0000 (02:27 +0100)]
clients/window: bump wl_seat version to 7

Since version 7 clients must use MAP_PRIVATE to map the keymap fd.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
5 years agoinput: bump wl_seat version to 7
Sebastian Wick [Fri, 1 Nov 2019 01:23:15 +0000 (02:23 +0100)]
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>
5 years agoclients/window: bump wl_seat version to 6
Sebastian Wick [Fri, 1 Nov 2019 01:15:10 +0000 (02:15 +0100)]
clients/window: bump wl_seat version to 6

Hook up listeners for touch shape and touch orientation.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
5 years agoinput: bump wl_seat version to 6
Sebastian Wick [Fri, 1 Nov 2019 01:09:28 +0000 (02:09 +0100)]
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>
5 years agoCI: build wayland from source
Sebastian Wick [Fri, 1 Nov 2019 16:00:40 +0000 (17:00 +0100)]
CI: build wayland from source

The next commit bumps the required Wayland version beyond what the repo
version supports.

Build wayland 1.17 into the docker image.

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
5 years agoshared: add read-only anonymous file abstraction
Sebastian Wick [Tue, 23 Jul 2019 17:15:59 +0000 (19:15 +0200)]
shared: add read-only anonymous file abstraction

The ro_anonymous_file is an abstraction around anonymous read-only files.
os_ro_anonymous_file_create creates such a file with the contents passed
in data. Subsequent calls to os_ro_anonymous_file_get_fd return a fd
that's ready to be send over the socket.
When mapmode is RO_ANONYMOUS_FILE_MAPMODE_PRIVATE the fd is only
guaranteed to be mmap-able readonly with MAP_PRIVATE but does not
require duplicating the file for each resource when memfd_create is
available. RO_ANONYMOUS_FILE_MAPMODE_SHARED may be used when the client
must be able to map the file with MAP_SHARED but it also means that the
file has to be duplicated even when memfd_create is available.

See also:
weston commit 76829fc4eaea329d2a525c3978271e13bd76c078
wayland commit 905c0a341ddf0a885811d19e2b79c65a3f1d210c

Signed-off-by: Sebastian Wick <sebastian@sebastianwick.net>
5 years agobackend-drm: make GBM optional
Stefan Agner [Tue, 9 Jul 2019 20:02:00 +0000 (22:02 +0200)]
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>
5 years agobackend-drm: separate out DRM virtual support
Stefan Agner [Mon, 8 Jul 2019 22:50:30 +0000 (00:50 +0200)]
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>
5 years agoremoting: make sure GL renderer is enabled
Stefan Agner [Sun, 21 Jul 2019 20:38:08 +0000 (22:38 +0200)]
remoting: make sure GL renderer is enabled

The remoting plug-in requires DRM virtual support which depends on
the GL renderer. Make sure the option is enabled.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agobackend-drm: use DRM_ constants everywhere
Stefan Agner [Sun, 20 Oct 2019 16:25:42 +0000 (18:25 +0200)]
backend-drm: use DRM_ constants everywhere

Use DRM_ constants for pixel formats in all cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agobuild: do not allow unresolved symbols
Pekka Paalanen [Tue, 9 Jul 2019 09:06:42 +0000 (12:06 +0300)]
build: do not allow unresolved symbols

Now that all cases of unresolved symbols have been either fixed or worked
around pending for a proper fix, we can switch the project to disallow
unresolved symbols during build. This will help catch programming mistakes
earlier.

Note, that existing Meson build directories will not automatically apply this
change. If you have an existing build directory, you must issue

meson configure -Db_lundef=true

in it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agotests: surface-screenshot needs libshared
Pekka Paalanen [Tue, 9 Jul 2019 09:02:34 +0000 (12:02 +0300)]
tests: surface-screenshot needs libshared

surface-screenshot-test.c uses file_create_dated() provided by libshared, so it
needs to link libshared.

This was not a problem when unresolved symbols during build were allowed and
the symbols was provided by the weston executable which accidentally exported
all libshared symbols. This would become a problem when we disallow unresolved
symbols project-wide, so fix it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoLink Weston plugins to libexec-weston.so
Pekka Paalanen [Tue, 9 Jul 2019 09:00:41 +0000 (12:00 +0300)]
Link Weston plugins to libexec-weston.so

All these plugins use symbols that were exported by the weston executable and
are now exported by libexec-weston.so. Linking these to libexec-weston.so fixes
unresolved symbols.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-rdp: work around unresolved symbols
Pekka Paalanen [Tue, 9 Jul 2019 08:56:05 +0000 (11:56 +0300)]
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>
5 years agocms-colord: work around unresolved symbols
Pekka Paalanen [Tue, 9 Jul 2019 08:53:14 +0000 (11:53 +0300)]
cms-colord: 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: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_set_color_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:79: undefined reference to `cmsReadTag'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:91: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:92: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:93: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_destroy_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:108: undefined reference to `cmsCloseProfile'
/usr/bin/ld: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_load_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:131: undefined reference to `cmsOpenProfileFromFile'

See also #263

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agocompositor: turn weston main() into a lib
Pekka Paalanen [Mon, 8 Jul 2019 14:12:41 +0000 (17:12 +0300)]
compositor: turn weston main() into a lib

This takes everything that was in 'weston' the executable a turns it into
library. A new trivial 'weston' executable is written.

Creating the library will allow future improvements:

- we can link weston plugins against the library, meaning that they no longer
  need unresolved symbols to be allowed during linking

- tests do not have to fork() and exec() 'weston', they can just link to the
  library and call wet_main() after setting things up; this will help with
  using a debugger

install_rpath is set so that we can install the library into weston's module
directory, away from the normal libraries in a system. This is one library we
do not intend for others to use.

The library has no stable ABI and is not versioned.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobuild: reduce sub-dependencies of libweston
Pekka Paalanen [Thu, 17 Oct 2019 13:32:34 +0000 (16:32 +0300)]
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>
5 years agobackend-x11: need libdrm headers in build
Pekka Paalanen [Thu, 24 Oct 2019 10:25:13 +0000 (13:25 +0300)]
backend-x11: need libdrm headers in build

9ddb3bc315adbc0c3951f00458fe05973fd13ef6 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>
5 years agobuild: link libdl explicitly to DRM backend
Pekka Paalanen [Thu, 17 Oct 2019 13:20:57 +0000 (16:20 +0300)]
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>
5 years agobuild: link libm explicitly
Pekka Paalanen [Thu, 17 Oct 2019 13:17:57 +0000 (16:17 +0300)]
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>
5 years agobuild: separate deps for int and ext libweston users
Pekka Paalanen [Thu, 18 Apr 2019 13:43:55 +0000 (16:43 +0300)]
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>
5 years agogitlab-ci: fix pages
Pekka Paalanen [Thu, 24 Oct 2019 09:48:43 +0000 (12:48 +0300)]
gitlab-ci: fix pages

This hopefully fixes a failure introduced in
5a0706b238987bf3dcf7dde54556850ee88ccdba:

cp: cannot stat '/builds/wayland/weston/prefix-weston-build-native-meson/share/doc/weston/*': No such file or directory

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agogitlab-ci: add build configuration without gl-renderer
Stefan Agner [Sun, 20 Oct 2019 15:19:03 +0000 (17:19 +0200)]
gitlab-ci: add build configuration without gl-renderer

Building without gl-renderer seems to fail rather often. Introduce a
specific build job which tests this configuration.

Make use of the Folded Block Scalar in YAML to concatenate the build
option string with spaces. This will make diffing build option
changes very readable.

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agoclients: avoid build error without gl-renderer
Stefan Agner [Sun, 20 Oct 2019 15:17:20 +0000 (17:17 +0200)]
clients: avoid build error without gl-renderer

Make sure gl-renderer is enabled when building the EGL and EGL
dmabuf clients. This avoids missing declaration warnings and
linking errors such as:
  ../clients/simple-dmabuf-egl.c:1142: undefined reference to `weston_check_egl_extension
  ...
  ../clients/simple-egl.c:206: undefined reference to `weston_check_egl_extension'

Signed-off-by: Stefan Agner <stefan@agner.ch>
5 years agobackend-headless: fix build issue without gl-renderer
Stefan Agner [Sun, 20 Oct 2019 14:40:07 +0000 (16:40 +0200)]
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>
5 years agoshared: Use memfd_create() when available
Emmanuel Gil Peyrot [Mon, 22 Jul 2019 13:06:20 +0000 (15:06 +0200)]
shared: Use memfd_create() when available

This (so-far) Linux-only API lets users create file descriptors purely
in memory, without any backing file on the filesystem and the race
condition which could ensue when unlink()ing it.

It also allows seals to be placed on the file, ensuring to every other
process that we won’t be allowed to shrink the contents, potentially
causing a SIGBUS when they try reading it.

This patch is best viewed with the -w option of git log -p.

It is an almost exact copy of Wayland commit
6908c8c85a2e33e5654f64a55cd4f847bf385cae, see
https://gitlab.freedesktop.org/wayland/wayland/merge_requests/4

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
5 years agodoc/sphinx: Add some documentation about timeline points
Marius Vlad [Thu, 5 Sep 2019 14:56:12 +0000 (17:56 +0300)]
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>
5 years agolibweston: Remove timeline-object and clean-up
Marius Vlad [Thu, 5 Sep 2019 13:46:31 +0000 (16:46 +0300)]
libweston: Remove timeline-object and clean-up

Removes timeline-object header and what is left of the older
timeline part.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agolibweston: Notify timeline of object modification
Marius Vlad [Tue, 15 Oct 2019 10:25:41 +0000 (13:25 +0300)]
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>
5 years agolibweston: Convert timeline points to use the timeline scope
Marius Vlad [Thu, 5 Sep 2019 11:56:12 +0000 (14:56 +0300)]
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>
5 years agolibweston: Create the 'timeline' scope
Marius Vlad [Thu, 5 Sep 2019 11:31:01 +0000 (14:31 +0300)]
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>
5 years agolibweston: Introduce timeline subscription and timeline subscription object
Marius Vlad [Thu, 5 Sep 2019 11:20:43 +0000 (14:20 +0300)]
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>
5 years agolibweston: Clean-up timeline to make room for a new approach
Marius Vlad [Thu, 5 Sep 2019 10:12:18 +0000 (13:12 +0300)]
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>
5 years agoweston-log: Add a subscription iterator
Marius Vlad [Tue, 6 Aug 2019 16:22:53 +0000 (19:22 +0300)]
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>
5 years agoweston-log-internal: Allow to hang-off data over the subscription
Marius Vlad [Mon, 29 Jul 2019 09:05:29 +0000 (12:05 +0300)]
weston-log-internal: Allow to hang-off data over the subscription

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agoweston-log: Add 'destroy_subscription' callback for the subscription
Marius Vlad [Mon, 29 Jul 2019 09:02:47 +0000 (12:02 +0300)]
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>
5 years agoweston-log: 'new_subscriber' is actually 'new_subscription'
Marius Vlad [Thu, 25 Jul 2019 08:46:44 +0000 (11:46 +0300)]
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>
5 years agolibweston: Fix rename of weston_compositor_destroy() reference
Marius Vlad [Fri, 23 Aug 2019 14:42:40 +0000 (17:42 +0300)]
libweston: Fix rename of weston_compositor_destroy() reference

Commit 284d5345ad38d 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>
5 years agoweston-log: s/scope/sub, leftover from the logging framework
Marius Vlad [Wed, 24 Jul 2019 08:38:46 +0000 (11:38 +0300)]
weston-log: s/scope/sub, leftover from the logging framework

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
5 years agotests: Fix undefined left shift in internal-screenshot-test
Adam Jackson [Wed, 16 Oct 2019 20:07:47 +0000 (16:07 -0400)]
tests: Fix undefined left shift in internal-screenshot-test

../tests/internal-screenshot-test.c:60:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

5 years agoimage-loader: Fix undefined left shift in premultiply_data
Adam Jackson [Wed, 16 Oct 2019 20:06:06 +0000 (16:06 -0400)]
image-loader: Fix undefined left shift in premultiply_data

../shared/image-loader.c:184:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

Store each channel in a uint32_t instead of a byte so we compute the shift over
an unsigned type.

5 years agolibweston: Fix integer underflow in weston_layer_mask_is_infinite
Adam Jackson [Wed, 16 Oct 2019 20:02:59 +0000 (16:02 -0400)]
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.

5 years agolibweston: fix possible crash after a view is removed the layer
Loïc Yhuel [Tue, 17 Sep 2019 18:14:56 +0000 (20:14 +0200)]
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>
5 years agocompositor: add use-gl option to headless
Pekka Paalanen [Fri, 20 Sep 2019 11:35:58 +0000 (14:35 +0300)]
compositor: add use-gl option to headless

This will allow one to run the headless backend with GL-renderer.

Implements: https://gitlab.freedesktop.org/wayland/weston/issues/278

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agoheadless, gl-renderer: support pbuffer outputs
Pekka Paalanen [Fri, 20 Sep 2019 11:23:12 +0000 (14:23 +0300)]
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>
5 years agonoop-renderer: zero-initialize struct
Pekka Paalanen [Wed, 2 Oct 2019 10:39:41 +0000 (13:39 +0300)]
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>
5 years agogl-renderer: add EGL surfaceless platform support
Pekka Paalanen [Fri, 20 Sep 2019 11:18:14 +0000 (14:18 +0300)]
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>
5 years agogl-renderer: document output_window_create
Pekka Paalanen [Thu, 19 Sep 2019 11:25:53 +0000 (14:25 +0300)]
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>
5 years agogl-renderer: document display_create
Pekka Paalanen [Thu, 19 Sep 2019 10:22:58 +0000 (13:22 +0300)]
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>
5 years agogl-renderer: display_create needs surface type
Pekka Paalanen [Thu, 19 Sep 2019 09:45:06 +0000 (12:45 +0300)]
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>
5 years agobackend-rdp: don't use shadow buffer for the RDP backend
Stefan Agner [Sun, 16 Jun 2019 21:42:58 +0000 (23:42 +0200)]
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>
5 years agoxwm: no need for compositor/weston.h
Pekka Paalanen [Fri, 4 Oct 2019 14:02:55 +0000 (17:02 +0300)]
xwm: no need for compositor/weston.h

The xwayland plugin (XWM) is a libweston plugin, so it has no business using
Weston things. Luckily its not, this was just a left-over include. Remove it to
reduce confusion.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobuild: simplify include_directories
Pekka Paalanen [Fri, 5 Apr 2019 14:09:28 +0000 (17:09 +0300)]
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>
5 years agoUnify the include style of shared/ headers
Pekka Paalanen [Fri, 5 Apr 2019 13:09:45 +0000 (16:09 +0300)]
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>
5 years agoxwm: dnd does not need cairo-util.h
Pekka Paalanen [Fri, 4 Oct 2019 12:43:55 +0000 (15:43 +0300)]
xwm: dnd does not need cairo-util.h

Turns out dnd.c does not actually need cairo-util.h. This was found when
unifying the include directives of all shared/ headers. Removing this makes one
less place to fix.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobuild: use dependency for matrix.c
Pekka Paalanen [Fri, 5 Apr 2019 10:50:43 +0000 (13:50 +0300)]
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>
5 years agobuild: shells do not need matrix.c
Pekka Paalanen [Fri, 4 Oct 2019 12:53:29 +0000 (15:53 +0300)]
build: shells do not need matrix.c

Do not build matrix.c into the shell plugins. The matrix functions are exported
by libweston.so and the shell plugins links to it.

Found by inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agogl-renderer: use EGLConfig printer for window outputs
Pekka Paalanen [Tue, 24 Sep 2019 09:56:16 +0000 (12:56 +0300)]
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>
5 years agogl-renderer: print detailed EGLConfig list
Pekka Paalanen [Mon, 23 Sep 2019 14:18:55 +0000 (17:18 +0300)]
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>
5 years agogl-renderer: improve get_egl_config errors
Pekka Paalanen [Thu, 19 Sep 2019 13:55:42 +0000 (16:55 +0300)]
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>
5 years agogl-renderer: prefer the base EGLConfig
Pekka Paalanen [Wed, 18 Sep 2019 13:41:51 +0000 (16:41 +0300)]
gl-renderer: prefer the base EGLConfig

If configless_context is not supported, we pick one EGLConfig as the "base
config" because we have just one GL context and different configs between the
context and EGLSurfaces might not work. Until now, we did not actually make
sure to pick the base config.

If the base config matches the requirements, prefer it. Only if it doesn't
match, go looking for another config.

This should give better chances of success on systems where configless_context
is not supported by relying less on eglChooseConfig().

Cc: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agogl-renderer: pbuffer config for non-surfaceless
Pekka Paalanen [Fri, 13 Sep 2019 14:31:07 +0000 (17:31 +0300)]
gl-renderer: pbuffer config for non-surfaceless

If we don't have the surfaceless_context extension, we create a pbuffer as a
dummy surface to work with. If we also don't have configless_context, then it
is possible the config used for creating the context does not support pbuffers.
Therefore, if both conditions apply, we need to pick a config that supports
both window and pbuffer surfaces.

This makes the "base" config compatible, but it does not yet guarantee that we
actually pick it again when creating the pbuffer surface. Fixing that is
another patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agogl-renderer: configs for pbuffers too
Pekka Paalanen [Fri, 13 Sep 2019 14:24:49 +0000 (17:24 +0300)]
gl-renderer: configs for pbuffers too

Fold more code into the common config choosing, the pbuffer path this time.
Simplifies code and allows gl_renderer_get_egl_config() to grow smarter in the
future to guarantee config compatility in the absence of configless_context
extension.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agogl-renderer: remove EGLConfig attributes from API
Pekka Paalanen [Mon, 30 Sep 2019 12:43:07 +0000 (15:43 +0300)]
gl-renderer: remove EGLConfig attributes from API

Now that all backends pass in a list of acceptable DRM formats, that is used to
determine if the EGLConfig has an alpha channel or not. Therefore the
opaque_attribs and alpha_attribs are now useless, and we can remove the whole
config_attribs argument from the API.

gl_renderer_get_egl_config() uses an internal attrib list that matches at least
the union of the opaque_attribs and alpha_attribs matches.

Overall, behaviour should remain unchanged.

The new attribute array becomes variable in the future, so it is left
non-const.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
5 years agobackend-x11: use DRM formats for EGLConfig
Pekka Paalanen [Mon, 30 Sep 2019 12:29:13 +0000 (15:29 +0300)]
backend-x11: use DRM formats for EGLConfig

Define a specific DRM format for the GL-renderer to render in. It goes through
fuzzy matching in egl-glue.c which ensures we get exactly the number of bits
for each channel, but does not require an exact format match.

This ensures we get the bit depth we expect instead of the first arbitrary
EGLConfig.

This should not change the current behaviour, because Mesa EGL takes care to
order the configs as apps expect.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>