Commit Graph

6145 Commits

Author SHA1 Message Date
Pekka Paalanen bb707dc0fe weston: remove SEGV and ABRT handlers
Catching an ABRT is kind of ok, catching a SEGV is russian roulette. We
have been quite lucky with it, but I've started hitting crashes inside
malloc() which causes a deadlock when our SEGV handler needs to malloc()
as well (weston_log_timestamp()).

One reason to catch SEGV and ABRT was to attempt to restore the VT on
the DRM-backend. Nowadays that job is done by logind or weston-launch.

The signal handler also printed a backtrace, which for me personally has
been extremely helpful. Arguably it's not necessary though, when we have
core files and services that catch cores. For instance, if using
systemd, 'coredumpctl gdb' is delightfully easy for getting into the
saved core.

Therefore, this code does more harm than it is useful, so remove it. We
also drop an optional dependency to libunwind.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Aleksander Morgado c34a9f5ca6 screenshot: save screenshot files in XDG_PICTURES_DIR
If XDG_PICTURES_DIR not given, it will use the current directory, as
it was before.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Aleksander Morgado 72032accbf file-util: allow specifying path separately in file_create_dated()
Instead of assuming the file prefix contains the path and filename
prefix, give these two items separately.

A NULL or empty string path may still be given to refer to the current
directory.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Aleksander Morgado e3c2a76d8f screenshot: save each new screenshot in a different file
Instead of overwriting the 'wayland-screenshot.png' file over and
over, store each requested screenshot in a filename based on timestamp
and sequence number.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Emre Ucan e8ff7df863 ivi-shell: fix the layer assignment change from one screen to another
if the layer is in order of some screen we need to remove it
from there and mark the screen order as dirty so it will be removed
in commit_screen_list call later
layer should only be assigned to one screen at a time

Signed-off-by: Eugen Friedrich <efriedrich@de.adit-jv.com>
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:17:12 +02:00
Emre Ucan 40d67c2862 ivi-shell: don't expilicitly assign outputs to views
it is assigned in weston_view_assign_outputs

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:16:57 +02:00
Emre Ucan 7b690559a5 ivi-shell: don't schedule compositor repaint
it is not necessary to repaint all outputs after
each commit_changes. Only outputs with modified
views has to be repainted.

We need to call weston_view_update_transform
for assigning views to outputs first.
Then, We can call weston_view_schedule_repaint
to trigger repaint for outputs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:16:44 +02:00
Emre Ucan a4608461b2 ivi-shell: change layer visibility to bool
ivi_layout_layer_set_visibility has bool
as argument.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-08 14:16:44 +02:00
Derek Foreman 4b72ff0e89 xwayland: Fix crash on weston shutdown
commit e7fff215ad made initializing the
selection_listener conditional, but didn't make its clean-up
conditional at shutdown.  Simply initializing the listener's list
link at init time makes this harmless.

To see this, run weston -Bheadless-backend.so and then connect to it
with an X client.  When killing weston it will attempt shutdown but
die with a segfault.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-07 10:56:37 -06:00
Emre Ucan f85bf152c1 ivi-shell: remove ivi_shell_setting
it has only developermode option parameter.
The parameter is only used in init_ivi_shell.
Therefore, we can basically remove the struct,
and check the option locally in the function.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:55:03 +02:00
Emre Ucan 0c1bbb9e52 ivi-shell: don't load controller modules
controller modules can be loaded as weston modules
from the main function of weston.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:55:03 +02:00
Emre Ucan 0707b0e5d4 tests: load ivi-shell test plugins as weston module
It is better to load ivi controller modules as a
generic weston module. Then, we do not need to
have a specific ivi way of loading modules.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Emre Ucan ffaf09eb2f hmi-controller: load as weston module
weston loads hmi-controller as a weston module.
IVI-shell does not need to load it explicitly.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Emre Ucan a9db8d7d64 hmi-controller: remove ivi_layout_interface global
Put the interface into hmi_controller struct.
It is better to have it in an object.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:53 +02:00
Emre Ucan ce9bc35185 ivi-shell: register ivi_layout_interface
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:54:37 +02:00
Derek Foreman b809d79d99 build: Clean up -DDATADIR in makefiles
Now only libshared (and libshared_cairo) requires this.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:39:51 +02:00
Derek Foreman e277276b85 shared: Update all users of DATADIR
Replace every use of DATADIR to create a filename with a call to the new
function that allows overriding DATADIR with an env var at runtime.

No attention is paid to asprintf failure.

This restores make distcheck to a passing state after commit 6b58ea
began checking cairo surfaces for validity and exchanged undefined
behaviour we shouldn't have been dependent on for consistent test failure.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: split if-branches into two lines]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:39:36 +02:00
Derek Foreman b7e3db6a76 tests: Set WESTON_DATA_DIR for tests
Set the env var to override the system data directory so we can run
tests with uninstalled icons.

