platform/upstream/weston.git
7 years agotests: Skip Xwayland test if binary isn't available
Daniel Stone [Tue, 29 Nov 2016 11:05:49 +0000 (11:05 +0000)]
tests: Skip Xwayland test if binary isn't available

We know we're not going to succeed if the binary isn't installed, so
skip the test in that case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agolibweston: Make module loading safe against long paths
Daniel Stone [Mon, 28 Nov 2016 12:13:54 +0000 (12:13 +0000)]
libweston: Make module loading safe against long paths

Avoid any buffer overflows here by checking we don't go over PATH_MAX
with stupid module names.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agocompositor-wayland: Destroy cursor images earlier
Daniel Stone [Thu, 24 Nov 2016 15:31:33 +0000 (15:31 +0000)]
compositor-wayland: Destroy cursor images earlier

Destroying a wl_cursor will attempt to access the wl_display, which
we have just freed. Avoid a segfault by destroying the cursor images
before we destroy the display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
7 years agoDon't prepend protocol/ to include paths
Daniel Stone [Thu, 24 Nov 2016 15:30:41 +0000 (15:30 +0000)]
Don't prepend protocol/ to include paths

No need to add protocol/, as it's already handled by an explicit
compiler include path.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
7 years agoeditor: Load a file if specified on command line
Bryce Harrington [Mon, 21 Nov 2016 21:26:23 +0000 (13:26 -0800)]
editor: Load a file if specified on command line

Add support for basic text file loading, to facilitate more expansive
testing of its UTF-8 text editing support.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoeditor: Use parse_options() from shared for command line options
Bryce Harrington [Mon, 21 Nov 2016 21:26:22 +0000 (13:26 -0800)]
editor: Use parse_options() from shared for command line options

Also add a basic --help option

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agocompositor-wayland: Set frame callback for Pixman
Daniel Stone [Mon, 28 Nov 2016 16:05:35 +0000 (16:05 +0000)]
compositor-wayland: Set frame callback for Pixman

Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
renderer, not just GL. Fixes a segfault when using compositor-wayland
with --use-pixman.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
7 years agogl-renderer: Fix an invalid write when closing a Weston window
Dima Ryazanov [Thu, 24 Nov 2016 02:41:00 +0000 (18:41 -0800)]
gl-renderer: Fix an invalid write when closing a Weston window

Call eglMakeCurrent before destroying the native EGL window, similar to what
other sample clients are already doing.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: Fix a use after free
Dima Ryazanov [Thu, 24 Nov 2016 13:13:12 +0000 (05:13 -0800)]
compositor-wayland: Fix a use after free

When a window is being closed, the frame_done callback often runs after
the output is already destroyed, i.e:

  wayland_output_start_repaint_loop
  input_handle_button
    wayland_output_destroy
  frame_done

To fix this, destroy the callback before destroying the output.

(Also, fix the type of output in frame_done: it's passed in
a wayland_output, not a weston_output.)

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xwayland: add is_mapped handling for XWAYLAND
Pekka Paalanen [Tue, 15 Nov 2016 12:24:21 +0000 (14:24 +0200)]
libweston-desktop/xwayland: add is_mapped handling for XWAYLAND

The xwayland window type XWAYLAND is not handled by the shell at all,
instead libweston-desktop maps such surfaces itself. However, it forgot
to set weston_surface::is_mapped and weston_view::is_mapped.

weston_surface::is_mapped affects the behaviour of weston_view_unmap()
and weston_surface_attach().

weston_view::is_mapped affects the behaviour of weston_view_unmap() and
weston_view_destroy().

When manually mapping a window of type XWAYLAND, mark both the view and
surface as mapped. This follows the expections in libweston, even though
the meaning of is_mapped is not clearly defined for either surface or
view.

Also, when the XWAYLAND window is manually unmapped, unmap the
weston_surface. This updates weston_surface::is_mapped to reflect the
state. However, as a side-effect it will also unmap all sibling views,
should any exist.

v2: rename surface_base to wsurface
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/xwayland: XWAYLAND surfaces are never 'added'
Pekka Paalanen [Tue, 15 Nov 2016 10:22:09 +0000 (12:22 +0200)]
libweston-desktop/xwayland: XWAYLAND surfaces are never 'added'

Add documentation (asserts) that show that windows of types XWAYLAND are
never registered with the shell.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xwayland: clarify 'added' logic
Pekka Paalanen [Tue, 15 Nov 2016 09:48:42 +0000 (11:48 +0200)]
libweston-desktop/xwayland: clarify 'added' logic

Setting to a constant is much easier to read and grep for than setting to
a computed variable.

There are no functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xwayland: window type XWAYLAND cannot have a parent
Pekka Paalanen [Tue, 15 Nov 2016 09:43:36 +0000 (11:43 +0200)]
libweston-desktop/xwayland: window type XWAYLAND cannot have a parent

Add an assert to ensure that a window of type XWAYLAND is never
attempted with a parent. Following the code though, the assert can be
made even stricter by allowing only TRANSIENT to have a parent.

This is essentially adding documentation.

v2: use stricter assert
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoXWM: debug position and size on map request
Pekka Paalanen [Mon, 14 Nov 2016 13:38:43 +0000 (15:38 +0200)]
XWM: debug position and size on map request

Helps debugging initial placement problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoXWM: debug position on create_notify
Pekka Paalanen [Mon, 14 Nov 2016 12:30:57 +0000 (14:30 +0200)]
XWM: debug position on create_notify

