platform/upstream/weston.git
8 years agoInclude space in 'if ('
Bryce Harrington [Tue, 12 Jul 2016 23:59:05 +0000 (16:59 -0700)]
Include space in 'if ('

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
8 years agoconfig-parser: Catch negative numbers assigned to unsigned config values
Bryce Harrington [Tue, 12 Jul 2016 00:55:15 +0000 (17:55 -0700)]
config-parser: Catch negative numbers assigned to unsigned config values

strtoul() has a side effect that when given a string representing a
negative number, it returns a negated version as the value, and does not
flag an error.  IOW, strtoul("-42", &val) sets val to 42.  This could
potentially result in unintended surprise behaviors, such as if one were
to inadvertantly set a config param to -1 expecting that to disable it,
but with the result of setting the param to 1 instead.

Catch this by using strtol() and then manually check for the negative
value.  This logic is modelled after Wayland's strtouint().

Note that this change unfortunately reduces the range of parseable
numbers from [0,UINT_MAX] to [0,INT_MAX].  The current users of
weston_config_section_get_uint() are anticipating numbers far smaller
than either of these limits, so the change is believed to have no impact
in practice.

Also add a test case for negative numbers that catches this error
condition.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agordp: Check for non-digits and errno in strtol call
Bryce Harrington [Tue, 12 Jul 2016 00:02:44 +0000 (17:02 -0700)]
rdp: Check for non-digits and errno in strtol call

Improve error checking for situations like RDP_FD=42foo, or where the
provided number is out of range.

Suggestion by Yong Bakos.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoRemove a wrong closing “extern "C"” in shared/xalloc.c
Emmanuel Gil Peyrot [Mon, 11 Jul 2016 16:31:59 +0000 (17:31 +0100)]
Remove a wrong closing “extern "C"” in shared/xalloc.c

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agordp: Check for non-numeric value in RDP_FD env var
Bryce Harrington [Sat, 9 Jul 2016 01:48:19 +0000 (18:48 -0700)]
rdp: Check for non-numeric value in RDP_FD env var

strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string, and return 0.  Running with
RDP_FD=foo would thus result in fd=0 being specified to
freerdp_peer_new(), which is unlikely to be the user's intent.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agomulti-resource: Check for no digits in time description
Bryce Harrington [Sat, 9 Jul 2016 01:05:56 +0000 (18:05 -0700)]
multi-resource: Check for no digits in time description

strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string.  E.g. "foo:bar" should trigger an
error, instead of being read as "0:0" and allowed through.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agooption-parser: Require integer option string values to be base-10
Bryce Harrington [Sat, 9 Jul 2016 00:44:10 +0000 (17:44 -0700)]
option-parser: Require integer option string values to be base-10

The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in option-parser.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.

In weston and the weston clients and tests using option-parser.c, the
options are all things that can be expected to be specified in base 10:
widths, heights, counts, scales, font sizes, ports, ttys, connectors,
etc.  The subsurfaces client uses two modes, limited to values 0 and 1
only.  The zuc testsuite has a --random parameter for specifying a seed,
which is the only option where using hexadecimal or octal numbers might
conceivably happen.

The benefit of limiting this to base-10 is to eliminate surprises when
parsing numbers from the command line.  Also, by making the code
consistent with other usages of strtol/strtoul, it may make it possible
to factor out the common code in the future.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfig-parser: Improve error checks for strtol/strtoul calls
Bryce Harrington [Thu, 7 Jul 2016 21:08:28 +0000 (14:08 -0700)]
config-parser: Improve error checks for strtol/strtoul calls

Check errno, which is set of over/underflow, out of range, etc.  Also
check for empty strings (the usages covered in this patch already also
cover the case where there are non-digits present).  Set errno to 0
before making the strto*l call in case of pre-existing errors
(i.e. ENOTTY when running under the testsuite).

This follows the error checking style used in Wayland
(c.f. wayland-client.c and scanner.c).

In tests, also check errno, and add testcases for parsing '0'.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoREADME: Fix grammar for 'an X*'
Bryce Harrington [Thu, 7 Jul 2016 17:53:17 +0000 (10:53 -0700)]
README: Fix grammar for 'an X*'

8 years agodmabuf: Fix grammar in a comment
Bryce Harrington [Wed, 6 Jul 2016 22:30:54 +0000 (15:30 -0700)]
dmabuf: Fix grammar in a comment

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoxwayland: Grammar fixes
Bryce Harrington [Wed, 6 Jul 2016 22:25:19 +0000 (15:25 -0700)]
xwayland: Grammar fixes

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoxwayland: Cleanup error message on spawn failure Signed-off-by: Bryce Harrington...
Bryce Harrington [Wed, 6 Jul 2016 22:18:46 +0000 (15:18 -0700)]
xwayland: Cleanup error message on spawn failure Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoxwayland: Include missing config.h
Bryce Harrington [Wed, 6 Jul 2016 22:14:20 +0000 (15:14 -0700)]
xwayland: Include missing config.h

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoREADME: Fix punctuation errors
Bryce Harrington [Wed, 6 Jul 2016 21:50:15 +0000 (14:50 -0700)]
README: Fix punctuation errors

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoREADME: minor the libweston ABI/API documentation
Emil Velikov [Mon, 4 Jul 2016 14:23:50 +0000 (15:23 +0100)]
README: minor the libweston ABI/API documentation

v2: Elaborate what is meant with "major ABI versions" (Pekka).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> (v1)
8 years agoREADME: clarify libweston purpose/goals.
Emil Velikov [Mon, 4 Jul 2016 14:23:49 +0000 (15:23 +0100)]
README: clarify libweston purpose/goals.

