platform/upstream/weston.git
7 years agocompositor-drm: Turn vblank_pending from bool to refcount
Daniel Stone [Tue, 4 Apr 2017 16:54:32 +0000 (17:54 +0100)]
compositor-drm: Turn vblank_pending from bool to refcount

vblank_pending is currently a bool, which is reset on every vblank
requests (i.e. sprite pageflip). This can occur more than once per
frame, so turn it into a callback, so we only fire frame-done when we've
collected all the events.

This fixes unexpected behaviour when multiple views per output have been
promoted to DRM planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Introduce fb_last member
Daniel Stone [Tue, 4 Apr 2017 16:54:31 +0000 (17:54 +0100)]
compositor-drm: Introduce fb_last member

Previously, framebuffers were stored as fb_current and fb_pending.
In this scheme, current was the last buffer that the kernel/hardware had
acknowledged displaying: a framebuffer would be created, set as
fb_pending, and Weston would request the kernel display it. When the
kernel signals that the request was completed and the hardware had made
the buffer current (i.e. page_flip_handler / vblank_handler), we would
unreference the old fb_current, and promote fb_pending to fb_current.

In other words, the view is 'which buffer has turned to light?'.

This patch changes them to a tristate of fb_last, fb_current and
fb_pending, based around the kernel's view of the current state.
fb_pending is used purely as a staging area for request construction;
when the kernel acknowledges a request (e.g. drmModePageFlip returns 0),
the previous buffer is moved to fb_last, and this new buffer to
fb_current. When the kernel signals that the request has completed and
the hardware has made the buffer current, we simply unreference and
clear fb_last, without touching fb_current/fb_pending.

The view here is now 'which state is current in the kernel?'.

As all state changes are incremental on the last state submitted to the
kernel, even if the hardware has not yet been able to make it current,
this simplifies state tracking: all state submissions will always be
relative to fb_current, rather than the previous
(fb_pending) ? fb_pending : fb_current.

The use of fb_pending is strictly bounded between a repaint cycle
(including a grouped set of repaints) beginning, and those repaints
being flushed to the kernel.

fb_current will always be valid between an output's first repaint
flush, and when a disable/destroy request has been processed. For a
plane, it will be valid when a repaint cycle enabling that plane has
been flushed, and when a repaint cycle disabling that plane has been
flushed.

fb_last is only present when a repaint request for the output/plane has
been submitted, but not yet completed by the hardware.

This is the same set of constructs which will be used for storing
plane/output state objects in future patches.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: correctly set the version of the drmEventContext
Emil Velikov [Tue, 4 Apr 2017 17:07:34 +0000 (18:07 +0100)]
compositor-drm: correctly set the version of the drmEventContext

We implement v2 so use that instead of the DRM_EVENT_CONTEXT_VERSION
macro.

The latter defines the version of the drmEventContext struct declared in
the header [used in the current build] and can be 2, 3 or even 1000.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Return FB directly from render
Daniel Stone [Tue, 4 Apr 2017 16:54:30 +0000 (17:54 +0100)]
compositor-drm: Return FB directly from render

Instead of setting state members directly in the drm_output_render
functions (to paint using Pixman or GL), just return a drm_fb, and let
the core function place it in state.

This brings damage handling in line with repaint state, so we do not
clear damage if repaint fails.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Reshuffle drm_output_render
Daniel Stone [Tue, 4 Apr 2017 16:54:29 +0000 (17:54 +0100)]
compositor-drm: Reshuffle drm_output_render

Call drm_output_render unconditionally, doing an early exit if we're
already rendering a client buffer on the primary plane.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Rename current/next FB members
Daniel Stone [Tue, 4 Apr 2017 16:54:28 +0000 (17:54 +0100)]
compositor-drm: Rename current/next FB members

'next' is used as a framebuffer which has either been rendered but not
had a configuration request (pageflip or CRTC set) applied to it, or
when for a framebuffer that has had configuration requested but not
applied (delayed pageflip where the event has not been applied).

'current' is used as the last framebuffer for which we know
configuration has been fully applied, i.e. CRTC set executed or pageflip
requested and event received.

Rename these members to fb_current and fb_pending, doing some small
reordering of drm_output whilst in the vicinity.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Use drm_fb for cursor buffers
Daniel Stone [Tue, 4 Apr 2017 16:54:27 +0000 (17:54 +0100)]
compositor-drm: Use drm_fb for cursor buffers

Now that we have better types in drm_fb, use it for cursor buffers as
well. This gives us easier refcounting for our cursors, as well as a
unified buffer-destruction path.

Currently this makes no difference, as the KMS legacy cursor update API
uses GEM names directly, and never touches DRM FBs. However, the cursor
plane becomes a regular KMS plane under atomic, at which point we
require DRM FBs.

Take the opportunity to move to drm_fb ahead of time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Refcount drm_fb
Daniel Stone [Tue, 4 Apr 2017 16:54:26 +0000 (17:54 +0100)]
compositor-drm: Refcount drm_fb

Sometimes we need to duplicate an existing drm_fb, e.g. when
pageflipping to the same buffer to kickstart the repaint loop. To handle
situations like these, and simplify resource management for dumb and
cursor buffers, refcount drm_fb.

