platform/upstream/weston.git
6 years agocompositor-drm: Add to_drm_mode helper
Daniel Stone [Wed, 16 Nov 2016 11:51:27 +0000 (11:51 +0000)]
compositor-drm: Add to_drm_mode helper

Much like we already have to_drm_output and to_drm_backend.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoxwm: do not include shadow in input region
Ian Ray [Thu, 18 Jan 2018 11:44:04 +0000 (11:44 +0000)]
xwm: do not include shadow in input region

The window frame was created with position and size which include
an offset for margins and shadow.  Set the input region to ignore
shadow.

[daniels: Fixed type mismatch, removed unused variable.]

Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Scott Moreau <oreaus@gmail.com>
6 years agocompositor: Implement runtime output transform changes
Ilia Bozhinov [Sun, 25 Jun 2017 12:21:39 +0000 (12:21 +0000)]
compositor: Implement runtime output transform changes

Up to now we could set the transform only on output initialization.
However, on certain situations(like tablets and convertible laptops),
screen orientation can change while the compositor is running and thus
the need for change of the output transform arises.

When the transform changes, we must update the output geometry,
output->region and output->previous_damage, as well as send this change
to clients. We also have to check whether any of the pointers are inside
the output which is being rotated. If this is the case, they are moved
to the new center, because otherwise the pointer is stuck outside of the
screen ans "lost" to the user.

What is more, after calling this function compositors should check if
any view is now outside of the screen and move it according to their
wish.

Signed-off-by: Ilia Bozhinov <iliyabo@hotmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: return conservative format list if dmabuf import modifiers unsupported
Philipp Zabel [Wed, 17 Jan 2018 16:54:32 +0000 (17:54 +0100)]
gl-renderer: return conservative format list if dmabuf import modifiers unsupported

If the EGL_EXT_image_dma_buf_import_modifiers extension is not
supported, let gl_renderer_query_dmabuf_formats return a hardcoded
fallback list. That list contains ARGB8888, XRGB8888, and if the
GL_EXT_texture_rg extension is supported, YUYV, NV12, YUV420, and
YUV444.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolinux-dmabuf: send deprecated format events
Michael Tretter [Wed, 17 Jan 2018 16:54:31 +0000 (17:54 +0100)]
linux-dmabuf: send deprecated format events

Although the format event is deprecated, some clients, especially the
GStreamer waylandsink, only support zwp_linux_dmabuf_v1 version 1 and
require the deprecated format event.

Send format events instead of the modifier event, if the client binds on
a protocol version before version 3, skipping formats that only support
non-linear modifiers.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodmabuf: set modifier to invalid for not supporting clients
Emre Ucan [Tue, 9 Jan 2018 13:00:30 +0000 (14:00 +0100)]
dmabuf: set modifier to invalid for not supporting clients

modifier_hi and modifier_lo are set to 0 by clients,
which are not supporting modifiers. Modifier attributes
of buffers of these clients set to 0 too in linux-dmabuf.c

import_simple_dmabuf function in gl-renderer.c compares
modifier attribute of the buffer with DRM_FORMAT_MOD_INVALID.
DRM_FORMAT_MOD_INVALID is equal to ((1ULL<<56) - 1).
Therefore, modifer 0 is accepted as valid. Then, the function
checks support for eglQueryDmaBufModifiersEXT.
If it is not supported import_simple_dmabuf function is returning
NULL.

This patch sets the modifier attribute to DRM_FORMAT_MOD_INVALID
for clients which are not supporting modifiers. Without this patch
linux-dmabuf protocol is not working for not supporting clients.

Fixes: b138d7afb3a2a7d51dccb12f08d70c2d86766901 ("gl-renderer: Ignore INVALID modifier")
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Tomohito Esaki <etom@igel.co.jp>
6 years agogl-renderer: always enable unpack subimage and RG textures in ES3 contexts
Arnaud Vrac [Wed, 17 Jan 2018 18:36:35 +0000 (19:36 +0100)]
gl-renderer: always enable unpack subimage and RG textures in ES3 contexts

The GL_EXT_unpack_subimage and GL_EXT_texture_rg are part of the core ES
3.0 specification, so also check the GL driver version in addition to
the extension string to determine if those features are supported.

This allows using those extensions on some GL drivers that do not expose
them in the extensions string, but still support OpenGLES3.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: move GL_EXT_texture_rg extension check
Arnaud Vrac [Wed, 17 Jan 2018 18:36:34 +0000 (19:36 +0100)]
gl-renderer: move GL_EXT_texture_rg extension check

This is a GL extension and not EGL, so it should be checked after the
EGL context has been created.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: try to create a GLES3 context
Arnaud Vrac [Wed, 17 Jan 2018 18:36:33 +0000 (19:36 +0100)]
gl-renderer: try to create a GLES3 context

GL drivers might allow using GLES3 features even in GLES2 contexts, but
that's not always the case. To make sure we can use GLES3, first try to
create a GLES3 context and then fallback to GLES2 on failure.

The reported GL version is used to determine which GLES version is
actually available.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: save OpenGL version in renderer context
Arnaud Vrac [Wed, 17 Jan 2018 18:36:32 +0000 (19:36 +0100)]
gl-renderer: save OpenGL version in renderer context

This will allow to make some assumptions in further patches when GLES3
is available.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: Don't repaint if no damage
Daniel Stone [Mon, 14 Nov 2016 17:46:59 +0000 (17:46 +0000)]
compositor-drm: Don't repaint if no damage