v2: Rewrap, add a couple of missing words (Pekka).
v3: Use alternative wording (Yong).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor-x11: Flush xcb connection from x11_output_destroy()
Armin Krezović [Thu, 30 Jun 2016 04:29:00 +0000 (06:29 +0200)]
compositor-x11: Flush xcb connection from x11_output_destroy()

Current code flushes the connection when it receives
a delete window request. This means that a destroyed
window will remain available when X11 output gets
removed differently (ie, from a testing module).

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor: Switch to new surface/view mapped checks
Armin Krezović [Thu, 30 Jun 2016 04:04:33 +0000 (06:04 +0200)]
compositor: Switch to new surface/view mapped checks

This patch makes use of new flags which were introduced
by previous patches to check if a surface/view is mapped

v2:

- Rebased to apply on git master
- Added comments with link to discussion about proposed
  changes for weston_{surface,view}_is_mapped()

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agotests: update for manual surface/view mapping
Armin Krezović [Thu, 30 Jun 2016 04:04:32 +0000 (06:04 +0200)]
tests: update for manual surface/view mapping

This is a follow up for weston-test to manually
set mapped status for views/surfaces it controls

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoivi-shell: update for manual surface/view mapping
Armin Krezović [Thu, 30 Jun 2016 04:04:31 +0000 (06:04 +0200)]
ivi-shell: update for manual surface/view mapping

This is a follow up for ivi-shell to manually
set mapped status for views/surfaces it controls

v2:

- Updated for changes in git master

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agofullscreen-shell: update for manual surface/view mapping
Armin Krezović [Thu, 30 Jun 2016 04:04:30 +0000 (06:04 +0200)]
fullscreen-shell: update for manual surface/view mapping

This is a follow up for fullscreen-shell to manually
set mapped status for views/surfaces it controls

v2:

- Add manual mapping to fs_output_apply_pending()

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agodesktop-shell: update for manual surface/view mapping
Armin Krezović [Thu, 30 Jun 2016 04:04:29 +0000 (06:04 +0200)]
desktop-shell: update for manual surface/view mapping

This is a follow up for desktop-shell to manually
set mapped status for views/surfaces it controls

v2:

- Add manual mapping to shell_fade_create_surface()
  and shell_ensure_fullscreen_black_view()

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor: Untangle surface/view is_mapped from output assignments
Armin Krezović [Thu, 30 Jun 2016 04:04:28 +0000 (06:04 +0200)]
compositor: Untangle surface/view is_mapped from output assignments

Currently, weston assumes a surface/view is mapped if
it has an output assigned. In a zero outputs scenario,
this isn't really desirable.

This patch introduces a new flag to weston_surface and
weston_view, which has to be set manually to indicate
that a surface/view is mapped.

v2:

- Remove usage of new flags from
  weston_{view,surface}_is_mapped at this point. They
  will be added after all the implicit mappings have
  been introduced
- Unmap a surface before unmapping a view so the input
  foci is cleaned up properly
- Remove implicit view mapping from view_list_add
- Cosmetic fixes

v3:

- Rebased to apply on git master

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoxwayland: make the plugin usable by libweston compositors
Giulio Camuffo [Wed, 29 Jun 2016 09:54:27 +0000 (11:54 +0200)]
xwayland: make the plugin usable by libweston compositors

This patch follows a similar approach taken to detach the backends from
weston. But instead of passing a configuration struct when loading the
plugin, we use the plugin API registry to register an API, and to get it
in the compositor side.  This API allows to spawn the Xwayland process
in the compositor side, and to deal with signal handling.  A new
function is added in compositor.c to load and init the xwayland.so
plugin.

