Commit graph

34 commits

Author SHA1 Message Date
Pekka Paalanen 949b2eb751 clients: rewrite screenshot.c for new protocol
The functionality of this screenshooting helper client is kept exactly
the same as before: if you have multiple outputs, some transformed, some
scale, in any layout, this will create a "multi-image" where the
framebuffer (the physical image) of each output is pasted into a row of
images in the order the outputs were advertised thrugh wl_registry.
Output transform or scale are not accounted for. If you have a monitor
rotated sideways, the screenshot will have the image of that monitor
reverse-sideways.

Otherwise the client is almost completely re-written, so trying to read
the diff is not that useful.

The old screenshooting protocol is replaced with the new
weston-output-capture protocol. This makes it unnecessary to listen for
wl_output information (since we do not handle output transform or scale
anyway).

The buffer sizes and formats are dictated by the compositor, which also
means we cannot hardcode the format. Hence, use Pixman for the blitting,
in case it needs to do format conversion. It is good to get rid of
hand-crafted pixel data manipulation code too.

For that reason we also need a pixel format database to convert between
DRM fourcc, wl_shm and Pixman codes. We link to libweston to borrow its
database instead of inventing another partial copy of it. It's weird to
use compositor library private API in a client, but better than the
alternative.

The original code had no tear-down code at all. Now, if everything
succeeds, the program ends with no unfreed memory according to ASan. If
something fails, it still YOLO's it (doesn't free stuff). That's how far
my pedantry carried.

I also did not bother taking output transform or scale into account,
since the old code did not either. It would be nice to create a seamless
image of the desktop with shots rotated and scaled to align, in the max
scale over all outputs. Meh.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:12:32 +02:00
Simon Ser 9b455e24a2 clients/simple-dmabuf-egl: drop Y_INVERT flag
The motivations for this are:

- Y_INVERT is not used by most real-world clients.
  weston-simple-dmabuf-egl and weston-simple-dmabuf-v4l are one only
  known users. Thus this creates a special case just for these demo
  clients.
- Some compositors (wlroots) have dropped support for DMA-BUF flags,
  so the client no longer runs there.
- Dropping the flag allows compositors to use a KMS hardware plane to
  display the buffer.

It keeps the same axis orientation we had in place where we had the
y-invert flag enabled by default, by doing a reflection about x-axis.

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/675
2022-11-07 11:28:29 +02:00
Robert Mader 62ab6891db clients/simple-egl: Handle buffer scale and transform
Buffer scale is common enough in the modern desktop space to
expect average GL clients to handle it. Thus lets include it into
our main example client.

While on it, also handle buffer transforms. It's essentially free
for GL clients in terms of computing power but may increase the
chance that Wayland compositors are able to hit scanout fast paths.
Thus having an example client for it is likely valueabel for client
and compositor developers.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-31 12:08:06 +00:00
Robert Mader 572ad2d8a9 clients/simple-dmabuf-*: Use gbm_bo_create_with_modifiers2
It is used in Mesa. Lets switch to it as well in order to provide
good examples and encourage proper API usage.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-05-23 13:25:34 +00:00
Simon Ser 778c0683c0 clients/simple-dmabuf-feedback: use presentation-time
Print a message when presentation switches to/from zero-copy mode.
This makes it easier to understand whether the compositor DMA-BUF
feedback was effective.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-27 14:21:55 +02:00
Simon Ser 7e70f9016a clients: drop weston-info
Users should rely on wayland-info from wayland-utils [1] instead.
We've been printing a deprecation since 85382d394a ("clients:
deprecate weston-info"), so users should be aware already.

