platform/upstream/weston.git
9 years agoconfigure: fix enable_simple_intel_dmabuf_client=auto
Pekka Paalanen [Mon, 17 Aug 2015 06:59:13 +0000 (09:59 +0300)]
configure: fix enable_simple_intel_dmabuf_client=auto

When the user does not specify --enable nor
--disable-simple-intel-dmabuf-client, we want to autodetect based on
dependencies. cb512c018e8db66574b4e0d1263c52a05267918c implemented this,
but forgot to actually enable it if the autodetect comes positive.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agoconfigure.ac: bump to version 1.8.91 for the alpha release 1.8.91
Bryce Harrington [Sun, 16 Aug 2015 21:17:17 +0000 (14:17 -0700)]
configure.ac: bump to version 1.8.91 for the alpha release

9 years agoreleasing: Soften suggestion to update the wayland version dependency
Bryce Harrington [Sun, 16 Aug 2015 21:16:26 +0000 (14:16 -0700)]
releasing:  Soften suggestion to update the wayland version dependency

9 years agoreleasing: Update release names
Bryce Harrington [Sun, 16 Aug 2015 21:00:05 +0000 (14:00 -0700)]
releasing: Update release names

9 years agoFix armhf configure breakage due to missing libdrm_intel package
Bryce Harrington [Fri, 14 Aug 2015 19:44:50 +0000 (12:44 -0700)]
Fix armhf configure breakage due to missing libdrm_intel package

The buildbots discovered that recent changes break on Ubuntu 15.04's
armhf images:

  configure:16137: checking for SIMPLE_DMABUF_CLIENT
  configure:16144: $PKG_CONFIG --exists --print-errors "wayland-client libdrm libdrm_intel"
  Package libdrm_intel was not found in the pkg-config search path.
  ...
  configure:16194: error: Package requirements (wayland-client libdrm libdrm_intel) were not met:

  No package 'libdrm_intel' found

This patch was provided by Daniel Stone.  I've not tested it other than
verifying it does not cause build problems on x86_64.

Acked-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoFix build breakage when using older gbm lacking dmabuf import
Bryce Harrington [Fri, 14 Aug 2015 19:23:13 +0000 (12:23 -0700)]
Fix build breakage when using older gbm lacking dmabuf import