We don't yet use the code that checks this env var, so make distcheck
will still fail.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:38:37 +02:00
Derek Foreman 83b900fb46 shared: Add a function to prefix filenames with datadir
Currently we look for png files in their install directory, and we
manufacture filenames with string pasting at compile time.

This new function will allow overriding the compile time setting with
the env var WESTON_DATA_DIR so we can do neat tricks like allow our
test suite to pass when we haven't yet installed icons system-wide.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: split if-branch into two lines.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:38:21 +02:00
Daniel Stone 598ee9ddf5 compositor-drm: Atomic modesetting support
Add support for using the atomic-modesetting API to apply output state.
Unlike previous series, this commit does not unflip sprites_are_broken,
until further work has been done with assign_planes to make it reliable.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Co-authored-by: Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.com>
Co-authored-by: Derek Foreman <derek.foreman@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 13:55:13 +00:00
Daniel Stone d5526cb974 compositor-drm: Add blob_id member to drm_mode
For atomic modesetting support, the mode is identified by a blob
property ID, rather than being passed inline. Add a blob_id member to
drm_mode to handle this, including refactoring mode destruction into a
helper function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 13:55:13 +00:00
Pekka Paalanen cd011a6e96 compositor-drm: Discover atomic properties
Set the atomic client cap, where it exists, and use this to discover the
plane/CRTC/connector properties we require for atomic modesetting.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 13:55:13 +00:00
Daniel Stone c1d0f477bd compositor-drm: Don't restore original CRTC mode
When leaving Weston, don't attempt to restore the previous CRTC
settings. The framebuffer may well have disappeared, and in every
likelihood, whoever gets the KMS device afterwards will be repainting
anyway.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 13:55:13 +00:00
Daniel Stone 62c0d63a82 compositor-drm: Consistent failure paths for output creation
Rather than a smattering of error handlers, use consistent jump labels
for error paths in create_output_for_connector().

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 13:55:09 +00:00
Daniel Stone 8747f95682 compositor-drm: Use apply_state for starting repaint
Rather than open-coding it ourselves, use the new apply_state helper in
drm_output_start_repaint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Fabien DESSENNE <fabien.dessenne@st.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 12:40:45 +00:00
Daniel Stone a08512f464 compositor-drm: Move repaint state application to flush
Split repaint into two stages, as implied by the grouped-repaint
interface: drm_output_repaint generates the repaint state only, and
drm_repaint_flush applies it.

This also moves DPMS into output state. Previously, the usual way to
DPMS off was that repaint would be called and apply its state, followed
by set_dpms being called afterwards to push the DPMS state separately.
As this happens before the repaint_flush hook, with no change to DPMS we
would set DPMS off, then immediately re-enable the output by posting the
repaint. Not ideal.

Moving DPMS application at the same time complicates this patch, but I
couldn't find a way to split it; if we keep set_dpms before begin_flush
then we break DPMS off, or if we try to move DPMS to output state before
using the repaint flush, we get stuck as the repaint hook generates an
asynchronous state update, followed immediately by set_dpms generating a
synchronous state update.

In drm_output_update_complete, the *_pending flags are cleared
before any of the pending actions are taken; this ensures that the
actions cannot recurse.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 12:34:49 +00:00
Daniel Stone 6020f478c7 compositor-drm: Disable unused CRTCs/connectors
If we have an unused CRTC or connector, explicitly disable it during the
end of the repaint cycle, or when we get VT-switched back in.

This commit moves state_invalid from an output property to a backend
property, as the unused CRTCs or connectors are likely not tracked by
drm_outputs. This matches the mechanics of later commits, where we move
to a global repaint-flush hook, applying the state for all outputs in
one go.

The output state_invalid flag originally provoked full changes on output
creation (via setting the flag at output enable time) and session enter.

For the new-output case, we will not have any FB in output->state_cur,
so we still take the same path in repaint as if state_invalid were set.
At session enter, we preserve the existing behaviour: as
start_repaint_loop will fail when state_invalid is set, all outputs will
be scheduled for repaint together, and state_invalid will not be cleared
until after all outputs have been repainted, inside repaint_flush.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 12:33:28 +00:00
Daniel Stone 087ddf04e2 compositor-drm: Track unused connectors and CRTCs
Rather than a more piecemeal approach at backend creation, explicitly
track connectors and CRTCs we do not intend to use, so we can ensure
they are disabled where appropriate.

When we have an updated list of connector and CRTC IDs, we add any which
are not owned by an enabled drm_output to the list. We remove them from
the list when drm_output_repaint() is called for that output, and re-add
them when the output is disabled or destroyed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-06 12:33:18 +00:00
Alexandros Frantzis 85f8432911 tests: Support weston_test request for adding a test seat
Support adding a test seat using the weston_test.device_add request.
This will be used in tests in upcoming commits where we will need to
re-add the seat after having it removed.