If we don't have any damage for the primary plane, then don't force a
repaint; simply reuse the old buffer we already have.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Remove NULL checks in switch_mode
Daniel Stone [Sat, 7 Oct 2017 13:01:45 +0000 (14:01 +0100)]
compositor-drm: Remove NULL checks in switch_mode

Calling switch_mode with no output or mode never makes any sense. Drop
the NULL checks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Use drm_plane for scanout plane
Daniel Stone [Tue, 16 Jan 2018 15:37:33 +0000 (15:37 +0000)]
compositor-drm: Use drm_plane for scanout plane

Use a real drm_plane to back the scanout plane, displacing
output->fb_{last,cur,pending} to their plane-tracked equivalents.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Use drm_plane for cursor plane
Daniel Stone [Tue, 19 May 2015 19:02:41 +0000 (20:02 +0100)]
compositor-drm: Use drm_plane for cursor plane

Change the type of cursor_plane from a weston_plane (base tracking
structure) to a drm_plane (wrapper containing additional DRM-specific
details), and make it a dynamically-allocated pointer.

Using the standard drm_plane allows us to reuse code which already deals
with drm_planes, e.g. a common cleanup function.

This patch introduces a 'special plane' helper, creating a drm_plane
either from a real KMS plane when using universal planes, or a fake plane
otherwise. Without universal planes, the cursor and primary planes are
hidden from us; this helper allows us to pretend otherwise.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Introduce drm_plane_is_available
Daniel Stone [Sat, 7 Oct 2017 11:59:02 +0000 (12:59 +0100)]
compositor-drm: Introduce drm_plane_is_available

Helper for the pattern of checking whether or not a plane can be used on
an output during the current repaint cycle.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Introduce drm_plane_state structure
Daniel Stone [Mon, 14 Nov 2016 16:57:01 +0000 (16:57 +0000)]
compositor-drm: Introduce drm_plane_state structure

Track dynamic plane state (CRTC, FB, position) in separate structures,
rather than as part of the plane. This will make it easier to handle
state management later, and much more closely tracks what the kernel
does with atomic modesets.

The fb_last pointer previously used in drm_plane now becomes part of
output->state_last, and is not directly visible from the plane itself.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Introduce drm_output_state structure
Daniel Stone [Fri, 11 Nov 2016 19:11:49 +0000 (19:11 +0000)]
compositor-drm: Introduce drm_output_state structure

Currently this doesn't actually really do anything, but will be used in
the future to track the state for both modeset and repaint requests.
Completion of the request gives us a single request-completion path for
both pageflip and vblank events.

This merges the timing paths for scanout and plane-but-but-atomic-plane
content.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agocompositor-drm: Add shutting_down flag
Daniel Stone [Thu, 5 Oct 2017 15:27:21 +0000 (16:27 +0100)]
compositor-drm: Add shutting_down flag

Does what it says on the box: is true when the compositor is shutting
down.

When we begin to use universal planes, we need divergent destruction
paths. With universal planes, the drm_planes are created at backend
initialisation time, and destroyed with the backend. However, without
universal planes, we create per-output drm_planes to hold the
primary/scanout and cursor planes, whose lifetime is tied to the output.

We will use the new shutting_down flag to determine if output
destruction is hot-unplug or compositor shutdown, and make a decision on
whether or not to destroy the special planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoUnconditionally add linux-dmabuf’s protocol to BUILT_SOURCES
Emmanuel Gil Peyrot [Sun, 7 Jan 2018 11:09:27 +0000 (12:09 +0100)]
Unconditionally add linux-dmabuf’s protocol to BUILT_SOURCES

This was preventing weston-info from building if both
weston-simple-dmabuf-drm and weston-simple-dmabuf-v4l2 were disabled at
build-time.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reported-by: Cedric Sodhi <manday@openmail.cc>
Tested-by: Cedric Sodhi <manday@openmail.cc>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoconfigure: fix sys/sysmacros.h check
Pekka Paalanen [Mon, 18 Dec 2017 08:02:58 +0000 (10:02 +0200)]
configure: fix sys/sysmacros.h check

This patch is a copy of
https://cgit.freedesktop.org/mesa/drm/commit/?id=7040fea0280bad527ed4b3d5eee7d7bfbf303efc
by Adam Jackson.

Commit 43c5a65b034a243700cf9c5bfbe6bcefb15f1161 "configure.ac: use
AC_HEADER_MAJOR to detect major()/minor()" started using AC_HEADER_MAJOR
to detect the header where major() is defined. This caused a regression
on systems where glibc is still providing a deprecated definition of
major() through sys/types.h, leading to a bunch of compiler warnings:

