Track the seat that initiated a seat instead of picking the first one.
Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.
Now the zoom will follow the pointer of the seat that initiated the zoom.
Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.
Add an assert() to make sure update_zoom is never called without an
active zoom.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't do anything with a pointer, and zoom can be initiated by the
keyboard, so the name was a little confusing.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The initialization of the freerdp_peer was done too early.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=91390.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
backend_init now returns an int not a pointer.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
In parallel out-of-tree builds it is possible for e.g. ivi-shell/weston.ini to
be written before ivi-shell/ exists. Solve this by creating the target
directory first.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Allows to force loading an identity gamma table if
option icc_profile= is given in weston.ini for
an output, ie., icc_profile= is specified to an
empty assignment.
Some special display output devices, e.g., for
neuro-science applications, and special display
testing hardware need a guaranteed perfect pixel
passthrough from framebuffer to output. This is
an easy way to set this up for cms-static.
v2: Remove confusing/redundant weston_log debug output.
v3: Don't use the "identity" keyword to trigger this, but
instead assignment of an empty string will trigger
loading of an identity LUT. Suggested by Derek Foreman.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
cms-colord used the weston_compositor destroy signal to
trigger its final colord_module_destroy cleanup, and the
wl_output destroy signal to trigger per output cleanup.
The problem is that the compositor destroy signal gets
emitted before the output destroy signals at compositor
shutdown, colord_module_destroy would free all its
shared data structures and then later on the output
destroy callback would try to access those shared
data structures when handling output destruction
-> Use after free -> Crash, usually with VT switching
dead and thereby an unuseable system requiring a reboot.
Solve this by moving the output destruction handling into
the colord_cms_output_destroy() cleanup function for
colord-cms own hash dictionary of all active outputs.
The output destroy callback just removes the corresponding
output from the dictionary and triggers proper cleanup if
an output is unplugged during runtime. During compositor
shutdown, the dictionary as a whole is released before
releasing all other shared data structures, thereby
triggering cleanup of all remaining outputs.
Tested to fix crashes on x11 and drm backends.
v2: Formatting: Wrap lines to < 80 characters, as suggested
by Derek. Thanks.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Removing the screensaver had the accidental side effect of disabling
DPMS display shut down.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We were loading modules out of the system dirs unconditionally, so
tests that loaded modules would use the system ones, or fail if
they weren't installed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Moving the destroy listener setup allows the animation completion handler
to be called before we free any structures it needs.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Break device_removed() out into its own function like device_added().
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.
Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This fixes the case where an output isn't at y = 0, where the panel height
isn't correct for constraints.
It also kills a bug - moving a window with a mod-drag off the top of the
screen clamped earlier than it should.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The panel size calculation needs to take the output position into account
or it's only correct when the output is at 0, 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
get_output_work_area() now returns the absolute work area including the
output's offset.
This will make math a little simpler later when we use it to constrain
window moves.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Addresses this warning found by Denis Denisov:
[src/logind-util.c:702]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Adds basic support for optionally outputting in the XML format
commonly used by JUnit compatible tools.
This format is supported by default by many tools, including
the Jenkins build system. It also is more detailed and
captures more information than the more simplistic TAP
format.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dist_wayland_session_DATA will distribute and install src/weston.desktop, so the
definition of wayland_session_DATA which also installs src/weston.desktop will
result in the file being installed twice and (rarely) cause install to fail.
Spotted and fix by Roy Li <rongqing.li@windriver.com>.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Currently rotate is on the right mouse button and resize is on the middle.
As fantastic as rotating windows is, it's probably nicer to have resize on
the right button, especially for anyone with only 2 buttons.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Going from seat to input device requires that we test the device
before relying on the pointer. In all of these binding functions
we can trust exactly one input device type directly. If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.
When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't need the seat pointer, and the caller should already have
tested that the keyboard pointer is valid.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This should be identical to the pointer in shset->seat.
A later patch prevents direct access to seat->pointer, using the
known valid pointer in the grab will be nicer than using the
getter functions that patch introduces.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It never actually needs the seat, and we always verify the touch pointer
before calling it, so let's just pass a touch pointer instead of having
an assumption that the seat's touch pointer has been verified.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer. However, in a binding you're
guaranteed that the seat has a device of that type. If we pass in
that type instead of the seat, it's obvious we don't have to test it.
The bindings can still get the seat pointer via whatever->seat if they
need it.
This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
These functions should never be called outside of the core.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
We shouldn't actually use the keyboard pointer unless we check that
a keyboard is present.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Cut a chunk of code out from drm_output_set_cursor() and form a new
function for writing a cursor bo data from a weston_view with a wl_shm
buffer.
Add more asserts to verify the assumptions in there.
v2: Use drm_compositor::cursor_{width,height} instead of hard-coded 64.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Instead of testing against a hardcoded 64x64 pixel size to see if a view
is suitable for promotion to a cursor plane, use our cursor_width and
cursor_height variables.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Track the current DPMS level for any given output, and track failure (or
otherwise) of the DPMS-setting property call.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Makes create_output_for_connector() slightly easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Refactor the code constructing the connector name into a new function.
This makes create_output_for_connector() slightly easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Refactor the code for choosing the initial mode for an output from
create_output_for_connector() to drm_output_choose_initial_mode().
This makes create_output_for_connector() slightly easier to read.
v2: Document everything.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
If a stopped repaint loop gets restarted due to posting of new
damage, and this restart of the repaint loop happens late in the
video refresh cycle, ie. already inside the repaint-window and
thereby after the composition deadline for the current frame,
then defer the actual output repaint to the composition deadline
of the next video refresh cycle by setting the repaint timer
accordingly.
This tries to make sure that:
a) Client(s) posting damage timely before the composition deadline
(video refresh duration - "repaint-window" duration) of the
current refresh cycle will trigger a repaint within the current
refresh cycle, thereby avoiding one extra frame of compositor
lag due to the needed restart of the repaint loop if the loop
was stopped. This allows them to benefit from the earlier
"instant repaint restart" commit to keep latency low.
b) Late clients which post damage close to the end of a refresh
cycle can't race other clients if the repaint loop is restarted.
Instead they will get deferred to the next compositor cycle,
just as if the repaint loop would have been already running -
the semantic of the "repaint-window" parameter is preserved.
This is especially important to prevent a very late client
from triggering a repaint very close to the vblank, which
would cause the compositor to certainly miss the vblank and
skip one frame and then cause a delay of another frame for
other clients which posted their damage in time for the
following frame. Iow. this provides clients with a more
predictable compositor timing and makes it easier for them
to latch onto the compositors repaint cycle.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
drm_output_start_repaint_loop() incurred a delay of
one refresh cycle by using a no-op page-flip to get
an accurate vblank timestamp as reference. This causes
unwanted lag whenever Weston exited its repaint loop, e.g.,
whenever an application wants to repaint with less than
full video refresh rate but still minimum lag.
Try to use the drmWaitVblank ioctl to get a proper
timestamp instantaneously without lag. If that does
not work, fall back to the old method of idle page-flip.
This optimization will work on any drm/kms driver
which supports high precision vblank timestamping.
As of Linux 4.0 these would be intel, radeon and
nouveau on all their supported gpu's.
On kms drivers without instant high precision timestamping
support, the kernel is supposed to return a timestamp
of zero when calling drmWaitVblank() to query the current
vblank count and time iff vblank irqs are currently
disabled, because the only way to get a valid timestamp
on such kms drivers is to enable vblank interrupts and
then wait a bit for the next vblank irq to take a new valid
timestamp. The caller is supposed to poll until at next
vblank irq it gets a valid non-zero timestamp if it needs
a timestamp.
This zero-timestamp signalling works up to Linux 3.17, but
got broken due to a regression in Linux 3.18 and later. On
Linux 3.18+ with kms drivers that don't have high precision
timestamping, the kernel erroneously returns a stale timestamp
from an earlier vblank, ie. the vblank count and timestamp are
mismatched. A patch is under way to fix this, but to deal with
broken kernels, we also check non-zero timestamps if they are
more than one refresh duration in the past, as this indicates
a stale/invalid timestamp, so we need to take the page-flip
fallback for restarting the repaint loop.
v2: Implement review suggestions by Pekka Paalanen, especially
extend the commit message to describe when and why the
instant restart won't work due to missing Linux kernel
functionality or a Linux kernel regression.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
v3: Fix timespec_to_nsec() which was computing picoseconds,
use the new timespec-util.h helpers.
v4: Rebased to master, split long lines.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
A helper to improbe readability.
Cc: Daniel Stone <daniels@collabora.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
A new optional parameter "-d msecs" allows to specify a
delay before the surface attach/damage/commit to shift
the point in time when a surface update is committed.
This allows to test how different client timings interact
with the compositors repaint timing.
Suggested by Pekka Paalanen.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v2: Clarify the intent, doing a delay in window_create_feedback()
is a bit surprising. Use nanosleep() instead of clock_nanosleep(),
which may not support the chosen presentation clock.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>