Commit Graph

587 Commits

Author SHA1 Message Date
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
Marius Vlad 5d767416c1 libweston/compositor-drm: Print composition mode in weston-debug
This fixes the situation when using only plane-state mode for
compositing there's no obvious debug message stating that. This patch
makes it slightly better/easier to dermine what mode the compositor is
using currently.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:07 +02:00
Marius Vlad 7d070ca0ba Fix compiler warnings generated by older toolchains/compiler
This fixes warnings like ``may be used uninitialized''

libweston/compositor-drm.c: In function 'drm_device_is_kms':
libweston/compositor-drm.c:6374:12: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
  b->drm.id = id;

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-15 18:37:53 +02:00
Daniel Stone 8011b0fa03 Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.

More information at http://mesonbuild.com

Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.

This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.

It is expected that the autotools build system will be removed soon
after the next Weston release.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:50:54 +02:00
David Fort 7b7d9d316a rdp-compositor: fix compilation with FreeRDP 2.0-rc4
Some members have been removed from FreeRDP structs, so let's use local
variables.
2018-12-04 23:42:27 +01:00
Marius Vlad 00a6e01d53 compositor: Make pixel format printing in human-friendly form
This would make weston-debug much more readable when looking at
the pixel format of the buffer.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-11-20 18:00:25 +02:00
Marius Vlad a9a630401f pixel-formats: Added pixel_format_get_info_shm() helper for printing SHM buffers
In current form SHM buffers pixel format can only be printed as 0 and 1.
With the help of this helper we align with DRM_FORMAT_ pixel format.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-11-20 18:00:09 +02:00
Pekka Paalanen 62a9436417 compositor-drm: parse all DRM format names
Use the pixel format table to parse format names. This makes the parser
recognize almost all DRM format names.

Not all formats are usable, but we rely on the use to fail
appropriately. What we can use depends on the drivers anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Pekka Paalanen f5ed7431e5 pixel-formats: search by name
Add a function to find a format description by the DRM format name. This
will be useful when parsing configuration strings.

While at it, fix the two function formattings in pixel-formats.h to
match everything else in the file.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Pekka Paalanen e7c91b61c7 pixel-formats: add name string
There is often a need to print the name of a pixel format. Printing the
raw numeric value is hard to decipher, printing the four ASCII
characters is slightly more human-friendly but still needs a decoder
table. Add a name that can be printed easily.

The bulk of this patch was done with:
sed -i -e 's/\.format = DRM_FORMAT_\(.\+\),/DRM_FORMAT(\1),/' libweston/pixel-formats.c

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Arkadiusz Hiler 5a5cbc0245 compositor-drm: Log atomic commits and flips
Add a couple log points for tracking atomic commits and flip processing.

Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-11-03 09:13:09 +00:00
Vasilis Liaskovitis 486b463a18 gl-renderer, pixman: disconnect the client on unhandled buffer type.
Introduce a helper function to disconnect the client on unhandled
buffer types, and use it in the gl and pixman renderers. The function
is modeled after linux_dmabuf_buffer_send_server_error.

Also print the egl error state in the gl renderer, in case the
unrecognized buffer error happens when querying an egl buffer.

https://gitlab.freedesktop.org/wayland/weston/issues/148
2018-11-02 14:28:05 +00:00
Deepak Rawat a864f58f44 compositor-drm: Read FB2_MODIFIERS capability
Not all drivers support fb2 modifiers so read the capability before
using drmModeAddFB2WithModifiers.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2018-11-02 13:28:34 +00:00
Tomohito Esaki b1fb00dbcd compositor-drm: Add Support virtual output
Add support virtual output for streaming image to remote output by
remoting-plugin which will be added by the patch:
"Add remoting plugin for output streaming."
The gbm bo of virtual output is the linear format.

Virtual output is implemented based on a patch by Grigory Kletsko
<grigory.kletsko@cogentembedded.com>.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 718a40b49c compositor-drm: store gbm bo flags in drm_output
Store usage flags of gbm bo in drm_output in order to specify the bo
format for each output. A following patch will add a new type of
drm_output which requires different gbm_bo_flags.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 1506e99fd3 gl-renderer: provide fence sync fd for synchronizing with GPU rendering
Add new API to gl-renderer interface for providing fence sync fd. the
backend can wait for GPU rendering by this API.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 4976b09a7e compositor-drm: add num_planes to drm_fb structure
Add new member to store number of planes to drm_fb structure.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Emil Velikov da4f185faa libweston: print EGL information as early as possible
In the case where CreateContext/MakeCurrent fails, we still want to
know what the EGL driver is capable of.

Move the EGL info printing, just after the eglInitialize() call to
ensure that.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-10-18 16:14:05 +01:00
Emil Velikov 3bb047b605 libweston: split EGL and GL info logging
Split the two into separate functions. Former requires an initialized
EGL display, while the latter a current context.

We will use that distinction with the next patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-10-18 16:14:03 +01:00
Daniel Stone bff27cb835 compositor-drm: Don't warn about missing backlight control
Not every output will have a backlight control, and even if it does we
may just not be able to find it. Not having backlight control isn't an
error, so don't spam the log with it, as doing so can confuse users into
thinking this is an actual error which is responsible for their real
problems.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-23 11:21:40 +02:00
Daniel Stone a65d55e133 gl-renderer: Remove warning on missing extensions
Not having swap_buffers_with_damage could cause a performance impact on
some backends, but at least on GBM it causes no issues. It also seems to
confuse users into thinking it's a legitimate error which could explain
session slowness.

Similarly with buffer_age, whilst we do lose a little bit of performance
by not being able to do partial renders, it is not a great deal, and the
user is unlikely to be able to do anything about it in any event.

Remove the warning; we print the full extension list at startup, so we
already have enough information from the logs to easily diagnose any
real errors.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-23 11:21:40 +02:00
Philipp Zabel 61dc4ca92e compositor-drm: check connector non-desktop property and mark head accordingly
Use the DRM connector "non-desktop" property to mark weston_heads that
represent head mounted displays and other non-standard displays that the
desktop should not be extended to.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-23 09:18:00 +00:00
Philipp Zabel c18ffd3939 libweston: add weston_head_{is,set}_non_desktop()
Add non-desktop property for weston_heads representing displays that the
desktop should not be extended to by default, e.g. head mounted displays.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-23 09:18:00 +00:00
Philipp Zabel fff2797c88 compositor-drm: use weston_view_is_opaque()
Implement drm_view_is_opaque() using weston_view_is_opaque(). Also, use
weston_view_is_opaque() directly in drm_output_propose_state(), with the
clipped_view.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-18 19:22:20 +02:00