/home/pq/git/weston/libweston/launcher-logind.c: In function ‘launcher_logind_open’:
/home/pq/git/weston/libweston/launcher-logind.c:182:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
  fd = launcher_logind_take_device(wl, major(st.st_rdev),

The issue has been discussed earlier on
https://lists.gnu.org/archive/html/autoconf/2016-09/msg00013.html

Work around the issue by causing the warning to trigger a build failure
inside AC_HEADER_MAJOR test, so that we get MAJOR_IN_SYSMACROS defined.

Cc: Adam Jackson <ajax@redhat.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoweston: add --drm-device option for DRM-backend
Pekka Paalanen [Tue, 28 Mar 2017 15:14:37 +0000 (18:14 +0300)]
weston: add --drm-device option for DRM-backend

Developers with testing rigs having multiple graphics cards plugged in
often want to test things on a specific card. We have ways to choose a
card through seat assignments, but configuring that run by run is
awkward.

Add a command line option for opening a specific DRM device.

v2: call it --drm-device instead of --device

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: add specific_device configuration option
Pekka Paalanen [Tue, 28 Mar 2017 15:04:27 +0000 (18:04 +0300)]
compositor-drm: add specific_device configuration option

Developers with testing rigs having multiple graphics cards plugged in
often want to test things on a specific card. We have ways to choose a
card through seat assignments, but configuring that run by run is
awkward.

Add a new DRM backend option to try to open a specific device, and quit
if it fails.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Add test for pointer axis events
Alexandros Frantzis [Mon, 18 Dec 2017 10:16:55 +0000 (12:16 +0200)]
tests: Add test for pointer axis events

Add test to verify the server correctly emits pointer axis events.  This
requires updating the weston-test protocol with a new request for
pointer axis events.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agotests: Add test for touch event timestamps
Alexandros Frantzis [Wed, 13 Dec 2017 11:27:58 +0000 (13:27 +0200)]
tests: Add test for touch event timestamps

Add test to verify that the server correctly sets the timestamps of
touch events. This requires updating the weston-test protocol with a new
request for touch events.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agotests: Add test for keyboard key event timestamps
Alexandros Frantzis [Wed, 13 Dec 2017 11:27:57 +0000 (13:27 +0200)]
tests: Add test for keyboard key event timestamps

Add test to verify that the server correctly sets the timestamps of
keyboard key events. This requires updating the weston-test protocol to
support passing key event timestamps.

simple_keyboard_test now uses the create_client_with_keyboard_focus()
helper function which changes the initial state of the surface to be
focused. This leads to one additional iteration of the test loop when
starting, during which the surface is deactivated, i.e., loses focus.
After this initial iteration the test continues as before.

Furthermore, simple_keyboard_test now uses the send_key() helper
function which performs a roundtrip internally. To account for this, the
client_roundtrip() function is now directly called in the loop only when
it is still required, i.e., when deactivating the surface.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agotests: Add checks for pointer motion and button event timestamps
Alexandros Frantzis [Wed, 13 Dec 2017 11:27:55 +0000 (13:27 +0200)]
tests: Add checks for pointer motion and button event timestamps

Enhance the existing pointer motion and button event tests to
additionally verify the event timestamps. This requires updating the
weston-test protocol to support passing motion and button event
timestamps.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add timespec_to_proto helper function
Alexandros Frantzis [Wed, 13 Dec 2017 11:27:54 +0000 (13:27 +0200)]
shared: Add timespec_to_proto helper function

Add helper function to convert from struct timespec values to tv_sec_hi,
tv_sec_lo, tv_nsec triplets used for sending high-resolution timestamp
data over the wayland protocol. Replace existing conversion code with
the helper function.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add timespec_from_proto helper function
Alexandros Frantzis [Wed, 13 Dec 2017 11:27:53 +0000 (13:27 +0200)]
shared: Add timespec_from_proto helper function

Add helper function to convert tv_sec_hi, tv_sec_lo, tv_nsec triplets,
used for sending high-resolution timestamp data over the wayland
protocol, to struct timespec values. Replace existing conversion code
with the helper function.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agordp compositor: add a man page and add links to that page
David Fort [Fri, 15 Dec 2017 14:23:59 +0000 (15:23 +0100)]
rdp compositor: add a man page and add links to that page

6 years agotests: Use separate test cases for pointer motion and button tests
Alexandros Frantzis [Mon, 4 Dec 2017 13:34:04 +0000 (15:34 +0200)]
tests: Use separate test cases for pointer motion and button tests

Split pointer motion and pointer button tests so that each test case is
more focused and self-contained.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agotests: Move wl_pointer tests to their own file
Alexandros Frantzis [Mon, 4 Dec 2017 13:34:03 +0000 (15:34 +0200)]
tests: Move wl_pointer tests to their own file

Move wl_pointer tests from event-test.c to their own pointer-test.c
file. This move makes the test organization clearer and more consistent,
and will make addition of further pointer tests easier.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: drop return type from ::query_dmabuf_{formats, modifiers}
Emil Velikov [Tue, 5 Dec 2017 14:26:16 +0000 (14:26 +0000)]
libweston: drop return type from ::query_dmabuf_{formats, modifiers}

Nobody checks for the bool returned by these functions. At the same
time: a) the functions set the respective num_foo to zero on error and
b) callers honour that variable.

Just drop the return type - it's useless.

Note: this is an ABI break.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: use correct pixel shader for NV12 format uploaded to RG texture
Arnaud Vrac [Wed, 29 Nov 2017 14:25:35 +0000 (15:25 +0100)]
gl-renderer: use correct pixel shader for NV12 format uploaded to RG texture

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Fixes: 00a03d2f724 ("gl-renderer: add support of WL_SHM_FORMAT_NV12")
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: fix pixel format used in texture uploads when using R/RG textures
Arnaud Vrac [Wed, 29 Nov 2017 14:25:34 +0000 (15:25 +0100)]
gl-renderer: fix pixel format used in texture uploads when using R/RG textures

In glTexImage2D / glTexSubImage2D calls, the only pixel formats allowed
for the GL_R8 and GL_RG internal formats are respectively GL_RED and
GL_RG [1].

Make sure we match this requirement, as some drivers will fail with the
current code.

