Commit graph

1448 commits

Author SHA1 Message Date
Harish Krupo ee4c7a24dd window.c: Don't assume registry advertisement order
The toytoolkit assumes that wl_seats are advertised after
wl_data_device_manager and creates a data_device during wl_seat
registry binding. This patch removes this assumption by creating
data_devices for all the wl_seats created up until then.

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

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 16:24:26 +00:00
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

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

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

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

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

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

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

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Luca Weiss 923a1e9688 Fix incorrect include
In file included from ../clients/multi-resource.c:38:                                                                                       
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]                               
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>                                                                            
  ^~~~~~~
2019-04-14 10:38:25 +00:00
Kamal Pandey 53d7c243ba FIX: weston: clients: typo in simple-dmabuf-egl.c
Fix variable EGL_NO_IMAGE to EGL_NO_IMAGE_KHR in
clients/simple-dmabuf-egl.c

Signed-off-by: Kamal Pandey <pandeykamal13526@gmail.com>
2019-04-04 19:45:45 +05:30
Alexandros Frantzis ff98a9080f clients/simple-dmabuf-egl: Properly check for error in gbm_bo_get_handle_for_plane
gbm_bo_get_handle_for_plane returns handle.s32 == -1 on error, at least
for the Mesa dri implementation.

Reported-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-03-28 09:51:28 +00: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
Alexandros Frantzis 10a7339611 clients/simple-dmabuf-egl: Create the EGL display using the GBM platform
Since we are managing and rendering to buffers on our own with GBM,
create the EGL display using the GBM platform with the DRM render node,
instead of using the Wayland EGL platform.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-03-05 13:04:39 +02:00
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01: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
Michael Teyfel d6371b5a6a window client: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel a232b7e22c simple-shm: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Michael Teyfel 111d3d8fb4 simple-egl: remove ivi-application support
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
2019-02-06 17:45:09 +00:00
Alexandros Frantzis 7261edfe36 clients: Add a mandelbrot set shader to simple-dmabuf-egl
Support drawing a mandelbrot set in the fragment shader, rendering it
with separate draw calls, one for each cell in a virtual 4x4 grid. This
more complex and heavy drawing will potentially help us to visually
discover any present or future explicit synchronization issues.

The mandelbrot set rendering is enabled with the -m/--mandelbrot
command-line switch.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +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
emersion ac71ee5d6a clients: sanitize XCURSOR_SIZE
Fixes https://gitlab.freedesktop.org/wayland/weston/issues/164
2019-01-31 09:04:22 +00:00
Dima Ryazanov 13bdf25270 clients: A better fix for a crash when unlocking or unconfining a pointer
This is a rewrite of the fix in:
https://lists.freedesktop.org/archives/wayland-devel/2018-May/038140.html

It addresses Pekka's concerns about window getting destroyed before the
unlock/unconfine event is triggered.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +00:00
Dima Ryazanov 44dd7f2738 clients: Delete an unused variable
Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +00:00
Dima Ryazanov 336ce67da7 Revert "Fix a crash when unlocking or unconfining a pointer"
This reverts commit e0dc5d47cb.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2019-01-31 00:20:36 +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
Marius Vlad f7843a50ab clients/screenshot: Allow weston-screenshooter to be called directly
As is stands now, libexec/weston-screenshooter can only be called from
within weston server. This will allow weston-screenshooter to be called
on the command line. The final scope here is to allow taking screenshots
without the need of a keyboard.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad 3c7cfbbf62 clients/screenshot: Avoid using global variables to pass down data between functions
This is just cosmetic and doesn't fixes anything.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad 0161802aa0 Fix compiler warning: unused variable when building with DEBUG
clients/keyboard.c: In function 'dbg':
clients/keyboard.c:276:6: warning: variable 'l' set but not used [-Wunused-but-set-variable]
  int l;

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-15 18:37:57 +02:00
Marius Vlad acec383be0 Fix compiler warnings: invalid type format
This patch fixes the following warnings:

clients/weston-info.c: In function 'print_tablet_tool_info':
clients/weston-info.c:569:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'uint64_t' [-Wformat=]
   printf("\t\t\thardware serial: %lx\n", info->hardware_serial);
   ^
clients/weston-info.c:572:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'uint64_t' [-Wformat=]
   printf("\t\t\thardware wacom: %lx\n", info->hardware_id_wacom);

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-15 18:37:57 +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
Pekka Paalanen 9d771fc506 clients/simple-egl: include weston-egl-ext.h correctly
weston-egl-ext.h was moved to shared/ in
ffff92d592

Use the correct include path, so that Meson build does not need to add
../shared to the include path just for this.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 12:13:36 +02:00
emersion 807cd2e589 clients: configure cursor theme from XCURSOR_* env
If XCURSOR_THEME or XCURSOR_SIZE is set, use it as the cursor theme
or cursor size.

This is similar to what Qt and some X11 apps do.
2018-11-02 13:45:37 +00:00
orbitcowboy 1f3fae2f1a Fixed potential memory leaks in simple-dmabuf-drm.c found by Cppcheck. 2018-11-02 13:34:35 +00:00
emersion b49af1ed19 weston-info: add xdg-output support 2018-09-18 00:17:00 +02:00
Stefan Agner 20b241691b desktop-shell: allow to center background image
Add the centered option as background-type. This draws the image
once in the center of the screen. If the image is larger, it will
be cropped like scale-crop.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2018-09-17 14:53:03 +00:00
Stefan Agner 1c1e4fdaf4 desktop-shell: always paint background color first
Only draw the background once, using the the current default
background color or the user specified background color.