Helps debugging X11 window positioning issues.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-x11: fix segfault when use_pixman is true
Ryo Munakata [Thu, 24 Nov 2016 10:05:07 +0000 (19:05 +0900)]
compositor-x11: fix segfault when use_pixman is true

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoDon't include version.h from compositor.h
Daniel Stone [Wed, 23 Nov 2016 18:48:23 +0000 (18:48 +0000)]
Don't include version.h from compositor.h

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewd-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agotests: Extend subsurface place_{above,below} hierarchy
Daniel Stone [Tue, 22 Nov 2016 12:40:34 +0000 (12:40 +0000)]
tests: Extend subsurface place_{above,below} hierarchy

Following on from b8c16c995b, extend the family tree being tested by
place_above and place_below a little, ensuring that subsurfaces can't be
placed above or below surfaces which are related to them, but aren't
their immediate parent or sibling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agobuild: fix wayland-backend distcheck
Pekka Paalanen [Wed, 23 Nov 2016 09:46:57 +0000 (11:46 +0200)]
build: fix wayland-backend distcheck

Fix the following error from 'make distcheck':

  CC       libweston/wayland_backend_la-compositor-wayland.lo
../../libweston/compositor-wayland.c:54:51: fatal error: xdg-shell-unstable-v6-client-protocol.h: No such file or directory
 #include "xdg-shell-unstable-v6-client-protocol.h"

Files generated with the scanner belong in nodist_*_SOURCES, not with
the regular sources.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston-terminal: Fix crash on first keystroke
Derek Foreman [Tue, 22 Nov 2016 19:00:38 +0000 (13:00 -0600)]
weston-terminal: Fix crash on first keystroke

Since 894b3rcc634 weston-terminal will crash on first keystroke if you
fail to create an xkb compose state.  This can happen if you don't have
a Compose file.

Instead, now we just return uncomposed symbols.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor: allow using nested parent as a subsurface sibling
Arnaud Vrac [Wed, 8 Jun 2016 16:37:57 +0000 (18:37 +0200)]
compositor: allow using nested parent as a subsurface sibling

The parent of a subsurface can be used as a sibling in the place_below
and place_above calls. However this did not work when the parent is
nested, so fix the sibling check and add a test to check this case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: Create the drag-and-drop window in weston_wm_dnd_init
Carlos Garnacho [Mon, 22 Feb 2016 18:42:23 +0000 (19:42 +0100)]
xwayland: Create the drag-and-drop window in weston_wm_dnd_init

Just to keep it hidden so far... A lot of the plumbing necessary to
handle x11->wayland drag and drop is missing, and the current
partial handling gets in the middle for X11 drag-and-drop itself
to work.

The approach is well directed, but needs some further work, till
then, just keep our fake drag-and-drop target hidden. This allows
drag-and-drop to work between X11 clients in Xwayland, and avoids
a crash with (currently unhandled) wl_resource-less data sources.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=94218

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Add move (without scale) animation
Quentin Glidic [Wed, 10 Aug 2016 13:53:33 +0000 (15:53 +0200)]
libweston: Add move (without scale) animation

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell/client: Add left/right panel position (basic) support
Quentin Glidic [Thu, 23 Jun 2016 16:55:24 +0000 (18:55 +0200)]
desktop-shell/client: Add left/right panel position (basic) support

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell/client: Introduce helper variables
Quentin Glidic [Thu, 23 Jun 2016 16:55:23 +0000 (18:55 +0200)]
desktop-shell/client: Introduce helper variables

These variables will be much more useful in the following commit.
The indentation is off to avoid future diff noise.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell/client: Parse the clock format once
Quentin Glidic [Thu, 23 Jun 2016 16:55:22 +0000 (18:55 +0200)]
desktop-shell/client: Parse the clock format once

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell/client: Use a proper enum for clock format
Quentin Glidic [Thu, 23 Jun 2016 16:55:21 +0000 (18:55 +0200)]
desktop-shell/client: Use a proper enum for clock format

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell: Properly position the panel surface
Quentin Glidic [Thu, 23 Jun 2016 16:55:20 +0000 (18:55 +0200)]
desktop-shell: Properly position the panel surface

Now weston actually supports putting the panel at the bottom of the
screen.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell: Compute panel size without using output
Quentin Glidic [Thu, 23 Jun 2016 16:55:19 +0000 (18:55 +0200)]
desktop-shell: Compute panel size without using output

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell/client: Add bottom panel support
Quentin Glidic [Thu, 23 Jun 2016 16:55:18 +0000 (18:55 +0200)]
desktop-shell/client: Add bottom panel support

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl: Don't declare variables in for loop
Bryce Harrington [Mon, 21 Nov 2016 18:02:42 +0000 (10:02 -0800)]
gl: Don't declare variables in for loop