The buildbots discovered this issue on Ubuntu 14.04, which carries
libgbm 10.1.3-0ubuntu0.4.  The dmabuf changes need gbm 10.2, so it fails
during build like this:

  src/compositor-drm.c: In function ‘drm_output_prepare_overlay_view’:
  src/compositor-drm.c:984:10: error: variable ‘gbm_dmabuf’ has
  initializer but incomplete type
     struct gbm_import_fd_data gbm_dmabuf = {
            ^
  etc.

Proposed fix is to conditionalize the gbm fd import feature in
compositor-drm.

This fix was suggested by daniels.  I set up a synthetic test
environment to reproduce the issue as found by the buildbots and tweaked
the patch to get it to build both with and without gbm 10.2.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoclients: add simple-dmabuf client
George Kiagiadakis [Thu, 12 Jun 2014 14:26:49 +0000 (16:26 +0200)]
clients: add simple-dmabuf client

v2:
- adapted to protocol changes
- added TODO comments
- minor clean-up
- change y-invert from per-plane boolean to per-buffer flag

v3:
- fix a typo: 1 -> i (noticed by Carlos Olmedo Escobar)

Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
9 years agocompositor-drm: dmabuf GBM import
Pekka Paalanen [Thu, 12 Jun 2014 14:12:12 +0000 (17:12 +0300)]
compositor-drm: dmabuf GBM import

v2:
- add TODO note about multi-planar import and how we should do it

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agocompositor-drm: init linux_dmabuf support
Pekka Paalanen [Thu, 12 Jun 2014 12:12:48 +0000 (15:12 +0300)]
compositor-drm: init linux_dmabuf support

v2 changes:
- only initialize linux_dmabuf if renderer supports it

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agocompositor-x11: init linux_dmabuf support
Pekka Paalanen [Thu, 12 Jun 2014 13:52:53 +0000 (16:52 +0300)]
compositor-x11: init linux_dmabuf support

v2 changes:
- only initialize linux_dmabuf if renderer supports it

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agogl-renderer: add dmabuf import
Pekka Paalanen [Thu, 12 Jun 2014 13:49:29 +0000 (16:49 +0300)]
gl-renderer: add dmabuf import

Import dmabuf as an EGLImage, and hold on to the EGLImage until we are
signalled a content change. On content change, destroy the EGLImage and
re-import to trigger GPU cache flushes.

We hold on to the EGLImage as long as possible just in case the client
does other imports that might later make re-importing fail.

As dmabuf protocol uses drm_fourcc codes, we need libdrm for
drm_fourcc.h. However, we are not doing any libdrm function calls, so
there is no new need to link to libdrm.

RFCv1 changes:
- fix error if dmabuf exposed unsupported
- always use GL_TEXTURE_EXTERNAL_OES with dmabuf

v2 changes:
- improve support check and error handling
- hold on to the imported EGLImage to avoid the dmabuf becoming
  unimportable in the future
- send internal errors with linux_dmabuf_buffer_send_server_error()
- import EGL_EXT_image_dma_buf_import extension headers
- use heuristics to decide between GL_TEXTURE_2D and
  GL_TEXTURE_EXTERNAL_OES
- add comment about Mesa requirements
- change y-invert from per-plane boolean to per-buffer flag

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agogl-renderer: introduce struct egl_image
Louis-Francis Ratté-Boulianne [Mon, 8 Jun 2015 13:37:05 +0000 (16:37 +0300)]
gl-renderer: introduce struct egl_image

This is a reference-counted holder of an EGLImage. For now, direct
EGLImage usage is simply converted to use egl_image. Use of reference
counting will come in a later patch.

v2:
- this is a new patch, split from gl-renderer dmabuf import support

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agodmabuf: implement linux_dmabuf extension
Pekka Paalanen [Mon, 29 Sep 2014 18:18:40 +0000 (14:18 -0400)]
dmabuf: implement linux_dmabuf extension

v2 changes:
- implement the revised protocol
- add basic sanity checks when creating buffer and check for support
- add way to attach user data to the dmabuf for renderer use
- bump max number of planes to 4 to follow DRM AddFb2 ioctl
- improve errors handling
- use separate linux_dmabuf_buffer fields for the different wl_resource
  types
- as SERVER_ERROR code is no more, use a wl_display "generic" error for
  emergency-disconneting a client we fail to process
- more documentation
- change y-invert from per-plane boolean to per-buffer flag

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agoprotocol: add linux_dmabuf extension (v3)
Pekka Paalanen [Mon, 29 Sep 2014 18:08:29 +0000 (14:08 -0400)]
protocol: add linux_dmabuf extension (v3)

An experimental (hence the 'z' prefix) linux_dmabuf Wayland protocol
extension for creating dmabuf-based wl_buffers in a generic manner.

This does not include proper dmabuf metadata negotiation because
there is no way to communicate all dmabuf constraints from the
compositor to a client before-hand. The client has to create a
wl_buffer wrapping one or more dmabuf buffers and then listen at
the feedback object returned to know if the operation was successful.

RFCv1 changes (after a first draft without code):
- some renames of interfaces and argument, no semantic changes
- added destructor protocol to dmabuf_batch
- added feedback interface for buffer creation

v2 changes:
- use drm_fourcc.h as authoritative source for format codes
- add support for the 64-bit layout qualifier and y-inverted dmabufs
- simplify the 'add' request (no need to preserve fd numerical id)
- add explicit plane index in the 'add' request
- integrate the 'feedback' object events to the batch interface
- rename 'create_buffer' to 'create' and move it into the batch interface
- add requirements needed from the graphics stack and clients
- improve existing errors and add batch error codes
- removed error codes from the global interface
- improve documentation for arguments, enums, etc.
- rename dmabuf_batch to zlinux_buffer_params
- The y-inverted property makes more sense as a whole buffer property.
  Y-flipping individual planes of the same buffer object is hardly useful.
  The y-invert is also converted into a flag, so we may add more flags
  later.
- add flags for interlaced buffer content

v3 changes:
- Apply Daniel Vetter's comments about wording on coherency.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agoweston-launch: On error putenv returns a non-zero value
Dawid Gajownik [Sun, 9 Aug 2015 15:50:40 +0000 (12:50 -0300)]
weston-launch: On error putenv returns a non-zero value

According to POSIX standard "upon successful completion, putenv() shall
return 0; otherwise, it shall return a non-zero value." Unlike in
setenv() we should not be checking only for negative values.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
9 years agocompositor: fix crash when destroying incompletely created output
Dawid Gajownik [Fri, 7 Aug 2015 00:04:16 +0000 (21:04 -0300)]
compositor: fix crash when destroying incompletely created output

When the output can't be completely created in the backend (for example
lack of memory), weston_compositor_add_output() is never run. In such
a case output->link is not initialized. Letter, when
weston_output_destroy() is called, application crashes on
wl_list_remove(&output->link).

This problem happens when drm, fbdev, rdp, rpi or wayland backend is
used.

v2: Initialize output->link in weston_output_init() as suggested by
Derek Foreman.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agofullscreen-shell: Fix modeset on transformed outputs
Jason Ekstrand [Thu, 8 Jan 2015 16:57:44 +0000 (08:57 -0800)]
fullscreen-shell: Fix modeset on transformed outputs

Previously, we blindly created a mode for the output based on surface size
and completely ignoring the output transform.  This caused modesets to fail
on outputs that were transformed by 90 or 270 degrees.  We should be
swapping the width and the height in this case.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoinput: when destroying a seat, remove keyboard focus first
Derek Foreman [Thu, 6 Aug 2015 17:19:51 +0000 (12:19 -0500)]
input: when destroying a seat, remove keyboard focus first

If we destroy all the devices before trying to remove keyboard focus
we'll segfault because we destroyed the keyboard.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoCoding style fixes
Dawid Gajownik [Thu, 6 Aug 2015 20:12:19 +0000 (17:12 -0300)]
Coding style fixes

- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoUse [x]zalloc instead of [x]malloc + memset
Ryo Munakata [Fri, 7 Aug 2015 11:20:46 +0000 (20:20 +0900)]
Use [x]zalloc instead of [x]malloc + memset

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoxwm: don't let X windows steal the focus
Giulio Camuffo [Sun, 29 Mar 2015 11:20:23 +0000 (14:20 +0300)]
xwm: don't let X windows steal the focus