[1] https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml, Table 2

Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Fixes: 00a03d2f724 ("gl-renderer: add support of WL_SHM_FORMAT_NV12")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolibweston-desktop/xwayland: Make sure racy surfaces are properly mapped
Quentin Glidic [Fri, 8 Dec 2017 10:10:53 +0000 (11:10 +0100)]
libweston-desktop/xwayland: Make sure racy surfaces are properly mapped

This fixes a race between Xwayland committing the surface content via
the wl_surface, and the XWM setting the role of the surface.
We now keep track of the (first) content commit on the surface and
forward it to the shell when we finally get the role.
There is no need to track later changes, as the only way for Xwayland to
unmap a surface is to destroy it.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agoconfigure.ac: drop spurious bracket
Guido Günther [Fri, 8 Dec 2017 19:46:34 +0000 (20:46 +0100)]
configure.ac: drop spurious bracket

Otherwise configure output looks like

    checking for library containing pam_open_session... -lpam
    ./configure: line 18064: ]: command not found
    checking for COLORD... yes

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolibweston-desktop: add signal for title/app-id changes
Matt Hoosier [Tue, 5 Sep 2017 13:05:49 +0000 (08:05 -0500)]
libweston-desktop: add signal for title/app-id changes

As discussed on
https://lists.freedesktop.org/archives/wayland-devel/2017-August/034720.html,
it's useful for the shell implementation to know when these change,
for example to relay the information on to taskbars or similar.

To avoid ABI changes or the need to make the weston_desktop_surface
definition public, new functions are introduced for attaching
listeners to these signals.

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoxwm: Use Pango to draw title string if available
Louis-Francis Ratté-Boulianne [Mon, 13 Nov 2017 21:20:56 +0000 (16:20 -0500)]
xwm: Use Pango to draw title string if available

If Weston is built with Pango, use it to render the title for
X11 applications and Weston toy toolkit clients. It allows us
to ellipsize the title when there isn't enough space to show the
whole string.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoxwm: Deal with title in a smarter way when there isn't enough space
Louis-Francis Ratté-Boulianne [Mon, 13 Nov 2017 21:20:55 +0000 (16:20 -0500)]
xwm: Deal with title in a smarter way when there isn't enough space

The title in X11 windows and Wayland application using Weston toy
toolkit were placing the title in a very naive fashion. It was
only try to center the string in the title bar. This patch:

 * Makes sure the title isn't renderer underneath buttons;
 * Move the title to the left if the titlebar isn't large enough;
 * Clip the end of the title if needed.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoxwm: Maximize windows when double-clicking on title bar
Louis-Francis Ratté-Boulianne [Mon, 13 Nov 2017 21:20:50 +0000 (16:20 -0500)]
xwm: Maximize windows when double-clicking on title bar

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoxwm: Only send configure a window if the new size is different
Louis-Francis Ratté-Boulianne [Mon, 13 Nov 2017 21:20:52 +0000 (16:20 -0500)]
xwm: Only send configure a window if the new size is different

If we configure a window with the same size and wait for the
sync alarm to go off, the resizing is gonna block. The event is
only handled is the size actually changed.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoxwm: Handle third data entry in client messages
Ilia Bozhinov [Sat, 24 Jun 2017 17:53:02 +0000 (17:53 +0000)]
xwm: Handle third data entry in client messages

A single client message can be used to modify two properties at once.
That's why when processing such messages we have to check both the second
and the third data entry for states that we must handle.

Signed-off-by: Ilia Bozhinov <iliyabo@hotmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodesktop-shell: Handle the fullscreen to maximized case safely
Derek Foreman [Fri, 6 Oct 2017 19:37:45 +0000 (14:37 -0500)]
desktop-shell: Handle the fullscreen to maximized case safely

When a client transitions from maximized to fullscreen to maximized (run
weston-terminal, maximize it, hit f11 twice) we're sending size 0,0 for
the unfullscreen configure, which still has maximized set.

This results in clients correctly picking any size they like, and weston
disconnecting them for it.

Instead, pass the correct maximized size.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodesktop-shell: refactor maximized size calculation into its own function
Derek Foreman [Fri, 6 Oct 2017 19:37:44 +0000 (14:37 -0500)]
desktop-shell: refactor maximized size calculation into its own function

We need to calculate maximized size to resolve a bug with unsetting
fullscreen, might as well share the code.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: add a create_test_surface function
Emilio Pozuelo Monfort [Fri, 3 Feb 2017 15:10:37 +0000 (16:10 +0100)]
tests: add a create_test_surface function

This doesn't attach a buffer to the surface. This is needed for the
next commit, where we have a test case with a surface that doesn't
have a buffer attached.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoinput: Do not override keyboard focus on restore
Quentin Glidic [Fri, 21 Jul 2017 12:02:40 +0000 (14:02 +0200)]
input: Do not override keyboard focus on restore

If we start a special (grabbing) client when Weston is unfocused, it
would lose focus when coming back to Weston.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-x11: Implement mode switching
Armin Krezović [Fri, 28 Oct 2016 22:26:46 +0000 (00:26 +0200)]
compositor-x11: Implement mode switching

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclients: simple-egl: Restore window size when un-maximized
Tomohiro Komagata [Mon, 4 Dec 2017 19:40:31 +0000 (19:40 +0000)]
clients: simple-egl: Restore window size when un-maximized

The window position was correct but the window size was wrong
when simple-egl returns from maximized window to un-maximized.
Its size should be restored to original size.