Fixes compilation error introduced by 43cea54c:

  libweston/gl-renderer.c:2862:2: error: ‘for’ loop initial declarations
  are only allowed in C99 mode
    for (unsigned i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint);
    i++) {
    ^

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: Port to xdg-shell-v6
Armin Krezović [Mon, 21 Nov 2016 17:42:42 +0000 (18:42 +0100)]
compositor-wayland: Port to xdg-shell-v6

v2:

 - Keep wl_shell code around until xdg_shell is declared stable.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: add support of WL_SHM_FORMAT_YUYV
Vincent ABRIOU [Thu, 20 Oct 2016 14:20:11 +0000 (16:20 +0200)]
gl-renderer: add support of WL_SHM_FORMAT_YUYV

This patch allow gl-renderer to accept WL_SHM_FORMAT_YUYV buffers.
This is the pixel format supported by most of the USB webcams.

v2:
 - fix hsub Vs vsub inversion

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-x11: Move vfunc setting from set_size to enable
Armin Krezović [Fri, 28 Oct 2016 22:26:45 +0000 (00:26 +0200)]
compositor-x11: Move vfunc setting from set_size to enable

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: Destroy shm buffers on output disable
Armin Krezović [Sun, 9 Oct 2016 15:30:29 +0000 (17:30 +0200)]
compositor-wayland: Destroy shm buffers on output disable

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agocompositor-wayland: Properly clean up on backend destroy
Armin Krezović [Sun, 9 Oct 2016 15:30:28 +0000 (17:30 +0200)]
compositor-wayland: Properly clean up on backend destroy

Also remove a wrong XXX comment.

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agocompositor-wayland: Simplify fullscreen output surface handling
Armin Krezović [Sun, 9 Oct 2016 15:30:27 +0000 (17:30 +0200)]
compositor-wayland: Simplify fullscreen output surface handling

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agocompositor-wayland: Move vfunc setting from set_size to enable
Armin Krezović [Sun, 9 Oct 2016 15:30:26 +0000 (17:30 +0200)]
compositor-wayland: Move vfunc setting from set_size to enable

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
7 years agoweston-editor: Free preferred_language in text_entry_destroy
Silvan Jegen [Thu, 17 Nov 2016 20:43:06 +0000 (21:43 +0100)]
weston-editor: Free preferred_language in text_entry_destroy

Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/nested-client: call eglTerminate/eglReleaseThread at exit
Emil Velikov [Mon, 14 Nov 2016 17:08:19 +0000 (17:08 +0000)]
clients/nested-client: call eglTerminate/eglReleaseThread at exit

Do a minimalistic teardown at program exist.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agotests/buffer-count-test: teardown after the test
Emil Velikov [Mon, 14 Nov 2016 17:08:18 +0000 (17:08 +0000)]
tests/buffer-count-test: teardown after the test

Might be a bit of an overkill, but still. One should cleanup after
themselves.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: use weston_platform_destroy_egl_surface wrapper
Emil Velikov [Mon, 14 Nov 2016 17:08:17 +0000 (17:08 +0000)]
gl-renderer: use weston_platform_destroy_egl_surface wrapper

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/window: use weston_platform_destroy_egl_surface wrapper
Emil Velikov [Fri, 18 Nov 2016 19:12:58 +0000 (19:12 +0000)]
clients/window: use weston_platform_destroy_egl_surface wrapper

v2: Use correct (destroy) API (Dan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/subsurfaces: use weston_platform_destroy_egl_surface wrapper
Emil Velikov [Mon, 14 Nov 2016 17:08:15 +0000 (17:08 +0000)]
clients/subsurfaces: use weston_platform_destroy_egl_surface wrapper

... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/simple-egl: use weston_platform_destroy_egl_surface wrapper
Emil Velikov [Mon, 14 Nov 2016 17:08:14 +0000 (17:08 +0000)]
clients/simple-egl: use weston_platform_destroy_egl_surface wrapper

... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients/nested-client: destroy the EGL surface during teardown
Emil Velikov [Mon, 14 Nov 2016 17:08:13 +0000 (17:08 +0000)]
clients/nested-client: destroy the EGL surface during teardown

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoshared/platform.h: introduce weston_platform_destroy_egl_surface()
Emil Velikov [Mon, 14 Nov 2016 17:08:12 +0000 (17:08 +0000)]
shared/platform.h: introduce weston_platform_destroy_egl_surface()

Introduce the weston_platform_destroy_egl_surface() wrapper to
complement the weston_platform_create_egl_surface() one.

We'll use the former with the next patches trhoughout weston to
consistently destroy the surface as needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogl-renderer: add support for EGL_KHR_swap_buffers_with_damage
Emil Velikov [Mon, 14 Nov 2016 16:03:45 +0000 (16:03 +0000)]
gl-renderer: add support for EGL_KHR_swap_buffers_with_damage

Extension is identical to the EXT one, yet we need to check for the KHR
abbreviated extension name + entry-point.

v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agosimple-egl: add support for EGL_KHR_swap_buffers_with_damage
Emil Velikov [Mon, 14 Nov 2016 17:27:14 +0000 (17:27 +0000)]
simple-egl: add support for EGL_KHR_swap_buffers_with_damage

Functionally identical to the EXT version of the extension.

v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)
v3: do the above sed for real (Frank)

[daniels: Fixed signed vs. unsigned warning.]

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Move text_backend_* to weston.h
Quentin Glidic [Thu, 18 Aug 2016 09:15:44 +0000 (11:15 +0200)]
libweston: Move text_backend_* to weston.h

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoIgnore the OSC code for desktop notifications
Dima Ryazanov [Fri, 4 Nov 2016 06:46:02 +0000 (23:46 -0700)]
Ignore the OSC code for desktop notifications

In Fedora, bash is configured to display a desktop notification when a command
finishes (and the terminal is not focused). weston-terminal complains about it;
let's silence it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: remove unused function declaration of weston_compositor_top
Ryo Munakata [Fri, 18 Nov 2016 12:17:41 +0000 (21:17 +0900)]
libweston: remove unused function declaration of weston_compositor_top

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: Fix X11 lock file size confusion
Daniel Stone [Wed, 16 Nov 2016 16:37:05 +0000 (16:37 +0000)]
xwayland: Fix X11 lock file size confusion

The X11 lock file was somewhat opaque. Into a sized array of 16
characters, we previously read 11 bytes. 61beda653b fixed the parsing of
this input to ensure that we only considered the first 10 bytes: this
has the effect of culling a LF byte at the end of the string.

This commit more explicitly NULLs the entire string before reading, and
trims trailing LF characters only.

It also adds some documentation by way of resizing pid, an explicit size
check on snprintf's return, and comments.

Verified manually that it emits lock files with a trailing \n, as Xorg
does. Also verified manually that it ignores misformatted lock files,
but accepts either \n or \0 in the trailing position.

Related Mutter issue: https://bugzilla.gnome.org/show_bug.cgi?id=774613

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agotext-input: Clear out context->input pointer
Daniel Stone [Thu, 10 Nov 2016 15:47:56 +0000 (15:47 +0000)]
text-input: Clear out context->input pointer

If we destroy the text_input (e.g. due to surface deactivation) whilst
the IM manager (the client holding the input_method_context resource,
usually weston-keyboard) sends an event, we can hit a segfault in
text-backend. This is because we free the text_input structure, but
don't actually clear the context->input structure even when we send the
deactivate event.

This is clearly intended to be catered for, since context->input is
always checked for NULL before we relay any events.

This is enough to fix one cause of text-test failing, but it's
ultimately error-prone until we have a no-op test-shell; there is still
a race where weston-desktop-shell can launch weston-keyboard before
text-test manages to bind zwp_text_input_manager.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Maniphest Tasks: https://phabricator.freedesktop.org/T7615
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoxwayland: Fix crash when run with no input device
Tom Hochstein [Tue, 1 Nov 2016 19:14:00 +0000 (14:14 -0500)]
xwayland: Fix crash when run with no input device

Starting an xterm with no input device led to a crash
because weston_wm_pick_seat() was returning garbage and
weston_wm_selection_init() was trying to use the garbage.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoxwayland: fix lock file parsing
Pekka Paalanen [Mon, 14 Nov 2016 13:05:28 +0000 (15:05 +0200)]
xwayland: fix lock file parsing

Patch 139fcabe7cdb1f2296bf02ef917aaab84e00cd4e "xwayland: Improve error
checking for strtol call" caused a regression in the X11 unix socket
lock file parsing. Before that patch, only the first 10 characters were
considered for parsing. After the patch, the newline as the 11th
character caused strtol() to stop parsing at the 10th character which
was then considered an error as not the whole input was consumed.

The effect of the regression was that no X11 lock files were ever deemed
stale, hence stale lock files were never removed. Up till now, I have
accumulated 37 lock files, and Weston complaining for each of them on
every start it cannot parse them.

Fix this by terminating the string at the expected newline character.

Also, it looks like 'pid' was being used uninitialized, risking strtol()
reading past the end of the array. This patch fixes that too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoGet rid of the window_create_menu function
Dima Ryazanov [Mon, 14 Nov 2016 07:44:52 +0000 (23:44 -0800)]
Get rid of the window_create_menu function

It's currently unused, and there's actually no way to use it correctly.

The caller cannot free the menu that was created:
- the function only returns the window, not the menu
- there's no public API to destroy a menu object

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoterminal: Silence maybe-uninitialized warning
Quentin Glidic [Sun, 10 Jul 2016 09:00:57 +0000 (11:00 +0200)]
terminal: Silence maybe-uninitialized warning

clients/terminal.c: In function 'redraw_handler':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  struct utf8_state_machine machine;
                            ^~~~~~~

clients/terminal.c: In function 'handle_char':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Warning produced by GCC 5.3 and 6.1, with -O3.

'I found it weird that the compiler wouldn’t see that, so I re-checked
the code.

I think with -O3, this specific "for" is compile-time unlooped, and
utf8_next_char inlined.  And there is *one* path that can keep
machine.state to utf8state_start, thus triggering the warning.

Without -O3, the function is globally tagged as “changing unicode”, so
no warning is produced.

[...]

Side note: I picked 0 as the default value, but maybe in this case
0xfffd would be better?'

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
7 years agoinput: Update keyboard serial on press and release
Olivier Fourdan [Thu, 30 Jun 2016 14:01:56 +0000 (16:01 +0200)]
input: Update keyboard serial on press and release

Other compositors such as mutter update the keyboard serial for both key
press and key release, unlike weston which updates it only on key press.

When dealing with popup windows which require a match in serials, if the
event that caused the popup to be shown is a key release, then the popup
would be dismissed.

This occurs when navigating gtk+ sub-menus using the keyboard.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=768017

7 years agogl-renderer: Use EGL_KHR_no_config_context
Armin Krezović [Fri, 30 Sep 2016 12:27:38 +0000 (14:27 +0200)]
gl-renderer: Use EGL_KHR_no_config_context

This patch makes use of recently implemented
EGL_KHR_no_config_context extension in Mesa,
which superseeds EGL_MESA_configless_context.

See also (and the follow-up patch):

https://lists.freedesktop.org/archives/mesa-dev/2016-September/128510.html

v2:

 - Extend existing infrastructure for EGL_MESA_configless_context
   per suggestion from Emmanuel Gil Peyrot.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients: Fix weston-scaler source-only mode to use integer width and height
Derek Foreman [Fri, 30 Sep 2016 16:13:23 +0000 (11:13 -0500)]
clients: Fix weston-scaler source-only mode to use integer width and height

If only the source of a viewport is set, the width and height must
be integer or the protocol mandates that the compositor generate an
error.  This is because using only the source is a crop, and the
width and height become the surface size - all surface sizes must
be integer.

Weston was fixed to generate this error in bb32ccc0, however the
test app continued to use fractional co-ordinates when run as
weston-scaler -s  (which only sets the viewport source)

This leaves fractional width/height for the other cases, but uses
integer for the crop-only mode.  The descriptions in the help text
are still accurate with this change, but weston-scaler -s no longer
exits with an error.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxdg-shell: validate positioner object
Sjoerd Simons [Fri, 23 Sep 2016 07:31:23 +0000 (09:31 +0200)]
xdg-shell: validate positioner object

According to the xdg-shell v6 protocol a positioner object is only
complete if both the size and its anchor rectangle are set. Ensure the
weston clients do this and let weston be more strict on checking if a
client has done so.

This also fixes weston-terminal popups not showing up on gnome-shell
3.22.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoivi-shell: describe members of type wl_list
Ucan, Emre (ADITG/SW1) [Fri, 1 Jul 2016 09:34:50 +0000 (09:34 +0000)]
ivi-shell: describe members of type wl_list

I wrote comments on which list they are used with

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: fix surface_list to layer_list, add ivi_layout_transition_set::transition_list]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: clear unused struct members
Ucan, Emre (ADITG/SW1) [Fri, 1 Jul 2016 09:34:44 +0000 (09:34 +0000)]
ivi-shell: clear unused struct members

