platform/upstream/weston.git
8 years agogl-renderer: conditionally call query_buffer while gl_renderer_attach
Vincent Abriou [Thu, 3 Nov 2016 10:15:32 +0000 (11:15 +0100)]
gl-renderer: conditionally call query_buffer while gl_renderer_attach

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This patch allow gl-renderer to accept WL_SHM_FORMAT_NV12 buffers.

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

This patch allow gl-renderer to accept WL_SHM_FORMAT_YUV420 buffers.

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

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

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

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

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

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

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

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

v2:

 - Rebased for latest changes.

v3:

 - Rebased for changes in wayland backend.

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

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

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

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

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

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

v2:

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

v3:

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

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

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

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

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

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

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

v2:

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

v3:

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

v4:

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

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

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

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

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

v2:

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

v3:

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

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

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

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

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

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

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

New feature:

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

v2:

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

v3:

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

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

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

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

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

v2:

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

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

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

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

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

v2:

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

v3:

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

v4:

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

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

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

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

Pending output handling helpers have also been introduced.

v2:

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

v3:

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

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agolibweston: Add initial output API for windowed outputs configuration
Armin Krezović [Fri, 30 Sep 2016 12:11:03 +0000 (14:11 +0200)]
libweston: Add initial output API for windowed outputs configuration

This adds new plugin-specific API for configuring outputs
on "windowed" backends, such as X11, wayland/non-fullscreen
and even headless (although, it doesn't have any windows,
its configuration is very similar). It can be used from
compositors to configure pending outputs and should be used
with previously added weston_output_set_{scale,transform}
to properly configure an output before enabling it.

It also supports creating additional outputs on the mentioned
backends.

v2:

 - Rename output-api.h to windowed-output-api.h.
 - Rename output_configure() to output_set_size().
 - Document return values.

v3:

 - Fixed copyright.
 - Noted that output name can't be NULL in
   output_create().

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

This patch implements additional functionality that will be used
for configuring, enabling and disabling weston's outputs. Its
indended use is by the compositors or user programs that want to
be able to configure, enable or disable an output at any time. An
output can only be configured while it's disabled.

The compositor and backend specific functionality is required
for these functions to be useful, and those will come later in
this series.

All the new functions have been documented, so I'll avoid
describing them here.

v2:

 - Minor documentation improvements.
 - Rename output-initialized to output->enabled.
 - Split weston_output_disable() further into
   weston_compositor_remove_output().
 - Rename weston_output_deinit() to weston_output_enable_undo().

 - Make weston_output_disable() call two functions mentioned
   above instead of calling weston_output_disable() directly.
   This means that backend needs to take care of doing backend
   specific disable in backend specific destroy function.

v3:

 - Require output->name to be set before calling
   weston_output_init_pending().
 - Require output->destroying to be set before
   calling weston_compositor_remove_output().
 - Split weston_output_init_pending() into
   weston_compositor_add_pending_output() so pending outputs
   can be announced separately.
 - Require output->disable() to be set in order for
   weston_output_disable() to be usable.
 - Fix output removing regression that happened when
   weston_output_disable() was split.
 - Minor documentation fix.

v4:

 - Bump libweston version to 2 as this patch breaks the ABI.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agogl-renderer: Add support for DRM_FORMAT_YUV444 buffers
Matthias Treydte [Mon, 25 Jul 2016 10:15:41 +0000 (12:15 +0200)]
gl-renderer: Add support for DRM_FORMAT_YUV444 buffers

This uses the existing infrastructure for dealing with planar YUV buffers and only adds the
relevant yuv_format_descriptor to the table.
Reviewed-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
8 years agoclients/stacking: Silence a compiler warning
Armin Krezović [Wed, 28 Sep 2016 22:18:10 +0000 (00:18 +0200)]
clients/stacking: Silence a compiler warning

This patch fixes a compiler warning when building with
clang, since it doesn't support gnu_printf attribute.

v2:

 - Switch to WL_PRINTF per suggestion from Eric Engestrom.