When we get a focus in event from an X window which is not the one
we last set as the active window, reset the focus.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agorpi-renderer: use weston_output matrix instead of a private matrix
Derek Foreman [Thu, 7 May 2015 16:54:18 +0000 (11:54 -0500)]
rpi-renderer: use weston_output matrix instead of a private matrix

We already do this math in compositor.c so let's not duplicate it here.
Additionally, the copy here has broken zoom, so this also fixes zooming.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
9 years agoinput: add a weston_pointer_clear_focus() helper function
Derek Foreman [Mon, 11 May 2015 20:40:11 +0000 (15:40 -0500)]
input: add a weston_pointer_clear_focus() helper function

Valgrind has shown that in at least one place (default_grab_pointer_focus)
we're testing uninitialized values coming out of weston_compositor_pick_view.

This is happening when default_grab_pointer_focus is called when there is
nothing on the view list, and during the first repaint when only the black
surface with no input region exists.

This patch adds a function to clear pointer focus and also set the sx,sy
co-ordinates to a sentinel value we shouldn't compute with.

Assertions are added to make sure any time pointer focus is set to NULL
these values are used.

weston_compositor_pick_view() now returns these values too.

Now the values are always initialized, even when no view exists, and
they're initialized in such a way that actually doing computation
with them should fail in an obvious way, but we can compare them
safely for equality.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agotest/ivi: include protocol headers for all used protocols
Bill Spitzak [Thu, 6 Aug 2015 15:24:59 +0000 (16:24 +0100)]
test/ivi: include protocol headers for all used protocols

This seems like a good idea for consistency that the protocol header
is included for any protocols used by the code. This also means the
code will compile with headers generated by wayland-scanner -c.

Fixed to use angle brackets.

Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agoinput: pass the global touch coordinates to the touch grab
Giulio Camuffo [Wed, 8 Jul 2015 08:55:28 +0000 (11:55 +0300)]
input: pass the global touch coordinates to the touch grab

This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.

Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agocompositor: remove a call to weston_compositor_schedule_repaint
Ryo Munakata [Sat, 25 Jul 2015 02:09:41 +0000 (11:09 +0900)]
compositor: remove a call to weston_compositor_schedule_repaint

In weston_compositor_create, we initialize output_list.
After that we call weston_compositor_schedule_repaint which just calls
weston_output_schedule_repaint on all elements of output_list.
This call does nothing obviously. So we remove it.

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Guilio Camuffo <guiliocamuffo@gmail.com>
9 years agodesktop-shell: Make resize and move functions take a pointer instead of a seat
Derek Foreman [Wed, 5 Aug 2015 19:48:11 +0000 (14:48 -0500)]
desktop-shell: Make resize and move functions take a pointer instead of a seat

An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agodon't crash when the key file doesn't exist
David FORT [Sat, 1 Aug 2015 22:35:30 +0000 (00:35 +0200)]
don't crash when the key file doesn't exist

This allows to close the remaining issue in
https://bugs.freedesktop.org/show_bug.cgi?id=91390

Reviewed-by: Daniel Stone <daniels@collabora.com>
9 years agobackends: don't destroy renderer and output twice
Dawid Gajownik [Fri, 31 Jul 2015 03:02:28 +0000 (00:02 -0300)]
backends: don't destroy renderer and output twice

drm, fbdev, rpi and wayland backends are unnecessarily destroying
renderer and output before executing weston_compositor_shutdown()

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-rdp: rdp_destroy() double free error #91457
Dawid Gajownik [Wed, 5 Aug 2015 20:21:28 +0000 (17:21 -0300)]
compositor-rdp: rdp_destroy() double free error #91457

When something goes wrong during weston initialization,
weston_compositor_destroy() is executed. It destroys the backend and
then frees compositor memory. Unfortunately RDP backend is not correctly
destroyed. It frees compositor instead of a backend memory. This causes
later a double free error. The easiest way to reproduce a problem is to
run weston with an invalid option.

Additionally some other objects of rdp_backend structure are not
destroyed/freed. The patch fixes both issues.

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

v3: comply with Weston coding style, this time for real
v2: comply with Weston coding style

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoscreen-share: don't test keyboard/pointer pointers
Dawid Gajownik [Sat, 1 Aug 2015 02:46:46 +0000 (23:46 -0300)]
screen-share: don't test keyboard/pointer pointers

Keyboards and pointers aren't freed when devices are removed, so we
should really be testing keyboard_device_count and pointer_device_count
in most cases, not the actual pointers. Otherwise we end up with
different behaviour after removing a device than we had before it was
inserted.

This commit makes screen-share.c compile once again after changes in
commit 1281a36e3bcd27345bd4a107f282213ecca56f0e.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: drop shell_client from the head of the surface list on destroy
Derek Foreman [Fri, 29 May 2015 15:46:44 +0000 (10:46 -0500)]
desktop-shell: drop shell_client from the head of the surface list on destroy

This prevents a use after free when the surfaces are automatically cleaned
up later, as shell_client's freed node was still in the surface list.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agocompositor-rdp: free() can handle NULL pointers
Dawid Gajownik [Sat, 1 Aug 2015 14:02:54 +0000 (11:02 -0300)]
compositor-rdp: free() can handle NULL pointers

