Commit graph

138 commits

Author SHA1 Message Date
Daniel Stone f214fdca5a compositor-drm: Use signed int for width/height
This makes it sign-compatible with weston_output->{width,height}.

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

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone 4e5eceb075 compositor-drm: Use fb->fd consistently
Everyone else uses fb->fd rather than pulling the FD back out of GBM.
Use that in the destroy callback too.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>

Differential Revision: https://phabricator.freedesktop.org/D1406
2016-12-12 17:15:08 +00:00
Daniel Stone 3e661f7b6c compositor-drm: Extract EGL destroy to helper
No functional change.

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

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone a3ae4767ad compositor-drm: Simplify drm_sprite_crtc_supported
No need to walk the CRTC list every time looking for CRTC indices, when we
already have the CRTC index stashed away. Taking the plane as an argument
also simplifies things a little for callers, and future-proofs for a
potential future KMS API which passes a list of supported CRTC IDs rather
than a bitmask of supported CRTC indices.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>

Differential Revision: https://phabricator.freedesktop.org/D1407
2016-12-12 17:15:08 +00:00
Daniel Stone 17339233a0 compositor-drm: Comment struct members
Clarify the difference between crtc_id (DRM object) and pipe (index into
drmModeRes->crtcs array, possible_crtcs bitmask).

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1405
2016-12-12 16:52:22 +00:00
Daniel Stone beb97e5f79 libweston: Make module loading safe against long paths
Avoid any buffer overflows here by checking we don't go over PATH_MAX
with stupid module names.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-30 10:27:51 +00:00
Daniel Stone 698f9bf854 compositor-wayland: Destroy cursor images earlier
Destroying a wl_cursor will attempt to access the wl_display, which
we have just freed. Avoid a segfault by destroying the cursor images
before we destroy the display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-29 09:49:29 +00:00
Daniel Stone 7dbb0e148f Don't prepend protocol/ to include paths
No need to add protocol/, as it's already handled by an explicit
compiler include path.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-29 09:49:00 +00:00
Daniel Stone 21fac60838 compositor-wayland: Set frame callback for Pixman
Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
renderer, not just GL. Fixes a segfault when using compositor-wayland
with --use-pixman.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-28 22:00:46 +00:00
Dima Ryazanov 6a38ad740c gl-renderer: Fix an invalid write when closing a Weston window
Call eglMakeCurrent before destroying the native EGL window, similar to what
other sample clients are already doing.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-28 18:11:09 +00:00
Dima Ryazanov 89c2f637b9 compositor-wayland: Fix a use after free
When a window is being closed, the frame_done callback often runs after
the output is already destroyed, i.e:

  wayland_output_start_repaint_loop
  input_handle_button
    wayland_output_destroy
  frame_done

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

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

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-28 11:29:30 +00:00
Ryo Munakata e6dec90e29 compositor-x11: fix segfault when use_pixman is true
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-24 11:45:40 +00:00
Daniel Stone 04bd040258 Don't include version.h from compositor.h
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewd-by: Bryce Harrington <bryce@osg.samsung.com>
2016-11-24 11:42:05 +00:00
Arnaud Vrac b8c16c995b compositor: allow using nested parent as a subsurface sibling
The parent of a subsurface can be used as a sibling in the place_below
and place_above calls. However this did not work when the parent is
nested, so fix the sibling check and add a test to check this case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-11-22 12:39:11 +00:00
Quentin Glidic 24d306ccd8 libweston: Add move (without scale) animation
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:22:47 +00:00
Bryce Harrington fe0410b0cc gl: Don't declare variables in for loop
Fixes compilation error introduced by 43cea54c:

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

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:04:40 +00:00
Armin Krezović 3447619a3a compositor-wayland: Port to xdg-shell-v6
v2:

 - Keep wl_shell code around until xdg_shell is declared stable.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:00:19 +00:00
Vincent ABRIOU e5732c7866 gl-renderer: add support of WL_SHM_FORMAT_YUYV
This patch allow gl-renderer to accept WL_SHM_FORMAT_YUYV buffers.
This is the pixel format supported by most of the USB webcams.