drm_fb_get_from_bo has a path where it may reuse a drm_fb, if the BO has
been imported and not released yet. As drm_fb_unref now relies on actual
refcounting (backed up by asserts), we add a balancing drm_fb_ref() to
the path where we return a reused drm_fb.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Drop output from release_fb
Daniel Stone [Tue, 4 Apr 2017 16:54:25 +0000 (17:54 +0100)]
compositor-drm: Drop output from release_fb

We only need it for the GBM surface the FB was originally created
against; a mismatch here is very bad indeed, so no reason to pass it in
explictly every time rather than store it.

Following patches change drm_fb to be explicitly reference counted; in
order to reduce churn, rename drm_output_release_fb to drm_fb_unref
whilst changing its call signature here, even though it does not yet
actually perform reference counting.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Refactor destroy drm_fb function
Tomohito Esaki [Tue, 4 Apr 2017 16:54:24 +0000 (17:54 +0100)]
compositor-drm: Refactor destroy drm_fb function

The drm_fb destroy callback to mostly the same thing regardless of
whether the buffer is a dumb buffer or gbm buffer. This patch refactors
the common parts into a new function that can be called for both cases.

[daniels: Rebased on top of fb->fd changes, cosmetic changes.]

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Store format in drm_fb
Daniel Stone [Tue, 4 Apr 2017 16:54:23 +0000 (17:54 +0100)]
compositor-drm: Store format in drm_fb

This uses the new pixel-format helpers, so we can also replace depth/bpp
with these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalaneN@collabora.co.uk>
7 years agocompositor-drm: Add explicit type member to drm_fb
Daniel Stone [Tue, 4 Apr 2017 16:54:22 +0000 (17:54 +0100)]
compositor-drm: Add explicit type member to drm_fb

Rather than magically trying to infer what the buffer is and what we
should do with it when we go to destroy it, add an explicit type
instead.

In doing so, the test for dumb images (destroying them, but only if
they're not the 'live' ones) is removed. This was dead code, as the only
path which could cause us to shuffle images is drm_output_switch_mode.
This calls drm_output_release_fb before the images are reallocated in
drm_output_fini_pixman / drm_output_init_pixman, with the reallocation
unconditionally destroying the images, so can never be hit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Calculate more cursor state up front
Daniel Stone [Tue, 4 Apr 2017 16:54:21 +0000 (17:54 +0100)]
compositor-drm: Calculate more cursor state up front

Make drm_output_set_cursor more deterministic, by calculating more state
and performing more plane manipulation, inside
drm_output_prepare_cursor_view.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agolibweston: Add pixel-format helpers
Daniel Stone [Tue, 4 Apr 2017 16:54:20 +0000 (17:54 +0100)]
libweston: Add pixel-format helpers

Rather than duplicating knowledge of pixel formats across several
components, create a custom central repository.

Signed-off-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix include paths and two copy-pastas]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agobuild: make libdrm a hard build-time dependency
Pekka Paalanen [Thu, 6 Apr 2017 11:06:20 +0000 (14:06 +0300)]
build: make libdrm a hard build-time dependency

Libdrm provides headers that are useful even without libdrm.so itself,
particularly drm_fourcc.h. Therefore promote libdrm as a hard build-time
dependency of libweston core so that we can always rely on libdrm
headers.

This does not affect any runtime dependencies. Specifically, no runtime
dependency to libdrm.so is added in any build configuration.

Currently only gl-renderer is using drm_fourcc.h. Now we can drop the
GL_RENDERER check from configure.ac and just use LIBDRM_CFLAGS.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka, from Quentin: just drop have_libdrm var completely]
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agobuild: do not link libdrm without DRM backend
Pekka Paalanen [Thu, 6 Apr 2017 10:57:57 +0000 (13:57 +0300)]
build: do not link libdrm without DRM backend

The pkg-config test for LIBDRM is independent of whether the DRM backend
is enabled or not. Therefore it is possible to have libdrm available and
found, even though it is not needed.

Do not link libdrm.so into the launchers unless it is really needed,
that is, DRM compositor is built. Otherwise you end up with
fbdev-backend.so and weston-launch depending on libdrm.so.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoconfigure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR
Pekka Paalanen [Thu, 6 Apr 2017 10:18:59 +0000 (13:18 +0300)]
configure: replace HAVE_LIBDRM with BUILD_DRM_COMPOSITOR

HAVE_LIBDRM was used as a condition for the launcher infrastructure to
call libdrm.so functions. It was set by an independent test for libdrm,
which would silently continue if libdrm was not found. It was assumed
that if you enabled a feature that used libdrm at runtime, the test for
that feature would imply that HAVE_LIBDRM is also set. This was quite
subtle.

The only feature that actually uses libdrm.so at runtime is the DRM
backend. No other backend needs the libdrm calls in the launcher
infrastructure.

Therefore to simplify things, stop using HAVE_LIBDRM and use
BUILD_DRM_COMPOSITOR instead. If you enable the DRM compositor, you
automatically also get libdrm support in the launchers.

There are still things depending on LIBDRM_CFLAGS and LIBDRM_LIBS, so
the test cannot be removed completely.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agodesktop-shell: Position maximized surfaces on the correct output.
Emmanuel Gil Peyrot [Tue, 4 Apr 2017 17:49:33 +0000 (18:49 +0100)]
desktop-shell: Position maximized surfaces on the correct output.