There's no need to check if a pointer exists before passing it to free().
free() can handle NULL pointers.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-By: David FORT <contact@hardening-consulting.com>
9 years agomain: print backends in help message in alphabetical order
Dawid Gajownik [Fri, 31 Jul 2015 20:39:00 +0000 (17:39 -0300)]
main: print backends in help message in alphabetical order

For better readability of `weston --help' output, backends are now sorted
in alphabetical order.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years ago.gitignore: ignore doxygen generated files v2
Dawid Gajownik [Fri, 31 Jul 2015 21:28:59 +0000 (18:28 -0300)]
.gitignore: ignore doxygen generated files v2

Fixes incorrect commit d95637905861162c08251843acccc11e509b5d94

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
9 years agoinput: Don't test keyboard/pointer/touch pointers
Derek Foreman [Fri, 31 Jul 2015 21:55:32 +0000 (16:55 -0500)]
input: Don't test keyboard/pointer/touch pointers

Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agofullscreen-shell: Test for device presence properly
Derek Foreman [Wed, 15 Jul 2015 18:00:47 +0000 (13:00 -0500)]
fullscreen-shell: Test for device presence properly

We should be testing device counts, not pointers.  The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after the last release.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodesktop-shell: Check for device presence properly
Derek Foreman [Wed, 15 Jul 2015 18:00:46 +0000 (13:00 -0500)]
desktop-shell: Check for device presence properly

We should be testing device counts, not pointers.  The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after a release.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodesktop-shell: Don't call wl_list_init() in the middle of a list
Derek Foreman [Wed, 15 Jul 2015 18:00:45 +0000 (13:00 -0500)]
desktop-shell: Don't call wl_list_init() in the middle of a list

seat->keyboard_focus_listener.link isn't a head, it's just sometimes a
member of the focus signal list.  Calling wl_list_init() on it puts
a loop in the list.

Instead, we remove the item then init it.  That way we can call remove on
it again later even if it hasn't been re-added to a list.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoinput: Check device counts in bind_seat()
Derek Foreman [Wed, 15 Jul 2015 18:00:44 +0000 (13:00 -0500)]
input: Check device counts in bind_seat()

We shouldn't be using seat->pointer|keyboard|touch here, we should be
testing *_device_count to see if a device is currently present.

Testing the pointers directly will result in incorrectly advertising
capabilities after all devices of a type have been removed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoUpdate .gitignore
Dawid Gajownik [Wed, 29 Jul 2015 03:55:55 +0000 (00:55 -0300)]
Update .gitignore

Hi,

after running configure with "Enable developer documentation" set to
"yes" git status warns about two new untracked files:

        doc/doxygen/tooldev.doxygen
        doc/doxygen/tools.doxygen

Below is a small patch.

HTH,
  Dawid

9 years agomain: update RDP backend help message
Dawid Gajownik [Fri, 31 Jul 2015 17:49:57 +0000 (14:49 -0300)]
main: update RDP backend help message

`--env-socket' option is of type WESTON_OPTION_BOOLEAN, not
WESTON_OPTION_STRING. Socket should be defined in RDP_FD environment variable.

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agogitignore: Ignore some dist generated files
Bryce Harrington [Fri, 31 Jul 2015 01:17:29 +0000 (18:17 -0700)]
gitignore: Ignore some dist generated files

9 years agozoom: Store the seat that initiated a zoom
Derek Foreman [Thu, 23 Jul 2015 19:55:15 +0000 (14:55 -0500)]
zoom: Store the seat that initiated a zoom

Track the seat that initiated a seat instead of picking the first one.

Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.

Now the zoom will follow the pointer of the seat that initiated the zoom.

Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agozoom: Call weston_output_activate_zoom() appropriately
Derek Foreman [Thu, 23 Jul 2015 19:55:13 +0000 (14:55 -0500)]
zoom: Call weston_output_activate_zoom() appropriately

No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.

Add an assert() to make sure update_zoom is never called without an
active zoom.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agozoom: Rename zoom_area_center_from_pointer to zoom_area_center_from_point
Derek Foreman [Thu, 23 Jul 2015 19:55:14 +0000 (14:55 -0500)]
zoom: Rename zoom_area_center_from_pointer to zoom_area_center_from_point

It doesn't do anything with a pointer, and zoom can be initiated by the
keyboard, so the name was a little confusing.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agozoom: Change zoom->active to a bool
Derek Foreman [Thu, 23 Jul 2015 19:55:12 +0000 (14:55 -0500)]
zoom: Change zoom->active to a bool

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoFix crash when using RDP4 security
FORT David [Mon, 20 Jul 2015 12:39:21 +0000 (14:39 +0200)]
Fix crash when using RDP4 security

The initialization of the freerdp_peer was done too early.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=91390.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoremove a warning during compilation
FORT David [Mon, 20 Jul 2015 12:39:20 +0000 (14:39 +0200)]
remove a warning during compilation

backend_init now returns an int not a pointer.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agobuild: mkdir target weston.ini directories before writing
Ross Burton [Fri, 17 Jul 2015 11:33:45 +0000 (12:33 +0100)]
build: mkdir target weston.ini directories before writing