v2:
 - fix hsub Vs vsub inversion

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 17:47:13 +00:00
Armin Krezović 225bf9dff1 compositor-x11: Move vfunc setting from set_size to enable
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:50:20 +00:00
Armin Krezović 2e66252582 compositor-wayland: Destroy shm buffers on output disable
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:49 +00:00
Armin Krezović 78895c5fd8 compositor-wayland: Properly clean up on backend destroy
Also remove a wrong XXX comment.

Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:46 +00:00
Armin Krezović f054d35aad compositor-wayland: Simplify fullscreen output surface handling
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:42 +00:00
Armin Krezović f16de17054 compositor-wayland: Move vfunc setting from set_size to enable
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-11-21 16:44:38 +00:00
Emil Velikov 02639554e7 gl-renderer: use weston_platform_destroy_egl_surface wrapper
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:26 +00:00
Emil Velikov 43cea54c90 gl-renderer: add support for EGL_KHR_swap_buffers_with_damage
Extension is identical to the EXT one, yet we need to check for the KHR
abbreviated extension name + entry-point.

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

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:31:29 +00:00
Quentin Glidic 46dc9b440b libweston: Move text_backend_* to weston.h
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:03:20 +00:00
Ryo Munakata 08f09e2012 libweston: remove unused function declaration of weston_compositor_top
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 09:48:12 +00:00
Olivier Fourdan df84dbe382 input: Update keyboard serial on press and release
Other compositors such as mutter update the keyboard serial for both key
press and key release, unlike weston which updates it only on key press.

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

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

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=768017
2016-11-16 14:46:22 +00:00
Armin Krezović e3bfee18df gl-renderer: Use EGL_KHR_no_config_context
This patch makes use of recently implemented
EGL_KHR_no_config_context extension in Mesa,
which superseeds EGL_MESA_configless_context.

See also (and the follow-up patch):

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

v2:

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

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 14:46:22 +00:00
Miguel A. Vico 967b6bc637 gl-renderer: Refactor gl_renderer_output_window_create()
This change refactors gl_renderer_output_window_create() to separate out
window surface creation code from output common creation code.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: rebased and removed unused 'gr' and 'ec']
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:07:40 +02:00
Miguel A. Vico 41700e355f gl-renderer: Add <platform_attribs> param to gl_renderer_display_create
This change adds <platform_attribs> parameter to
gl_renderer_display_create() in case we ever want to pass non-NULL.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: removed notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:44 +02:00
Miguel A. Vico 684c9f49e5 gl-renderer: Accept non-NULL empty <visual_id> arrays
This change modifies egl_choose_config() to accept a non-NULL but empty
<visual_id> array (i.e. n_ids == 0)

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:32 +02:00
Miguel A. Vico 4057cd93d6 gl-renderer: Rename <attribs> param of gl_renderer to <config_attribs>
This change renames <attribs> parameter of gl_renderer_display_create()
and gl_renderer_output_window_create() to <config_attribs> to explain
which attribs it is.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
[Pekka: remove notes about EGLOutput]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:10 +02:00
Miguel A. Vico c095cde364 gl-renderer: Rename gl_renderer::output_create to output_window_create
No functional change. This patch renames gl_renderer_output_create() to
gl_renderer_output_window_create(), which is something more descriptive
of what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:06:01 +02:00
Miguel A. Vico dddc670c04 gl-renderer: Rename gl_renderer_create to gl_renderer_display_create
No functional change. This patch only renames gl_renderer_create() to
gl_renderer_display_create(), which is something more descriptive of
what the function does.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-11-07 17:05:18 +02:00
Vincent Abriou 9c526e0e62 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>
2016-11-03 21:23:05 +00:00
Vincent Abriou 7327d5a7a2 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>
2016-11-01 18:30:16 +00:00
Daniel Díaz 75b7197f4e 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>
2016-10-22 15:04:58 +01:00
Armin Krezović 2045016d8e
compositor-wayland: Convert fullscreen flag to bool
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-10-14 10:42:17 +02:00
Armin Krezović 2d321e3321
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>
2016-10-10 13:45:25 +02:00
Armin Krezović 7f1c0b8a35
compositor-wayland: Convert sprawl flag to boolean
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-10-10 13:42:59 +02:00
Armin Krezović 7e71b8755a
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>
2016-10-10 13:41:18 +02:00
Vincent Abriou 00a03d2f72 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>
2016-10-05 18:12:33 +01:00
Vincent Abriou fdeefe4241 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>
2016-10-05 18:05:44 +01:00
Vincent Abriou c950667e87 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>
2016-10-05 16:47:43 +01:00
Armin Krezović a483cac1af 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>
2016-10-05 14:59:10 +03:00
Armin Krezović 927267b915 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>
2016-10-05 14:59:09 +03:00
Armin Krezović 5fe00cb975 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>
2016-10-05 14:59:09 +03:00
Armin Krezović 4008740d5e 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>
2016-10-05 14:59:09 +03:00
Armin Krezović 782f5df9e3 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>
2016-10-05 14:59:09 +03:00