During a maximize event, a surface was previously always put back to
the primary output after one frame on the correct output, while keeping
its size.  This was caused by the shell surface’s last_{width,height}
not being reset when it was either fullscreen or maximized, leading to
the unmaximize/maximize dance being done at each commit.

This was introduced in 8f9d90a84bb2888b074fea93c4a28778bc6439c6.

Changes since v1:
- Fix the actual issue instead of a symptom.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agowcap: Prevent fd leak in wcap_decoder_create() fail path
Sergi Granell [Wed, 29 Mar 2017 20:41:02 +0000 (22:41 +0200)]
wcap: Prevent fd leak in wcap_decoder_create() fail path

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-wayland: Properly dealloc mmap data using munmap
Raúl Peñacoba [Wed, 29 Mar 2017 20:23:07 +0000 (22:23 +0200)]
compositor-wayland: Properly dealloc mmap data using munmap

Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoeditor: Add missing free() and display_destroy() in main
Raúl Peñacoba [Wed, 29 Mar 2017 16:16:46 +0000 (18:16 +0200)]
editor: Add missing free() and display_destroy() in main

Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoivi-layout: Add missing free() in ivi_view_create
Raúl Peñacoba [Wed, 29 Mar 2017 16:13:36 +0000 (18:13 +0200)]
ivi-layout: Add missing free() in ivi_view_create

Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agogl-renderer: Change 'data' type to 'uint8_t *', since 'void *' arithmetic is undefined
Raúl Peñacoba [Tue, 28 Mar 2017 16:17:56 +0000 (18:17 +0200)]
gl-renderer: Change 'data' type to 'uint8_t *', since 'void *' arithmetic is undefined

Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-drm: Add missing drmModeFreeResources in drm_device_is_kms
Sergi Granell [Tue, 28 Mar 2017 10:44:04 +0000 (12:44 +0200)]
compositor-drm: Add missing drmModeFreeResources in drm_device_is_kms

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-wayland: Call weston_compositor_exit when receiving an xdg toplevel close...
Sergi Granell [Sat, 25 Mar 2017 16:19:36 +0000 (17:19 +0100)]
compositor-wayland: Call weston_compositor_exit when receiving an xdg toplevel close event

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agodesktop-shell: Remove unused variable in panel_create
Raúl Peñacoba [Sat, 25 Mar 2017 15:42:38 +0000 (16:42 +0100)]
desktop-shell: Remove unused variable in panel_create

Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-wayland: Call set_window_geometry when using zxdg_shell_v6
Sergi Granell [Fri, 24 Mar 2017 22:45:13 +0000 (23:45 +0100)]
compositor-wayland: Call set_window_geometry when using zxdg_shell_v6

This way Wayland compositors will be aware of Weston's
"visible bounds" (and ignore its shadows).

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoweston-terminal: Fix race at startup
Derek Foreman [Fri, 24 Mar 2017 21:29:31 +0000 (16:29 -0500)]
weston-terminal: Fix race at startup

If anything is printed for the terminal window to display before the
window has been initially sized we end up with a segfault.

This defers the exec() of the shell child process until after the
window is sized so this can't happen anymore.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agodesktop-shell: launch clients in their own process group.
Derek Foreman [Fri, 24 Mar 2017 14:41:13 +0000 (09:41 -0500)]
desktop-shell: launch clients in their own process group.

Client applications shouldn't be in the same process group as
the display server.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoweston: Set CLOEXEC on stdin
Derek Foreman [Fri, 24 Mar 2017 14:41:12 +0000 (09:41 -0500)]
weston: Set CLOEXEC on stdin

We don't want to leak this into apps launched from the panel.

stdout and stderr are left for now because some things launched
by weston - such as weston-keyboard - share weston's log by
printing to those fds.

I'm singling out stdin because it's never needed by a child process
and because it's value is 0, which makes it easy to accidentally
do bad things to (commit 5c611d933f60f720db98331c9c1c6ed4420f9782)

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoos: Check for EINTR on ftruncate()
Derek Foreman [Thu, 23 Mar 2017 16:59:23 +0000 (11:59 -0500)]
os: Check for EINTR on ftruncate()

The man page indicates that ftruncate() can set errno to EINTR, so test
for this.

I have not actually been able to provoke an EINTR error from ftruncate()
in testing though.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoos: Check for EINTR on posix_fallocate()
Derek Foreman [Thu, 23 Mar 2017 16:59:22 +0000 (11:59 -0500)]
os: Check for EINTR on posix_fallocate()

posix_fallocate() can return EINTR and need to be restarted - I've hit
this when running weston-terminal under gdb.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-wayland: Check the return value of wayland_output_create_common
Sergi Granell [Fri, 24 Mar 2017 19:48:02 +0000 (20:48 +0100)]
compositor-wayland: Check the return value of wayland_output_create_common

If wayland_output_create_common returns NULL, it means that
the output creation failed.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-wayland: Refactor struct wayland_output::name usage
Sergi Granell [Fri, 24 Mar 2017 19:48:01 +0000 (20:48 +0100)]
compositor-wayland: Refactor struct wayland_output::name usage