In parallel out-of-tree builds it is possible for e.g. ivi-shell/weston.ini to
be written before ivi-shell/ exists.  Solve this by creating the target
directory first.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
9 years agocms-helper/static: Add "identity" builtin cms profile (v3)
Mario Kleiner [Sat, 18 Jul 2015 06:10:58 +0000 (08:10 +0200)]
cms-helper/static: Add "identity" builtin cms profile (v3)

Allows to force loading an identity gamma table if
option icc_profile= is given in weston.ini for
an output, ie., icc_profile= is specified to an
empty assignment.

Some special display output devices, e.g., for
neuro-science applications, and special display
testing hardware need a guaranteed perfect pixel
passthrough from framebuffer to output. This is
an easy way to set this up for cms-static.

v2: Remove confusing/redundant weston_log debug output.
v3: Don't use the "identity" keyword to trigger this, but
    instead assignment of an empty string will trigger
    loading of an identity LUT. Suggested by Derek Foreman.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agocms-colord: Fix crash at compositor shutdown. (v2)
Mario Kleiner [Sat, 18 Jul 2015 06:07:11 +0000 (08:07 +0200)]
cms-colord: Fix crash at compositor shutdown. (v2)

cms-colord used the weston_compositor destroy signal to
trigger its final colord_module_destroy cleanup, and the
wl_output destroy signal to trigger per output cleanup.

The problem is that the compositor destroy signal gets
emitted before the output destroy signals at compositor
shutdown, colord_module_destroy would free all its
shared data structures and then later on the output
destroy callback would try to access those shared
data structures when handling output destruction
-> Use after free -> Crash, usually with VT switching
dead and thereby an unuseable system requiring a reboot.

Solve this by moving the output destruction handling into
the colord_cms_output_destroy() cleanup function for
colord-cms own hash dictionary of all active outputs.

The output destroy callback just removes the corresponding
output from the dictionary and triggers proper cleanup if
an output is unplugged during runtime. During compositor
shutdown, the dictionary as a whole is released before
releasing all other shared data structures, thereby
triggering cleanup of all remaining outputs.

Tested to fix crashes on x11 and drm backends.

v2: Formatting: Wrap lines to < 80 characters, as suggested
    by Derek. Thanks.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Put monitor to sleep when idle timer expires
Derek Foreman [Mon, 20 Jul 2015 21:28:13 +0000 (16:28 -0500)]
desktop-shell: Put monitor to sleep when idle timer expires

Removing the screensaver had the accidental side effect of disabling
DPMS display shut down.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agocompositor: Respect WESTON_BUILD_DIR env var in weston_load_module
Derek Foreman [Mon, 8 Jun 2015 16:46:54 +0000 (11:46 -0500)]
compositor: Respect WESTON_BUILD_DIR env var in weston_load_module

We were loading modules out of the system dirs unconditionally, so
tests that loaded modules would use the system ones, or fail if
they weren't installed.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoexposay: Fix use after free when a view is destroyed during animation
Derek Foreman [Tue, 26 May 2015 21:21:05 +0000 (16:21 -0500)]
exposay: Fix use after free when a view is destroyed during animation

Moving the destroy listener setup allows the animation completion handler
to be called before we free any structures it needs.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoexposay: Fix logic inversion when ending keyboard grabs
Derek Foreman [Sat, 18 Jul 2015 01:58:02 +0000 (20:58 -0500)]
exposay: Fix logic inversion when ending keyboard grabs

I flipped a ! in cee82d62865ab5b239935f102c2e1f7868e0fa65
and the exposay keyboard grab became permanent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoinput: make a function for device removal
Derek Foreman [Tue, 5 May 2015 20:01:52 +0000 (15:01 -0500)]
input: make a function for device removal

Break device_removed() out into its own function like device_added().

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agowindow: Use wl_cursor_frame_and_duration() for mouse cursor updates
Derek Foreman [Wed, 22 Apr 2015 22:23:35 +0000 (17:23 -0500)]
window: Use wl_cursor_frame_and_duration() for mouse cursor updates

Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.

Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: use work area instead of panel size to constrain moves
Derek Foreman [Wed, 15 Apr 2015 17:23:56 +0000 (12:23 -0500)]
desktop-shell: use work area instead of panel size to constrain moves

This fixes the case where an output isn't at y = 0, where the panel height
isn't correct for constraints.

It also kills a bug - moving a window with a mod-drag off the top of the
screen clamped earlier than it should.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agodesktop-shell: use output position in get_output_panel_size()
Derek Foreman [Wed, 15 Apr 2015 17:23:55 +0000 (12:23 -0500)]
desktop-shell: use output position in get_output_panel_size()

The panel size calculation needs to take the output position into account
or it's only correct when the output is at 0, 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agodesktop-shell: add output co-ordinates to get_output_work_area()
Derek Foreman [Wed, 15 Apr 2015 17:23:54 +0000 (12:23 -0500)]
desktop-shell: add output co-ordinates to get_output_work_area()

get_output_work_area() now returns the absolute work area including the
output's offset.

This will make math a little simpler later when we use it to constrain
window moves.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agologind-util: Use %u for unsigned int in snprintf
Bryce Harrington [Sat, 11 Jul 2015 02:51:52 +0000 (19:51 -0700)]
logind-util: Use %u for unsigned int in snprintf