Signed-off-by: Tomohiro Komagata <tomohiro.komagata.aj@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconfigure.ac: use AC_HEADER_MAJOR to detect major()/minor()
Sergei Trofimovich [Wed, 31 May 2017 21:17:50 +0000 (22:17 +0100)]
configure.ac: use AC_HEADER_MAJOR to detect major()/minor()

This change slightly updates c4d7f66c12853b9575366dd9f4a7960ec5694934
which added <sys/sysmacros.h> inclusion.

Autoconf has AC_HEADER_MAJOR to find out which header defines
reqiured macros:
    https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html

This change should increase portability across other libcs.

Bug: https://bugs.gentoo.org/610652
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agooption-parser: replace int/0/1 with bool/false/true
Eric Engestrom [Wed, 24 May 2017 20:23:15 +0000 (21:23 +0100)]
option-parser: replace int/0/1 with bool/false/true

These are already used as bools by all callers, let's make that official.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoconfig-parser: fix `short_name` type
Eric Engestrom [Wed, 24 May 2017 20:23:14 +0000 (21:23 +0100)]
config-parser: fix `short_name` type

This field is populated with chars, compared to chars and printed as
a char. It should probably be a char.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston-resizor: Don't add new frame callbacks every click
Derek Foreman [Wed, 8 Feb 2017 21:05:54 +0000 (15:05 -0600)]
weston-resizor: Don't add new frame callbacks every click

The frame callback added on button click re-adds itself when done,
so adding a new one every click resulted in an ever increasing
number of callbacks.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: remove unneeded cast
Emil Velikov [Mon, 31 Jul 2017 19:45:20 +0000 (20:45 +0100)]
gl-renderer: remove unneeded cast

The variable num is of EGLint type.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agocompositor-drm: fix z-order inversion in plane assignment
Matt Hoosier [Thu, 24 Aug 2017 14:24:20 +0000 (09:24 -0500)]
compositor-drm: fix z-order inversion in plane assignment

As discussed in the following thread:

https://lists.freedesktop.org/archives/wayland-devel/2017-August/034755.html

the existing plane assignment in the DRM backend is vulnerable to
accidental masking of the intended fullscreen surface. This change
adds a simple stateful memory to the plane assignment algorithm
to prevent that.

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston: added missing header time.h
Valery Kartel [Wed, 9 Aug 2017 11:27:29 +0000 (14:27 +0300)]
weston: added missing header time.h

without it I can't built weston on alpinelinux

Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Fix integer overflows on 32-bit systems
Alexandros Frantzis [Fri, 1 Dec 2017 17:28:52 +0000 (19:28 +0200)]
tests: Fix integer overflows on 32-bit systems

Ensure that the integer type used in expressions involving
multiplication with NSEC_PER_SEC is large enough to avoid overflows on
32-bit systems. In the expressions fixed by this patch a 64-bit type
(long long) is required.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agodnd: Abort with an error message if compositor doesn't support drag and drop
Derek Foreman [Thu, 20 Apr 2017 19:31:37 +0000 (14:31 -0500)]
dnd: Abort with an error message if compositor doesn't support drag and drop

This test isn't particularly useful when the compositor doesn't support
drag and drop - so bail if we fail to create a data source.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoclients: Don't crash when compositor doesn't support drag and drop
Derek Foreman [Thu, 20 Apr 2017 19:31:36 +0000 (14:31 -0500)]
clients: Don't crash when compositor doesn't support drag and drop

display_create_data_source() can return NULL when there's no data device
manager present.  Instead of carrying on blindly, test its return value.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoweston-info: Add support for zwp_linux_dmabuf_v1
Emmanuel Gil Peyrot [Tue, 3 Oct 2017 13:36:21 +0000 (14:36 +0100)]
weston-info: Add support for zwp_linux_dmabuf_v1

This now prints each (format, modifier) tuple, to show which ones the
compositor sends to its clients.  It is only implemented for version 3+,
since I didn’t have any compositor implementing previous versions, and
the old `format` event is deprecated anyway.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Mark tests as used so they don’t get removed at link time
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:07 +0000 (19:48 +0100)]
tests: Mark tests as used so they don’t get removed at link time

Without this attribute, the test macros were making Weston fail to
build with LTO enabled.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agotests: Add one more indentation level to some macros
Emmanuel Gil Peyrot [Fri, 14 Apr 2017 18:48:06 +0000 (19:48 +0100)]
tests: Add one more indentation level to some macros

This is a preparatory patch for the next one.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agogl-renderer: Set pitch correctly for subsampled textures
Daniel Stone [Thu, 5 Oct 2017 14:31:26 +0000 (15:31 +0100)]
gl-renderer: Set pitch correctly for subsampled textures

zwp_linux_dmabuf_v1 allows clients to pass an explicit pitch for each
plane, but wl_shm only takes a single pitch parameter; the pitch for
secondary planes must be inferred.

Multi-plane sub-sampled textures have partial width/height, e.g.
YUV420/I420 has a full-size Y plane, followed by a half-width/height U
plane, and a half-width/height V plane.

GStreamer's waylandsink - the only user of wl_shm YUV formats - expects
the implementation to follow the example of Xv and implicitly divide the
pitch for secondary planes by the subsampling factor. gl-renderer was
not doing this, and instead just using the (larger) stride provided by
the client for all planes in the buffer.

Fix gl-renderer to divide pitch by the subsampling factor when uploading
from subsampled SHM buffers into GL textures, also dividing co-ordinates
when doing offset partial uploads.