struct wayland_output::name was used but never initialized.
Also zxdg_toplevel_v6_set_title was only called for windowed outputs,
and some compositors let you see the client's name even when it is
fullscreen (GNOME Shell's Activities menu for example).

So rename struct wayland_output::name to struct wayland_output::title and
precompute it on wayland_output_create_common(), so it can be later used
on xdg's set_title and frame_create.

v2: Move zxdg_toplevel_v6_set_title() before the wl_surface_commit()
as per Quentin Glidic's suggestion.

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoFix uninitialized msec_to_next in output_repaint_timer_arm
Sergi Granell [Sat, 18 Mar 2017 12:01:15 +0000 (13:01 +0100)]
Fix uninitialized msec_to_next in output_repaint_timer_arm

Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agoman: move pageflip-timeout later
Pekka Paalanen [Mon, 13 Mar 2017 13:25:42 +0000 (15:25 +0200)]
man: move pageflip-timeout later

The paragraph about pageflip-timeout was added in between the two
paragraphs of idle-time, causing the paragraphs to be associated wrong.

Move the pageflip-timeout paragraph to the end.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston-terminal: Add a --maximized command line parameter
Derek Foreman [Wed, 8 Mar 2017 17:58:20 +0000 (11:58 -0600)]
weston-terminal: Add a --maximized command line parameter

This is useful for testing compositor response to a client that
requests a maximized initial surface.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston-launch: Add sysmacros.h include for major()
Daniel Stone [Tue, 14 Mar 2017 17:25:30 +0000 (17:25 +0000)]
weston-launch: Add sysmacros.h include for major()

Same as with c4d7f66c, but I hadn't done a full-tree rebuild so didn't
see this one go by.

Signed-off-by: Daniel Stone <daniels@collabora.com>
7 years agolibinput: Suppress unhandled-case warning
Daniel Stone [Tue, 14 Mar 2017 17:24:04 +0000 (17:24 +0000)]
libinput: Suppress unhandled-case warning

When the wheel tilt source is present, gcc complains that we don't
handle all possible enumeration values. We already ensure this cannot
happen in its only caller (handle_pointer_axis), but gcc doesn't
recognise this. Give it a default value to quiet the warning.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agosimple-dmabuf-v4l: Remove incorrect assert
Derek Foreman [Fri, 10 Mar 2017 20:21:32 +0000 (14:21 -0600)]
simple-dmabuf-v4l: Remove incorrect assert

According to v4l2 documentation, DQBUF always clears FLAG_DONE, so
this assert can be expected to fire 100% of the time.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoconfigure: bump libweston to 3.0.0
Pekka Paalanen [Tue, 14 Mar 2017 10:14:51 +0000 (12:14 +0200)]
configure: bump libweston to 3.0.0

Bump the future release to 3.0.0 due to breaking ABI in libweston.

We have merged a few patches already that change libweston/compositor.h.
While most of the changes arguably change only things libweston users
should not be touching, some change the size of e.g. struct
weston_output and struct weston_compositor, possibly moving member
offsets. We also haven't separated public and private parts from
compositor.h yet. To be on the safe side, bump the major now. I'm sure
there will be more changes that make the bump obviously necessary.

Cc: Bryce Harrington <bryce@osg.samsung.com>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoAllow backends to group repaint flushes
Daniel Stone [Wed, 1 Mar 2017 11:34:10 +0000 (11:34 +0000)]
Allow backends to group repaint flushes

Implement new repaint_begin and repaint_flush hooks inside
weston_backend, allowing backends to gang together repaints which
trigger at the same time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoSwitch to global output repaint timer
Daniel Stone [Wed, 1 Mar 2017 11:34:08 +0000 (11:34 +0000)]
Switch to global output repaint timer

In preparation for grouping output repaint together where possible,
switch the per-output repaint timer, to a global timer which iterates
across all outputs.

This is implemented by storing the absolute time for the next repaint
for each output locally, and maintaining a global timer which iterates
all of them, scheduling the repaint for the first available time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: The comment about 1 ms delay.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agolauncher: Add sysmacros.h include for major()
Daniel Stone [Mon, 13 Mar 2017 16:32:18 +0000 (16:32 +0000)]
launcher: Add sysmacros.h include for major()

glibc 2.25 produces a warning when sysmacros.h is not directly included
but major() is used, as it is intended to be moved to sysmacros.h and
only there. Include it to keep the build happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
7 years agoFix 'implicit fallthrough' warning with new GCC
Daniel Stone [Mon, 13 Mar 2017 16:31:36 +0000 (16:31 +0000)]
Fix 'implicit fallthrough' warning with new GCC

GCC 7 now warns on case statements falling through without an explicit
comment that falling through is OK. Insert some to make it happy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
7 years agoChange boolean repaint_scheduled to quad-state enum
Daniel Stone [Fri, 3 Mar 2017 16:59:42 +0000 (16:59 +0000)]
Change boolean repaint_scheduled to quad-state enum

repaint_scheduled is actually cleverly a quad-state, disguised as a
boolean. There are four possible conditions for the repaint loop to be
in at any time:
  - loop idle; no repaint will occur until specifically requested, which
    may be never (repaint_scheduled == 0)
  - loop schedule to begin: the loop was previously idle, but due to a
    repaint-schedule request, we will call the start_repaint_loop hook
    in the next idle task
  - repaint scheduled: the compositor has definitively scheduled a
    repaint request for this output, which will occur in fixed time
  - awaiting repaint completion: the backend has not yet signaled
    completion of the last repaint request, and the compositor will not
    schedule another until it does so

All but the first condition were previously conflated as
repaint_scheduled == 1, but break them out into separate conditions to
aid clarity, backed up by some asserts.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoChange repaint_needed to bool
Daniel Stone [Wed, 1 Mar 2017 11:34:06 +0000 (11:34 +0000)]
Change repaint_needed to bool

It is only used as a binary value.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoDon't delay initial output paint
Daniel Stone [Wed, 1 Mar 2017 11:34:05 +0000 (11:34 +0000)]
Don't delay initial output paint

On startup, we cannot lock on to the repaint timer because it is unknown
to us. We deal with this by claiming that the moment of entry into the
repaint loop is the moment a frame returned, causing finish_frame to
delay our initial repaint to (refresh_time - repaint_delay), typically
around 9ms of utterly wasted time.

Add an explicit stamp == NULL, to determine that we are just beginning
our repaint loop, that the timings are in fact totally invalid, and that
it would be beneficial to repaint the output immediately. This will only
trigger when the display had previously been disabled or the previous
state is unknown, e.g. at startup, or coming back from DPMS off.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoCalculate next-frame target time in absolute space
Daniel Stone [Wed, 1 Mar 2017 11:34:04 +0000 (11:34 +0000)]
Calculate next-frame target time in absolute space

Rather than determining the time until next-frame repaint in relative
space (time until repaint), determine it first in absolute space, and
then later convert this to relative.

This will later allow us to store these per-output, so we can have a
single idle timer which will allow us to aggregate multiple repaints
together when timing allows.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec subtraction helpers
Daniel Stone [Wed, 1 Mar 2017 11:34:03 +0000 (11:34 +0000)]
timespec: Add timespec subtraction helpers

Add helpers to subtract two timespecs, then return the difference in
either milliseconds or nanoseconds. These will be used to compare
timestamps during the repaint cycle.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_to_msec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:02 +0000 (11:34 +0000)]
timespec: Add timespec_to_msec helper

