A few functions had argument 'output' which was not used at all. Remove
such unused arguments.
The coming migration to the head-based output API would have made it
awkward to come up with the output argument for these, but luckily they
are not actually needed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Sergi Granell <xerpi.g.12@gmail.com>
Acked-by Daniel Stone <daniels@collabora.com>
Change all backends to set the core backend pointer early.
This is necessary for libweston core to be able to access the backend
vfuncs before the backend init function returns. Particularly,
weston_output_init() will be needing to inspect the backend vfuncs to
see if the backend has been converted to a new API. Backends that create
outputs as part of their init would fail without setting the pointer
earlier.
For consistency, all backends are modified instead of just those that
could hit an issue.
Libweston core will take care of resetting the backend pointer to NULL
in case of error since "libweston: ensure backend is not loaded twice".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Check and ensure that a compositor can only load one backend
successfully. If a backend fails to load, it is theoretically possible
to try another backend. Once loading succeeds, only destroying the
compositor would allow "unloading" a backend.
If backend init fail, ensure the backend pointer remains NULL to avoid
calling into a half-loaded backend on e.g. compositor destruction.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
'release' is a more appropriate name because the function does not free
the underlying memory. The main reason for this is that we need the name
weston_output_destroy() for new API that actually will free also the
underlying memory.
Since the function is only used in backends and external backends are
not a thing, this does not cause libweston major version bump, even
though it does change the ABI. There is no way external users could have
successfully used this function.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
A client may have bound the same wl_output multiple times, for who knows
what reason. As the server cannot know which wl_output resource to use
for which wl_surface, send enter/leave events for all of them.
This is a protocol correctness fix.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Move the remaining scattered setup of the fixed properties into
create_output_for_connector(). All these are already known and they
cannot change.
This helps future refactoring.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
This fixes a regression where monitor make and model would always be
advertised as "unknown" to Wayland clients. The EDID strings were parsed
at create_output_for_connector() time, but the fallback "unknown" values
were set in weston_drm_output_api::set_mode vfunc later. This made the
correct monitor info be shown in the log, but not sent to clients.
The purpose of the "unknown" assignments is to give fallback values in
case EDID is not providing them.
Fix all that by moving all setting of the make, model and serial into
create_output_for_connector(). These values cannot change afterwards
anyway. While at it, document find_and_parse_output_edid().
The ugly casts in create_output_for_connector() are required to silence
compositor warnings from ignoring const attribute. This is temporary,
and a future refactoring will get rid of the casts.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Move the weston_output_init() call into wayland_output_create_common().
This avoids passing the name twice to different functions, and follows
the precedent set in "libweston: weston_output_init(..., +name)" for
calling init before accessing fields.
Since the error paths in wayland_output_create_for_parent_output() and
wayland_output_create_fullscreen() are now guaranteed to have
weston_output init'd, call weston_output_destroy() appropriately. There
might be more to free than just the name.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Add 'name' argument to weston_output_init(). This is much more obvious
than the assert inside weston_output_init() to ensure the caller has set
a field in weston_output first.
Now weston_output_init() will strdup() the name itself, which means we
can drop a whole bunch of strdup()s in the backends. This matches
weston_output_destroy() which was already calling free() on the name.
All backends are slightly reordered to call weston_output_init() before
accessing any fields of weston_output, except the Wayland backend which
would make it a little awkward to do it in this patch. Mind, that
weston_output_init() still does not reset the struct to zero - it is
presumed the caller has done it, since weston_output is embedded in the
backend output structs.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
[Daniel: document name copying]
Acked-by Daniel Stone <daniels@collabora.com>
There are IVI tests that require an output. Previously these tests would
silently skip if no outputs were present. However, a test setup should
always have outputs with these tests. Skipping could easily leave the
tests dead without notice.
Make these tests fail instead of skip if there are no outputs.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Acked-by Daniel Stone <daniels@collabora.com>
Initialize the list in weston_output_init() instead of doing it
separately in each backend.
One would expect weston_output_init() to initialize all weston_output
members, at least those that are not NULL.
We rely on the set_size() functions to be called only once, as is
assert()'d. If set_size() becomes callable multiple times, this patch
will force them to be fixed to properly manage the mode list instead of
losing all members.
compositor-wayland.c is strange in
wayland_output_create_for_parent_output(): it first called
wayland_output_set_size() that initialized the mode list with a single
mode manufactured from width and height and set that mode as current.
Then it continued to reset the mode list and adding the list of modes
from the parent output, leaving the current mode left to point to a mode
struct that is no longer in the mode list and with a broken 'link'
element. This patch changes things such that the manufactured mode is
left in the list, and the parent mode list is added. This is probably
not quite right either.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
With FreeRDP 2.0 the crypto needs to be initialized or we fail as soon as we try to
compute a md5. The API also changed for the suppress output callback.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
On the musl C library, tests/timespec-text.c does not build, with the
following error:
In file included from tests/timespec-test.c:36:0:
./shared/timespec-util.h:41:21: warning: ‘struct timespec’ declared
inside parameter list will not be visible outside of this definition
or declaration
timespec_sub(struct timespec *r,
^~~~~~~~
[...]
Indeed, struct timespec is defined in time.h, so we must include it.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Use EGL fence sync objects to emit timepoints for the beginning and the
end of rendering on the GPU. The timepoints are emitted asynchronously
using the sync file fds associated with the fence sync objects. The sync
file fds are acquired using the facilities provided by the
EGL_ANDROID_native_fence_sync extension.
The asynchronous timepoint submissions are stored in a list in
gl_output_state until they are executed, and any pending submissions
that remain at output destruction time are cleaned up.
If timelining is inactive or the required EGL extensions are not
present, then GPU timepoint processing and emission are skipped.
Note that the GPU timestamps returned by sync files are in the
CLOCK_MONOTONIC clock domain, and are thus compatible with the
timeline timestamps (which also are in the CLOCK_MONOTONIC domain).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The sync file functionality is required by the upcoming GPU render
timeline work, but it's only available in relatively new linux kernel
versions (4.7 and above).
This commit provides a "sanitized" version of the required sync file
definitions. On systems that don't have the sync file header (due to
having an older kernel), we will be able to fall back to our own
definitions when building.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Check for the EGL_KHR_fence_sync and EGL_ANDROID_native_fence_sync
extensions and get pointers to required extension functions.
These extensions allow us to acquire GPU timestamp information
asynchronously, and are required by the upcoming work to add
rendering begin/end timepoints to the weston timeline.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The purpose of this argument is to hold timestamp information about
events that occurred on the GPU. This argument allows us to include GPU
timestamps in timepoints such as the beginning and end of frame
rendering.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This change replaces a queued emission of buffer-release events (which
is prone to starvation) with a regular event emission. This means that
client programs no longer need to secretly install surface frame
listeners just to guarantee that they get correctly notified of buffer
lifecycle events.
v2:
More information about the historical reasons why this change hadn't
happened yet, and the consensus to finally move ahead with it can be
found at the discussion terminating in this message:
https://lists.freedesktop.org/archives/wayland-devel/2017-September/035147.html
Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Not referenced anywhere ever, has been there since the introduction of
fbdev-backend.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Fix the assumption that MAP_FAILED would be equal to NULL. It is not.
Set 'fb' explicitly to NULL on mmap failure so that comparisons to NULL
would produce the expected result.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Simplifies the code, and makes moving weston_output_init() into
wayland_output_create_common() a little easier.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Gets rid of the constant size char array.
While here, document the function.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
This patch disables the opacity binding when the modifier is configured
to `none' in weston.ini, and thus supports use cases where one does not
want to have this binding.
Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch changes the zoom binding to use the modifier configured in
weston.ini instead of hardcoding MODIFIER_SUPER.
Signed-off-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When calibrating touchscreen with weston-calibrator, you can use the mouse to
click on the cross which is recorded as a touch event. This event is used to
compute the final calibration of the touchscreen which results in invalid
touchscreen calibration and broken touchscreen behaviour.
In order to avoid to use the mouse in weston-calibrator, we disable mouse
operation by default and add a parameter "--enable-mouse" to enable it.
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_check_egl_extension() returns a bool, not a pointer.
Fixes: ce5b614c80 "clients/nested: use weston_check_egl_extension
over strstr"
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Remove the option, because it is hard to use.
Drm connector ids are hard to reach for users,
and they can change when kernel or device tree
is modified.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
[Pekka: bump WESTON_DRM_BACKEND_CONFIG_VERSION]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Two cases are tested: success and fail case of the screen-remove-layer API.
Signed-off-by: Michael Teyfel <mteyfel@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The old code for scheduling configure events on idle looked like:
if (configure_scheduled) {
if (this_event_is_the_same) {
remove_timer();
return;
}
}
If we queued one new event (either changed, or the client had never
received any configure event), followed immediately by one event which
was the same as the first, we would delete the scheduled send of the
first event.
Fix this by treating unconfigured surface as never the same.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
drm_pending_state is currently skeletal, but will be used to retain
data through begin_repaint -> assign_planes -> repaint -> repaint_flush.
The flush and cancel functions are currently identical, only freeing the
state, but they will be used for different purposes in later patches.
Specifically, the intent is to apply any pending output changes (through
PageFlip/SetCrtc, or the atomic ioctls) in flush, and only free the
state in cancel.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Retain drm_plane tracking objects for all actual DRM planes when using
universal planes, not just overlay planes. Rename uses of 'sprite' to
'plane' to make it clear that it can now be any kind of plane, not just
an overlay/sprite.
These are currently unused.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add awareness of, rather than support for, universal planes. Activate
the client cap when we start if possible, and if this is activated,
studiously ignore non-overlay planes. For now.
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 <lfrb@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add a cache for DRM property IDs and values, and use it for the two
connector properties we currently update: DPMS and EDID.
As DRM property ID values are not stable, we need to do a name -> ID
lookup each run in order to discover the property IDs and enum values to
use for those properties. Rather than open-coding this, add a property
cache which we can use across multiple different object types.
This patch takes substantial work from the universal planes support
originally authored by Pekka Paalanen, though it has been heavily
reworked.
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>
All planes being displayed have a framebuffer. What makes 'fb_plane'
special is that it's being displayed as the primary plane by KMS.
Previous patchsets renamed this to 'primary_plane' to match the KMS
terminology, namely the CRTC's base plane, which is controlled by
drmModeSetCrtc in the legacy API, and identified by PLANE_TYPE ==
"Primary" in the universal-plane API.
However, Weston uses 'primary_plane' internally to refer to the case
where client content is _not_ directly displayed on a plane, but
composited via the renderer, with the result of the compositing then
shown.
Rename to 'scanout_plane' as our least-ambiguous name, and document it a
bit.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
This moves the single sprite creation code from create_sprites() into a
new function. The readability clean-up is small, but my intention is to
write an alternate version of create_sprites(), and sharing the single
sprite creation code is useful.
The removal code now actually removes the plane from the list.
In doing this, the gymnastics required to exact the CRTC ID the plane
was last on when making a disabling drmModeSetPlane call have been
removed; specifying the CRTC is not necessary when disabling a plane.
(The atomic API goes a step further, mandating it be zero.)
[daniels: Genericised from drm_sprite to drm_plane, moving some of the
logic back into create_sprites(), also symmetrical
drm_plane_destroy.]
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Fixes the failure to start with fbdev-backend:
weston: /home/pq/git/weston/libweston/compositor.c:4733: weston_compositor_add_pending_output: Assertion `output->disable' failed.
The disable hook was completely unimplemented, and the regression was
caused by e952a01c3b
"libweston: move asserts to add_pending_output()".
It used to work because Weston never tried to explicitly disable the
fbdev output, but now it is hitting the assert.
Fix it by tentatively implementing a disable hook. It has not been
tested to work for explicit disabling, but it does solve the regression.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=102208
Cc: bluescreen_avenger@verizon.net
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: n3rdopolis <bluescreen_avenger@verizon.net>
It's been unused since the legacy (non-libinput) input backends have
been removed.
Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
The GCC address sanitizer overrides dlopen and dlclose, so the configure
test does not detect libdl as a needed dependency for linking. It is
still needed though, as dlsym is not exported by the sanitizer. The
result is that linking fails in the end.
Fix this by checking for dlsym instead of dlopen.
This can be reproduced by configuring the build with:
CFLAGS="-fsanitize=address -fsanitize=undefined"
LDFLAGS="-fsanitize=address -fsanitize=undefined"
Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Without this weston crashes when a client using xdg-shell-v5 is run.
Signed-off-by: Arnaud Vrac <rawoul@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
xdg_shell requires this information to be shared with the client in
order to conform with the specification.
The code to forward this to the client by way of a configure() event
is already in place and works fine, it was just never being used until
now.
Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
commit 749637a8a3
introduced this feature, but the break is outside of any conditional
so only the first item in the list is ever tested.
If a client skips a few configures and then acks the most recent
it's still operating within spec, so the break should only occur
when a match is found.
This version also adds a break after we miss the target, as a tiny
optimization (the list will be cleaned up on disconnect anyway),
as it makes the code no more difficult to read or maintain.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This is easily noticed as a leaked fd on every VC switch.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fix a regression with VT-switching away from Weston and then back
causing drmModePageFlip() to fail with ENOSPC or EINVAL, leaving one or
more outputs not updated. The regression appeared in
47224cc9312fef05c1a523ea0da0a1aae66f100d:
compositor-drm: Delete drm_backend_set_modes
Fix it by forcing a drmModeSetCrtc() on all outputs both initially
created and after VT-switch in.
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v2: moved state_invalid=true from create_output_for_connector() to
drm_output_enable()
Reviewed-by: Daniel Stone <daniels@collabora.com>