[1]: https://gitlab.freedesktop.org/wayland/wayland-utils/

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-02-03 16:19:27 +00:00
Marius Vlad 3c5e6c536f clients/meson:build: Conditionally build dmabuf-feedback client
As mesa includes gbm_bo_get_fd_for_plane() from 21.1.0 version onwards,
build the dma-buf feedback client only after that. This should provide
some sanity for package maintainers, as this would need pulling a
rather newer mesa version to build it (which might not be available).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-12 13:39:04 +00:00
Leandro Ribeiro 18d9ad98b1 clients: add client to test the dma-buf feedback implementation
Simple client to test the dma-buf feedback implementation. This does not
replace the need to implement a dma-buf feedback test that can be run in
the CI. But as we still don't know exactly how to do this, this client
can be helpful to run tests manually.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2021-11-25 11:16:54 -03:00
Marius Vlad eb53d7c156 multi-resource: Convert to xdg-shell
Convert remaining wl_shell client to xdg-shell.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-14 09:28:04 +00:00
Marius Vlad 539c5a6c95 simple-touch: Convert to xdg-shell
wl_shell is officially deprecated so remove support for it and
instead add support for xdg-shell.  With it, we've further:

- moved out the buffer handling into its own a distinct structure in
  case we might want to do multi-buffer rendering
- perform a redraw after we have receiving the initial configure event,
  as to draw to working area where to user can use it for receving touch
  events

Additionally we are setting an appid in case one might want to use it in
tandem with kiosk-shell as to be able to place it on a
distinct/different output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-10-14 09:28:04 +00:00
Marius Vlad ab2c72b05c clients/simple-dmabuf-v4l: Add 'weston-direct-display' protocol
Makes use of weston-direct-display protocol to pass the dmabuf
straight to the display-controller if such a path is possible.

Removes the Y_INVERT flag in case that was passed, and notifies
the user about it, as the weston implementation would force going
through the renderer when passing the Y_INVERT flag, but in the same
time direct-display avoids any GPU import so having them both in the
same time would result into weston refusing the create a buffer.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-01-29 14:39:04 +00:00
Michael Forney ba3b384b93 clients/presentation-shm: Add missing dependency on xdg-shell protocol
Signed-off-by: Michael Forney <mforney@mforney.org>
2019-12-18 18:51:55 +00:00
Simon Ser 0a4f6e7d6d
clients: drop simple-dmabuf-drm
This client contains driver-specific code to allocate buffers. However clients
shouldn't contain driver-specific code and should rely on e.g. mesa to allocate
buffers via standard interfaces.

Additionally, because the build system always tries to enable all features, some
experimental drivers and drivers that aren't included in amd64 distribution
packages were required. Users would need to manually disable some drivers.
Releasers would need to install libdrm from source (because the release process
forbids adding custom build flags). Dropping simple-dmabuf-drm simplifies both
building and releasing.

The functionality previously tested via simple-dmabuf-drm can now be tested with
simple-dmabuf-egl.

Signed-off-by: Simon Ser <contact@emersion.fr>
2019-11-28 15:20:13 +01:00
Harish Krupo 7bcbab1f2f clients/window: Add viewport destination support
Add support for setting the widget's destination wp viewport.
Setting it in the widget instead of being set directly by the client
ensure that the widget can be identified in widget_find_widget.

v2: Return -1 on error (Pekka)
    Scale allocated x and y when viewport is set (Pekka)
    Allow user to set -1 for viewport width and height (Pekka)

v3: Use NULL instead of 0 (Daniel)
    return 0 if width and height are -1 (Daniel)

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
2019-11-25 21:54:40 +00:00
Marius Vlad 21627136b2 clients/simple-dmabuf-drm: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:58 +02:00
Marius Vlad 4ee832d361 clients/simple-dmabuf-egl: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:53 +02:00
Drew DeVault a1eeaf48c6 simple-dmabuf-egl: update to xdg-shell stable 2019-11-12 11:35:56 -05:00
Stefan Agner 88c8f69a2f 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>
2019-10-24 09:09:33 +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 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
Ankit Nautiyal 8b40deaaaa clients: Add content-protection client app
This patch adds a client app which can be used to show the
implementation of weston content-protection protocol. The app can
request for Type-0 and Type-1 content or request for disabling
content-protection to the content-protection server.
It listens for the content-protection status change event from the
server and accordingly display the required content.