I removed unused members of ivi_layout* data
structs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Refactor gl_renderer_output_window_create()
Miguel A. Vico [Wed, 18 May 2016 15:50:54 +0000 (17:50 +0200)]
gl-renderer: Refactor gl_renderer_output_window_create()

This change refactors gl_renderer_output_window_create() to separate out
window surface creation code from output common creation code.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: rebased and removed unused 'gr' and 'ec']
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Add <platform_attribs> param to gl_renderer_display_create
Miguel A. Vico [Wed, 18 May 2016 15:47:59 +0000 (17:47 +0200)]
gl-renderer: Add <platform_attribs> param to gl_renderer_display_create

This change adds <platform_attribs> parameter to
gl_renderer_display_create() in case we ever want to pass non-NULL.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: removed notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Accept non-NULL empty <visual_id> arrays
Miguel A. Vico [Wed, 18 May 2016 15:48:47 +0000 (17:48 +0200)]
gl-renderer: Accept non-NULL empty <visual_id> arrays

This change modifies egl_choose_config() to accept a non-NULL but empty
<visual_id> array (i.e. n_ids == 0)

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Rename <attribs> param of gl_renderer to <config_attribs>
Miguel A. Vico [Wed, 18 May 2016 15:44:22 +0000 (17:44 +0200)]
gl-renderer: Rename <attribs> param of gl_renderer to <config_attribs>