Paralleling timespec_to_nsec, converts to milliseconds.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: added doc about flooring]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_add_msec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:01 +0000 (11:34 +0000)]
timespec: Add timespec_add_msec helper

Add a (timespec) = (timespec) + (msec) helper, to save intermediate
conversions in its users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotimespec: Add timespec_add_nsec helper
Daniel Stone [Wed, 1 Mar 2017 11:34:00 +0000 (11:34 +0000)]
timespec: Add timespec_add_nsec helper

Add a (timespec) = (timespec) + (nsec) helper, to save intermediate
conversions to nanoseconds in its users.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: pageflip timeout implementation
Emmanuel Gil Peyrot [Tue, 7 Mar 2017 13:27:54 +0000 (13:27 +0000)]
compositor-drm: pageflip timeout implementation

Weston will not repaint until previous update has been acked by a
pageflip event coming from the drm driver. However, some buggy drivers
won’t return those events or will stop sending them at some point and
Weston output repaints will completely freeze. To ease developers’ task
in testing their drivers, this patch makes compositor-drm use a timer
to detect cases where those pageflip events stop coming.

This timeout implementation is software only and includes basic
features usually found in a watchdog. We simply exit Weston gracefully
with a log message and an exit code when the timout is reached.

The timeout value can be set via weston.ini by adding a
pageflip-timeout=<MILLISECONDS> entry under [core]
section. Setting it to 0 disables the timeout feature.

v2:
- Made sure we would get both the pageflip and the vblank events before
  stopping the timer.
- Reordered the error and success cases in
  drm_output_pageflip_timer_create() to be more in line with the rest
  of the code.

v3:
- Reordered (de)arming of the timer with the code around it to avoid it
  being rearmed before the current dearming.
- Return the proper value for the dispatcher in the pageflip_timeout
  callback.
- Also display the output name in case the timer fires.

v4:
- Reordered a forgotten timer rearming after its drmModePageFlip().

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83884
Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoclients/simple-egl: add delay option
Eero Tamminen [Mon, 20 Feb 2017 13:14:49 +0000 (15:14 +0200)]
clients/simple-egl: add delay option

This emulates extra drawing work by usleep().

This is an enhancement to reproduce the problem in the bug report.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98833
[Pekka: reordered the help text]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoclients/weston-info: print unknown formats better
Pekka Paalanen [Mon, 13 Feb 2017 14:35:00 +0000 (16:35 +0200)]
clients/weston-info: print unknown formats better

Don't just dump the raw 32-bit values, try to interpret it as a DRM
fourcc too.

This prints properly the formats YUYV, NV12 and YU12 supported by
Weston.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agolibweston/launcher: use C99 initializers for the iface(s)
Emil Velikov [Fri, 10 Feb 2017 20:14:23 +0000 (20:14 +0000)]
libweston/launcher: use C99 initializers for the iface(s)

Makes the code easier to read and browse through.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston/launcher: annotate iface(s) as constant data
Emil Velikov [Fri, 10 Feb 2017 20:14:22 +0000 (20:14 +0000)]
libweston/launcher: annotate iface(s) as constant data