This allows for non-filling background image implemenation
while still using the specified background color.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2018-09-17 14:53:03 +00:00
Pekka Paalanen b9fdc14b2a clients: add weston-debug
A tool for accessing the zcompositor_debug_v1 interface features.

Installed along weston-info, because it should be potentially useful for
people running libweston-based compositors.

Signed-off-by: Pekka Paalanen <pq@iki.fi>

Added a man page for weston-debug client

Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
[Pekka: fixed 'missing braces aroudn initializer' warning]

Add --list and --all arguments, using interface advertisement.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2018-09-17 13:29:47 +01:00
Emilio Pozuelo Monfort cce820dcaf simple-dmabuf-drm: fix build with --disable-egl
Just rely on getting the supported formats through the dmabuf
extension.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-07-13 16:13:32 +01:00
Emilio Pozuelo Monfort 1166f8e9a1 simple-dmabuf-drm: require zwp_linux_dmabuf_v1 v3
We effectively require it as we don't react to dmabuf_format,
only to dmabuf_modifiers, so there's a chance we may not get
the supported formats information at all.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-07-13 16:13:23 +01:00
Pekka Paalanen 82dd54d943 desktop-shell: fix output removal for background/panel
When the compositor has multiple outputs (not clones) and one of them is
removed, the ones remaining to the right will be moved to close the gap.
Because reflowing the remaining outputs happens before removing the
wl_output global, we get the new output x,y before the removal. This
causes us to consider the remaining output immediately to the right of
the removed output to be a clone of the removed output whose x,y don't
get updated. That will then hit the two assertions this patch removes.

The reason the assertions were not actually hit is because of a
compositor bug which moved the remaining outputs in the wrong direction.
The next patch will fix the reflow, so we need this patch first to avoid
the asserts.

Remove the assertions and hand over the background and panel if the
"clone" does not already have them. If the clone already has them, we
destroy the unnecessary background and panel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marius Vlad <marius-cristian.vlad@nxp.com>
2018-07-05 10:38:25 +03:00
Yong Gan bc04d70336 client: Fix segmentation fault in the case weston-nested
eglTerminate should be called before the display was disconnected.

Signed-off-by: Yong Gan <yong.gan@nxp.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-06-07 18:07:08 +01:00
Daniel Stone 3a80ca0629 simple-dmabuf-drm: Fallback DRM_FORMAT_MOD_LINEAR definition
Just in case we're running on something quite old.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-06-07 08:55:39 +01:00
Louis-Francis Ratté-Boulianne b79dead1dd clients: add a new touchscreen calibrator
The new calibrator uses weston_touch_calibration protocol extension and
provides the following features:

- chooses the physical touch device to be calibrated by DEVPATH or by
  the output/head name; device enumeration provided

- the compositor ensures the calibrator window is shown in the correct
  position and size

- no matter how wrong the old calibration is, the touch events will
  always arrive in the application

- the calibration is complete, not incremental; the received touch
  events are guaranteed to be unmodified

- computes a libinput style calibration matrix directly, not the
  WL_CALIBRATION format

- supports multiple touch devices: calibrate one device at a time, and
  show user feedback on touching a wrong device instead of recording bad
  data

- uses four touch point samples: three to compute the calibration, and
  one to verify the calibration is roughly correct

- consistent exit codes

- upload the new calibration into the server after successful
  and verified calibration

Due to using special touchscreen calibration protocol extension, this
application cannot be tested without touch input from the compositor.

Practically all of the above mentioned are unlike how the old
calibrator client worked.

Co-developed by Louis-Francis and Pekka.

v2:
- improve help() text
- rename wrong_touch_handler() to invalid_touch_handler()
- improve debug prints by adding sample number
- reorganize code into sample funcs vs. touch funcs
- add a state machine to properly process touch and related events

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:46:24 +03:00
Markus Ongyerth 995bf51b2c weston-info: destroy wl_keyboard
Fixes a memory leak by calling wl_keyboard_destroy on any keyboard
that was used to listen for events.

Signed-off-by: Markus Ongyerth <wl@ongy.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 13:34:46 +03:00
Markus Ongyerth ccdc81d609 weston-info: Add support for tablet-unstable-v2
This now prints each tablet seat with at least one tablet/pad/tool
attached.
For each tablet seat, each tablet, pad and tool is printed with as much
detail about the device as the protocol provides.
Seat info is stored to be referenced, because the protocol requires to
request a tablet_seat for each wl_seat and it's not guaranteed that the
tablet_v2_manager is available when seats are advertised.

Signed-off-by: Markus Ongyerth <wl@ongy.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 13:33:13 +03:00
Dima Ryazanov e0dc5d47cb Fix a crash when unlocking or unconfining a pointer
In GNOME (but not in Weston), if a window loses focus, the client first receives
the focus event, then the unlock/unconfine event. This causes toytoolkit to
dereference a NULL window when unlocking or unconfining the pointer.

To repro:
- Run weston-confine
- Click the window
- Alt-Tab away from it

Result:

[1606837.869] wl_keyboard@19.modifiers(63944, 524352, 0, 0, 0)
[1606837.926] wl_keyboard@19.leave(63945, wl_surface@15)
[1606837.945] wl_pointer@18.leave(63946, wl_surface@15)
[1606837.956] wl_pointer@18.frame()
[1606837.961] zwp_confined_pointer_v1@26.unconfined()
Segmentation fault (core dumped)

To fix this, get the input from the window instead of the other way around.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-29 13:26:53 +03:00