We only support one test seat at the moment, so this commit also
introduces checks to ensure the client doesn't try to create multiple
test seats or try to remove an already removed test seat.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-01 12:54:48 +02:00
Alexandros Frantzis b0b598c73c libweston: Make weston_touch destruction safe
Ensure the server can safely handle client requests for wl_touch
resources that have become inert due to a weston_touch object
destruction.

This change involves, among other things, setting the weston_touch
object, instead of the weston_seat object, as the user data for wl_touch
resources. Although this is not strictly required at the moment (since
no code is using the wl_touch user data), it makes the code safer:

 * It makes more sense conceptually.
 * It is consistent with how wl_pointer resources are handled.
 * It allows us to clear the user data during weston_touch
   destruction, so other code can check whether the resource is
   inert.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-01 12:53:13 +02:00
Alexandros Frantzis 7a314d6328 libweston: Make weston_keyboard destruction safe
Ensure the server can safely handle client requests for wl_keyboard
resources that have become inert due to a weston_keyboard object
destruction.

This change involves, among other things, setting the weston_keyboard
object, instead of the weston_seat object, as the user data for
wl_keyboard resources.  Although this is not strictly required at the
moment (since no code is using the wl_keyboard user data), it makes the
code safer:

 * It makes more sense conceptually.
 * It is consistent with how wl_pointer resources are handled.
 * It allows us to clear the user data during weston_keyboard
   destruction, so other code can check whether the resource is inert.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-01 12:49:15 +02:00
Tomohito Esaki bf31f6cfb9 desktop-shell: remove surface listener when surface is destroyed
There may be race condition between destroying surface and destroying
output. If handle_output_destroy() is called after surface is destroyed,
illegal memory access occurs when surface destroy signals is
unregistered from the panel/background. This patch fixes this issue and
removes unnecessary initialization for panel surface listener.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-31 09:44:00 +02:00
Greg V 551b805430 Use $(SED) to make sure GNU sed is used
FreeBSD's default sed is not compatible with this expression.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 18:20:01 +00:00
Daniel Stone bac2c549f0 xwayland: Explicitly link with xcb-shape
XWM uses xcb-shape as of 332d1892bb, to exclude the shadow from the
input region. However, it does not explicitly link xcb-shape for the new
symbols; on one of my machines this is pulled in as a transient
dependency (masking the issue), but apparently not the other.

Solve it by explicitly linking xcb-shape and requiring it in configure.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Fixes: 332d1892bb ("xwm: do not include shadow in input region")
Cc: Ian Ray <ian.ray@ge.com>
2018-01-18 12:38:34 +00:00
Emmanuel Gil Peyrot 6b58ea8c43 xwm: Add icon support to the frame
This fetches the _NET_WM_ICON property of the X11 window, and use the
first image found as the frame icon.

This has been tested with various X11 programs, and improves usability
and user-friendliness a bit.

Changes since v1:
- Changed frame_button_create() to use
  frame_button_create_from_surface() internally.
- Removed a check that should never have been commited.

Changes since v2:
- Request UINT32_MAX items instead of 2048, to avoid cutting valid
  icons.
- Strengthen checks against malformed input.
- Handle XCB_PROPERTY_DELETE to remove the icon.
- Schedule a repaint if the icon changed.

Changes since v3:
- Keep the previous Cairo surface until the new one has been
  successfully loaded.
- Use uint32_t for cardinals.  Unsigned is the same type except on
  16-bit machines, but uint32_t is clearer.
- Declare length as uint32_t too, like in xcb_get_property_reply_t.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-01-18 12:24:19 +00:00
Daniel Stone cb04cc4f68 compositor-drm: Add to_drm_mode helper
Much like we already have to_drm_output and to_drm_backend.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-18 12:11:11 +00:00
Ian Ray 332d1892bb xwm: do not include shadow in input region
The window frame was created with position and size which include
an offset for margins and shadow.  Set the input region to ignore
shadow.

[daniels: Fixed type mismatch, removed unused variable.]

Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Scott Moreau <oreaus@gmail.com>
2018-01-18 11:50:13 +00:00
Ilia Bozhinov 8564a0d109 compositor: Implement runtime output transform changes
Up to now we could set the transform only on output initialization.
However, on certain situations(like tablets and convertible laptops),
screen orientation can change while the compositor is running and thus
the need for change of the output transform arises.

When the transform changes, we must update the output geometry,
output->region and output->previous_damage, as well as send this change
to clients. We also have to check whether any of the pointers are inside
the output which is being rotated. If this is the case, they are moved
to the new center, because otherwise the pointer is stuck outside of the
screen ans "lost" to the user.