Also make sure to re-arm the SIGUSR1 when the X server quits.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
[Pekka: moved xwayland/weston-xwayland.c -> compositor/xwayland.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor: add plugin-registry
Pekka Paalanen [Wed, 29 Jun 2016 09:54:26 +0000 (11:54 +0200)]
compositor: add plugin-registry

Implement a simple register and lookup for function tables. This is
intended for plugins to expose APIs to other plugins.

It has been very hard to arrange a plugin to be able to call into
another plugin without modifying Weston core to explicitly support each
case. This patch fixes that.

The tests all pass.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoinput: Move weston_seat_set_keyboard_focus and document
Bryce Harrington [Thu, 30 Jun 2016 02:04:07 +0000 (19:04 -0700)]
input: Move weston_seat_set_keyboard_focus and document

Place it with the other weston_seat functions.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoinput: Rename weston_surface_activate to weston_seat_set_keyboard_focus
Bryce Harrington [Thu, 30 Jun 2016 02:04:06 +0000 (19:04 -0700)]
input: Rename weston_surface_activate to weston_seat_set_keyboard_focus

The name suggests that it activates surfaces, but the code says it
rather just assigns keyboard focus.  Rename it for clarity, and so the
original function name could be used for something more appropriate
later.  Switch order of parameters since keyboard focus is a property of
the seat.  Update all callers as appropriate.

Change was asked for by pq, May 26, 2016:

 "This should be called weston_seat_set_keyboard_focus(seat, surface).
 Keyboard focus is a property of the seat."

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agotests: implement visualize_image_difference()
Pekka Paalanen [Thu, 2 Jun 2016 15:02:46 +0000 (18:02 +0300)]
tests: implement visualize_image_difference()

Useful for pointing out where the image comparisons fail.

Internal-screenshot-test is modified to save the visualization if the
test fails.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: make screenshooting return a buffer
Pekka Paalanen [Fri, 27 May 2016 11:11:01 +0000 (14:11 +0300)]
tests: make screenshooting return a buffer

Screenshooting does not involve creating a wl_surface, so using struct
surface is superfluous.

Return a struct buffer instead. It could have been just a
pixman_image_t, but setting up proper destruction would be a bit more
work. Should not hurt to keep the wl_buffer around until the user is
ready to free the image.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: convert image saver to pixman
Pekka Paalanen [Fri, 27 May 2016 10:54:35 +0000 (13:54 +0300)]
tests: convert image saver to pixman

This rewrites write_surface_as_png() into write_image_as_png(), which
operates on a pixman_image_t instead of a struct surface.

This is part of the migration to use pixman_image_t everywhere without
superfluous parameters/members.

Now the image saving handles more than just ARGB32 format, presumably.
At least it does not assume everything is always ARGB32.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: convert reference image loader to pixman
Pekka Paalanen [Wed, 25 May 2016 08:47:41 +0000 (11:47 +0300)]
tests: convert reference image loader to pixman

This rewrites load_surface_from_png() to load_image_from_png(), to
return a pixman_image_t instead of a struct surface.

A loaded image has no need for wl_buffer or wl_surface or any of the
associated attributes. This is part of unifying to make everything use
pixman_image_t.

cairo_surface_flush() is added, because Cairo documentation for
cairo_image_surface_get_data() says you have to flush after drawing,
before using the data. It is unclear if loading a PNG counts as drawing,
so stay on the safe side.

load_image_from_png() now pays attention to the pixel format returned by
Cairo, which seems to come out as CAIRO_FORMAT_RGB24 in
internal-screenshot-test, not as CAIRO_FORMAT_ARGB32 as expected. I do
not know if Cairo actually guarantees the x8/a8 channel to be 0xff for
RGB24, but better to not trust it. Therefore the image is explicitly
converted to a8r8g8b8 as needed. This also adds support for loading A8
and RGB16_565 images, provided that Cairo delivers them.

The cairo surface is now wrapped directly into a pixman_image_t. If the
pixel format conversion is not needed, this eliminates a copy of the
image data. The Cairo surface will get automatically destroyed with the
Pixman image.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: rewrite check_surfaces_*() API
Pekka Paalanen [Mon, 23 May 2016 14:42:27 +0000 (17:42 +0300)]
tests: rewrite check_surfaces_*() API

check_surfaces_geometry() is removed as it was not used by anything, and
unlikely would be.

check_surfaces_equal() is merged into check_surfaces_match_in_clip(),
passing a NULL clip means to compare whole images.

check_surfaces_match_in_clip() is converted to work on pixman_image_t
instead of struct surface. The function is only concerned about
comparing images in memory, and does not care about a wl_buffer or a
wl_surface.

The verbosity of image comparisons is greatly reduced. An image mismatch
no longer prints a flood of raw pixel values. This will be replaced
later with a function writing out an error image instead.

Degenerate comparisons are no longer accepted, be that clip outside
images or zero area. Those are an indication of a programmer error.

The pixel format assumptions are made more visible in the code.

A new internal helper image_check_get_roi() computes and verifies the
area to be compared. Image iterator helper makes it simpler to write
manual pixel-poking loops.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: let create_shm_buffer() handle any format
Pekka Paalanen [Fri, 20 May 2016 15:30:03 +0000 (18:30 +0300)]
tests: let create_shm_buffer() handle any format

Change create_shm_buffer() to handle any pixel format known to Pixman.
Presumably in the future we might want to test e.g. RGB565 content with
screenshot tests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: make create_shm_buffer() static
Pekka Paalanen [Fri, 20 May 2016 15:10:02 +0000 (18:10 +0300)]
tests: make create_shm_buffer() static

No users remain outside the file. This will allow to fix the assumptions
in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: ivi_layout-test to use create_shm_buffer_a8r8g8b8()
Pekka Paalanen [Fri, 20 May 2016 15:01:05 +0000 (18:01 +0300)]
tests: ivi_layout-test to use create_shm_buffer_a8r8g8b8()

This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: internal-screenshot-test to use create_shm_buffer_a8r8g8b8()
Pekka Paalanen [Fri, 20 May 2016 15:01:05 +0000 (18:01 +0300)]
tests: internal-screenshot-test to use create_shm_buffer_a8r8g8b8()

This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: event-test to use create_shm_buffer_a8r8g8b8()
Pekka Paalanen [Fri, 20 May 2016 15:01:05 +0000 (18:01 +0300)]
tests: event-test to use create_shm_buffer_a8r8g8b8()

This removes the uses of create_shm_buffer() from this test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agotests: introduce struct buffer for client-helper
Pekka Paalanen [Fri, 20 May 2016 14:25:38 +0000 (17:25 +0300)]
tests: introduce struct buffer for client-helper

We are growing more tests that need to handle buffers, both just images
and wl_buffers. Particularly the screenshooting facility needs these.
Currently everything is in struct surface, which contains more than we
need. It is a bit messy.

Create a new struct buffer to encapsulate the image representation, the
wl_buffer, and enough information to tear it all down (munmap) so we
don't have to leak everything. Some tests might start doing things in
loops, and leaking would accumulate.

Instead of inventing our own image representation, use pixman_image_t.
It is a well-tested library worth using, and we already rely on it in
other places.

This makes the tests depend on Pixman, which requires the fix for
building buffer-count, which would otherwise not find pixman.h.

The new create_shm_buffer_a8r8g8b8() creates an image with an explicit
format, and pixman_image_t keeps track of it. And stride and size and
data. This implementation is still a little hacky due to calling
create_shm_buffer().

A very new thing is buffer_destroy(). Previously we didn't really free
any buffers. It is not a problem when the process will exit soon anyway,
but it may become a problem if tests start iterating things.

Manual memset() on a image is converted to a pixman action, just to show
how to do it properly with pixman.

Stride and pixel format assumptions still linger all around, but those
are for another patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
8 years agoivi-shell: implement surface_on_many_layer test
Ucan, Emre (ADITG/SW1) [Tue, 7 Jun 2016 09:40:21 +0000 (09:40 +0000)]
ivi-shell: implement surface_on_many_layer test

A surface can be added to many layers.
This test is implemented to test this use-case
and the correct behaviour of get_layers_under_surface
API.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoivi-shell: introduce ivi_layout_view
Ucan, Emre (ADITG/SW1) [Tue, 14 Jun 2016 14:43:40 +0000 (14:43 +0000)]
ivi-shell: introduce ivi_layout_view

This patch introduces ivi_layout_view data struct,
which is a wrapper of weston_view.

There is always only one ivi_layout_view for an
ivi_layout_surface and ivi_layout_layer pair.
A surface could have many views with different
geometry and transformations, so that a surface
can be shown on:
1. On many screens
2. On the same screen with different positions

The geometry of a view is modified, when properties of
its layer are changed through ivi_layout_interface.
Users of ivi_layout_interface does not have direct access
to ivi_layout_view structure.

v2 changes:
1. Use ivi_view_is_rendered function instead of
   active member
2. Add descriptions to introduced members of
   structs

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Natsume: add empty line]
Reviewed-by: Wataru Natsume <wnatsume@jp.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoivi-shell: add surface_created listener after launchers
Ucan, Emre (ADITG/SW1) [Fri, 17 Jun 2016 13:50:16 +0000 (13:50 +0000)]
ivi-shell: add surface_created listener after launchers