Addresses this warning found by Denis Denisov:

  [src/logind-util.c:702]: (warning) %d in format string (no. 1)
  requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor: destroy modifier_binding_list
Ryo Munakata [Fri, 17 Jul 2015 04:07:42 +0000 (13:07 +0900)]
compositor: destroy modifier_binding_list

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agoAdding doxygen setup and info for the testing framework.
Jon A. Cruz [Thu, 16 Jul 2015 02:22:43 +0000 (19:22 -0700)]
Adding doxygen setup and info for the testing framework.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoConverted the config parser test to the new framework.
Jon A. Cruz [Thu, 16 Jul 2015 02:22:42 +0000 (19:22 -0700)]
Converted the config parser test to the new framework.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoEnables output in the JUnit XML format.
Jon A. Cruz [Thu, 16 Jul 2015 02:22:41 +0000 (19:22 -0700)]
Enables output in the JUnit XML format.

Adds basic support for optionally outputting in the XML format
commonly used by JUnit compatible tools.

This format is supported by default by many tools, including
the Jenkins build system. It also is more detailed and
captures more information than the more simplistic TAP
format.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agobuild: don't duplicate rule for weston.desktop
Ross Burton [Thu, 16 Jul 2015 19:56:32 +0000 (20:56 +0100)]
build: don't duplicate rule for weston.desktop

dist_wayland_session_DATA will distribute and install src/weston.desktop, so the
definition of wayland_session_DATA which also installs src/weston.desktop will
result in the file being installed twice and (rarely) cause install to fail.

Spotted and fix by Roy Li <rongqing.li@windriver.com>.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agoshell: Switch middle and right mouse bindings
Derek Foreman [Thu, 25 Jun 2015 21:03:30 +0000 (16:03 -0500)]
shell: Switch middle and right mouse bindings

Currently rotate is on the right mouse button and resize is on the middle.

As fantastic as rotating windows is, it's probably nicer to have resize on
the right button, especially for anyone with only 2 buttons.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agolog: Open log file CLOEXEC so child processes don't get the fd
Derek Foreman [Mon, 8 Jun 2015 16:37:31 +0000 (11:37 -0500)]
log: Open log file CLOEXEC so child processes don't get the fd

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoinput: Also pass appropriate pointer type when libva unavailable
Bryce Harrington [Fri, 17 Jul 2015 02:12:26 +0000 (19:12 -0700)]
input: Also pass appropriate pointer type when libva unavailable

9 years agobindings: Make run binding functions take apropriate device instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:43 +0000 (13:00 -0500)]
bindings: Make run binding functions take apropriate device instead of a seat

Going from seat to input device requires that we test the device
before relying on the pointer.  In all of these binding functions
we can trust exactly one input device type directly.  If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.

When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agobindings: make install_binding_grab take a keyboard instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:42 +0000 (13:00 -0500)]
bindings: make install_binding_grab take a keyboard instead of a seat

It doesn't need the seat pointer, and the caller should already have
tested that the keyboard pointer is valid.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Use the grabbed pointer in popup_grab_button
Derek Foreman [Wed, 15 Jul 2015 18:00:41 +0000 (13:00 -0500)]
desktop-shell: Use the grabbed pointer in popup_grab_button

This should be identical to the pointer in shset->seat.

A later patch prevents direct access to seat->pointer, using the
known valid pointer in the grab will be nicer than using the
getter functions that patch introduces.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Make surface_resize take a pointer instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:40 +0000 (13:00 -0500)]
desktop-shell: Make surface_resize take a pointer instead of a seat

It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Make surface_rotate take a pointer instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:39 +0000 (13:00 -0500)]
desktop-shell: Make surface_rotate take a pointer instead of a seat

It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Make surface_move take a pointer instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:38 +0000 (13:00 -0500)]
desktop-shell: Make surface_move take a pointer instead of a seat

It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agodesktop-shell: Make surface_touch_move take a touch instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:37 +0000 (13:00 -0500)]
desktop-shell: Make surface_touch_move take a touch instead of a seat

It never actually needs the seat, and we always verify the touch pointer
before calling it, so let's just pass a touch pointer instead of having
an assumption that the seat's touch pointer has been verified.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoinput: Pass the appropriate pointer type to bindings instead of a seat
Derek Foreman [Wed, 15 Jul 2015 18:00:36 +0000 (13:00 -0500)]
input: Pass the appropriate pointer type to bindings instead of a seat

Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Simplify logic in setup_output_seat_constraint
Derek Foreman [Wed, 15 Jul 2015 18:00:35 +0000 (13:00 -0500)]
compositor-drm: Simplify logic in setup_output_seat_constraint

Use early return for a slight simplification.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agobindings: Stop exporting internal functions
Derek Foreman [Wed, 15 Jul 2015 18:00:34 +0000 (13:00 -0500)]
bindings: Stop exporting internal functions

These functions should never be called outside of the core.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoexposay: Test keyboard presence before using keyboard pointer
Derek Foreman [Wed, 15 Jul 2015 18:00:33 +0000 (13:00 -0500)]
exposay: Test keyboard presence before using keyboard pointer