This change renames <attribs> parameter of gl_renderer_display_create()
and gl_renderer_output_window_create() to <config_attribs> to explain
which attribs it is.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: remove notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Rename gl_renderer::output_create to output_window_create
Miguel A. Vico [Wed, 18 May 2016 15:43:00 +0000 (17:43 +0200)]
gl-renderer: Rename gl_renderer::output_create to output_window_create

No functional change. This patch renames gl_renderer_output_create() to
gl_renderer_output_window_create(), which is something more descriptive
of what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogl-renderer: Rename gl_renderer_create to gl_renderer_display_create
Miguel A. Vico [Wed, 18 May 2016 15:41:07 +0000 (17:41 +0200)]
gl-renderer: Rename gl_renderer_create to gl_renderer_display_create

No functional change. This patch only renames gl_renderer_create() to
gl_renderer_display_create(), which is something more descriptive of
what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agogl-renderer: conditionally call query_buffer while gl_renderer_attach
Vincent Abriou [Thu, 3 Nov 2016 10:15:32 +0000 (11:15 +0100)]
gl-renderer: conditionally call query_buffer while gl_renderer_attach

While gl_renderer_attach, query_buffer should be call only if the
query_buffer function exists ie when has_bind_display is true.

v2:
 - Take into account Giulio's remark. Use has_bind_display viariable to test if
   EGL_WL_bind_wayland_display extension is supported.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agolibweston: fix building issue when EGL support is not enabled
Vincent Abriou [Tue, 11 Oct 2016 11:47:03 +0000 (13:47 +0200)]
libweston: fix building issue when EGL support is not enabled

weston-egl-ext.h has been include in compositor-xx.c file in order to
define EGL_PLATFORM_xxx_KHR extensions used by the compositors.
But in case EGL support is not enabled, all EGL related definition must
be skipped except EGL_PLATFORM_xxx_KHR that must be still defined to
allow compositor-xx.c to build.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoxwayland: Move includes to avoid deprecation warnings
Daniel Stone [Mon, 31 Oct 2016 14:51:18 +0000 (14:51 +0000)]
xwayland: Move includes to avoid deprecation warnings