Add surface_created listener after the initialization of launchers.
Otherwise, surfaces of the launchers will be added to the application
layer too.

This does create a race where we might miss some surfaces that get
created before the UI client signals ready, but it was agreed the race
is not significant. You cannot use the launchers before the UI is ready,
and someone using systemd integration to launch clients in parallel to
Weston with ivi-shell and hmi-controller is unlikely. After all,
hmi-controller is just a demo.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: added extra commit message notes]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agogl-renderer: Always setup gl-renderer
Armin Krezović [Thu, 23 Jun 2016 09:59:35 +0000 (11:59 +0200)]
gl-renderer: Always setup gl-renderer

Currently, the gl-renderer setup is being done on per-output
basis. This isn't desirable when trying to make weston run
with zero outputs.

When there are no outputs present, there is no surface available
to attach an EGLContext to with eglMakeCurrent, which makes
any EGL command fail.

The problem is solved by using EGL_KHR_surfaceless_context to
bind an EGLContext to EGL_NO_SURFACE, or if that is
unavailable, creating a dummy PbufferSurface and binding an
EGLContext to it, so EGL gets set up properly.

v2:

- Move PbufferSurface creation into its own function
- Introduce a new EGLConfig with EGL_PBUFFER_BIT set
  and use it to create a PbufferSurface
- Make PbufferSurface attributes definition static
- Check for return of gl_renderer_setup and terminate
  in case it fails
- Remove redundant gl_renderer_setup call from
  gl_renderer_output_create
- Only destroy the dummy surface if it is valid

This patch causes a warning from Mesa when using the i965 driver:
libEGL warning: FIXME: egl/x11 doesn't support front buffer rendering.
A bug has been filed about it since it seems to be spurious:
https://bugs.freedesktop.org/show_bug.cgi?id=96694

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: filed a Mesa bug and added the note in commit msg]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agokeyboard: Only set toplevel when there is a valid output
Armin Krezović [Thu, 23 Jun 2016 09:59:34 +0000 (11:59 +0200)]
keyboard: Only set toplevel when there is a valid output

Currently, the keyboard client is created and the input
panel surface is set as toplevel on the first output it
finds. This does not work in a scenario when there are
no outputs, resulting in weston-keyboard to crash at
startup due to operating on an invalid output pointer.

This makes input panel toplevel setting depend on a
valid output, and if there was no output present at
startup, it will be set toplevel as soon as an output
gets plugged in.

v2:

- Remove dependency on output pointer at startup
- Only setup output_configure_handler after the
  keyboard has been created
- Let the output_configure_handler handle toplevel
  setting in all cases

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: fixed a line break]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agofullscreen-shell: Avoid NULL pointer dereference
Armin Krezović [Thu, 23 Jun 2016 09:59:33 +0000 (11:59 +0200)]
fullscreen-shell: Avoid NULL pointer dereference

When there are no outputs present, an output pointer
can be NULL. Dereferencing such pointer will result
in a crash.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agodesktop-shell: Avoid NULL pointer dereference
Armin Krezović [Thu, 23 Jun 2016 09:59:32 +0000 (11:59 +0200)]
desktop-shell: Avoid NULL pointer dereference

When there are no outputs present, an output pointer
can be NULL. Dereferencing such pointer will result
in a crash.

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 agotoytoolkit: Return NULL when no outputs are present
Armin Krezović [Thu, 23 Jun 2016 09:59:31 +0000 (11:59 +0200)]
toytoolkit: Return NULL when no outputs are present

Currently, display_get_output returns a first member
of the linked list, which can never be NULL.

This is problematic, as the function would return a
dangling pointer and NULL pointer checks wouldn't
work where needed and some of the invalid members
would get accessed that way, resulting in a crash.

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 agodesktop-shell: Return NULL when no outputs are present
Armin Krezović [Thu, 23 Jun 2016 09:59:30 +0000 (11:59 +0200)]
desktop-shell: Return NULL when no outputs are present

Currently, get_default_output returns a first member
of the linked list, which can never be NULL.

This is problematic, as the function would return a
dangling pointer and NULL pointer checks wouldn't
work where needed and some of the invalid members
would get accessed that way, resulting in a crash.

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 agocompositor-headless: Support starting with zero outputs
Armin Krezović [Thu, 23 Jun 2016 09:59:29 +0000 (11:59 +0200)]
compositor-headless: Support starting with zero outputs

This patch adds a new command line option which can be
used to tell headless backend not to create any
virtual outputs.