v3:

 - Explicitly include wayland-util.h

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agolibweston-desktop: fix sending the configure event with wl_shell
Giulio Camuffo [Wed, 28 Sep 2016 19:29:14 +0000 (21:29 +0200)]
libweston-desktop: fix sending the configure event with wl_shell

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoconfigure: remove double equal test bashism
Murray Calavera [Thu, 29 Sep 2016 20:24:30 +0000 (21:24 +0100)]
configure: remove double equal test bashism

Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoshared/platform: include weston-egl-ext.h only if ENABLE_EGL is defined
Krzysztof Konopko [Thu, 15 Sep 2016 11:01:49 +0000 (13:01 +0200)]
shared/platform: include weston-egl-ext.h only if ENABLE_EGL is defined

Including `weston-egl-ext.h` causes compilation failure for configurations
with EGL disabled.

Verified with `--disable-egl`, `--disable-x11-compositor`
and `--disable-drm-compositor`.

Signed-off-by: Krzysztof Konopko <kris@youview.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agolibweston-desktop: Fix some clang warnings
Armin Krezović [Sat, 10 Sep 2016 17:11:21 +0000 (19:11 +0200)]
libweston-desktop: Fix some clang warnings

Fixes:

implicit conversion from enumeration type '...' to different
enumeration type '...' [-Wenum-conversion]

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agostring-helpers.h: Fix usage on musl libc
Kylie McClain [Sat, 24 Sep 2016 03:40:14 +0000 (23:40 -0400)]
string-helpers.h: Fix usage on musl libc

On musl, int32_t is defined in stdint.h.

Signed-off-by: Kylie McClain <kylie@somasis.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoshare/cairo-util: Use wl_pointer_button_state enum directly
Quentin Glidic [Sun, 10 Jul 2016 09:00:55 +0000 (11:00 +0200)]
share/cairo-util: Use wl_pointer_button_state enum directly

This silences two warnings:

clients/window.c:2450:20: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
                                              button, state);
                                                      ^~~~~

clients/window.c:2453:15: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
                                                button, state);
                                                        ^~~~~

Warning produced by Clang 3.8.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agozunitc/junit-reporter: Silence pointer-sign warning
Quentin Glidic [Sun, 10 Jul 2016 09:00:56 +0000 (11:00 +0200)]
zunitc/junit-reporter: Silence pointer-sign warning

/usr/x86_64-pc-linux-gnu/include/libxml2/libxml/xmlstring.h:35:18:
warning: pointer targets in passing argument 3 of 'xmlStrPrintf' differ
in signedness [-Wpointer-sign]
 #define BAD_CAST (xmlChar *)
                  ^
tools/zunitc/src/zuc_junit_reporter.c:77:41: note: in expansion of macro
'BAD_CAST'
  xmlStrPrintf(scratch, sizeof(scratch), BAD_CAST %d, value);
                                         ^~~~~~~~
