Paralleling timespec_to_nsec, converts to milliseconds.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
[Pekka: added doc about flooring]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add a (timespec) = (timespec) + (msec) helper, to save intermediate
conversions in its users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add a (timespec) = (timespec) + (nsec) helper, to save intermediate
conversions to nanoseconds in its users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Weston will not repaint until previous update has been acked by a
pageflip event coming from the drm driver. However, some buggy drivers
won’t return those events or will stop sending them at some point and
Weston output repaints will completely freeze. To ease developers’ task
in testing their drivers, this patch makes compositor-drm use a timer
to detect cases where those pageflip events stop coming.
This timeout implementation is software only and includes basic
features usually found in a watchdog. We simply exit Weston gracefully
with a log message and an exit code when the timout is reached.
The timeout value can be set via weston.ini by adding a
pageflip-timeout=<MILLISECONDS> entry under [core]
section. Setting it to 0 disables the timeout feature.
v2:
- Made sure we would get both the pageflip and the vblank events before
stopping the timer.
- Reordered the error and success cases in
drm_output_pageflip_timer_create() to be more in line with the rest
of the code.
v3:
- Reordered (de)arming of the timer with the code around it to avoid it
being rearmed before the current dearming.
- Return the proper value for the dispatcher in the pageflip_timeout
callback.
- Also display the output name in case the timer fires.
v4:
- Reordered a forgotten timer rearming after its drmModePageFlip().
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=83884
Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This emulates extra drawing work by usleep().
This is an enhancement to reproduce the problem in the bug report.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98833
[Pekka: reordered the help text]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Don't just dump the raw 32-bit values, try to interpret it as a DRM
fourcc too.
This prints properly the formats YUYV, NV12 and YU12 supported by
Weston.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Makes the code easier to read and browse through.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Don't import buffers which span multiple outputs, short-cut any attempt
to import SHM buffers, and ignore buffers with a global alpha set.
I'm not convinced all of these conditions entirely make sense, but this
at least makes them equally nonsensical.
Differential Revision: https://phabricator.freedesktop.org/D1414
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
And properly deconstruct it in drm_output_destroy.
Might be useful for finding out which modes are supported
before even setting them, in case we want to extend the
modesetting API.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Previously in picking CRTC -> encoder -> connecting routing, we went for
the first triplet we found which claimed to work.
Preserving the existing routing means that startup will be faster: on a
multi-head system, changing the routing implies disabling both CRTCs,
then re-enabling them with a new configuration, which may involve
retraining links etc.
Furthermore, the existing routing may be set for a reason; each
CRTC/encoder is not necessarily as capable as the other, so the routing
may be configured to stay within such device limits.
Try where possible to respect the routing we pick up, rather than
blithely configuring our own.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Given that we can have render-only devices, or vgem in a class of its
own, ignore any non-KMS devices in compositor-drm's device selection.
For x86 platforms, this is mostly a non-issue since we look at the udev
boot_vga issue, but other architectures which lack this, and have
multiple KMS devices present, will hit this.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Thierry Reding <treding@nvidia.com>
Reported-by: Daniel Vetter <daniel.vetter@intel.com>
This symbol wasn’t exported from the weston binary, most likely due to
an oversight in 6e2c12496b, and because
internal modules can link against libshared.la directly it hasn’t been
found ever since.
This commit makes it possible for external modules to iterate over the
configuration file.
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
If we're building with EGL support generally, but without Cairo/GLESv2,
building the clients fail, because window.c defines the EGL native
types, however platform.h also brings these in.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Bryce Harrington <brycef@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Destroying the shared seat removes the link from so->seat_list.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Don't try to dereference the seat if it's NULL.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
A handful of source files were not using the MIT Expat text in
COPYING. Update these files to bring them inline with the rest,
standardizing on the MIT Expat text.
Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Remove the last usage of connector_allocator, which was to check for
displays which have been hot-unplugged, and replace it with an array
which doesn't rely on the connector IDs remaining below 32 (or 64).
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
Rather than using connector_allocator to determine whether an output is
newly connected or not, use a list walk across all outputs instead.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
crtc_allocator was used as a bitmask of CRTC IDs, so we didn't try to
use the same CRTC for multiple outputs. Unfortunately, this only works
to the extent that CRTC object IDs fit within the bitmask; though they
were previously, they are not guaranteed to be under 32 or even 64.
Replace the only use of crtc_allocator with a list walk across outputs.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
This reverts commit 0fee977c46.
This commit introduces a requirement on v4l2_query_ext_ctrl and
VIDIOC_QUERY_EXT_CTRL, which were introduced in kernel 3.17. Some Ubuntu
LTS releases ship with much older kernels (and, significantly, UAPI),
which don't have these.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
If ivilayer or ivisurf of ivi_view is made invisible in the
commit_changes call, we have to damage the weston_view below this
ivi_view. Otherwise content of this ivi_view will stay visible.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The iteration counter cannot be used to detect non-iterated tests
defined with TEST and FAIL_TEST.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
When a client changes the subsurfaces state, we need to damage
them so the result is visible. We do that by flagging the surfaces
when the state changes and causing damage when committing the
state. This prevents normal repaints from considering these changes
until a commit has happened, and allows the client to atomically
schedule several changes.
This fixes the subsurface_z_order test, which is now marked as expected
to succeed.
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
This is marked as a FAIL_TEST, because the last image comparison fails
due to a bug in Weston.
Jointly authored by Pekka and Emilio.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: move weston-tests-env as terminator to EXTRA_DIST, change
ok/FAIL to PASS/FAIL, write diff image only on fail.]
Acked-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Logs is where we write all our custom test logs, let's also put the
screenshots in the same place by default from cluttering the base
directory.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Screenshot tests often want to use the test name for writing out images.
This is a helper to get the test name without writing it multiple times
in the source.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Pick the color 0xCC336699 as AARRGGBB, as if blended on black. This is
the color used with developing the sub-surface shot tests.
No other big reason than it should not be black to have better chances
of catching blending problems.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This is a new desktop shell plugin, specifically written for tests. It
implements the bare minimum of a WM with predictable window positioning.
It offers a known static background without forking any helper clients
and therefore avoids any races with executing screenshot-based tests.
Not forking unused helper clients also reduces the load during a test
run.
The code was written by Quentin as a part of a much larger private
patch. Pekka, following Emilio's example, extracted just the shell
plugin parts as a stand-alone patch and wrote the commit message.
[Emilio: update to latest weston_layer and shell_init API]
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Micah Fedke <micah.fedke@collabora.co.uk>
[Pekka: fix build]
The v4l2 API can be queried to detect if the input video image is
horizontally or vertically flipped. If the image is y-flipped, we can
set the ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT flag to notify the
compositor. If the image is h-flipped, we can only print a warning
since linux_buffer_params_v1 does not support horizontal flipping.
Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The connector option is a part of drm_backend struct.
Therefore, it is not needed to pass it as an argument
to create_outputs function.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
weston can be started with --connector option to be initialized
with a particular output. But in the update_outputs this option
is not considered and output is created for all the available
connectors. This patch fixes this issue by considering
the option for connectors in the update_outputs.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
This patch checks the attribute flags on incoming dmabufs and refuses to
put them overlays if they have any of the flags set (currently:
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT,
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED and
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST), instead defaulting to
the gl-renderer which can handle some of the flags.
This check should be superceded by buffer transforms, when they become
available.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
It is a better idea to use one for loop instead
of using three nested for loops.
We do not need to update the transformation of
views according to the scenegraph. The important
thing is that every visible view is updated before
commit_changes function returns.
The first if statement checks, if the view is on
the currently rendered scenegraph. The second if
statement checks, if the view's layer or surface
is visible. These checks ensure that we do not
update the transformation matrix of a view, which
is not visible on the screen.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: minor whitespace fix]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
We can get ivisurf, ivilayer and iviscreen
easily from ivi_view. Then, we do not need
to check, if ivi_view's layer is the same
as the given ivilayer.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
buffer-count was introduced in line with a Mesa change which forced
an earlier block on frame events to try to enforce double-buffering
where available.
The Mesa change has since been reverted (Mesa commit 9ca6711faa), as
this had unpleasant interactions with buffer_age in particular, so this
test is no longer valid.
Additionally, it only worked on backends which initialised EGL (not
headless-backend, where tests generally run), which can be flaky due to
initialisation races. Not only that, but on the DRM backend, we can
legitimately enter triple-buffering due to promoting the surface to a
hardware plane, skipping GPU composition.
In light of all this, just remove the test.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Given that it's used by clients, it's really the very definition of
shared.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
repaint_needed / repaint_scheduled are surprisingly subtle. Explode the
conditional with side-effects into more obvious separate calls, and
document what they do.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>