We shouldn't actually use the keyboard pointer unless we check that
a keyboard is present.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agotext-backend: Replace focus_listener_initialized with a bool
Derek Foreman [Wed, 15 Jul 2015 18:00:32 +0000 (13:00 -0500)]
text-backend: Replace focus_listener_initialized with a bool

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Refactor code into cursor_bo_update()
Pekka Paalanen [Mon, 16 Jun 2014 09:05:40 +0000 (12:05 +0300)]
compositor-drm: Refactor code into cursor_bo_update()

Cut a chunk of code out from drm_output_set_cursor() and form a new
function for writing a cursor bo data from a weston_view with a wl_shm
buffer.

Add more asserts to verify the assumptions in there.

v2: Use drm_compositor::cursor_{width,height} instead of hard-coded 64.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Fix cursor view size check
Daniel Stone [Tue, 16 Jun 2015 17:42:23 +0000 (18:42 +0100)]
compositor-drm: Fix cursor view size check

Instead of testing against a hardcoded 64x64 pixel size to see if a view
is suitable for promotion to a cursor plane, use our cursor_width and
cursor_height variables.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Record current DPMS level
Daniel Stone [Thu, 18 Jun 2015 06:49:02 +0000 (07:49 +0100)]
compositor-drm: Record current DPMS level

Track the current DPMS level for any given output, and track failure (or
otherwise) of the DPMS-setting property call.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Refactor getting current mode into a new function
Pekka Paalanen [Wed, 4 Jun 2014 13:43:06 +0000 (16:43 +0300)]
compositor-drm: Refactor getting current mode into a new function

Makes create_output_for_connector() slightly easier to read.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor-drm: Refactor connector name into new function
Pekka Paalanen [Wed, 4 Jun 2014 13:29:49 +0000 (16:29 +0300)]
compositor-drm: Refactor connector name into new function

Refactor the code constructing the connector name into a new function.
This makes create_output_for_connector() slightly easier to read.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agocompositor-drm: Refactor initial mode out of create_output
Pekka Paalanen [Wed, 4 Jun 2014 11:00:53 +0000 (14:00 +0300)]
compositor-drm: Refactor initial mode out of create_output

Refactor the code for choosing the initial mode for an output from
create_output_for_connector() to drm_output_choose_initial_mode().

This makes create_output_for_connector() slightly easier to read.

v2: Document everything.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agocompositor: Respect repaint-window when restarting repaint loop.
Mario Kleiner [Sun, 21 Jun 2015 19:25:15 +0000 (21:25 +0200)]
compositor: Respect repaint-window when restarting repaint loop.

If a stopped repaint loop gets restarted due to posting of new
damage, and this restart of the repaint loop happens late in the
video refresh cycle, ie. already inside the repaint-window and
thereby after the composition deadline for the current frame,
then defer the actual output repaint to the composition deadline
of the next video refresh cycle by setting the repaint timer
accordingly.

This tries to make sure that:

a) Client(s) posting damage timely before the composition deadline
   (video refresh duration - "repaint-window" duration) of the
   current refresh cycle will trigger a repaint within the current
   refresh cycle, thereby avoiding one extra frame of compositor
   lag due to the needed restart of the repaint loop if the loop
   was stopped. This allows them to benefit from the earlier
   "instant repaint restart" commit to keep latency low.

b) Late clients which post damage close to the end of a refresh
   cycle can't race other clients if the repaint loop is restarted.
   Instead they will get deferred to the next compositor cycle,
   just as if the repaint loop would have been already running -
   the semantic of the "repaint-window" parameter is preserved.

   This is especially important to prevent a very late client
   from triggering a repaint very close to the vblank, which
   would cause the compositor to certainly miss the vblank and
   skip one frame and then cause a delay of another frame for
   other clients which posted their damage in time for the
   following frame. Iow. this provides clients with a more
   predictable compositor timing and makes it easier for them
   to latch onto the compositors repaint cycle.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agocompositor-drm: Allow instant start of repaint loop. (v4)
Mario Kleiner [Sun, 21 Jun 2015 19:25:14 +0000 (21:25 +0200)]
compositor-drm: Allow instant start of repaint loop. (v4)

drm_output_start_repaint_loop() incurred a delay of
one refresh cycle by using a no-op page-flip to get
an accurate vblank timestamp as reference. This causes
unwanted lag whenever Weston exited its repaint loop, e.g.,
whenever an application wants to repaint with less than
full video refresh rate but still minimum lag.

Try to use the drmWaitVblank ioctl to get a proper
timestamp instantaneously without lag. If that does
not work, fall back to the old method of idle page-flip.

This optimization will work on any drm/kms driver
which supports high precision vblank timestamping.
As of Linux 4.0 these would be intel, radeon and
nouveau on all their supported gpu's.

On kms drivers without instant high precision timestamping
support, the kernel is supposed to return a timestamp
of zero when calling drmWaitVblank() to query the current
vblank count and time iff vblank irqs are currently
disabled, because the only way to get a valid timestamp
on such kms drivers is to enable vblank interrupts and
then wait a bit for the next vblank irq to take a new valid
timestamp. The caller is supposed to poll until at next
vblank irq it gets a valid non-zero timestamp if it needs
a timestamp.

