Commit Graph

6991 Commits

Author SHA1 Message Date
Marius Vlad 7e0f20311f clients/fullscreen: Refuse to resize the surface size when fullscreen'ed
This would be causing a protocol error in which the buffer size needs to
match the one provided in the configure event.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-25 20:40:24 +00:00
Marius Vlad 36453951fb doc/scripts/gdb: Added gdb script to dump contents of the flight recorder
Mimics the C version that displays the contents of the flight recorder.
With a core-dump in place source the python file then call
'display_flight_rec' to dump the data.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-25 20:29:49 +00:00
Marius Vlad d2dbcd3d7e weston-log-flight-rec: Fix useless comparison when displaying the
contents of the flight recorder

The overlap variable is sufficient to determine from where to start
displaying the contents of the ring buffer. Also redundant to verify
if the position in the buffer went over the maximum size.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-25 20:29:49 +00:00
Marius Vlad 0ba0b8e86f weston-log-flight-rec: Don't allow more than one flight recorder to be
created

Having a (single) global variable which others depend on it implies
having a single flight recorder present. Until we have a reason to
support multiple flight recorders limit the amount to a maximum of one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-25 20:29:49 +00:00
Marius Vlad b1f5f8076a weston-log-flight-rec: Add a global variable to access the ring buffer
With it add also a function which can be used in an assert()-like
situation to display the contents of the ring buffer. Within gdb
this call also be called if the program is loaded/still loaded into
memory.