This will be used for output hotplug emulation, where
weston will start with no outputs available, and the
virtual output will be created at runtime.

v2:

- Use bool instead of int for the indicator flag
- Move final newspace to a separate line in command
  line options

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 agocompositor-x11: fix title overflow in x11_backend_create_output
Benoit Gschwind [Sun, 5 Jun 2016 17:01:11 +0000 (19:01 +0200)]
compositor-x11: fix title overflow in x11_backend_create_output

sprintf can overflow the fixed length title which is char[32]. This
patch change title to dynamically allocated char array using asprintf or
strdup. If one of them fail we leave returning NULL to indicate the
failure.

Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
8 years agotests: print the command line to log
Pekka Paalanen [Fri, 13 May 2016 13:29:30 +0000 (16:29 +0300)]
tests: print the command line to log

weston-tests-env is a beast to handle, when you would like to start
weston manually for a test you wan to start inside gdb. This patch
causes the full command line to be printed to the automake test logs, so
you can copy it from there and run it by hand.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agomain: log the command line
Pekka Paalanen [Thu, 11 Feb 2016 12:42:21 +0000 (14:42 +0200)]
main: log the command line

Write the command line to the log to aid debugging. It needs to be
copied before parsing, because parsing mutates argv.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agotests: fix the cursor race in internal-screenshot
Pekka Paalanen [Fri, 10 Jun 2016 07:50:04 +0000 (10:50 +0300)]
tests: fix the cursor race in internal-screenshot

This fix also depends on "compositor-headless: do not create a seat".

If we lose the race against weston-desktop-shell setting cursors, which
is very rare, we get a cursor image in the screenshot, causing the test
to fail. This is now fixed by moving the (remaining) cursor out of the
way.

Arguably we should have better solutions for this, but that is another
story. This is a stop-gap measure we can copy also in new
screenshooting tests.

v2: Remove the example code for how to trigger the race, and rewrite the
big comment.

Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoRename src/ to libweston/
Pekka Paalanen [Fri, 3 Jun 2016 14:12:10 +0000 (17:12 +0300)]
Rename src/ to libweston/

This clarifies what is supposed to be the libweston code.

v2: screen-share.c is already in compositor/ instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]

8 years agoMove weston source to compositor/
Pekka Paalanen [Fri, 3 Jun 2016 13:45:21 +0000 (16:45 +0300)]
Move weston source to compositor/

This is the start of separating weston-the-compositor source files from
libweston source files.

This is moving all the files related to the 'weston' binary. Also the
CMS and systemd plugins are moved.

xwayland plugin is not moved, because it will be turned into a
libweston feature.

To avoid breaking the build, #includes for weston.h are fixed to use
compositor/weston.h. This serves as a reminder that such files may need
further attention: moving to the right directory, or maybe using the
proper -I flags instead.

v2: Move also screen-share.c, and add a note about weston-launch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]

8 years agocompositor-headless: do not create a seat
Pekka Paalanen [Thu, 16 Jun 2016 09:07:12 +0000 (12:07 +0300)]
compositor-headless: do not create a seat

The headless backend was creating a seat, but nothing would ever happen
on that seat, except the pointer cursor would show up.

Tests do not seem to use this seat either. weston-test.so plugin creates
its own seat to be controlled by the tests.

This is part of the series to get rid of cursors for screenshot-based
tests where they are not wanted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agotests: check kbd init in the plugin
Pekka Paalanen [Thu, 16 Jun 2016 09:04:53 +0000 (12:04 +0300)]
tests: check kbd init in the plugin

Check that the keyboard init in weston-test.so plugin succeeds.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agocompositor-drm: support RGB565 with pixman renderer
Tomi Valkeinen [Mon, 20 Jun 2016 11:18:45 +0000 (14:18 +0300)]
compositor-drm: support RGB565 with pixman renderer

At the moment only XRGB8888 is supported when using pixman renderer.
This patch adds support also for RGB565.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
8 years agoBuild: Silence shift-negative-value warning
Daniel Stone [Sat, 18 Jun 2016 06:04:30 +0000 (16:04 +1000)]
Build: Silence shift-negative-value warning

Pixman's headers include a representation of -1 in fixed-point, which is
-1 << 16. This trips a GCC warning about shifting negative values. As we
can't do much about it, just silence the warning.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoscreen-share: Use wet_get_config()
Daniel Stone [Sat, 18 Jun 2016 06:02:38 +0000 (16:02 +1000)]
screen-share: Use wet_get_config()

compositor->config was removed a while ago.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoclients/dmabuf-intel: use three buffers
Pekka Paalanen [Fri, 10 Jun 2016 10:13:01 +0000 (13:13 +0300)]
clients/dmabuf-intel: use three buffers

Use three buffers like simple-dmabuf-v4l instead of just two.

This is required, because when a frame callback arrives, the just
committed buffer is only on its way to the screen, while the previous
buffer is still being scanned out. It will take for the page flip to
complete, before the previous buffer is release. However, we want to be
able to repaint already at the frame callback, so three buffers can be
necessary.

This patch fixes weston-simple-dmabuf-intel to not abort with "Both
buffers busy at redraw()." when hardware overlays are used and the
surface gets directly scanned out.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agomain: report presentation clock resolution
Pekka Paalanen [Mon, 18 Apr 2016 12:53:38 +0000 (15:53 +0300)]
main: report presentation clock resolution

For debugging weird timing issues. If your clock resolution is
unexpectedly e.g. 10 ms, you can be sure you will have strange timing
issues. This is almost certainly caused by kernel misconfiguration.