The content Type-0, Type-1 and unprotected contents are prepared
using cairo surface, with different color and text to distinguish
between the contents.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-07-05 14:13:30 +05:30
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

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

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

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen cbffca980b meson: link editor with gobject-2.0
editor.c calls g_clear_object(), so it should link to gobject directly instead
of relying on pangocairo pulling it in in its pkg-config.

Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/211

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 09:43:23 +00:00
ant8me f99fac22ab clients: use xdg_shell stable instead of v6
Now that Weston supports the stable revision, use it. Better to excercise the
current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- rename shell to wm_base
- fix continued line alignment
- drop unrelated change of adding parentheses around bit-wise and

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 11:18:38 +00:00
Alexandros Frantzis a95bb6f7e5 clients: Support explicit synchronization in simple-dmabuf-egl
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>

Changes in v7:
  - Merge acquire fence and release fence code blocks in redraw().
  - Use 1 << n to define option bitflags.
  - Remove redundant statement involving OPT_IMPLICIT_SYNC.

Changes in v6:
  - Add option for window size.
  - Add option for enabling/disabling explicit sync.

Changes in v5:
  - Meson support.
2019-02-06 12:21:56 +00:00
Pekka Paalanen fb61e45de2 meson: friendly error for simple-dmabuf-drm
This is probably the most annoying ones. Some distributions do not even package
a libdrm_${driver} if the driver's hardware does not occur on the CPU
architecture, e.g. Debian x86_64 does not have libdrm_etnaviv.

Helps people to disable those.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-01-17 14:39:27 +00:00
Alexandros Frantzis 9985c534b8 clients/simple-dmabuf-egl: Render a moving square
Render a moving square instead of just clearing the buffer, to help
uncover rendering issues (e.g. modifier-related issues) which may not be
visible with a simple glClear.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-01-17 14:04:05 +02:00
Alexandros Frantzis e9700f62af clients/simple-dmabuf-egl: Support dmabuf format modifiers
Take into account format modifiers advertised by the compositor and the
EGL implementation and supported by the buffer creation mechanism, to
select the optimal buffer modifier.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-01-17 14:04:05 +02:00
Pekka Paalanen 4b29ffddaa meson: contain and check simple-dmabuf-egl deps
Check the egl, glesv2 and gbm dependencies locally instead of relying on
the dep_* variables from the top level meson.build or
libweston/meson.build (dep_gbm).

This should make these dependencies now explicitly checked when the app
is built, rather than relying on other components doing the checks. If
the drm-backend was disabled, this would have probably hit an error
using the undeclared variable dep_gbm.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 182d3771dd meson: fix pangocairo being optional
Cannot use dependency() directly in the structure, because it will
execute regardless of the option. Instead, let's store the dependency
name in the structure and use the same logic as with simple_clients to
conditionally look for the dependencies.

As a bonus, this brings friendly error messages to demo-clients
dependencies.

subsurfaces' dependencies are also converted to maintain consistency
with simple_clients.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 11:16:16 +02:00
Alexandros Frantzis b100668426 clients: Add simple-dmabuf-egl
Add a client that uses EGL/GLESv2 to draw to dmabuf buffers, utilizing
EGLImages and FBOs. The client uses GBM to create the dmabufs buffers.

The simple-dmabuf-egl client is partly based on patch [1] that changes
dmabuf clients to use GBM instead of libdrm code, but has been greatly
simplified since in this case we don't require direct pixel access or
non-RGBA formats.

[1] https://patchwork.freedesktop.org/patch/239796/

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2018-12-18 17:25:09 +02:00
Marius Vlad d85fe29c1f compositor: Install weston-screenshooter in BINDIR
Previously weston-screenshooter was installed in LIBEXECDIR, but given
that now it can be invoked by the user whenever debug protocol is
enabled, let's intall it into BINDIR. This way, it can be invoked
without the need to modify PATH.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +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