Tested with:
  $ gst-launch-1.0 videotestsrc ! waylandsink

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Tested-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
Acked-by: Vincent ABRIOU <vincent.abriou@st.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: fdeefe42418 ("gl-renderer: add support of WL_SHM_FORMAT_YUV420")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103063

6 years agoclients/editor: Toggle panel visibility on click
Joshua Watt [Sat, 24 Jun 2017 21:03:42 +0000 (16:03 -0500)]
clients/editor: Toggle panel visibility on click

If the --click-to-show option is specified, clicking an input field will toggle
the input panel visiblity

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
6 years agotext-backend: Allow client hiding of input panel
Joshua Watt [Sat, 24 Jun 2017 21:03:41 +0000 (16:03 -0500)]
text-backend: Allow client hiding of input panel

Previously, the hide_input_panel and show_input_panel messages for the text
input protocol were limited to specific cases, such as showing the panel on
activation, or making the panel visible after activation. Now, clients are
allowed to toggle the panel visiblity at will as long as they are the currently
active client

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
6 years agoman: mention logind for launching
Pekka Paalanen [Tue, 31 Oct 2017 09:29:25 +0000 (11:29 +0200)]
man: mention logind for launching

Logind has been long supported as means to launch Weston without
weston-launch. It's good to note it in the manual.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agocompositor-drm, compositor-fbdev: stop suggesting root
Pekka Paalanen [Tue, 31 Oct 2017 08:19:48 +0000 (10:19 +0200)]
compositor-drm, compositor-fbdev: stop suggesting root

Stop suggesting to run Weston as root, it is only meant for debugging.
Instead, mention the two supported ways to run Weston on DRM and fbdev:
weston-launch helper and logind service.

Cc: "Ucan, Emre (ADITG/ESB)" <eucan@de.adit-jv.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: added forgotten "using" word.]

6 years agoweston-launch: improve help text for -u and -t
Pekka Paalanen [Wed, 1 Nov 2017 10:20:24 +0000 (12:20 +0200)]
weston-launch: improve help text for -u and -t

Explain that -u requires root and -t requires -u. Most importantly,
document in what format does -t expect the tty to be given.

It has been confusing, because Weston's --tty option takes an integer,
weston-launch takes a full device path.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston-launch: fix -t option parsing
Pekka Paalanen [Wed, 1 Nov 2017 11:20:03 +0000 (13:20 +0200)]
weston-launch: fix -t option parsing

Fix an issue introduced in:

 commit ab4999492ce630e6bb1c93215fc052c2c29913bd
 Author: Kristian Høgsberg <krh@bitplanet.net>
 Date:   Fri Jul 19 21:26:24 2013 -0700

     weston-launch: Drop sleep_fork option

where the option string accidentally became "t::". That causes

$ weston-lauch -t /dev/tty4

to be parsed incorrectly, as if -t option had no argument and the tty
path gets passed to weston which errors out because of it.

This patch fixes the above to work as expected.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston-launch: quit if -t without -u
Pekka Paalanen [Wed, 1 Nov 2017 10:12:17 +0000 (12:12 +0200)]
weston-launch: quit if -t without -u

setup_tty() function uses the tty argument for choosing the tty/VT only
if wl->new_user (the -u option) is given. If the tty option is given
without -u, it will only be used for misleading error messages.

To make it clear to the user that -t without -u does not work the way
one might think, let weston-launch exit with an error in that case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
6 years agoweston: add wait-for-debugger option
Pekka Paalanen [Wed, 1 Nov 2017 08:26:46 +0000 (10:26 +0200)]
weston: add wait-for-debugger option

When you need to start Weston via weston-launch, systemd unit, or any
other runner, it is annoying to try to get in with a debugger,
especially if the thing you are interested in happens at start-up. To
make it easy, a new option is introduced.

The new option, implemented both as a command line option and a
weston.ini option, raises SIGSTOP early in the start-up, before the
weston_compositor has been created. This allows one to attach a debugger
at a known point in execution, and resume execution with SIGCONT.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Ian Ray <ian.ray@ge.com>
6 years agoweston: arm SEGV handler earlier
Pekka Paalanen [Wed, 11 Oct 2017 12:17:47 +0000 (15:17 +0300)]
weston: arm SEGV handler earlier

It is useful to print the backtrace regardless of whether we have a
compositor and a backend initialized yet. Move catch_signals() to the
earliest point in main() and protect the SEGV handler from dereferencing
NULL when we don't yet have a compositor or a backend.

The SEGV handler uses weston_log(), so cannot move catch_signals() any
earlier.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agolibweston: Use struct timespec for compositor time
Alexandros Frantzis [Thu, 16 Nov 2017 16:21:01 +0000 (18:21 +0200)]
libweston: Use struct timespec for compositor time

Change weston_compositor_get_time to return the current compositor time
as a struct timespec. Also, use clock_gettime (with CLOCK_REALTIME) to
get the time, since it's equivalent to the currently used gettimeofday
call, but returns the data directly in a struct timespec.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch motion events
Alexandros Frantzis [Thu, 16 Nov 2017 16:21:00 +0000 (18:21 +0200)]
libweston: Use struct timespec for touch motion events

Change code related to touch motion events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch up events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:59 +0000 (18:20 +0200)]
libweston: Use struct timespec for touch up events

Change code related to touch up events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for touch down events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:58 +0000 (18:20 +0200)]
libweston: Use struct timespec for touch down events