We rely on clock_getres() being available by the same thing that gets us
clock_gettime(), so that no new configure.ac check is needed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: David Fort <contact@hardening-consulting.com>
8 years agocompositor-fbdev: drop EGL support
Pekka Paalanen [Wed, 8 Jun 2016 14:39:37 +0000 (17:39 +0300)]
compositor-fbdev: drop EGL support

EGL code was added to the fbdev backend in
4aa756dc7a8d3cf3b4c6f018c3e2a053fff424b0 in 2013, apparently for running
Weston on libhybris with Android hardware drivers.

This actually had nothing to do with the fbdev backend, really. Fbdev
was just a convenient platform to plug in the EGL init code and load
GL-renderer. Fbdev itself was not used at all in this case.

Fbdev should be forgotten and die, as we have better interfaces for
accelerated rendering and for controlling displays. It may be a bit too
harsh to remove the whole fbdev backend just yet, but let us at least
simplify it this much.

Fbdev+EGL has been the unholy union used by proprietary driver stacks of
hardware vendors in the non-PC world as a quick and dirty way to get
something out on the screen. In these cases it is actually the EGL
implementation that does everything internally, fbdev is not needed.
Fbdev was never meant for the sort anyway.

If anyone still needs this use case, I recommend sticking with a
outdated Weston to match your outdated platform. Or if you really
insist, write a new backend that does not pretend to use fbdev and just
initializes EGL and GL-renderer.

Cc: Adrian Negreanu <groleo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoterminal: Document console codes less cryptically
Bryce Harrington [Thu, 16 Jun 2016 01:36:03 +0000 (18:36 -0700)]
terminal: Document console codes less cryptically

C.f. http://man7.org/linux/man-pages/man4/console_codes.4.html

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoMake config.h inclusion consistent
Bryce Harrington [Thu, 16 Jun 2016 01:13:07 +0000 (18:13 -0700)]
Make config.h inclusion consistent

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoweston-simple-im: Make capitalization consistent in error messages
Bryce Harrington [Thu, 16 Jun 2016 00:59:17 +0000 (17:59 -0700)]
weston-simple-im: Make capitalization consistent in error messages

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
8 years agoconfigure: remove the result line for BCM headers
Pekka Paalanen [Wed, 15 Jun 2016 07:28:05 +0000 (10:28 +0300)]
configure: remove the result line for BCM headers

This was a left-over from ca52b31d3f867d9a14b2a3b9fcd4f21aa5fb0a3d.

Reported-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoivi-shell: remove ivi_layout_get_weston_view
Ucan, Emre (ADITG/SW1) [Tue, 7 Jun 2016 09:40:17 +0000 (09:40 +0000)]
ivi-shell: remove ivi_layout_get_weston_view

A surface could have more than one views.
Therefore, it is not possible to map a surface to
a specific view. The implementation of the API
iterates the list of views of the surface, and
returns the first found view.

It is not necessary to have this API to found
a view of the surface. Therefore, I removed the API.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor-wayland: Correct output base make name
Yong Bakos [Sun, 5 Jun 2016 16:01:17 +0000 (11:01 -0500)]
compositor-wayland: Correct output base make name

Change the output make value from "waywayland" to "wayland".

References: 90bc88c710b34f46ef89e1c5765e5f63f8e02847

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agodesktop-shell: resize background and panel surfaces on output resize v4
David Fort [Thu, 9 Jun 2016 15:55:52 +0000 (17:55 +0200)]
desktop-shell: resize background and panel surfaces on output resize v4

When an output is resized (permanent mode switch), we should also notify the
shell client so that the panel and background fits to the new screen dimensions.

Signed-off-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agotests: add wp_viewporter tests
Pekka Paalanen [Tue, 19 Apr 2016 14:20:42 +0000 (17:20 +0300)]
tests: add wp_viewporter tests

These tests poke the viewporter interface to ensure proper behaviour
from client perspective, without testing the rendering result.

These cases are covered:
- create viewport twice
- source rectangle invalid value errors, and unset
- destination size invalid value errors, and unset
- source causing non-integer destination size
- source inside/outside of buffer with transform, scale
- source outside NULL buffer, then getting real buffer
- source outside NULL buffer with inherited NULL
- set_source, set_destination, and destroy after the wl_surface is
  destroyed

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: fix wp_viewport.set_source errors
Pekka Paalanen [Tue, 26 Apr 2016 11:42:11 +0000 (14:42 +0300)]
compositor: fix wp_viewport.set_source errors

The revised wp_viewport spec requires that unset has to have all of x, y,
width and height -1 to be recognized.

Check for negative x and y and raise the required error. The error event
now mentions the wl_surface, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: check viewport dst size validity
Pekka Paalanen [Tue, 26 Apr 2016 11:28:28 +0000 (14:28 +0300)]
compositor: check viewport dst size validity

wp_viewporter requires the destination size to be always in integers,
even when it is implicit from source rectangle. Emit appropriate
protocol errors.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: check viewport source rect validity
Pekka Paalanen [Tue, 26 Apr 2016 10:46:38 +0000 (13:46 +0300)]
compositor: check viewport source rect validity

wp_viewporter spec requires protocol errors when the viewport is outside
the buffer area.

The viewport is checked in wl_surface.commit handler as the error needs
to be delivered as a reply to the commit, not at state apply time later
(e.g. with synchronized sub-surfaces, or at render time).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: fix wp_viewport use after free
Pekka Paalanen [Fri, 22 Apr 2016 11:14:38 +0000 (14:14 +0300)]
compositor: fix wp_viewport use after free

If a client destroyed the wl_surface before the wp_viewport, Weston core
would access freed memory, because the weston_surface pointer stored in
the wp_viewport wl_resource's user data was stale.

Fix this by setting the user data to NULL on wl_surface destruction. It
is specifically about wl_surface and not weston_surface destruction,
because this is about client-visible behaviour. Something internal might
keep weston_surface alive past the wl_surface.