The global variable will be used in a later patch to be accessed from a
python gdb script.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-25 20:29:49 +00:00
Veeresh Kadasani bdfc11cd1b simple-dmabuf-egl: make application generic
Don't exit if EGL_KHR_no_config_context extension
is not supported

Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
2019-11-25 20:16:45 +00:00
Daniel Stone 3ef098fad1 config-parser: Export get_full_path and destroy
Make sure we export the get_full_path() accessor (declared in the
header, used by Weston itself) and the parser's destroy function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-11-25 12:27:08 +00:00
Pekka Paalanen 531b61c14a libweston: do not include weston.h
Libweston is not allowed to depend on Weston. Fortunately this include is
unnecessary and can be simply removed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-25 13:11:56 +02:00
Leandro Ribeiro a2e80aca68 backend-drm: remove unnecessary ifdefs
Remove unnecessary ifdefs for DRM_MODE_CONNECTOR_DSI, DRM_MODE_CONNECTOR_DPI.
They are both provided by libdrm and were introduced long before 2.4.83 (the
lowest version we currently support).

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2019-11-23 13:15:59 -03:00
Leandro Ribeiro 6196b201be backend-drm: remove unecessary ifdef checks
Since commit 28d26483 ("build: bump libdrm requirement to newer version
(2.4.83)"), all supported libdrm versions provide modifier formats,
atomic API and blob formats. Remove ifdef checks (HAVE_DRM_ADDFB2_MODIFIERS,
HAVE_DRM_ATOMIC, HAVE_DRM_FORMATS_BLOB) to improve the code and make it
simpler.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2019-11-23 09:57:52 +00:00
Leandro Ribeiro 94e4068ba1 build: bump libdrm requirement to newer version (2.4.83)
There are some features that are available only if the user's libdrm version is
not too old: format modifiers require at least libdrm 2.4.71, atomic API at
least 2.4.78 and blob formats at least 2.4.83.

Bump libdrm to 2.4.83 (the oldest version that support these features) in order
to be able to remove ifdef checks and simplify the code. Major distributions
already support libdrm 2.4.91, so it's safe to apply this commit.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
2019-11-23 09:57:52 +00:00
Marius Vlad 18462e8924 backend-drm: Further checks to skip plane assignment to HW planes
Mode change from mixed-mode to renderer-only means we should no longer
try to place views in HW planes (as we composite everything into the
primary plane) thus we should avoid that whenever that happens.

In the same time we need to be able to place in mixed-mode/renderer-only
mode the cursor view into the cursor plane (if one is available).

This patch adds a further check to skip plane assignment when disabling
overlay support (when we switch to renderer-only mode), when drivers do
not have atomic-modeset or it has been disabled intentionally.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-22 20:25:20 +02:00
Marius Vlad 48bc5efa7c backend-drm: Turn zpos duplicate check into an hard assert
This way we make sure we find out (if we have assigned invalid zpos
values) much faster.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-22 17:11:36 +02:00
Marius Vlad 788e80db77 backend-drm: Skip testing plane state if plane is not enabled
Adds a further assert() to make sure we're not checking against invalid
values. This was seen in the wild when the kernel rejects the commit for
overlay resulting in a check for invalid zpos values.

Fixes: #304

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-22 17:11:36 +02:00
Marius Vlad bd002b9884 backend-drm: Assign the primary plane the lowest zpos value
when switching to mixed-mode of compositing

This way we avoid an (incorrect) duplicate check of zpos values. Also,
this would be needed because the renderer needs have the lowest zpos value
available as we don't (yet) properly support underlays, the primary
plane serves as our renderer.

Adds also a check to see if we try to assign a view to a plane with
a lower zpos value than the one assigned to the primary when switching
to mixed-mode of compositing.

Fixes: #304

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-22 17:11:28 +02:00
Pekka Paalanen b544ac3ab4 tests: drop FAIL_TEST
Nothing is using FAIL_TEST or FAIL_TEST_P and that is good. Remove them to not
encourage using them.

If we need a test that should fail, it always needs to fail in a very specific
way which needs to be checked. For this we have e.g. expect_protocol_error().
We never want a fail-test to pass because it failed in a way we did not expect.
Therefore these macros are useless.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 16:09:41 +02:00
Pekka Paalanen e4f6f8c6de tests/ivi: rename test_section
Use a different section name to make sure that if this plugin is loaded into
the same process as where weston-test-runner.h is used, the two different
sections cannot get mixed up. This is just a precaution, but it removes a bit
of reader confusion as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 16:09:20 +02:00
Pekka Paalanen 48d2c15ad6 tests: rename struct weston_test to weston_test_entry
This avoids confusing it with the opaque struct weston_test from
protocol/weston-test.xml.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 12:54:51 +02:00
Pekka Paalanen 54c03dfe51 tests/xwayland: do not call exit(SUCCESS)
Successful tests should just return, not call exit() which breaks the new test
harness when it uses TAP.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 12:54:32 +02:00
Pekka Paalanen 12a138d51e tests: replace fprintf() with testlog()
When we move on to TAP, stdout will be reserved for TAP and stderr is for free
chatter. Set up an example that tests should use testlog() instead of fprintf
or printf to chat in the right place.

Most statements were already printing to stderr, so this just makes then a
little shorter. There are also some statements that printed to stdout and are
now corrected.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 12:54:10 +02:00
Pekka Paalanen dc9d3342a8 tests/subsurface-shot: hardcode reference image names
Using the test name for the reference images will stop working when the new
test harness starts using fixtures. Fixtures allow running the same tests in
varying environments, so the test results file names will include fixture
index. However the reference images will remain the same for all fixtures.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 12:53:29 +02:00
Pekka Paalanen 2c73b673a7 tests: write image to current directory by default
This reverts 50b7b70835.

We didn't make Meson create a logs directory, so writing the images fails
because the directory does not exist. If you run a test without Meson, there is
even less expectation that it would write somewhere else than CWD by default.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-22 12:53:01 +02:00
Jeffy Chen 9774917049 clients: Add more sanity checks to catch destroyed window
Add a sanity check to touch_handle_down() and data_device_enter() as
what we did for pointer and keyboard.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-11-21 16:54:38 +00:00
Jeffy Chen 179458ad23 clients: Drop corresponding touch points when destroying windows
This is to avoid memory leaking of these touch points.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-11-21 16:54:38 +00:00
Olivier Fourdan f568968f8a xwm: Use Xwayland allow commits for repaint
Initially, `_XWAYLAND_ALLOW_COMMITS` was introduced in commit 7ace831ca
to avoid drawing the window content before it's ready to be shown.

But a repaint might also be triggered by the client damages before the
XWM has finished drawing its window decorations and drop shadows, which
previously was not too much of an issue since the XWM could still
finish updating the X11 window after the buffer was submitted.

However, with the addition of multiple window buffers in Xwayland [1]
which are aimed at preventing the X11 clients from updating the buffer
after it's been committed, this is no longer possible.

As a result, the use of multiple window buffers in Xwayland can cause
ugly repainting effects of the decorations if the buffer is submitted
before the XWM has finished painting its decorations.

Use the X11 property `_XWAYLAND_ALLOW_COMMITS` can be used to avoid
this, by controlling when Xwayland should commit changes to the Wayland
surface.

[1] https://gitlab.freedesktop.org/xorg/xserver/merge_requests/316
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2019-11-21 16:50:09 +00:00
Pekka Paalanen 3025353e83 compositor: allow double-loading modules
This is necessary for the test harness to be able to execute the compositor
multiple times in the same process. As we never unload opened modules, the
first compositor iteration will leave them all loaded and following compositor
iterations will then have them already loaded.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen f696ee9337 libweston: allow double-loading modules
This is necessary for the test harness to be able to execute the compositor
multiple times in the same process. As we never unload opened modules, the
first compositor iteration will leave them all loaded and following compositor
iterations will then have them already loaded.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen 6ffbba3ac1 Use weston_compositor_add_destroy_listener_once() in plugins
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.

Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.

All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
  did not fit there.

Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.

Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen 5caef6d355 colord: remove destroy listener on clean-up
This was forgetting to remove the compositor destroy listener, which would lead
to use-after-free on compositor tear-down especially on cms-colord init failure
paths. Found by inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen d2b9b5d1cc ivi-shell: fix init error path
This was forgetting to remove the compositor destroy listener if init failed,
which would lead to use-after-free on compositor tear-down. Found by
inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen e5e8188aa5 tests: fix test-shell init error path
This was forgetting to remove the compositor destroy listener if init failed,
which would lead to use-after-free on compositor tear-down. Found by
inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:32:55 +00:00
Pekka Paalanen f38d4458f7 tests: remove static data from presentation
While get_presentation() will only ever be called once (making the caching of
the return value moot), it is good to stop using the static variable as it
would cause surprising problems if anyone adds more tests here and runs it
under the new test harness.

It was leaked before and continues to be so.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:24:01 +00:00
Pekka Paalanen f8086fb839 tests: remove static data from ivi-layout-test-client
Using static data will mess things up when the test harness no longer fork()'s
each sub-test. Hence it needs to be converted to "normal" data.

Unfortunately here the cached value was actually used, so keeping that
behaviour is a handful. Yes, it was all leaked also before.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:24:01 +00:00
Pekka Paalanen 9551dd7827 tests: remove static data from ivi-shell-app-test
Just one test call this only once, so the cached value will never be useful.

Stop using static data, it sets a bad example. If more tests were added, things
would start failing when forking is removed from the test harness.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:24:01 +00:00
Pekka Paalanen d19c55c75e tests: remove static data from ivi-layout-test-plugin
I cannot see any reason why this should be static data. But if it is static
data, it will prevent re-entering wet_main() to run tests with this plugin, so
replace it with "normal" data.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:24:01 +00:00
Pekka Paalanen 4058828b54 tests: remove static data from viewporter
This caching is actually never hit. I tested by making the early return abort()
instead and all works just fine.

Remove the caching. The static variable will cause problems when we stop
fork()'ing for each test case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-21 16:24:01 +00:00
Marius Vlad 21627136b2 clients/simple-dmabuf-drm: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:58 +02:00
Marius Vlad 4ee832d361 clients/simple-dmabuf-egl: Make use of direct-display
Uses weston-direct-display extension.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:28:53 +02:00
Marius Vlad b8987056d4 renderer-gl: Display a solid shader color when direct-display is in use
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:07:54 +02:00
Marius Vlad 9ad82d5996 renderer-gl: Avoid retrieving the EGL image it direct_display flag was set
As we avoid importing the buffer in the GPU, when attaching the buffer
we'll not have a valid image to retrieve it from, and as such we'll
avoid touching and setting the surface state shader.

This adds also 'direct_display' to the surface state and with it, sets the
surface state 'direct_display' member whenever the imported buffer will
have the direct-display member set.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:07:54 +02:00
Marius Vlad 81bada58db backend-drm: Add dmabuf scan-out check for DRM-backend
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 14:07:54 +02:00
Marius Vlad 5a701547a4 libweston: Add the ability to determine if a dmabuf is scanout-capable
Adds a new callback 'can_scanout_dmabuf' in weston_backend, which
can be set by the back-end do determine if the buffer supplied can be
imported directly by KMS.

This patch adds a wrapper over it, 'weston_compositor_dmabuf_can_scanout'
which is called before importing the dmabuf in the GPU if the
direct_display dmabuf is being set. If that's true and the check
failed, we refuse to create a wl_buffer.

This patch avoids importing in the GPU.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-21 13:54:50 +02:00
Marius Vlad ebd10e512e libweston: Add weston-direct-display server side implementation
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-18 19:33:09 +02:00
Marius Vlad 26d5102957 protocol: Add weston-direct-display extension
Weston extension to assure clients that the dmabuf buffer will be
forwarded directly to the display controller.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-18 19:33:00 +02:00
Pekka Paalanen 69dcd23c60 libweston: drop a misleading dmabuf comment
This comment was added in 230f3b1bf8 with the
intent that if we had an information table about pixel formats (which we do
have today), we could implement more sanity checks like ensuring that width
pixels fit into stride.

Daniel Vetter said on #dri-devel IRC recently:

	< danvet> since userspace shouldn't look at stride for buffers with
	modifiers, only pass it around unchanged

I asked for clarification. It was expected that userspace would not do any kind
of sanity checks as modifiers could change everything.

Let's remove the misleading code comment so that people don't get the idea of
adding more well-intended but ill-advised sanity checks. If more checks are
added, they must take the modifier into account, which the existing checks do
not do.

After 5 years, it is far too late to remove our existing sanity checks, but we
can attempt to not cause any more damage that would restrict what people can do
in the kernel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-14 16:31:33 +02:00
Marius Vlad 9c4b5c4931 compositor: Fix some warning when passing debugoptimized to meson
Increase the buf size such it can accomodate sufficiently large local
buffers. Spotted whilst looking for something else.

../compositor/main.c:157:22: warning: ‘%s’ directive output may be
truncated writing up to 511 bytes into a region of size 128
[-Wformat-truncation=]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                      ^~             ~~~~~~~
../compositor/main.c:157:21: note: directive argument in the range
[-9223372036854775, 9223372036854775]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                     ^~~~~~~~~~~~~~
../compositor/main.c:157:2: note: ‘snprintf’ output between 7 and 659
bytes into a destination of size 128
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158 |    timestr, (tv.tv_usec / 1000));
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-14 10:54:40 +02:00
Eero Tamminen 58e99de1a8 Add include for missing symbols
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/303
2019-11-13 11:34:30 +00:00
Nicholas Niro 7aab746b3a backend-drm: Added support for legacy fd_import
This patch reenables the function drm_fb_get_from_dmabuf but with legacy
fd_import support for gbm/mesa < 17.1.
2019-11-12 13:01:02 -05:00
Nicholas Niro 56d1f4e7bc backend-drm: Fix for gbm modifiers when they are not available.
When the HAVE_GBM_MODIFIERS is unset, make the code drop back
to a single plane version like other places in the code.
2019-11-12 12:57:09 -05:00
Drew DeVault a1eeaf48c6 simple-dmabuf-egl: update to xdg-shell stable 2019-11-12 11:35:56 -05:00