Change code related to touch down events to use struct timespec to
represent time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for key events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:57 +0000 (18:20 +0200)]
libweston: Use struct timespec for key events

Change code related to key events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for axis events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:56 +0000 (18:20 +0200)]
libweston: Use struct timespec for axis events

Change code related to axis events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for button events
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:55 +0000 (18:20 +0200)]
libweston: Use struct timespec for button events

Change code related to button events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for motion events
Alexandros Frantzis [Fri, 24 Nov 2017 16:01:46 +0000 (18:01 +0200)]
libweston: Use struct timespec for motion events

Change code related to motion events to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agolibweston: Use struct timespec for the output presentation timestamp
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:53 +0000 (18:20 +0200)]
libweston: Use struct timespec for the output presentation timestamp

Store the output presentation timestamp as struct timespec.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agobuild,libweston: Use struct timespec for animations
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:52 +0000 (18:20 +0200)]
build,libweston: Use struct timespec for animations

Change code related to animations to use struct timespec to represent
time.

This commit is part of a larger effort to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This bumps the libweston major version due to breakage in the animation
ABI. The commits following this one break more ABI in other parts.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add helpers to convert between various time units and timespec
Alexandros Frantzis [Thu, 16 Nov 2017 16:20:51 +0000 (18:20 +0200)]
shared: Add helpers to convert between various time units and timespec

Add helper functions to make it easy and less error-prone to convert
between values in various time units (nsec, usec, msec) and struct
timespec. These helpers are going to be used in the upcoming commits to
transition the Weston codebase to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoshared: Add timespec_is_zero helper
Alexandros Frantzis [Mon, 27 Nov 2017 08:54:49 +0000 (10:54 +0200)]
shared: Add timespec_is_zero helper

Add a helper function to check if a struct timespec is zero. This helper
will be used in the upcoming commits to transition the Weston codebase
to struct timespec.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoivi-shell: Fix incorrect use of logical instead of bitwise operator
Alexandros Frantzis [Fri, 17 Nov 2017 11:39:06 +0000 (13:39 +0200)]
ivi-shell: Fix incorrect use of logical instead of bitwise operator

Fix the code to use the correct bitwise AND operator '&', instead of the
currently used logical AND operator '&&', to check the value of a bit
flag in a bit mask.

This problem was reported as a warning when building with clang.

Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
7 years agobuildsystem: add missing pkg-config stub for libweston uninstalled
Reynaldo H. Verdejo Pinochet [Fri, 3 Nov 2017 19:48:31 +0000 (12:48 -0700)]
buildsystem: add missing pkg-config stub for libweston uninstalled

-uninstalled.pc files are a pkg-config facility for working with
uninstalled libraries.

With pkg-config, foo-uninstalled.pc overrides foo.pc. foo-uninstalled.pc
should never be installed, and will be generated with references to the
build directory.

If you set up your environment so pkg-config looks for .pc files in your
build directories, you can use this to build and link against libraries
you haven't installed with "make install".

This can save time and space over installing with a prefix.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agocompositor-wayland: fix shm_buffer damage init
Pekka Paalanen [Tue, 24 Oct 2017 07:28:43 +0000 (10:28 +0300)]
compositor-wayland: fix shm_buffer damage init

It appears that wayland_shm_buffer::damage is in the global coordinate
space. Therefore initializing it to width x height at 0,0 is not correct
for any output not positioned at 0,0. That is, all outputs after the
first one get it wrong.

Initialize it from the output region, which is in the global coordinate
space.

While at it, add a comment to note that damage is in global coordinate
space. As I can see, this was the last confusion about it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: fix damage coordinates with pixman renderer
Armin Krezović [Mon, 23 Oct 2017 14:10:01 +0000 (16:10 +0200)]
compositor-wayland: fix damage coordinates with pixman renderer

Damage coordinates are in global coordinate space, and they need to
be translated to local coordinate space so multiple outputs can work.

This path now matches the similar path in the X11 backend.

This patch fixes the appearance of multiple windows in the parent
compositor. Previously, all windows except the one with nested output
position 0,0 would have their damage for the parent wl_surface always
fall outside of the wl_surface, save the decorations which were handled
separately. If the parent compositor was Weston/GL, this would lead to
the output area remaining black as partial GL texture uploads would
practically never update the texture. If the parent compositor was
Weston/pixman, the parent windows would not update on screen unless
something else caused the area to be repainted.

[Pekka: adjusted commit message]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: clarify wl_display_connect() error
Pekka Paalanen [Mon, 23 Oct 2017 09:03:38 +0000 (12:03 +0300)]
compositor-wayland: clarify wl_display_connect() error

Clarify the error message to explicitly say one was trying to connect to
a parent Wayland compositor. This hopefully is a good enough hint on
what using the wayland-backend is trying to do.

Add the command line display option value and WAYLAND_DISPLAY values for
good measure. WAYLAND_SOCKET is not shown as libwayland-client removes
it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: windowed/fullscreen not on fullscreen-shell
Pekka Paalanen [Wed, 18 Oct 2017 09:31:40 +0000 (12:31 +0300)]
compositor-wayland: windowed/fullscreen not on fullscreen-shell

The set_windowed and set_fullscreen functions are only useful on a
desktop shell, and never called on fullscreen-shell.

Remove the confusing dead code, and ensure we notice if these functions
get called in the wrong environment.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: allow to unset fullscreen
Pekka Paalanen [Wed, 18 Oct 2017 09:18:39 +0000 (12:18 +0300)]
compositor-wayland: allow to unset fullscreen