This zero-timestamp signalling works up to Linux 3.17, but
got broken due to a regression in Linux 3.18 and later. On
Linux 3.18+ with kms drivers that don't have high precision
timestamping, the kernel erroneously returns a stale timestamp
from an earlier vblank, ie. the vblank count and timestamp are
mismatched. A patch is under way to fix this, but to deal with
broken kernels, we also check non-zero timestamps if they are
more than one refresh duration in the past, as this indicates
a stale/invalid timestamp, so we need to take the page-flip
fallback for restarting the repaint loop.

v2: Implement review suggestions by Pekka Paalanen, especially
    extend the commit message to describe when and why the
    instant restart won't work due to missing Linux kernel
    functionality or a Linux kernel regression.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
v3: Fix timespec_to_nsec() which was computing picoseconds,
    use the new timespec-util.h helpers.

v4: Rebased to master, split long lines.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agocompositor,shared: add millihz_to_nsec()
Pekka Paalanen [Fri, 3 Jul 2015 12:08:53 +0000 (15:08 +0300)]
compositor,shared: add millihz_to_nsec()

A helper to improbe readability.

Cc: Daniel Stone <daniels@collabora.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoshared: introduce timespec-util.h
Pekka Paalanen [Fri, 3 Jul 2015 12:44:50 +0000 (15:44 +0300)]
shared: introduce timespec-util.h

Copyright is set according to the moved code from compositor.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agopresentation-shm: Allow setting of delay before surface.commit
Mario Kleiner [Sun, 21 Jun 2015 19:25:16 +0000 (21:25 +0200)]
presentation-shm: Allow setting of delay before surface.commit

A new optional parameter "-d msecs" allows to specify a
delay before the surface attach/damage/commit to shift
the point in time when a surface update is committed.

This allows to test how different client timings interact
with the compositors repaint timing.

Suggested by Pekka Paalanen.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v2: Clarify the intent, doing a delay in window_create_feedback()
    is a bit surprising. Use nanosleep() instead of clock_nanosleep(),
    which may not support the chosen presentation clock.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoREADME: introduce libweston
Pekka Paalanen [Tue, 14 Jul 2015 10:05:34 +0000 (13:05 +0300)]
README: introduce libweston

What is libweston and where do we intend to go with it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Jon A. Cruz <jonc@osg.samsung.com>
9 years agoivi-shell: transform refactoring to improve it to more readable code
Nobuhiko Tanibata [Wed, 15 Jul 2015 05:05:32 +0000 (14:05 +0900)]
ivi-shell: transform refactoring to improve it to more readable code

Transform matrix for transforming a surface to global_matrix is
calculated from
* ivi_layout_surface_properties
* ivi_layout_layer_properties

This patch pareares sub-method like following,
1/ calc_surface_to_global_matrix()
 calc_transformation_matrix() is called twice with
 ivi_layout_surface/layer_properties respectively.

2/ calc_transformation_matrix()
 This calcurates matrix from orientation, source rectangle and
 destination rectangle.
 2-1/ To calculate rotation, fit centor of source rectangle to (0,0)
      temporarily. This is moved back in 2-4.
 2-2/ Apply rotation variant
 2-3/ Apply scale variant
 2-4/ Apply positioning variant, taking account into 2-1 temporary
      positioning.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoivi-shell: transform refactoring, remove transform part of ivi_layout_surface and...
Nobuhiko Tanibata [Wed, 15 Jul 2015 05:05:10 +0000 (14:05 +0900)]
ivi-shell: transform refactoring, remove transform part of ivi_layout_surface and ivi_layout_layer once

To refactor transform of ivi_layout_surface and ivi_layout_surface to be
more readable logical flow.

Remove following parts once,
* definition of weston_transform in ivi_layout_surface
* update_layer_orientation
* update_layer_position
* update_surface_position
* update_surface_orientation
* update_scale

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoivi-shell: remove one indent level from update_prop()
Nobuhiko Tanibata [Wed, 15 Jul 2015 04:55:50 +0000 (13:55 +0900)]
ivi-shell: remove one indent level from update_prop()

There is no logic update.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
9 years agoPartially revert "xwayland: Always free reply from xcb_get_property_reply()"
Emmanuel Gil Peyrot [Wed, 15 Jul 2015 20:19:04 +0000 (22:19 +0200)]
Partially revert "xwayland: Always free reply from xcb_get_property_reply()"

This reverts commit d3553c721c0fed07f85b70fea418ca65ed974fbb.

weston_wm_write_property() takes the ownership of the reply it gets as
a parameter, and will eventually free it later in writable_callback.

This change introduced a double-free when Xwayland programs triggered a
copy to the clipboard, leading to a Weston crash.

Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
9 years agoDocumentation for the prepare_lock_surface event description, is incorrect
Christopher Michael [Tue, 14 Jul 2015 08:21:40 +0000 (01:21 -0700)]
Documentation for the prepare_lock_surface event description, is incorrect

Documentation for the prepare_lock_surface event description is
incorrect. The summary says "Tell the client..." however the full-text
description says "tell the shell..."

Signed-off-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[This time include the actual changes.]

9 years agozunitc: Fix minor typo
Bryce Harrington [Mon, 13 Jul 2015 19:23:01 +0000 (12:23 -0700)]
zunitc: Fix minor typo

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>