compositor.h already helpfully defines WL_HIDE_DEPRECATED for us, so we
don't get warnings about wl_buffer (in particular) being deprecated when
we have wayland-server headers defining it as deprecated, and then
wayland-client headers using the type.

Move it to be before all our other includes, so we actually make use of
it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoclients: Make XKB compose support conditional
Daniel Stone [Thu, 20 Oct 2016 13:45:58 +0000 (14:45 +0100)]
clients: Make XKB compose support conditional

Debian Jessie's version of libxkbcommon is too old for compose support,
so rather than force people to upgrade, let's make it conditional.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoAdd configuration option for no input device.
Daniel Díaz [Fri, 21 Oct 2016 19:03:13 +0000 (14:03 -0500)]
Add configuration option for no input device.

As it has been discussed in the past [1], running Weston
without any input device at launch might be beneficial for
some use cases.

Certainly, it's best for the vast majority of users (and
the project) to require an input device to be present, as
to avoid frustration and hassle, but for those brave souls
that so prefer, this patch lets them run without any input
device at all.

This introduces a simple configuration in weston.ini:
  [core]
  require-input=true

True is the default, so no behavioral change is introduced.

[1] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025193.html

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agolibweston-desktop: destroy wl_shell_surface after the wl_surface is destroyed
Giulio Camuffo [Wed, 28 Sep 2016 19:32:11 +0000 (21:32 +0200)]
libweston-desktop: destroy wl_shell_surface after the wl_surface is destroyed

The wl_shell_surface spec says that it is destroyed automatically by the
server when the wl_surface is destroyed, and indeed it does not have a
destroy request. So, do that.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-wayland: Convert fullscreen flag to bool
Armin Krezović [Thu, 13 Oct 2016 10:01:43 +0000 (12:01 +0200)]
compositor-wayland: Convert fullscreen flag to bool

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agosimple-im: Rename source file to be consistent with other client tools
Bryce Harrington [Tue, 11 Oct 2016 23:24:05 +0000 (16:24 -0700)]
simple-im: Rename source file to be consistent with other client tools

Except for weston-info, client source files are not prefixed "weston-".

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
8 years agosimple-im: Use the appropriate enum names to xkb calls
Bryce Harrington [Tue, 11 Oct 2016 23:17:39 +0000 (16:17 -0700)]
simple-im: Use the appropriate enum names to xkb calls

XKB_KEYMAP_COMPILE_NO_FLAGS and XKB_CONTEXT_NO_FLAGS are both defined as
0 so no functional change here, just improved code clarity.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
8 years agosimple-im: Use returns from main() consistently
Bryce Harrington [Tue, 11 Oct 2016 23:08:10 +0000 (16:08 -0700)]
simple-im: Use returns from main() consistently

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
8 years agowindow: Fix 'devlivery' misspelling
Bryce Harrington [Tue, 11 Oct 2016 23:06:44 +0000 (16:06 -0700)]
window: Fix 'devlivery' misspelling

8 years agoclients: Add XKB compose key support
Bryce Harrington [Mon, 10 Oct 2016 22:31:47 +0000 (15:31 -0700)]
clients: Add XKB compose key support

This adds single-symbol compose support using libxkbcommon's compose
functionality.  E.g., assuming you have the right alt key defined as
your compose key, typing <RAlt>+i+' will produce í, and <RAlt>+y+= will
produce ¥.  This makes compose key work for weston-editor,
weston-terminal, weston-eventdemo, and any other clients that use
Weston's window.* routines for accepting and managing keyboard input.

Compose sequences are loaded from the system's standard tables.  As
well, libxkbcommon will transparently load custom sequences from the
user's ~/.XCompose file.

Note that due to limitations in toytoolkit's key handler interface, only
compose sequences resulting in single symbols are supported.  While
libxkbcommon supports multi-symbol compose strings, support for passing
text buffers to Weston clients is left as future work.

This largely obviates the need for the weston-simple-im input method
client, which had provided a very limited compose functionality that was
only available in clients implementing the zwp_input_method protocol,
and with no mechanism to load system or user-specified compose keys.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53648
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
8 years agocompositor-wayland: Convert draw_initial_frame to boolean
Armin Krezović [Sun, 9 Oct 2016 15:30:25 +0000 (17:30 +0200)]
compositor-wayland: Convert draw_initial_frame to boolean

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-wayland: Convert sprawl flag to boolean
Armin Krezović [Sun, 9 Oct 2016 15:30:23 +0000 (17:30 +0200)]
compositor-wayland: Convert sprawl flag to boolean

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-wayland: Convert use-pixman flag to boolean
Armin Krezović [Sun, 9 Oct 2016 15:30:22 +0000 (17:30 +0200)]
compositor-wayland: Convert use-pixman flag to boolean

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agogl-renderer: add support of WL_SHM_FORMAT_NV12
Vincent Abriou [Wed, 5 Oct 2016 12:54:35 +0000 (14:54 +0200)]
gl-renderer: add support of WL_SHM_FORMAT_NV12

This patch allow gl-renderer to accept WL_SHM_FORMAT_NV12 buffers.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agogl-renderer: add support of WL_SHM_FORMAT_YUV420
Vincent Abriou [Wed, 5 Oct 2016 12:54:34 +0000 (14:54 +0200)]
gl-renderer: add support of WL_SHM_FORMAT_YUV420