/usr/x86_64-pc-linux-gnu/include/libxml2/libxml/xmlstring.h:98:17: note:
expected 'const char *' but argument is of type 'xmlChar * {aka unsigned
char *}'
                 xmlStrPrintf             (xmlChar *buf,

Warning produced by GCC 5.3, 6.1 and Clang 3.8.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agocompositor: set the opaque region for some views with transform
Giulio Camuffo [Sun, 4 Sep 2016 15:50:46 +0000 (18:50 +0300)]
compositor: set the opaque region for some views with transform

If the transform on a view is only a translation we can trivially
set the opaque region for it so to optimize the rendering.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agoconfigure: Also update libweston version to match weston
Bryce Harrington [Fri, 23 Sep 2016 00:38:39 +0000 (17:38 -0700)]
configure: Also update libweston version to match weston

8 years agoconfigure.ac: bump version to 1.12.90 for open development
Bryce Harrington [Thu, 22 Sep 2016 17:33:46 +0000 (10:33 -0700)]
configure.ac: bump version to 1.12.90 for open development

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoconfigure.ac: bump to version 1.12.0 for the official release
Bryce Harrington [Tue, 20 Sep 2016 19:22:46 +0000 (12:22 -0700)]
configure.ac: bump to version 1.12.0 for the official release

8 years agolibweston-desktop: Fix configure event for already well-sized surfaces
Quentin Glidic [Tue, 13 Sep 2016 08:05:58 +0000 (10:05 +0200)]
libweston-desktop: Fix configure event for already well-sized surfaces

Even if the surface size is already correct, we need to store the
configured size in case some other state change triggers a configure
event.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
8 years agoconfigure.ac: bump to version 1.11.94 for the RC2 release
Bryce Harrington [Tue, 13 Sep 2016 19:18:23 +0000 (12:18 -0700)]
configure.ac: bump to version 1.11.94 for the RC2 release

8 years agolibweston-desktop/xdg_shell_v6: Raise errors on not-yet-possible requests
Quentin Glidic [Sun, 11 Sep 2016 09:34:47 +0000 (11:34 +0200)]
libweston-desktop/xdg_shell_v6: Raise errors on not-yet-possible requests

These requests need a mapped surface, which can only happen after the
initial configure event.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agolibweston-desktop/xdg_shell_v6: Add surface as needed
Quentin Glidic [Sun, 11 Sep 2016 09:29:23 +0000 (11:29 +0200)]
libweston-desktop/xdg_shell_v6: Add surface as needed

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agoRevert "terminal: Fix crash due to race condition in init"
Quentin Glidic [Fri, 9 Sep 2016 17:53:38 +0000 (19:53 +0200)]
Revert "terminal: Fix crash due to race condition in init"

This reverts commit 5c611d933f60f720db98331c9c1c6ed4420f9782.

8 years agolibweston-desktop/xdg_shell_v5: Add surface as needed
Quentin Glidic [Thu, 18 Aug 2016 13:51:38 +0000 (15:51 +0200)]
libweston-desktop/xdg_shell_v5: Add surface as needed

This way we are sure the compositor is aware of a surface when we
forward a request for said surface.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agodesktop-shell: Add back the saved position and rotation for fullscreen/maximized
Quentin Glidic [Tue, 16 Aug 2016 12:26:20 +0000 (14:26 +0200)]
desktop-shell: Add back the saved position and rotation for fullscreen/maximized

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agodesktop-shell: Unset fullscreen/maximized state on commit
Quentin Glidic [Tue, 16 Aug 2016 12:26:03 +0000 (14:26 +0200)]
desktop-shell: Unset fullscreen/maximized state on commit

This only stores the current state, as libweston-desktop is still in
charge of double-buffering it.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agoconfigure.ac: bump to version 1.11.93 for the RC1 release
Bryce Harrington [Tue, 6 Sep 2016 21:47:33 +0000 (14:47 -0700)]
configure.ac: bump to version 1.11.93 for the RC1 release

8 years agocompositor-wayland: Only destroy the egl_window when using GLES.
Emmanuel Gil Peyrot [Thu, 1 Sep 2016 14:19:46 +0000 (15:19 +0100)]
compositor-wayland: Only destroy the egl_window when using GLES.

This prevents a segfault when unplugging an output when using pixman.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agolibweston-desktop/xwayland: Do not over-destroy the view
Quentin Glidic [Thu, 18 Aug 2016 14:45:30 +0000 (16:45 +0200)]
libweston-desktop/xwayland: Do not over-destroy the view

With this weston_view_destroy() call, Xwayland popups make Weston freeze
in a busy-loop (probably corrupted wl_list).

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoterminal: Fix crash due to race condition in init
Bryce Harrington [Mon, 29 Aug 2016 23:28:08 +0000 (16:28 -0700)]
terminal: Fix crash due to race condition in init

weston-terminal intermittently crashes on startup.  This occurs because
some parameters in the weston_terminal structure such as data_pitch,
don't get set to non-zero until the resize_handler() callback gets
triggered.  That callback makes a call to terminal_resize_cells(), to
calculate the proper values for these parameters.

On occasion, the resize handler call is slow to resolve, and the program
proceeds to start processing characters for the terminal window.  With
the parameters defaulting to zero, certain calculations come out wrong,
leading the program to attempt to scroll the buffer when it shouldn't,
and thus follows the crash.

Instead, force the call to terminal_resize_cells() during the init, with
some dummy defaults, to ensure the parameters are always non-zero.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=97539
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoclients: Use ARRAY_LENGTH macro in weston-simple-im
Bryce Harrington [Wed, 31 Aug 2016 01:38:27 +0000 (18:38 -0700)]
clients: Use ARRAY_LENGTH macro in weston-simple-im

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoconfigure.ac: (Re-)bump to version 1.11.92 for the beta release
Bryce Harrington [Tue, 30 Aug 2016 19:11:43 +0000 (12:11 -0700)]
configure.ac: (Re-)bump to version 1.11.92 for the beta release

8 years agoRevert "desktop-shell: Enable per-output fade animations"
Bryce Harrington [Tue, 30 Aug 2016 19:05:27 +0000 (12:05 -0700)]
Revert "desktop-shell: Enable per-output fade animations"

This reverts commit fde5adbedb2706f8e160156d9a08bc014d2e42f3.

(Accidental landing)

8 years agoRevert "compositor: Add internal support to track idle inhibition requests"
Bryce Harrington [Tue, 30 Aug 2016 19:05:16 +0000 (12:05 -0700)]
Revert "compositor: Add internal support to track idle inhibition requests"

This reverts commit f8300c87d5dddb0f55d5f2bd9ec3164cbd37d370.

(Accidental landing)

8 years agoRevert "compositor: Add public interface support for client-requested idle inhibition"
Bryce Harrington [Tue, 30 Aug 2016 19:05:01 +0000 (12:05 -0700)]
Revert "compositor: Add public interface support for client-requested idle inhibition"

This reverts commit 689feced3c0022e8f5cce79df0b19cc370de6247.

(Accidental landing)

8 years agoRevert "libweston: Add a signal to fire when the idle inhibitor is dropped"
Bryce Harrington [Tue, 30 Aug 2016 19:04:50 +0000 (12:04 -0700)]
Revert "libweston: Add a signal to fire when the idle inhibitor is dropped"

This reverts commit ca5b62426a97b4607d60eaf1154881ac8c1ac994.

(Accidental landing)

8 years agoRevert "libweston-desktop: Add listener and API to drop the idle inhibitor"
Bryce Harrington [Tue, 30 Aug 2016 19:04:37 +0000 (12:04 -0700)]
Revert "libweston-desktop: Add listener and API to drop the idle inhibitor"

This reverts commit e7069bcf93b2ffcf04b4128cb468fe83dc18baea.

(Accidental landing)

8 years agoRevert "shell: Inhibit idle fade-out behavior"
Bryce Harrington [Tue, 30 Aug 2016 19:04:26 +0000 (12:04 -0700)]
Revert "shell: Inhibit idle fade-out behavior"

This reverts commit 9be807c69b1249390bb213e5403b9183738777f4.

(Accidental landing)

8 years agoRevert "clients: Add screensaver inhibitor client demo"
Bryce Harrington [Tue, 30 Aug 2016 19:04:05 +0000 (12:04 -0700)]
Revert "clients: Add screensaver inhibitor client demo"

This reverts commit dfea66e7801f7c846ba3cc78146f8a18fd3aa7e4.

(Accidental landing)

8 years agoconfigure.ac: bump to version 1.11.92 for the beta release
Bryce Harrington [Tue, 30 Aug 2016 19:02:35 +0000 (12:02 -0700)]
configure.ac: bump to version 1.11.92 for the beta release

8 years agoreleasing: Fix incorrect direction about how many lines need tweaked
Bryce Harrington [Tue, 30 Aug 2016 19:00:38 +0000 (12:00 -0700)]
releasing: Fix incorrect direction about how many lines need tweaked

8 years agoclients: Add screensaver inhibitor client demo
Bryce Harrington [Fri, 19 Aug 2016 22:25:06 +0000 (15:25 -0700)]
clients: Add screensaver inhibitor client demo

Derive client from simple-shm and hook up the API defined in
wayland-protocols to allow client screensaver inhibition requests.

v5:
  + Add simple-idle client demo
  + Add command line options to delay creation/destruction of inhibitor

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
8 years agoshell: Inhibit idle fade-out behavior
Bryce Harrington [Tue, 30 Aug 2016 01:11:26 +0000 (18:11 -0700)]
shell: Inhibit idle fade-out behavior

When a client has registered idle inhibition on a surface, don't trigger
the fade-out animation on the output(s) the surface is displayed on.
But when the surface is destroyed or the inhibitor itself is destroyed
by client request, re-queue the fade out animation.

8 years agolibweston-desktop: Add listener and API to drop the idle inhibitor
Bryce Harrington [Tue, 23 Aug 2016 20:40:30 +0000 (13:40 -0700)]
libweston-desktop: Add listener and API to drop the idle inhibitor

Listen for the drop_idle_inhibitor signal from libweston, and propagate
the call to a corresponding libweston-desktop API.

8 years agolibweston: Add a signal to fire when the idle inhibitor is dropped
Bryce Harrington [Tue, 23 Aug 2016 20:39:14 +0000 (13:39 -0700)]
libweston: Add a signal to fire when the idle inhibitor is dropped

8 years agocompositor: Add public interface support for client-requested idle inhibition
Bryce Harrington [Thu, 11 Aug 2016 00:25:23 +0000 (17:25 -0700)]
compositor: Add public interface support for client-requested idle inhibition

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v5: Improve comments

8 years agocompositor: Add internal support to track idle inhibition requests
Bryce Harrington [Thu, 11 Aug 2016 00:25:22 +0000 (17:25 -0700)]
compositor: Add internal support to track idle inhibition requests

Adds a helper routine weston_output_inhibited_outputs() which returns a
mask of outputs that should inhibit screen idling.

Use this routine to check for inhibiting outputs for handling of idle
behaviors in core:  In sleep mode, only halt repainting outputs that
don't have valid inhibits.  Don't send these monitors DPMS off commands
either, if the system would otherwise be powering them down.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v5: Drop unused view variable

8 years agodesktop-shell: Enable per-output fade animations
Bryce Harrington [Thu, 11 Aug 2016 00:25:24 +0000 (17:25 -0700)]
desktop-shell: Enable per-output fade animations

Instead of creating a single global fade surface across all outputs,
create a separate surface for each output.  This will permit
e.g. individual fades for each output (or blocking the fade-outs if
inhibiting idling as will come in a latter patch.)

This also fixes a potential issue if on multihead layout spanning a
desktop wider than 8096 (or higher than 8096), the fade animation may
not completely cover all surfaces.

This assumes the output geometry doesn't change larger during the course
of the fade animation.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v5:
  + Use the new libweston-desktop API for dropping idle inhibitor to
   ensure fade_out gets triggered if the client destroys the inhibitor
   early.
  + Fix a crash when running multi-head due to double free of animations
  + Split idle inhibition implementation to a subsequent patch

8 years agolibweston: Drop shell_interface
Quentin Glidic [Mon, 15 Aug 2016 08:56:52 +0000 (10:56 +0200)]
libweston: Drop shell_interface

Its usage is now limited to some dock-related helper, and the plugin
registry is a better fit for that kind of helper.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agoconfig-parser: Drop debug text
Bryce Harrington [Sat, 27 Aug 2016 01:55:22 +0000 (18:55 -0700)]
config-parser: Drop debug text

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agodesktop-shell: Fix output destroying
Quentin Glidic [Sat, 20 Aug 2016 16:19:51 +0000 (18:19 +0200)]
desktop-shell: Fix output destroying

Now we properly unregister from the panel/background surface destroy
signals if the output is destroyed first.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
8 years agocompositor-drm: Zero drmModeAddFB2 data
Yong Bakos [Thu, 18 Aug 2016 00:37:55 +0000 (17:37 -0700)]
compositor-drm: Zero drmModeAddFB2 data

Initialize arrays of data passed to drmModeAddFB2, just as
drm_fb_get_from_bo does.

See https://lists.freedesktop.org/archives/wayland-devel/2016-August/030645.html

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoconfigure.ac: bump to version 1.11.91 for the alpha release
Bryce Harrington [Tue, 16 Aug 2016 18:51:53 +0000 (11:51 -0700)]
configure.ac: bump to version 1.11.91 for the alpha release

8 years agolibweston-desktop/{wl_shell, xwayland}: Fix changing between toplevel states
Quentin Glidic [Tue, 16 Aug 2016 09:42:47 +0000 (11:42 +0200)]
libweston-desktop/{wl_shell, xwayland}: Fix changing between toplevel states

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
8 years agolibweston-desktop/xwayland: Actually destroy the view
Quentin Glidic [Tue, 16 Aug 2016 08:55:02 +0000 (10:55 +0200)]
libweston-desktop/xwayland: Actually destroy the view

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agolibweston-desktop: Rename _destroy_view to _unlink_view
Quentin Glidic [Tue, 16 Aug 2016 08:52:46 +0000 (10:52 +0200)]
libweston-desktop: Rename _destroy_view to _unlink_view

It doesn't destroy the view per se (except for internal surfaces) and
require the caller to also destroy the view itself at the appropriate
time.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agodesktop-shell: Properly destroy the weston_desktop_view
Quentin Glidic [Tue, 16 Aug 2016 08:28:21 +0000 (10:28 +0200)]
desktop-shell: Properly destroy the weston_desktop_view

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agoMakefile.am: Fix libtool race
Quentin Glidic [Mon, 15 Aug 2016 15:29:09 +0000 (17:29 +0200)]
Makefile.am: Fix libtool race

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agoweston-editor: Close the data source after sending
Derek Foreman [Thu, 7 Jul 2016 15:52:17 +0000 (10:52 -0500)]
weston-editor: Close the data source after sending

We're leaking the fd when sending cut'n'paste.  Failure to close can also
makes the other end unhappy because it doesn't know the paste is finished.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
8 years agofullscreen-shell: avoid access to freed data
Arnaud Vrac [Wed, 8 Jun 2016 15:55:08 +0000 (17:55 +0200)]
fullscreen-shell: avoid access to freed data

Remove the output transform from the view transform list when its
surface is destroyed. The surface destruction also triggers the
freeing of its views, so the next access to the output transform link
could crash.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agogl-renderer, simple-dmabuf-v4l: fix dmabuf y-invert
Pekka Paalanen [Mon, 4 Jul 2016 13:25:16 +0000 (16:25 +0300)]
gl-renderer, simple-dmabuf-v4l: fix dmabuf y-invert

Invert the Y_INVERT flag for the EGL import fo dmabufs. This fixes
weston-simple-dmabuf-intel to show the same image on both GL-composited
and with direct scanout on a hardware plane. Before, the image would
y-flip when switching between these two cases. Now the orientation also
matches the color values written in simple-dmabuf-intel.c.

The GL-renderer uses the OpenGL convention of texture coordinates, where
the origin is at the bottom-left of an image. This can be observed in
texture_region() where the texcoords are inverted if y_invert is false,
since the surface coordinates have origin at top-left.  Both wl_shm and
dmabuf buffers have origin at the top-left.

When wl_shm buffer is imported with glTexImage2D, it gets inverted
because glTexImage2D is defined to read in the bottom row first. The shm
data is top row first. This incidentally also means, that buffer pixel
0,0 ends up at texture coordinates 0,0. This is now inverted compared to
the GL coordinate convention, and therefore gl_renderer_attach_shm()
sets y_inverted to true. This causes texture_region() to NOT invert the
texcoords. Wayland surface coordinates have origin at top-left, hence
the double-inversion.

Dmabuf buffers also have the origin at top-left. However, they are
imported via EGL to GL, where they should get the GL oriented
coordinates but they do not. It is as if pixel 0,0 ends up at texcoords
0,0 - the same thing as with wl_shm buffers. Therefore we need to invert
the invert flag.

Too bad EGL_EXT_image_dma_buf_import does not seem to specify the image
orientation. The GL spec implied result seems to conflict with the
reality in Mesa 11.2.2.

I asked about this in the Mesa developer mailing list. The question with
no answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120249.html
and the thread I hijacked to get some answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120733.html
which culminated to the conclusion:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120955.html
that supports this patch.

simple-dmabuf-v4l is equally fixed to not add Y_INVERT. There is no
rational reason to have it, and removing is necessary together with the
GL-renderer change to keep the image the right way up. This has been
tested with VIVID.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoclients/dmabuf-v4l: explain vivid setup
Pekka Paalanen [Mon, 4 Jul 2016 13:25:15 +0000 (16:25 +0300)]
clients/dmabuf-v4l: explain vivid setup

Add very short explanation on how to set up Vivid driver, when you don't
have suitable V4L2 device to use.

Using the XR24 (DRM_FORMAT_XRGB8888) format practically guarantees that
you can test direct scanout on a hardware overlay, too. At least on PC
hardware that has overlays. Tested to work on Intel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agoREADME: fix s/libwayland/libweston/ typo
Emil Velikov [Mon, 15 Aug 2016 15:31:11 +0000 (16:31 +0100)]
README: fix s/libwayland/libweston/ typo

Since one is (about to be) using libweston, they should check for it as
opposed to libwayland.

Silly copy/paste mistake that would have caused a lot of confusion.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-x11: remove redundant state arg of x11_backend_deliver_button_event
Benoit Gschwind [Wed, 18 May 2016 19:32:12 +0000 (21:32 +0200)]
compositor-x11: remove redundant state arg of x11_backend_deliver_button_event

The "state" variable in x11_backend_deliver_button_event is basically the
same as (event->response_type == XCB_BUTTON_PRESS), thus update the code
to use the last one.

Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-x11: add assert to avoid misuse of x11_backend_deliver_button_event
Benoit Gschwind [Wed, 18 May 2016 19:32:11 +0000 (21:32 +0200)]
compositor-x11: add assert to avoid misuse of x11_backend_deliver_button_event

The x11_backend_deliver_button_event can be called with any
xcb_generic_event. The assert check if the call is done with the
expected events.

Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
8 years agocompositor-drm: Stop sending uninit data to the kernel
Derek Foreman [Fri, 8 Jul 2016 17:50:57 +0000 (12:50 -0500)]
compositor-drm: Stop sending uninit data to the kernel

Valgrind noticed that we send uninit data to drmModeAddFB2.  While
the kernel should never read this (because of the plane format),
it's probably still nicer to zero the data before we send it.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
8 years agoconfigure.ac: check weston vs. libweston versions
Pekka Paalanen [Mon, 15 Aug 2016 11:06:15 +0000 (14:06 +0300)]
configure.ac: check weston vs. libweston versions

Check that the defined versions for Weston and libweston are consistent
and according to the version bumping rules:

- In pre-release and only pre-release versions the weston and libweston
  may differ

- when they differ, libweston version must be exactly (weston.major+1).0.0

- otherwise, the versions must be exactly the same.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoconfigure.ac: bump libweston version to match weston
Pekka Paalanen [Mon, 15 Aug 2016 11:16:05 +0000 (14:16 +0300)]
configure.ac: bump libweston version to match weston

This bump is required for the following patch that adds strict version
consistency checking between weston and libweston.

This bumps libweston major from 0 to 1. All libweston users need to
adapt. This major bump would have to be made on the 1.11.91 release
anyway.

Cc: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoREADME: updates on libweston versioning
Pekka Paalanen [Wed, 10 Aug 2016 11:54:08 +0000 (14:54 +0300)]
README: updates on libweston versioning

We have agreed to use the major as the ABI-version, so talk about major
to avoid confusion.

Remove unncessary or incorrect wording related to breaking ABI on minor
bumps.

Explain a little about the weston vs. libweston version numbers.

v2:
- Add a paragraph about ABI breaks between alpha and .0 releases.
- clarify pre-release definition
- Add two paragraphs about libweston versions differing from weston
  version and how to use pkg-config properly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoreleasing: how to handle libweston
Pekka Paalanen [Wed, 10 Aug 2016 09:06:43 +0000 (12:06 +0300)]
releasing: how to handle libweston

libweston has separate version numbering from weston because of
development needs.

During development, weston version is major.minor.90 which will never be
a release version number. While developing, we may break the libweston
backward-compatibility, in which case libweston_major_version will be
bumped. This means that libweston_major_version > weston_major_version
but only during the development period and for the pre-releases. When
the official x.y.0 release is made, weston and libweston versions will
get synchronized as explained in releasing.txt.

The reason we do this is that e.g. during the weston 3.0.90 development
period we must be able to install libweston-4.so because the development
has broken the compatibility and so we cannot install it as libweston-3.so
anymore. However, we cannot bump weston to 4.0.90, because then the
official release would go backwards in numbers to 4.0.0.

This also means that weston pre-releases major.minor.9x may install
libweston-(major+1).so. There is also libweston-(major+1).pc file but it
will give the weston version as the version number. IOW, pkg-config
check for 'libweston-M < M.0.0' matches only the pre-releases of the
libweston major version M. Hence, 'libweston-M >= M.0.0' cannot be
satisfied by pre-releases.

The weston and libweston version numbers MUST be identical in all
releases except the pre-releases major.minor.9x.

When the 1.11.91 pre-release is made, the rules imply that libweston
version will be bumped from 0.0.0 to 1.11.91. The bumping will continue
up to the 1.12.0 release. After the bump to 1.12.90, the libweston
version may be bumped to 2.0.0. Then the rules imply that:
- 1.12.9x pre-releases install libweston 2.0.0
- the next .0 release is 2.0.0 containing libweston 2.0.0

If the 1.12 stable branch will see additional releases, those will be
numbered 1.12.1, 1.12.2, etc. with the libweston version being the same
as the release version number.

If we have release 2.0.91 without libweston major bump, then libweston
version will match the release version, leading up to 2.1.0.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoweston-launch: Only run a login shell for new sessions
Quentin Glidic [Sun, 29 May 2016 11:39:26 +0000 (13:39 +0200)]
weston-launch: Only run a login shell for new sessions

This way, the environment is correctly preserved for weston. Since
commit 636156d5f693ac5b01cec6a2937d2b6cd4237ea9, clearenv() is only
called when we open a new PAM session, so it makes sense to only use a
login shell in that case.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
8 years agolibweston/launcher-weston-launch: Silence unused-function warning
Quentin Glidic [Sun, 10 Jul 2016 09:00:54 +0000 (11:00 +0200)]
libweston/launcher-weston-launch: Silence unused-function warning

libweston/launcher-weston-launch.c:58:1: warning: unused function
'is_drm_master' [-Wunused-function]
is_drm_master(int drm_fd)
^

Warning produced by Clang 3.8.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
8 years agolibweston: Silence tautological-compare warning
Quentin Glidic [Sun, 10 Jul 2016 09:00:53 +0000 (11:00 +0200)]
libweston: Silence tautological-compare warning

libweston/compositor.c:5023:14: warning: comparison of unsigned enum
expression < 0 is always false [-Wtautological-compare]
        if (backend < 0 || backend >= ARRAY_LENGTH(backend_map))
                    ~~~~~~~ ^ ~

Warning produced by Clang 3.8.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>