Already considered and handled as such.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Make scanout view preparation more stringent
Daniel Stone [Fri, 21 Oct 2016 17:08:37 +0000 (18:08 +0100)]
compositor-drm: Make scanout view preparation more stringent

Don't import buffers which span multiple outputs, short-cut any attempt
to import SHM buffers, and ignore buffers with a global alpha set.

I'm not convinced all of these conditions entirely make sense, but this
at least makes them equally nonsensical.

Differential Revision: https://phabricator.freedesktop.org/D1414

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agocompositor-drm: Construct mode list in create_output_for_connector
Armin Krezović [Sun, 9 Oct 2016 21:48:16 +0000 (23:48 +0200)]
compositor-drm: Construct mode list in create_output_for_connector

And properly deconstruct it in drm_output_destroy.

Might be useful for finding out which modes are supported
before even setting them, in case we want to extend the
modesetting API.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: Try to preserve existing output routing
Daniel Stone [Mon, 16 Jan 2017 14:33:38 +0000 (14:33 +0000)]
compositor-drm: Try to preserve existing output routing

Previously in picking CRTC -> encoder -> connecting routing, we went for
the first triplet we found which claimed to work.

Preserving the existing routing means that startup will be faster: on a
multi-head system, changing the routing implies disabling both CRTCs,
then re-enabling them with a new configuration, which may involve
retraining links etc.

Furthermore, the existing routing may be set for a reason; each
CRTC/encoder is not necessarily as capable as the other, so the routing
may be configured to stay within such device limits.

Try where possible to respect the routing we pick up, rather than
blithely configuring our own.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Ignore non-KMS devices
Daniel Stone [Mon, 19 Dec 2016 16:48:20 +0000 (16:48 +0000)]
compositor-drm: Ignore non-KMS devices

Given that we can have render-only devices, or vgem in a class of its
own, ignore any non-KMS devices in compositor-drm's device selection.
For x86 platforms, this is mostly a non-issue since we look at the udev
boot_vga issue, but other architectures which lack this, and have
multiple KMS devices present, will hit this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Thierry Reding <treding@nvidia.com>
Reported-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agoconfigure.ac: Bump to 2.0.90 for open development
Bryce Harrington [Mon, 27 Feb 2017 18:52:35 +0000 (10:52 -0800)]
configure.ac: Bump to 2.0.90 for open development

7 years agoconfigure.ac: bump to version 2.0.0 for the official release
Bryce Harrington [Sat, 25 Feb 2017 00:19:03 +0000 (16:19 -0800)]
configure.ac: bump to version 2.0.0 for the official release

7 years agoreleasing: Should only publish publican docs for actual releases
Bryce Harrington [Tue, 21 Feb 2017 22:34:10 +0000 (14:34 -0800)]
releasing: Should only publish publican docs for actual releases

7 years agoconfigure.ac: bump to version 1.99.94 for the RC2 release
Bryce Harrington [Tue, 21 Feb 2017 20:56:48 +0000 (12:56 -0800)]
configure.ac: bump to version 1.99.94 for the RC2 release

7 years agoconfig-parser: Export weston_config_next_section
Emmanuel Gil Peyrot [Tue, 21 Feb 2017 11:58:20 +0000 (11:58 +0000)]
config-parser: Export weston_config_next_section

This symbol wasn’t exported from the weston binary, most likely due to
an oversight in 6e2c12496bbef3cc913cfe9d5f0aeb4d8b23b368, and because
internal modules can link against libshared.la directly it hasn’t been
found ever since.

This commit makes it possible for external modules to iterate over the
configuration file.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoclients: Fix build without Cairo/GLES2
Daniel Stone [Thu, 16 Feb 2017 21:52:23 +0000 (21:52 +0000)]
clients: Fix build without Cairo/GLES2

If we're building with EGL support generally, but without Cairo/GLESv2,
building the clients fail, because window.c defines the EGL native
types, however platform.h also brings these in.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Bryce Harrington <brycef@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoscreen-share: Use wl_list_for_each_safe on destroy
Daniel Stone [Thu, 16 Feb 2017 19:59:51 +0000 (19:59 +0000)]
screen-share: Use wl_list_for_each_safe on destroy

Destroying the shared seat removes the link from so->seat_list.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoscreen-share: Avoid NULL dereference
Daniel Stone [Thu, 16 Feb 2017 19:59:50 +0000 (19:59 +0000)]
screen-share: Avoid NULL dereference

Don't try to dereference the seat if it's NULL.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agoconfigure.ac: bump to version 1.99.93 for the RC1 release
Bryce Harrington [Tue, 14 Feb 2017 21:02:45 +0000 (13:02 -0800)]
configure.ac: bump to version 1.99.93 for the RC1 release

7 years ago(multiple): Use standard permission notice
Yong Bakos [Mon, 23 Jan 2017 14:17:44 +0000 (06:17 -0800)]
(multiple): Use standard permission notice

A handful of source files were not using the MIT Expat text in
COPYING. Update these files to bring them inline with the rest,
standardizing on the MIT Expat text.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Mark eDP connection as internal
Armin Krezović [Wed, 8 Feb 2017 12:55:26 +0000 (13:55 +0100)]
compositor-drm: Mark eDP connection as internal

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor: Improve xwayland warning message
Armin Krezović [Thu, 9 Feb 2017 20:28:32 +0000 (21:28 +0100)]
compositor: Improve xwayland warning message