This patch allow gl-renderer to accept WL_SHM_FORMAT_YUV420 buffers.

In a gstreamer pipeline, the support of the WL_SHM_FORMAT_YUV420 by
weston avoid pixel conversion between software decoders and waylandsink.
Indeed, software decoders output I420 (YUV420 planar) that will
match with WL_SHM_FORMAT_YUV420.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agolibweston: include weston-egl-ext.h in drm, x11 and wayland compositor
Vincent Abriou [Wed, 5 Oct 2016 14:14:07 +0000 (16:14 +0200)]
libweston: include weston-egl-ext.h in drm, x11 and wayland compositor

As to what is done for gl-renderer.c, weston-egl-ext.h should be
include in compositor-drm.c, compositor-x11.c and compositor-wayland.c.
This fix building issue with GPU that does not have EGL_PLATFORM_xxx_KHR
in their extension header file eglext.h.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agocompositor-rdp: Properly destroy the renderer and pixman image
Armin Krezović [Fri, 30 Sep 2016 12:11:15 +0000 (14:11 +0200)]
compositor-rdp: Properly destroy the renderer and pixman image

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agolibweston: Drop requirement of setting mm_width/mm_height in backends
Armin Krezović [Fri, 30 Sep 2016 12:11:14 +0000 (14:11 +0200)]
libweston: Drop requirement of setting mm_width/mm_height in backends

They were required for transitional phase in order not to
break previous weston_output_init(). Now, they can even
be initialized on enable, or left with defaults if backend
doesn't support them.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agolibweston: Remove weston_backend_output_config structure
Armin Krezović [Fri, 30 Sep 2016 12:11:13 +0000 (14:11 +0200)]
libweston: Remove weston_backend_output_config structure

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Rename weston_output_init_pending() to weston_output_init()
Armin Krezović [Fri, 30 Sep 2016 12:11:12 +0000 (14:11 +0200)]
weston: Rename weston_output_init_pending() to weston_output_init()

v2:

 - Rebased for latest changes.

v3:

 - Rebased for changes in wayland backend.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agolibweston: Merge weston_output_init() into weston_output_enable()
Armin Krezović [Fri, 30 Sep 2016 12:11:11 +0000 (14:11 +0200)]
libweston: Merge weston_output_init() into weston_output_enable()

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Port X11 backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:10 +0000 (14:11 +0200)]
weston: Port X11 backend to new output handling API

This is a complete port of the X11 backend that
uses recently added output handling API for output
configuration.

- Output can be configured at runtime by passing the
  necessary configuration parameters, which can be
  filled in manually, obtained from the configuration
  file or obtained from the command line using
  previously added functionality. It is required that
  the scale and transform values are set using the
  previously added functionality.

- Output can be created at runtime using the output
  API. The output creation only creates a pending
  output, which needs to be configured the same way as
  mentioned above.

Same as before, a single output is created at runtime
using the default configuration or a configuration
parsed from the command line. The output-count
functionality is also preserved, which means more than
one output can be created initially, and more outputs can
be added at runtime using the output API.

v2:

 - Fix wet_configure_windowed_output_from_config() usage.
 - Call x11_output_disable() explicitly from
   x11_output_destroy().

v3:

 - Remove unneeded free().
 - Disallow calling x11_output_configure more than once.
 - Remove unneeded checks for output->name == NULL as that
   has been disallowed.
 - Use weston_compositor_add_pending_output().
 - Bump weston_x11_backend_config version to 2.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Port Wayland backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:09 +0000 (14:11 +0200)]
weston: Port Wayland backend to new output handling API

This is a complete port of the Wayland backend that
uses the recently added output handling API for output
configuration.

- Output can be configured at runtime by passing the
  necessary configuration parameters, which can be
  filled in manually, obtained from the configuration
  file or obtained from the command line using
  previously added functionality. It is required that
  the scale and transform values are set using the
  previously added functionality.

- Output can be created at runtime using the output
  API. The output creation only creates a pending
  output, which needs to be configured the same way as
  mentioned above.

However, the backend can behave both as windowed backend
and as a backend that issues "hotplug" events, when
running under fullscreen shell or with --sprawl command
line option. The first case was covered by reusing
previously added functionality. The second case required
another API to be introduced and implemented into both
the backend and compositor for handling output setup.

After everything has been set, output needs to be
enabled manually using weston_output_enable().

v2:

 - Fix wet_configure_windowed_output_from_config() usage.
 - Call wayland_output_disable() explicitly from
   wayland_output_destroy().

v3:

 - Get rid of weston_wayland_output_api and rework output
   creation and configuration in case wayland backend is
   started with --sprawl or on fullscreen-shell.
 - Remove unneeded free().
 - Disallow calling wayland_output_configure more than once.
 - Remove unneeded checks for output->name == NULL as that
   has been disallowed.
 - Use weston_compositor_add_pending_output().

v4:

 - Drop unused fields from weston_wayland_backend_config
   and bump WESTON_WAYLAND_BACKEND_CONFIG_VERSION to 2.
 - Move output creation to backend itself when
   --fullscreen is used.
 - Prevent possible duplicated output names by assigning
   a different name to outputs created without any
   configuration specified.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoweston: Port RDP backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:08 +0000 (14:11 +0200)]
weston: Port RDP backend to new output handling API