Add checks to all wp_viewport request handlers.

At the same time, implement the new error conditions in wp_viewport:
calling any request except destroy must result in a protocol error.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoprotocol: remove scaler.xml
Pekka Paalanen [Fri, 15 Apr 2016 14:02:39 +0000 (17:02 +0300)]
protocol: remove scaler.xml

The stable version of the scaling and cropping extension is found in
wayland-protocols as viewporter.xml.

Remove scaler.xml as nothing uses it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclients/simple-damage: migrate to wp_viewporter
Pekka Paalanen [Fri, 15 Apr 2016 14:00:21 +0000 (17:00 +0300)]
clients/simple-damage: migrate to wp_viewporter

Use wp_viewporter instead of wl_scaler and rename things as appropriate.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoclients/scaler: migrate to wp_viewporter
Pekka Paalanen [Fri, 15 Apr 2016 13:53:41 +0000 (16:53 +0300)]
clients/scaler: migrate to wp_viewporter

Use wp_viewporter instead of wl_scaler and rename things accordingly.

Since interface versions were reset, there is no need to check the
interface version anymore, and the wl_scaler.set request disappeared.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: rename scaler to viewport(er)
Pekka Paalanen [Fri, 15 Apr 2016 13:42:49 +0000 (16:42 +0300)]
compositor: rename scaler to viewport(er)

Since the interface is now called wp_viewport, rename functions from
"scaler" to "viewporter" as well.

scaler_surface_to_buffer() is renamed to viewport_surface_to_buffer()
because it is more about viewport than viewporter.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agocompositor: migrate to stable viewporter.xml
Pekka Paalanen [Fri, 15 Apr 2016 11:47:08 +0000 (14:47 +0300)]
compositor: migrate to stable viewporter.xml

Migrate from wl_scaler to wp_viewporter extension. The viewporter.xml
file is provided by wayland-protocols.

This stops Weston from advertising wl_scaler, and advertises
wp_viewporter instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
[Pekka: fix wayland-protocols requirement]

8 years agocompositor: recompute output position on mode switch
David Fort [Fri, 27 May 2016 21:22:57 +0000 (23:22 +0200)]
compositor: recompute output position on mode switch

When an output permanently changes its resolution, the output on the right
should be moved accordingly. We also add an event for output resizing so that
plugins can react when an output is resized.

Signed-off-by: David Fort <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agordp: don't release the seat until it is safe v2
David Fort [Fri, 27 May 2016 21:22:56 +0000 (23:22 +0200)]
rdp: don't release the seat until it is safe v2

Releasing a seat is not safe, so let's just announce it without keyboard
and mouse until this is fixed. Without this patch we just can't reconnect on
the RDP compositor as it crashes.

v2: fixed the leak of the xkb_keymap

Signed-off-by: David Fort <contact@hardening-consulting.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Sam Spilsbury <smspillaz@gmail.com>
8 years agomain: remove unused argument from backend loaders
Pekka Paalanen [Fri, 3 Jun 2016 12:28:40 +0000 (15:28 +0300)]
main: remove unused argument from backend loaders

There is no need to pass the backend name string to these functions
anymore.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agolibweston: use enum to choose the backend
Pekka Paalanen [Fri, 3 Jun 2016 12:23:46 +0000 (15:23 +0300)]
libweston: use enum to choose the backend

Change weston_compositor_load_backend() to use an enum to choose the
backend.

The caller no longer needs to know what the backend DSO is called in the
file system. Custom backends cannot be laoded anymore, as the loading
path is now always either LIBWESTON_MODULEDIR, or formed from
$WESTON_BUILD_DIR.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agolibweston: remove unused backend_init() arguments
Pekka Paalanen [Fri, 3 Jun 2016 11:56:18 +0000 (14:56 +0300)]
libweston: remove unused backend_init() arguments

Backends do not have access to command line elements nor weston_config
anymore. They use the backend-specific config APIs now.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agocompositor,main: use weston_compositor_load_backend()
Pekka Paalanen [Fri, 3 Jun 2016 11:49:54 +0000 (14:49 +0300)]
compositor,main: use weston_compositor_load_backend()

Move load_backend_new() from main.c to weston_compositor_load_backend()
in compositor.c.

This makes libweston load its own backends without leaking the details
to the user.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agomain: remove load_backend_old()
Pekka Paalanen [Fri, 3 Jun 2016 10:56:17 +0000 (13:56 +0300)]
main: remove load_backend_old()

Not used anymore, all backends are loaded through the new method.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoCreate a libweston-0.so
Giulio Camuffo [Thu, 2 Jun 2016 18:48:15 +0000 (21:48 +0300)]
Create a libweston-0.so

This commit also adds a libweston-0.pc file. The -0 is the abi version
introduced in the previous patch.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoSplit the modules and include files between weston and libweston
Giulio Camuffo [Thu, 2 Jun 2016 18:48:14 +0000 (21:48 +0300)]
Split the modules and include files between weston and libweston

The backends are now installed in lib/libweston-0, and the include
files that will be used by libweston in include/libweston-0. The other
modules and weston-specific include files are kept in the old paths.
A new wet_load_module() is added to load plugins in the old path,
which is not part of libweston, but weston only and defined in main.c.
To allow that to be used by out of tree weston plugins, the function
is declared in a new weston.h, installed in include/weston.

The -0 in the paths is the abi version of libweston, and it will also
be used by the libweston .so. If the abi changes the number will need
to be increased.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoallow compositors to define the logging behavior
Giulio Camuffo [Thu, 2 Jun 2016 18:48:13 +0000 (21:48 +0300)]
allow compositors to define the logging behavior

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agolibinput: don't use weston_config when configuring input devices
Giulio Camuffo [Thu, 2 Jun 2016 18:48:12 +0000 (21:48 +0300)]
libinput: don't use weston_config when configuring input devices