And fix formatting.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor-drm: Remove connector_allocator
Daniel Stone [Thu, 9 Feb 2017 14:06:31 +0000 (14:06 +0000)]
compositor-drm: Remove connector_allocator

Remove the last usage of connector_allocator, which was to check for
displays which have been hot-unplugged, and replace it with an array
which doesn't rely on the connector IDs remaining below 32 (or 64).

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agocompositor-drm: Avoid connector_allocator for hotplugs
Daniel Stone [Thu, 9 Feb 2017 13:58:35 +0000 (13:58 +0000)]
compositor-drm: Avoid connector_allocator for hotplugs

Rather than using connector_allocator to determine whether an output is
newly connected or not, use a list walk across all outputs instead.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agocompositor-drm: Remove crtc_allocator
Daniel Stone [Thu, 9 Feb 2017 13:49:15 +0000 (13:49 +0000)]
compositor-drm: Remove crtc_allocator

crtc_allocator was used as a bitmask of CRTC IDs, so we didn't try to
use the same CRTC for multiple outputs. Unfortunately, this only works
to the extent that CRTC object IDs fit within the bitmask; though they
were previously, they are not guaranteed to be under 32 or even 64.

Replace the only use of crtc_allocator with a list walk across outputs.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
7 years agoconfigure.ac: bump to version 1.99.92 for the beta release
Bryce Harrington [Wed, 8 Feb 2017 19:45:13 +0000 (11:45 -0800)]
configure.ac: bump to version 1.99.92 for the beta release

7 years agoRevert "clients: teach simple-dmabuf-v4l to deal with flipped input"
Daniel Stone [Wed, 8 Feb 2017 12:02:03 +0000 (12:02 +0000)]
Revert "clients: teach simple-dmabuf-v4l to deal with flipped input"

This reverts commit 0fee977c46423e496a6eda6418c31bfe09a1f27b.

This commit introduces a requirement on v4l2_query_ext_ctrl and
VIDIOC_QUERY_EXT_CTRL, which were introduced in kernel 3.17. Some Ubuntu
LTS releases ship with much older kernels (and, significantly, UAPI),
which don't have these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
7 years agolauncher: don't try to switch to weston's vt
Giulio Camuffo [Mon, 5 Dec 2016 13:50:36 +0000 (14:50 +0100)]
launcher: don't try to switch to weston's vt

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: Damage view below after unmapping
Ucan, Emre (ADITG/SW1) [Tue, 7 Feb 2017 12:55:59 +0000 (12:55 +0000)]
ivi-shell: Damage view below after unmapping

If ivilayer or ivisurf of ivi_view is made invisible in the
commit_changes call, we have to damage the weston_view below this
ivi_view. Otherwise content of this ivi_view will stay visible.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agotests: doc iterating in the runner
Pekka Paalanen [Tue, 7 Feb 2017 12:18:01 +0000 (14:18 +0200)]
tests: doc iterating in the runner

The iteration counter cannot be used to detect non-iterated tests
defined with TEST and FAIL_TEST.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agocompositor: damage pending subsurfaces when committing them
Emilio Pozuelo Monfort [Fri, 27 Jan 2017 16:30:29 +0000 (17:30 +0100)]
compositor: damage pending subsurfaces when committing them

When a client changes the subsurfaces state, we need to damage
them so the result is visible. We do that by flagging the surfaces
when the state changes and causing damage when committing the
state. This prevents normal repaints from considering these changes
until a commit has happened, and allows the client to atomically
schedule several changes.

This fixes the subsurface_z_order test, which is now marked as expected
to succeed.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
7 years agotests: add subsurface-shot test
Pekka Paalanen [Fri, 27 Jan 2017 16:30:28 +0000 (17:30 +0100)]
tests: add subsurface-shot test

This is marked as a FAIL_TEST, because the last image comparison fails
due to a bug in Weston.

Jointly authored by Pekka and Emilio.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: move weston-tests-env as terminator to EXTRA_DIST, change
ok/FAIL to PASS/FAIL, write diff image only on fail.]
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests: put screenshots to ./logs by default
Pekka Paalanen [Fri, 27 Jan 2017 16:30:27 +0000 (17:30 +0100)]
tests: put screenshots to ./logs by default

Logs is where we write all our custom test logs, let's also put the
screenshots in the same place by default from cluttering the base
directory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests: implement get_test_name()
Pekka Paalanen [Fri, 27 Jan 2017 16:30:26 +0000 (17:30 +0100)]
tests: implement get_test_name()

Screenshot tests often want to use the test name for writing out images.
This is a helper to get the test name without writing it multiple times
in the source.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests/shell: change background color
Pekka Paalanen [Fri, 27 Jan 2017 16:30:25 +0000 (17:30 +0100)]
tests/shell: change background color

Pick the color 0xCC336699 as AARRGGBB, as if blended on black. This is
the color used with developing the sub-surface shot tests.

No other big reason than it should not be black to have better chances
of catching blending problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agotests/shell: get rid of static variables
Pekka Paalanen [Fri, 27 Jan 2017 16:30:24 +0000 (17:30 +0100)]
tests/shell: get rid of static variables

Stop using static variables and clean up when we're done.