This is a complete port of the RDP backend that uses
the recently added output handling API for output
configuration.

Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually or obtained from the command line
using previously added functionality. It is required
that the scale and transform values are set using
the previously added functionality.

After everything has been set, output needs to be
enabled manually using weston_output_enable().

v2:

 - Rename output_configure() to output_set_size()
   in plugin API and describe it.
 - Manually fetch parsed_options from wet_compositor.
 - Call rdp_output_disable() explicitly from
   rdp_output_destroy().

v3:

 - Disallow calling rdp_output_set_size more than once.
 - Manually assign a hardcoded name to an output as that's
   now mandatory.
 - Use weston_compositor_add_pending_output().
 - Bump weston_rdp_backend_config version to 2.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Port headless backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:07 +0000 (14:11 +0200)]
weston: Port headless backend to new output handling API

This is a complete port of the headless backend that
uses the recently added output handling API for output
configuration.

- Output can be configured at runtime by passing the
  necessary configuration parameters, which can be
  filled in manually, obtained from the configuration
  file or obtained from the command line using
  previously added functionality. It is required that
  the scale and transform values are set using the
  previously added functionality.

- Output can be created at runtime using the output
  API. The output creation only creates a pending
  output, which needs to be configured the same way as
  mentioned above.

After everything has been set, output needs to be
enabled manually using weston_output_enable().

Same as before, a single output is created at runtime
using the default configuration or a configuration
parsed from the command line. The no-outputs
functionality is also preserved, which means that no
output will be created initially, but more outputs can
be added at runtime using the output API.

New feature:

This patch also adds, as a bonus of using shared
functionality, support for setting options for outputs
created by this backend in the weston config file in
addition to setting them from the command line.

v2:

 - Fix wet_configure_windowed_output_from_config() usage.
 - Call headless_output_disable() explicitly from
   headless_output_destroy().

v3:

 - Add scale support to output width and height.
 - Use scaled values in calls to various functions which
   require width and height.
 - Disallow calling headless_output_configure more than once.
 - Remove unneeded checks for output->name == NULL as that
   has been disallowed.
 - Use weston_compositor_add_pending_output().
 - Bump weston_headless_backend_config version to 2.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Port fbdev backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:06 +0000 (14:11 +0200)]
weston: Port fbdev backend to new output handling API

This is a complete port of the fbdev backend that uses
the recently added output handling API for output
configuration.

It is required that the scale and transform values are
set using the previously added functionality.

After everything has been set, output needs to be
enabled manually using weston_output_enable().

v2:

 - Use weston_compositor_add_pending_output().
 - Bump weston_fbdev_backend_config version to 2.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agoweston: Port DRM backend to new output handling API
Armin Krezović [Fri, 30 Sep 2016 12:11:05 +0000 (14:11 +0200)]
weston: Port DRM backend to new output handling API

This is a complete port of the DRM backend that uses
the recently added output handling API for output
configuration.

Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually or obtained from the configuration
file using previously added functionality. It is
required that the scale and transform values are set
using the previously added functionality.

After everything has been set, output needs to be
enabled manually using weston_output_enable().

v2:

 - Added missing drmModeFreeCrtc() to drm_output_enable()
   cleanup list in case of failure.
 - Split drm_backend_disable() into drm_backend_deinit()
   to accomodate for changes in the first patch in the
   series. Moved restoring original crtc to
   drm_output_destroy().

v3:

 - Moved origcrtc allocation to drm_output_set_mode().
 - Swapped connector_get_current_mode() and
   drm_output_add_mode() calls in drm_output_set_mode()
   to match current weston.
 - Moved crtc_allocator and connector_allocator update
   from drm_output_enable() to create_output_for_connector()
   to avoid problems when more than one monitor is connected
   at startup and crtc allocator wasn't updated before
   create_output_for_connector() was called second time,
   resulting in one screen being turned off.
 - Moved crtc_allocator and connector_allocator update from
   drm_output_deinit() to drm_output_destroy(), as it
   should not be called on drm_output_disable().
 - Use weston_compositor_add_pending_output().
 - Bump weston_drm_backend_config version to 2.

v4:

 - Reset output->original_crtc to NULL if drm_output_set_mode()
   fails.
 - Remove unneeded log message when disabling an output when a
   pageflip is pending.
 - Document that create_output_for_connector() takes ownership
   of the connector.
 - Free the connector if create output conditionals are not met
   in create_outputs() and update_outputs().

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor: Implement output configuration using windowed_output_api
Armin Krezović [Fri, 30 Sep 2016 12:11:04 +0000 (14:11 +0200)]
compositor: Implement output configuration using windowed_output_api

This implements output configuration for outputs which use
previously added weston_windowed_output_api. The function
takes an output that's to be configured, default configuration
that's to be set in case no configuration is specified in
the config file or on command line and optional third argument,
parsed_options, which will override defaults and options for
configuration if they are present.

This also introduces new compositor specific functions for
setting output's scale and transform from either hardcoded
default, config file option or command line option.

Pending output handling helpers have also been introduced.

v2:

 - Adapt to changes in previous patch.
 - Fix potential double free().
 - Remove redundant variables for scale and transform setting.
 - Drop parsed_options helper and parameter and use it directly
   in wet_configure_windowed_output_from_config().

v3:

 - Remove unneeded checks for output->name == NULL as that
   has been disallowed.
 - Stop printing mode if it's invalid, as it can be NULL.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>