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
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>
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>