What is more, after calling this function compositors should check if
any view is now outside of the screen and move it according to their
wish.

Signed-off-by: Ilia Bozhinov <iliyabo@hotmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:26:09 +00:00
Philipp Zabel 543d0a0bb6 gl-renderer: return conservative format list if dmabuf import modifiers unsupported
If the EGL_EXT_image_dma_buf_import_modifiers extension is not
supported, let gl_renderer_query_dmabuf_formats return a hardcoded
fallback list. That list contains ARGB8888, XRGB8888, and if the
GL_EXT_texture_rg extension is supported, YUYV, NV12, YUV420, and
YUV444.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:24:27 +00:00
Michael Tretter b0a749dcb3 linux-dmabuf: send deprecated format events
Although the format event is deprecated, some clients, especially the
GStreamer waylandsink, only support zwp_linux_dmabuf_v1 version 1 and
require the deprecated format event.

Send format events instead of the modifier event, if the client binds on
a protocol version before version 3, skipping formats that only support
non-linear modifiers.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:24:19 +00:00
Emre Ucan 99ef816fd1 dmabuf: set modifier to invalid for not supporting clients
modifier_hi and modifier_lo are set to 0 by clients,
which are not supporting modifiers. Modifier attributes
of buffers of these clients set to 0 too in linux-dmabuf.c

import_simple_dmabuf function in gl-renderer.c compares
modifier attribute of the buffer with DRM_FORMAT_MOD_INVALID.
DRM_FORMAT_MOD_INVALID is equal to ((1ULL<<56) - 1).
Therefore, modifer 0 is accepted as valid. Then, the function
checks support for eglQueryDmaBufModifiersEXT.
If it is not supported import_simple_dmabuf function is returning
NULL.

This patch sets the modifier attribute to DRM_FORMAT_MOD_INVALID
for clients which are not supporting modifiers. Without this patch
linux-dmabuf protocol is not working for not supporting clients.

Fixes: b138d7afb3 ("gl-renderer: Ignore INVALID modifier")
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Tomohito Esaki <etom@igel.co.jp>
2018-01-18 11:09:37 +00:00
Arnaud Vrac e79694ceec gl-renderer: always enable unpack subimage and RG textures in ES3 contexts
The GL_EXT_unpack_subimage and GL_EXT_texture_rg are part of the core ES
3.0 specification, so also check the GL driver version in addition to
the extension string to determine if those features are supported.

This allows using those extensions on some GL drivers that do not expose
them in the extensions string, but still support OpenGLES3.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:08:46 +00:00
Arnaud Vrac cc1a22bca9 gl-renderer: move GL_EXT_texture_rg extension check
This is a GL extension and not EGL, so it should be checked after the
EGL context has been created.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:08:33 +00:00
Arnaud Vrac 439e5fdd5f gl-renderer: try to create a GLES3 context
GL drivers might allow using GLES3 features even in GLES2 contexts, but
that's not always the case. To make sure we can use GLES3, first try to
create a GLES3 context and then fallback to GLES2 on failure.

The reported GL version is used to determine which GLES version is
actually available.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:08:00 +00:00
Arnaud Vrac 88abc6ab74 gl-renderer: save OpenGL version in renderer context
This will allow to make some assumptions in further patches when GLES3
is available.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-01-18 11:07:41 +00:00
Daniel Stone e95169b6af compositor-drm: Don't repaint if no damage
If we don't have any damage for the primary plane, then don't force a
repaint; simply reuse the old buffer we already have.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-17 18:11:19 +00:00
Daniel Stone 02d487a590 compositor-drm: Remove NULL checks in switch_mode
Calling switch_mode with no output or mode never makes any sense. Drop
the NULL checks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-17 18:11:19 +00:00
Daniel Stone e2e8013633 compositor-drm: Use drm_plane for scanout plane
Use a real drm_plane to back the scanout plane, displacing
output->fb_{last,cur,pending} to their plane-tracked equivalents.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-17 18:11:19 +00:00
Daniel Stone 2ba17f4de5 compositor-drm: Use drm_plane for cursor plane
Change the type of cursor_plane from a weston_plane (base tracking
structure) to a drm_plane (wrapper containing additional DRM-specific
details), and make it a dynamically-allocated pointer.

Using the standard drm_plane allows us to reuse code which already deals
with drm_planes, e.g. a common cleanup function.

This patch introduces a 'special plane' helper, creating a drm_plane
either from a real KMS plane when using universal planes, or a fake plane
otherwise. Without universal planes, the cursor and primary planes are
hidden from us; this helper allows us to pretend otherwise.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-17 18:11:00 +00:00
Daniel Stone 5ff289a170 compositor-drm: Introduce drm_plane_is_available
Helper for the pattern of checking whether or not a plane can be used on
an output during the current repaint cycle.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-01-17 15:28:26 +00:00