Instead add callbacks to the drm and fbdev backends and pass that to
the input backens so that when a new device needs to be configured
that is called and the compositor can configure it.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agocompositor: remove the weston_config field in weston_compositor
Giulio Camuffo [Thu, 2 Jun 2016 18:48:11 +0000 (21:48 +0300)]
compositor: remove the weston_config field in weston_compositor

The config can now be retrieved with a new function defined in weston.h,
wet_get_config(weston_compositor*).

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoMove the functions launching clients to main.c
Giulio Camuffo [Thu, 2 Jun 2016 18:48:10 +0000 (21:48 +0300)]
Move the functions launching clients to main.c

They belong in the compositor rather than libweston since they
set signals handlers, and a library should not do that behind its
user's back. Besides, they were using functions in main.c already
so they were not usable by other compositors.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoMove part of screenshooter.c to weston-screenshooter.c
Giulio Camuffo [Thu, 2 Jun 2016 18:48:09 +0000 (21:48 +0300)]
Move part of screenshooter.c to weston-screenshooter.c

This patch splits screensooter.c so that the code implementing
the private screenshooter protocol and launching the client is
moved to a weston specific file, leaving only the code that can
be shared between compositors in screenshooter.c.
Two exported functions are added in screenshooter.c to start and
stop the recorder.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoRename weston_compositor_xkb_init to weston_compositor_set_xkb_rule_names
Giulio Camuffo [Thu, 2 Jun 2016 18:48:08 +0000 (21:48 +0300)]
Rename weston_compositor_xkb_init to weston_compositor_set_xkb_rule_names

weston_compositor_xkb_destroy() is called automatically so having only
weston_compositor_xkb_init() to be called by the user was a bit weird.
So rename it so that it makes more sense.
Also export it, since libweston compositors need to call it.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoRemove Raspberry Pi backend and renderer
Pekka Paalanen [Wed, 1 Jun 2016 08:22:51 +0000 (11:22 +0300)]
Remove Raspberry Pi backend and renderer

This patch completely removes the Raspberry Pi backend and the renderer.

The backend and the renderer were written to use the proprietary
DispmanX API available only on the Raspberry Pi, to demonstrate what the
tiny computer is capable of graphics wise. They were also used to
demonstrate how Wayland and Weston in particular could leverage hardware
compositing capabilities that are not OpenGL. The backend was first
added in e8de35c922871bc5b15fbf0436efa233a6db8e41, in 2012.

Since then, the major point has been proven. Over time, support for the
rpi-backend diminished, it started to deteriorate and hinder Weston
development. On May 11, I tried to ask if anyone actually cared about
the rpi-backend, but did not get any votes for keeping it:
https://lists.freedesktop.org/archives/wayland-devel/2016-May/028764.html

The rpi-backend is a good example of how using an API that is only
available for specific hardware, even more so as it is only available
with a proprietary driver stack, is not maintainable in the long run.
Most developers working on Weston either just cannot, or cannot bother
to test things also on the RPi. Breakage creeps in without anyone
noticing. If someone actually notices it, fixing it will require a very
specific environment to be able to test. Also the quality of the
proprietary implementation fluctuated. There are reports that RPi
firmware updates randomly broke Weston, and that nowadays it is very
hard to find a RPi firmware version that you could expect to work with
Weston if Weston itself was not broken. We are not even sure what is
broken nowadays.

This removal does not leave Raspberry Pi users cold (for long), though.
There is serious work going on in implementing a FOSS driver stack for
Raspberry Pi, including modern kernel DRM drivers and Mesa drivers. It
might not be fully there yet, but the plan is to be able to use the
standard DRM-backend of Weston on the RPis. See:
http://dri.freedesktop.org/wiki/VC4/

The rpi-backend had its moments. Now, it needs to go. Good riddance!

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
8 years agoweston-launch: Handle invalid command line options
Tom Hochstein [Sat, 7 May 2016 11:57:40 +0000 (08:57 -0300)]
weston-launch: Handle invalid command line options

Exit the program if an unrecognized command line option is found.

Signed-off-by; Tom Hochstein <tom.hochstein@nxp.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoreleasing: Copyedit post-release branching directions
Bryce Harrington [Thu, 2 Jun 2016 00:17:57 +0000 (17:17 -0700)]
releasing: Copyedit post-release branching directions

8 years agoivi-shell: add API for weston_surface -> ivi_layout_surface
Pekka Paalanen [Tue, 12 Apr 2016 13:06:58 +0000 (16:06 +0300)]
ivi-shell: add API for weston_surface -> ivi_layout_surface

Add ivi-layout API for getting an ivi_layout_surface from a
weston_surface if it exists. This can be used by controllers that hook
up to core Weston callbacks and get handed a weston_surface, but need to
use ivi-layout API to manipulate it.

The only ways ivi-layout itself would be able to go from weston_surface
to ivi_layout_surface are either searching through the list of all
ivi_layout_surfaces or adding a dummy destroy listener to the
weston_surface. Therefore the implementation is delegated to
ivi-shell.c.

Ivi-shell.c can easily look up the ivi_shell_surface for a
weston_surface, and that will map 1:1 to an ivi_layout_surface.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
8 years agoconfigure.ac: bump version to 1.11.90 for open development
Pekka Paalanen [Wed, 1 Jun 2016 08:05:46 +0000 (11:05 +0300)]
configure.ac: bump version to 1.11.90 for open development

As announced in 1.11.0 release notes, master is open again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoconfigure.ac: bump to version 1.11.0 for the official release
Bryce Harrington [Wed, 1 Jun 2016 00:10:40 +0000 (17:10 -0700)]
configure.ac: bump to version 1.11.0 for the official release