The core Wayland protocol explicitly states that wl_keyboard.modifiers
must be send after wl_keyboard.enter.
This commit also changes the behavior of `seat_get_keyboard` to not
send `wl_keyboard.modifiers` in case where seat had pointer focus,
but not keyboard one.
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
In order to run DRM-backend tests, a DRM-device is needed. As we
do not necessarily have control of the hardware that is going to
run our tests in GitLab CI, DRM-backend tests were being skipped.
This patch add support to run the tests using VKMS (virtual KMS).
To achieve this, virtualization is needed, as we need to run a
custom kernel during the CI job. We've decided to go with virtme,
as it is simpler to setup and works good for our use case.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Launcher-direct does not allow us to run using a different
seat from the default seat0. This happens because VTs are
only exposed to the default seat, and users that are on
non-default seat should not touch VTs.
Add check in launcher-direct to skip VT/tty management if user
is running on a non-default seat.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Fix the following build warning by moving the 'seals' declaration inside the
HAVE_MEMFD_CREATE guard:
../shared/os-compatibility.c: In function ‘os_ro_anonymous_file_get_fd’:
../shared/os-compatibility.c:341:6: warning: unused variable ‘seals’ [-Wunused-variable]
int seals, fd;
^
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
As in some circumstances there could be no output connected, avoid
retrieving the width/height of the output if none was found/connected.
Fixes: #384
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Surface roles are permanent, so it should not be cleaned up.
Fixes: #409
weston: ../libweston/compositor.c:4094: weston_surface_set_role: Assertion `role_name' failed.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
When there's neither configless nor surfaceless EGL extension
(i.e. not a Mesa driver), Weston falls back to a dummy pbuffer surface.
Weston attempts to find for that surface an EGL config but uses a NULL
array of pixel formats. This fails with the following messages:
EGL_KHR_surfaceless_context unavailable. Trying PbufferSurface
Found an EGLConfig matching { pbf; } but it is not usable because
neither EGL_KHR_no_config_context nor EGL_MESA_configless_context
are supported by EGL.
failed to choose EGL config for PbufferSurface
EGL error state: EGL_SUCCESS (0x3000)
Failed to initialise the GL renderer;
Signed-off-by: Tomek Bury <tomek.bury@broadcom.com>
This moves the creation of the blob to be earlier, to when the damage is
calculated. It replaces the damage tracked inside of the plane state
with the blob id itself.
This should stop creating new blob ids for TEST_ONLY commits, and them
being leaked in general, as the blob ids are now freed with the plane
state.
The FB_DAMAGE_CLIPS property is now always set if it's supported, and
will be 0 in the case that we have no damage information, which
signifies full damage to the kernel.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
The missing build dependency was added. The override to disable this
check can be removed.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
cms-colord uses cms-helper functions which require lcms2. Therefore,
lcms2 must be added as a build dependency.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
This adds the first DRM-backend test. It is very simple
and was made in order to make easier to add more complex
DRM-backend tests in the future.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
With this patch we add support to run DRM-backend tests locally
in the test suite. For now this won't work in the CI, as there
are no cards available. But the plan is to achieve this by using
VKMS (virtual KMS) in the future.
To run DRM-backend tests locally, first of all the user has to
set the environment variable WESTON_TEST_SUITE_DRM_DEVICE to
'card0', 'card1' or any other device where he wants to run
the tests. Also, for now it only works if it is run as root,
but in the future this problem will be solved.
The tests will run on a non-default seat. The reason for that
is that we want to avoid opening input devices unnecessarily.
Also, since DRM-backend usage requires gaining DRM master status
on a DRM KMS device, nothing else must be using the device at
the same time. To achieve this we use a lock to run the
DRM-backend tests sequentially.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the test suite we may want to run a DRM-backend test on a
non-default seat, which may not have a input device associated.
Weston's default behavior is to not open if input devices are
not found, as it may cause troubles. For instance, Weston can
open but if no input device is set than the user can not
interact or leave it.
Add flag --continue-without-input to DRM-backend so we can run
these types of tests with no input. Notice that this won't force
the compositor to skip opening a input device if it finds it on
the non-default seat.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The test suite is dealing only with headless-backend tests.
In order to make it able to run DRM-backend tests, we have
to properly select the renderer that it will use.
This patch add the command line option --use-pixman if the test
defines the DRM-backend renderer as RENDERER_PIXMAN, and it will
add nothing to the command line if it defines RENDERER_GL (the
DRM-backend default renderer is already GL). Also, if the user
defines the DRM-backend renderer as RENDERER_NOOP, the test will
fail (as it should, since DRM-backend does not implement it).
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the test suite we have some default options which
are command line arguments used by most of the tests.
Two of these are width==320 and height==240. But
when we have DRM or fbdev backends, width and height
are not possible command line arguments. This makes
impossible to run tests that uses one of these types
of backends, as the compositor won't open if the
command line string is wrong.
Fix this by not passing command line arguments width
and height if the backend is DRM or fbdev.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If users ask explicitly to log to a file, it makes sense to quit
when we fail opening that file. Continuing execution would mean
wasting users' time if they expect to find the log file at the
end of the session.
Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When failing to open the log file nothing is reported to the user,
therefore we print a message on stderr when that happens.
Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
All timeline event timestamps are in CLOCK_MONOTONIC already. DRM KMS
timestamps are practically guaranteed to be CLOCK_MONOTONIC too, even though
presentation clock could theoretically be something else. For other backends,
the presentation clock is likely CLOCK_MONOTONIC_RAW due to
weston_compositor_set_presentation_clock_software().
This patch ensures that the recorded vblank timestamp is in CLOCK_MONOTONIC.
Otherwise interpreting the timeline traces might be difficult to do accurately,
since it would be hard to recover the relationship between the presentation
clock and timeline event timestamps.
The time conversion routine is the simplest possible, I don't think we need any
more accurate conversion for timeline purposes. Besides, DRM-backend is the
only backend where the timings actually matter, the other backends are
software-timed anyway.
Since the clock domain of the "vblank" attribute potentially changes, the
attribute is renamed. Wesgr never used this attribute.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using the number of planes to determine if GL_TEXTURE_EXTERNAL_OES should be
used is incorrect with some modifiers: For example RGBA with a
I915_FORMAT_MOD_Y_TILED_CCS modifier has two planes.
Use eglQueryDmaBufModifiersEXT() to query if the current format/modifier only
supports GL_TEXTURE_EXTERNAL_OES.
Use the current code as fallback of modifiers are not supported.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The wording of the xdg-shell protocol allows surfaces to not cover the
whole screen when they are made fullscreen. From the description of the
fullscreen state in xdg-shell:
The window geometry specified in the configure event is a maximum; the
client cannot resize beyond it. For a surface to cover the whole
fullscreened area, the geometry dimensions must be obeyed by the
client.
The last sentence is the condition for fullscreen coverage, not a
requirement.
This commit updates the code to not flag size mismatches for fullscreen
surfaces as a protocol error when the surface fits within the screen. In
such cases, the shell is responsible for centering surfaces
appropriately and also for obscuring other screen content as described
in the xdg_toplevel.set_fullscreen request description (and, indeed,
desktop-shell does all this).
For reference, contrast with the corresponding, stricter wording in the
obsolete xdg-shell-unstable-v6 protocol for the fullscreen state:
The window geometry specified in the configure event must be obeyed by
the client.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Make use of the templating structure the templates provide. No
functional changes in the end, container-build's default behavior is the
previously called container-if-not-exists template.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The project was moved a while ago to make it look less waylandy. Same
sha, so no actual changes here.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If a surface has subsurfaces then the surface itself is in the subsurface
list. To avoid printing it again there is a check to skip the child view,
if it is the same as the current view.
However, this fails when a surface with subsurfaces has two (or more) views:
The check to skip the parent fails for the other view and the two views are
printed again and again until a stack overflow occurs.
So instead check if the parent view of the subsurface view is the current
view. This way, any view that does not belong to a real subsurface is
skipped.
As a side effect, this ensures that each view of the subsurfaces is only
printed once at the correct place in the hierarchy.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Without universal plane, the weston crashes with null pointer access in
set_gbm_format function because that function called before output
enable function. By changing timing to set color format for primary
plane in this case, this issue fixes.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
pixman_renderer_output_create currently takes a flags enum bitmask for
its options. Switch this to using a structure, so we can introduce other
non-boolean options.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_pbuffer_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_window_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The renderer buffer size is usually the same size as the current mode,
so we were taking the dimensions from the currently-set mode. However,
using current_mode is quite confusing in places when it comes to scale,
and it also hampers our ability to do mode switches, as well as to
introduce a future option which will let the renderer use a smaller
buffer than the output and display scaled.
Simply take the dimensions of the renderer's output buffer from the
buffer itself.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This condition inside drm_output_render() checks if we can reuse the
existing renderer buffer for the primary plane; this occurs in
mixed-mode composition where a client buffer promoted to a plane has
changed, but the primary plane is unchanged.
We accomplish this by checking if there is no damage on the
primary/renderer plane, and then if there is already a renderer buffer
active on the primary plane: in that case, we can reuse the buffer we
already have.
There was a further condition checking if the width and height were
identical. This was designed to prevent against issues on mode changes.
However, runtime mode changes are already quite broken, and a mode
change will also cause damage on the full plane. We can simply remove
this condition.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When libweston-desktop kills an xdg-shell client because it has failed
to configure its surface as demanded, be more helpful by explaining
exactly what the error is.
Signed-off-by: Daniel Stone <daniels@collabora.com>
In order to start the repaint loop, the Wayland backend tries to damage
the full SHM buffer, but doesn't actually damage the full area if we
have a frame.
Store the buffer's width and height alongside the buffer itself, so we
can damage the full area when required.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This test ensures that
"pixman-renderer: half-fix bilinear sampling on edges"
keeps on working.
Unlike in the original report
https://gitlab.freedesktop.org/wayland/weston/issues/373, here we use buffer
scale 2 instead of output scale 2 to trigger bilinear filter. The effect is the
same, the actual resulting image in the failing case is just a little
different. This is so that it will be easy to add more viewport screenshooting
tests in this program in the future.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
There will be a new test program using viewports and would like to share this
bit of code.
There are two behavioral changes:
- Compositor wp_viewporter interface version is no longer checked.
- client_create_viewport() does not leak the viewporter object.
test_viewporter_double_create needs to call bind_to_singleton_global() itself
so that the viewporter object still exists when the error event arrives.
Otherwise error verification fails.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.
If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.
What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.
Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.
This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/373
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As in aaf35586f4, we want to fail when we are passed an invalid
transform name, not just blindly configure on using the normal
transform. The previous commit missed the callsite from the headless
backend's command-line parsing.
Fix this so that headless fails when an invalid transform is specified
on the command line.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When a test fails and it produces a difference image, also compute the min/max
per-channel signed difference statistics. These numbers can be used to adjust
the fuzz needed for fuzzy_match_pixels() to pass. Otherwise one would have to
manually inspect the reference and result images and figure out the values.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If the output only has a single weston_head attached to it, take its
declared transform as the default transform.
With the previous patches, this allows a device declaring the KMS 'panel
orientation' property (e.g. through DeviceTree) to autoconfigure to the
correct display rotation when running Weston.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The KMS 'panel orientation' property allows the driver to statically
declare a fixed rotation of an output device. Now that weston_head has a
transform member, plumb the KMS property through to weston_head so the
compositor can make a smarter choice out of the box.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches]
Signed-off-by: Daniel Stone <daniels@collabora.com>
Like physical size, subpixel arrangement, etc, transform advises of a
physical transform of a head, if present.
This commit adds the transform member and setter to weston_head, however
it is currently unused.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches.]
Signed-off-by: Daniel Stone <daniels@collabora.com>
If an invalid transformation is provided for an output, fail the output
configuration rather than continuing on using whatever we chose as the
default transform.
After !383, this will result in configurations using the old definition
failing and exiting, rather than continuing on the wrong way around.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Regardless of the default transform passed in, weston_parse_transform
would always return 'normal' if there was an output section. This is
because, if a section was declared for that output, it would ask
weston_config for the transform, with the default being 'normal'.
Fix it so we return the passed-in default transform when we have a
matching output section without a transform key. If the transform is
declared but invalid, we can remove the line resetting to the default
transform, because we've already set the default transform up top.
Signed-off-by: Daniel Stone <daniels@collabora.com>