[Emilio: update to latest weston_layer API]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: fix build after previous commit's fix]

7 years agotests: add test-desktop-shell
Quentin Glidic [Fri, 27 Jan 2017 16:30:23 +0000 (17:30 +0100)]
tests: add test-desktop-shell

This is a new desktop shell plugin, specifically written for tests. It
implements the bare minimum of a WM with predictable window positioning.
It offers a known static background without forking any helper clients
and therefore avoids any races with executing screenshot-based tests.
Not forking unused helper clients also reduces the load during a test
run.

The code was written by Quentin as a part of a much larger private
patch. Pekka, following Emilio's example, extracted just the shell
plugin parts as a stand-alone patch and wrote the commit message.

[Emilio: update to latest weston_layer and shell_init API]

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: fix build]

7 years agoclients: teach simple-dmabuf-v4l to deal with flipped input
Micah Fedke [Mon, 6 Feb 2017 17:57:41 +0000 (12:57 -0500)]
clients: teach simple-dmabuf-v4l to deal with flipped input

The v4l2 API can be queried to detect if the input video image is
horizontally or vertically flipped. If the image is y-flipped, we can
set the ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT flag to notify the
compositor.  If the image is h-flipped, we can only print a warning
since linux_buffer_params_v1 does not support horizontal flipping.

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: don't pass option_connector to create_outputs
Ucan, Emre (ADITG/SW1) [Thu, 2 Feb 2017 14:06:56 +0000 (14:06 +0000)]
compositor-drm: don't pass option_connector to create_outputs

The connector option is a part of drm_backend struct.
Therefore, it is not needed to pass it as an argument
to create_outputs function.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: update connectors with connector config
Ucan, Emre (ADITG/SW1) [Thu, 2 Feb 2017 14:06:55 +0000 (14:06 +0000)]
compositor-drm: update connectors with connector config

weston can be started with --connector option to be initialized
with a particular output. But in the update_outputs this option
is not considered and output is created for all the available
connectors. This patch fixes this issue by considering
the option for connectors in the update_outputs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: don't put y-inverted / interlaced / bottom-first dmabufs on overlays
Micah Fedke [Wed, 1 Feb 2017 20:28:23 +0000 (15:28 -0500)]
compositor-drm: don't put y-inverted / interlaced / bottom-first dmabufs on overlays

This patch checks the attribute flags on incoming dmabufs and refuses to
put them overlays if they have any of the flags set (currently:
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT,
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED and
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST), instead defaulting to
the gl-renderer which can handle some of the flags.

This check should be superceded by buffer transforms, when they become
available.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: simplify commit_changes function
Ucan, Emre (ADITG/SW1) [Mon, 30 Jan 2017 13:36:07 +0000 (13:36 +0000)]
ivi-shell: simplify commit_changes function

It is a better idea to use one for loop instead
of using three nested for loops.

We do not need to update the transformation of
views according to the scenegraph. The important
thing is that every visible view is updated before
commit_changes function returns.

The first if statement checks, if the view is on
the currently rendered scenegraph. The second if
statement checks, if the view's layer or surface
is visible. These checks ensure that we do not
update the transformation matrix of a view, which
is not visible on the screen.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: minor whitespace fix]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: pass only ivi_view to update_prop
Ucan, Emre (ADITG/SW1) [Mon, 30 Jan 2017 13:36:05 +0000 (13:36 +0000)]
ivi-shell: pass only ivi_view to update_prop

We can get ivisurf, ivilayer and iviscreen
easily from ivi_view. Then, we do not need
to check, if ivi_view's layer is the same
as the given ivilayer.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoreleasing: Copyedits
Bryce Harrington [Sat, 4 Feb 2017 01:23:24 +0000 (17:23 -0800)]
releasing: Copyedits

7 years agolibweston: grammar fix to recent comment
Bryce Harrington [Sat, 4 Feb 2017 01:01:59 +0000 (17:01 -0800)]
libweston: grammar fix to recent comment

7 years agotests: Remove buffer-count
Daniel Stone [Tue, 17 Jan 2017 15:00:42 +0000 (15:00 +0000)]
tests: Remove buffer-count

buffer-count was introduced in line with a Mesa change which forced
an earlier block on frame events to try to enforce double-buffering
where available.

The Mesa change has since been reverted (Mesa commit 9ca6711faa), as
this had unpleasant interactions with buffer_age in particular, so this
test is no longer valid.

Additionally, it only worked on backends which initialised EGL (not
headless-backend, where tests generally run), which can be flaky due to
initialisation races. Not only that, but on the DRM backend, we can
legitimately enter triple-buffering due to promoting the surface to a
hardware plane, skipping GPU composition.

In light of all this, just remove the test.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agoMove weston-egl-ext.h to shared
Daniel Stone [Thu, 24 Nov 2016 19:14:20 +0000 (19:14 +0000)]
Move weston-egl-ext.h to shared

Given that it's used by clients, it's really the very definition of
shared.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agoAdd comments and whitespace to repaint machinery
Daniel Stone [Mon, 16 Jan 2017 15:38:54 +0000 (15:38 +0000)]
Add comments and whitespace to repaint machinery

repaint_needed / repaint_scheduled are surprisingly subtle. Explode the
conditional with side-effects into more obvious separate calls, and
document what they do.

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