To be more symmetric with wayland_output_set_fullscreen(), implement the
xdg-shell path in wayland_output_set_windowed(). This should make it
possible to use the fullscreen key binding to toggle between a floating
window and fullscreen also under xdg-shell.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: actually free parent_output
Pekka Paalanen [Thu, 19 Oct 2017 07:26:27 +0000 (10:26 +0300)]
compositor-wayland: actually free parent_output

I could not find anywhere where struct parent_output was freed, so
apparently we were leaking it.

Check against wayland_backend_register_output() and add the missing
clean-up: removal from the parent output list, and free().

registry_handle_global_remove() also needs fixing to use a safer loop,
because now we are actually removing the list item.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: fix mode_list corruption on --sprawl
Pekka Paalanen [Thu, 19 Oct 2017 10:19:50 +0000 (13:19 +0300)]
compositor-wayland: fix mode_list corruption on --sprawl

The wayland-backend with --sprawl is one way to trigger
wayland_output_create_for_parent_output(), which intends to find a mode
from the parent mode list and use it. Calling wayland_output_set_size()
initialized an embedded struct weston_mode and inserts that into the
mode list. Then the assignment output->mode = *mode; corrupts the
mode_list by overwriting the link entry. This leads to an endless loop
in bind_output() in compositor.c.

Fix this by manually doing the setup that wayland_output_set_size() did
and do not call it.

As a side effect, it now relays the parent compositor's physical output
size to our own clients. It no longer smashes the refresh rate either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: remove unused 'scale'
Pekka Paalanen [Thu, 19 Oct 2017 10:18:14 +0000 (13:18 +0300)]
compositor-wayland: remove unused 'scale'

This member is only ever set and never read, therefore it is dead.

Delete dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: avoid recursive dispatch with wl_outputs
Pekka Paalanen [Thu, 19 Oct 2017 09:03:06 +0000 (12:03 +0300)]
compositor-wayland: avoid recursive dispatch with wl_outputs

Calling wl_display_roundtrip() from within a Wayland event handler means
we will re-enter event dispatch, that is, it will lead to recursive
dispatch. Even if libwayland-client was safe, this would lead to
unexpected code paths: the first event handler function has not returned
when other event handler functions may get called. In this particular
case it maybe didn't hurt, but it's still a fragile pattern to use.

Replace the wl_display_roundtrip() with a manual sync callback to do the
work.

This does not break the wayland-backend initialization sequence, because
sprawl_across_outputs was set only after the roundtrip to ensure
wl_registry globals have been received so the code would not have been
hit anyway, and weston_backend_init() also has a second roundtrip that
ensures the per wl_output events have been received before continuing.

For wayland-backend output hotplug the change is insignificant because
it will only delay the output creation a bit, and the parent outputs are
not processed anywhere in between.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: fix boolean wayland backend options
Pekka Paalanen [Fri, 20 Oct 2017 13:22:44 +0000 (16:22 +0300)]
weston: fix boolean wayland backend options

Surprisingly, WESTON_OPTION_BOOLEAN uses the type int32_t, not bool.
Passing in a pointer bool does not end well. Fix this to pass in
pointers as parse_options() expects.

This fixes a bug where 'weston --use-pixman --sprawl' would work but
'weston --sprawl --use-pixman' would ignore the --sprawl option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xdg-shell-v6: Actually send same-as-current configure if needed
Quentin Glidic [Tue, 17 Oct 2017 14:14:49 +0000 (16:14 +0200)]
libweston-desktop/xdg-shell-v6: Actually send same-as-current configure if needed

If a surface is in state A, and we just sent a configure for state B,
setting back state A would be ignored, because state B has not been
committed yet.
Now, we check against the latest configured state (which is current
state if configure list is empty).

Reported on wlroots https://github.com/swaywm/wlroots/pull/280

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
7 years agocompositor-wayland: Don't use two different presentation methods for fs shell
Armin Krezović [Tue, 7 Feb 2017 20:03:40 +0000 (21:03 +0100)]
compositor-wayland: Don't use two different presentation methods for fs shell

This patch fixes the wayland backend to not use two different
presentation methods when running on fullscreen-shell.

See also: https://patchwork.freedesktop.org/patch/114534/

v2:

 - Add missing wayland_output_resize_surface() call
 - Start repaint loop after initial frame has been drawn

v3:

 - Redraw the initial frame if present for mode fails

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93514
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-wayland: destroy the appropriate output instead of exiting when receiving...
Sergi Granell [Wed, 27 Sep 2017 14:06:37 +0000 (16:06 +0200)]
compositor-wayland: destroy the appropriate output instead of exiting when receiving an xdg_toplevel::close event

v2: Fix use after free spotted by Daniel Stone

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-wayland: use input region instead of opaque region to zxdg_shell_v6::set_w...
Sergi Granell [Mon, 25 Sep 2017 09:57:37 +0000 (11:57 +0200)]
compositor-wayland: use input region instead of opaque region to zxdg_shell_v6::set_window_geometry

The opaque region is a few pixels off due to the rounded corners
of the frame decorations, and, therefore, the input region
matches the window's geometry more closely.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Allow disabling universal planes
Daniel Stone [Wed, 6 Sep 2017 16:29:57 +0000 (17:29 +0100)]
compositor-drm: Allow disabling universal planes

Add a test environment variable to allow disabling universal planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>