Commit graph

1795 commits

Author SHA1 Message Date
Philipp Zabel 2d3e170955 backend-pipewire: remove linear modifier for now
As of PipeWire version 0.3.69, the gstpipewiresrc element uses the
existence of a modifier as a trigger to select dmabuf memory, failing
caps negotiation as we don't send DMA buffers yet.

Remove the linear modifier for now, to be added back when we add dmabuf
support to the PipeWire backend. This allows testing the PipeWire
backend with current GStreamer + PipeWire.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-19 13:56:44 +00:00
Philipp Zabel dfa821d4c0 backend-pipewire: pass backend to weston_pipewire_output_api::create_head()
Pass the backend instead of the compositor to the PipeWire output API
create_head() method and increment the API version.

That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-19 13:36:45 +00:00
Philipp Zabel 9e070c0840 backend-drm: obtain DRM backend from listener in session_notify()
The session_listener is embedded in the DRM backend structure.
Use this to obtain the DRM backend with container_of().

That way the DRM backend will not have to be found from the compositor.
This is trivial now, but in the multi-backend case would entail
iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-19 13:36:45 +00:00
Philipp Zabel ebc3a22b09 backend-pipewire: add PipeWire backend
Add a separate PipeWire backend based on the PipeWire plugin. The backend
requires PipeWire 0.3.x.

The PipeWire backend can be used as a standalone-backend backend for streaming
and composing Wayland clients to PipeWire.

The backend supports the on-demand creation of heads via the
weston_pipewire_output_api_v1. It also supports per-output pixel format
configuration via a gbm-format option.

Multiple PipeWire outputs can be created by setting the num-outputs option in
the [pipewire] section.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-04-18 10:48:50 +00:00
Michael Tretter bcacd9ec5a backend-drm: schedule connector disable for detached head
Currently, if a head is detached, the entire state of the device is invalidated
to make sure that the connector is disabled on the next atomic commit. Side
effect of the invalid state is that all planes are disabled on the next commit.
This includes planes that are used with a different head that is not part of the
next atomic commit. Disabling the planes of unrelated outputs causes a blanking
of these outputs until output is repainted and the plane is reenabled.

Store the detached heads in a list on the output and disable the connectors for
all heads in this list in the next atomic commit.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-04-18 11:11:21 +02:00
Philipp Zabel 78818c6d24 backend-vnc: pass vnc_backend to vnc_head_create()
Pass the VNC backend to vnc_head_create().

That way the already known backend will not have to be found from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Also remove the now unused to_vnc_backend() helper.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-17 09:40:52 +02:00
Philipp Zabel 0a1d77a728 backend-rdp: pass rdp_backend to rdp_head_create()
Pass the RDP backend to rdp_head_create().

That way the already known backend will not have to be found from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Also remove the now unused to_rdp_backend() helper.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-17 09:40:52 +02:00
Philipp Zabel 7d2112c713 libweston: pass backend to weston_windowed_output_api::create_head()
Pass the backend instead of the compositor to the windowed output API
create_head() method and increment the API version.

That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-17 09:38:50 +02:00
Philipp Zabel 5dd796e447 backend-vnc: remove output move listener leftovers
The output move listener removal was incomplete. Remove the remaining
bits to fix a segfault on shutdown.

Fixes: 40f5eaf401 ("backend-vnc: use output power_state to disable repainting while disconnected")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-04-15 09:13:21 +02:00
Pekka Paalanen 741c9e6a99 backend-wayland: fully release pango and fontconfig
This was not found in the test suite, but if you run wayland-backend
manually with ASan, you see the same leaks as in

  backend-headless: fully release pango and fontconfig

Fix them the same way.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-04-12 12:34:58 +00:00
Pekka Paalanen 823580e070 backend-headless: fully release pango and fontconfig
In the color-icc-output test, this fixes the following ASan reports:

Direct leak of 6912 byte(s) in 27 object(s) allocated from:
    #0 0x7f36bf0a9e8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f36bd9c2704  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20704)
    #2 0x7f36bd9c2dc8  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20dc8)
    #3 0x7f36bd9c439c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2239c)
    #4 0x7f36bd9cb24c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2924c)
    #5 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #6 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #7 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #8 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #9 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #10 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #11 0x7f36bd9c977c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2777c)
    #12 0x7f36bd9c9c9e  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27c9e)
    #13 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #14 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #15 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #16 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #17 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #18 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #19 0x7f36bd9bb507  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19507)
    #20 0x7f36bd9bb766  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19766)
    #21 0x7f36bd9ad926  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xb926)
    #22 0x7f36bd9af8c6 in FcConfigSubstituteWithPat (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xd8c6)
    #23 0x7f36ba21caae  (/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0+0xbaae)
    #24 0x7f36b9b8a6df  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xc6df)
    #25 0x7f36b9b88bd9  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xabd9)
    #26 0x7f36b9db218d  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2418d)
    #27 0x7f36b9db313b  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2513b)
    #28 0x7f36b9db39aa  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x259aa)
    #29 0x7f36b9db84c8  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a4c8)
    #30 0x7f36b9db8702 in pango_layout_get_pixel_extents (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a702)
    #31 0x7f36ba05fbb3 in theme_render_frame ../../git/weston/shared/cairo-util.c:586
    #32 0x7f36ba06c7b7 in frame_repaint ../../git/weston/shared/frame.c:1071
    #33 0x7f36ba07191b in weston_gl_borders_update ../../git/weston/libweston/gl-borders.c:81
    #34 0x7f36ba0544c3 in headless_output_update_gl_border ../../git/weston/libweston/backend-headless/headless.c:150
    #35 0x7f36ba0545a3 in headless_output_repaint ../../git/weston/libweston/backend-headless/headless.c:165
    #36 0x7f36bea58238 in weston_output_repaint ../../git/weston/libweston/compositor.c:3115
    #37 0x7f36bea5921d in weston_output_maybe_repaint ../../git/weston/libweston/compositor.c:3186
    #38 0x7f36bea5a100 in output_repaint_timer_handler ../../git/weston/libweston/compositor.c:3267
    #39 0x7f36beee6766 in wl_timer_heap_dispatch ../../git/wayland/src/event-loop.c:526
    #40 0x7f36beee6766 in wl_event_loop_dispatch ../../git/wayland/src/event-loop.c:1020
    #41 0x7f36beee41d4 in wl_display_run ../../git/wayland/src/wayland-server.c:1431
    #42 0x7f36bfaa3dc3 in wet_main ../../git/weston/compositor/main.c:4080
    #43 0x557d4f1e1703 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:410
    #44 0x557d4f1ebd43 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:534
    #45 0x557d4f1c8568 in fixture_setup ../../git/weston/tests/color-icc-output-test.c:462
    #46 0x557d4f1c861f in fixture_setup_run_ ../../git/weston/tests/color-icc-output-test.c:464
    #47 0x557d4f1ec92e in main ../../git/weston/tests/weston-test-runner.c:682
    #48 0x7f36bda4ed09 in __libc_start_main ../csu/libc-start.c:308
    #49 0x557d4f1c5a89 in _start (/home/pq/build/weston-meson/tests/test-color-icc-output+0x3da89)

Indirect leak of 1696 byte(s) in 53 object(s) allocated from:
    #0 0x7f36bf0aa037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f36bd9c2d48  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d48)
    #2 0x7f36bd9c439c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2239c)
    #3 0x7f36bd9cb24c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2924c)
    #4 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #5 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #6 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #7 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #8 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #9 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #10 0x7f36bd9c977c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2777c)
    #11 0x7f36bd9c9c9e  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27c9e)
    #12 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #13 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #14 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #15 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #16 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #17 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #18 0x7f36bd9bb507  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19507)
    #19 0x7f36bd9bb766  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19766)
    #20 0x7f36bd9ad926  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xb926)
    #21 0x7f36bd9af8c6 in FcConfigSubstituteWithPat (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xd8c6)
    #22 0x7f36ba21caae  (/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0+0xbaae)
    #23 0x7f36b9b8a6df  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xc6df)
    #24 0x7f36b9b88bd9  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xabd9)
    #25 0x7f36b9db218d  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2418d)
    #26 0x7f36b9db313b  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2513b)
    #27 0x7f36b9db39aa  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x259aa)
    #28 0x7f36b9db84c8  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a4c8)
    #29 0x7f36b9db8702 in pango_layout_get_pixel_extents (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a702)
    #30 0x7f36ba05fbb3 in theme_render_frame ../../git/weston/shared/cairo-util.c:586
    #31 0x7f36ba06c7b7 in frame_repaint ../../git/weston/shared/frame.c:1071
    #32 0x7f36ba07191b in weston_gl_borders_update ../../git/weston/libweston/gl-borders.c:81
    #33 0x7f36ba0544c3 in headless_output_update_gl_border ../../git/weston/libweston/backend-headless/headless.c:150
    #34 0x7f36ba0545a3 in headless_output_repaint ../../git/weston/libweston/backend-headless/headless.c:165
    #35 0x7f36bea58238 in weston_output_repaint ../../git/weston/libweston/compositor.c:3115
    #36 0x7f36bea5921d in weston_output_maybe_repaint ../../git/weston/libweston/compositor.c:3186
    #37 0x7f36bea5a100 in output_repaint_timer_handler ../../git/weston/libweston/compositor.c:3267
    #38 0x7f36beee6766 in wl_timer_heap_dispatch ../../git/wayland/src/event-loop.c:526
    #39 0x7f36beee6766 in wl_event_loop_dispatch ../../git/wayland/src/event-loop.c:1020
    #40 0x7f36beee41d4 in wl_display_run ../../git/wayland/src/wayland-server.c:1431
    #41 0x7f36bfaa3dc3 in wet_main ../../git/weston/compositor/main.c:4080
    #42 0x557d4f1e1703 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:410
    #43 0x557d4f1ebd43 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:534
    #44 0x557d4f1c8568 in fixture_setup ../../git/weston/tests/color-icc-output-test.c:462
    #45 0x557d4f1c861f in fixture_setup_run_ ../../git/weston/tests/color-icc-output-test.c:464
    #46 0x557d4f1ec92e in main ../../git/weston/tests/weston-test-runner.c:682
    #47 0x7f36bda4ed09 in __libc_start_main ../csu/libc-start.c:308
    #48 0x557d4f1c5a89 in _start (/home/pq/build/weston-meson/tests/test-color-icc-output+0x3da89)

Indirect leak of 537 byte(s) in 52 object(s) allocated from:
    #0 0x7f36bf057817 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:452
    #1 0x7f36bd9c1fa4 in FcValueSave (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1ffa4)
    #2 0x7f36bd9c2d5d  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d5d)
    #3 0x7f36bd9c439c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2239c)
    #4 0x7f36bd9cb24c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2924c)
    #5 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #6 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #7 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #8 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #9 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #10 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #11 0x7f36bd9c977c  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2777c)
    #12 0x7f36bd9c9c9e  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27c9e)
    #13 0x7f36bd29c4a9  (/lib/x86_64-linux-gnu/libexpat.so.1+0xc4a9)
    #14 0x7f36bd29ada7  (/lib/x86_64-linux-gnu/libexpat.so.1+0xada7)
    #15 0x7f36bd29ba59  (/lib/x86_64-linux-gnu/libexpat.so.1+0xba59)
    #16 0x7f36bd29f8b0 in XML_ParseBuffer (/lib/x86_64-linux-gnu/libexpat.so.1+0xf8b0)
    #17 0x7f36bd9c9152  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x27152)
    #18 0x7f36bd9c956b  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2756b)
    #19 0x7f36bd9bb507  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19507)
    #20 0x7f36bd9bb766  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x19766)
    #21 0x7f36bd9ad926  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xb926)
    #22 0x7f36bd9af8c6 in FcConfigSubstituteWithPat (/lib/x86_64-linux-gnu/libfontconfig.so.1+0xd8c6)
    #23 0x7f36ba21caae  (/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0+0xbaae)
    #24 0x7f36b9b8a6df  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xc6df)
    #25 0x7f36b9b88bd9  (/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0+0xabd9)
    #26 0x7f36b9db218d  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2418d)
    #27 0x7f36b9db313b  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2513b)
    #28 0x7f36b9db39aa  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x259aa)
    #29 0x7f36b9db84c8  (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a4c8)
    #30 0x7f36b9db8702 in pango_layout_get_pixel_extents (/lib/x86_64-linux-gnu/libpango-1.0.so.0+0x2a702)
    #31 0x7f36ba05fbb3 in theme_render_frame ../../git/weston/shared/cairo-util.c:586
    #32 0x7f36ba06c7b7 in frame_repaint ../../git/weston/shared/frame.c:1071
    #33 0x7f36ba07191b in weston_gl_borders_update ../../git/weston/libweston/gl-borders.c:81
    #34 0x7f36ba0544c3 in headless_output_update_gl_border ../../git/weston/libweston/backend-headless/headless.c:150
    #35 0x7f36ba0545a3 in headless_output_repaint ../../git/weston/libweston/backend-headless/headless.c:165
    #36 0x7f36bea58238 in weston_output_repaint ../../git/weston/libweston/compositor.c:3115
    #37 0x7f36bea5921d in weston_output_maybe_repaint ../../git/weston/libweston/compositor.c:3186
    #38 0x7f36bea5a100 in output_repaint_timer_handler ../../git/weston/libweston/compositor.c:3267
    #39 0x7f36beee6766 in wl_timer_heap_dispatch ../../git/wayland/src/event-loop.c:526
    #40 0x7f36beee6766 in wl_event_loop_dispatch ../../git/wayland/src/event-loop.c:1020
    #41 0x7f36beee41d4 in wl_display_run ../../git/wayland/src/wayland-server.c:1431
    #42 0x7f36bfaa3dc3 in wet_main ../../git/weston/compositor/main.c:4080
    #43 0x557d4f1e1703 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:410
    #44 0x557d4f1ebd43 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:534
    #45 0x557d4f1c8568 in fixture_setup ../../git/weston/tests/color-icc-output-test.c:462
    #46 0x557d4f1c861f in fixture_setup_run_ ../../git/weston/tests/color-icc-output-test.c:464
    #47 0x557d4f1ec92e in main ../../git/weston/tests/weston-test-runner.c:682
    #48 0x7f36bda4ed09 in __libc_start_main ../csu/libc-start.c:308
    #49 0x557d4f1c5a89 in _start (/home/pq/build/weston-meson/tests/test-color-icc-output+0x3da89)

SUMMARY: AddressSanitizer: 9145 byte(s) leaked in 132 allocation(s).

We do the clean-up unconditionally because xwayland plugin may also need
it, but cannot easily do it itself. This reduces reported leaks in
xwayland test too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-04-12 12:34:58 +00:00
Philipp Zabel 40f5eaf401 backend-vnc: use output power_state to disable repainting while disconnected
With weston_output_power_on/off() we can use power_state to disable
repainting completely while no VNC client is connected. This allows
to remove the initial repaint and per-output damage tracking.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-12 14:44:13 +03:00
Daniel Stone 03add7dce5 input: Destroy tablet-tool bindings on exit
Make sure we don't leak any tablet tool bindings.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-12 10:10:25 +00:00
Leandro Ribeiro 84eb3158b4 color-lcms: add debug scope for pipeline optimizer
Whenever a color transformation is being created, this debug scope
prints its pipeline before and after being optimized. It should be used
with the color-lcms-transformations scope.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-12 10:03:32 +00:00
Leandro Ribeiro a28e0c26e1 color-lcms: add debug scope for color profiles
It prints the existent color profiles for new subscribers. Also prints
any creation/destruction of color profiles.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-12 10:03:32 +00:00
Leandro Ribeiro d827bdd5d4 color-lcms: add debug scope for color tranformations
It prints the existent color transformations for new subscribers. Also
prints any creation/destruction of color transformations.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-12 10:03:32 +00:00
Leandro Ribeiro cb542dd56a color-lcms: save ICC profile version string with a single decimal value
We have a string describing the ICC profile. cmsGetProfileVersion()
returns a float value, and we are converting that to string with "%f"
and saving to this description. Instead, use "%.1f" to restrict it to a
single decimal value, which is enough. With this change we have e.g.
"version 4.4" instead of "version 4.4000000".

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-04-12 10:03:32 +00:00
Vitaly Prosyak 712fd0f576 color-lcms: Fix memory leak in join_curvesets
LCMS API cmsStageAllocToneCurves uses cmsDupToneCurve which internally
re-allocates a new table of points. As a result, we have to free the old
table returned from lcmsJoinToneCurve.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2023-04-11 14:26:30 +00:00
Daniel Stone 052e63eecf input: Fix uint/enum declaration mismatch
We were declaring that the binding handler took an enum in the
declaration (good!), but then using a uint in the definition (oops).

cf. wayland/weston!1205

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-11 11:44:34 +00:00
Daniel Stone 27617ec937 drm: Fix type confusion in writeback_state
wl_array_for_each() returns a pointer to each storage location; as we're
storing a pointer to drm_fb, this means that we have a drm_fb **, not a
drm_fb *.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-04 11:30:52 +00:00
marius vlad 82dbb606a2 libweston: Skip setting DPMS if output is not enabled
With the output not being enabled, there's no way we can actually
manipulate its DPMS state.

Signed-off-by: marius vlad <marius.vlad@collabora.com>
2023-04-04 08:13:58 +00:00
marius vlad 70004a7edc libweston: Set default power state at output initialization
Rather than setting the initial power state when adding
it (using weston_compositor_add_output), do that at the initilization
stage.

Reason being that the compositor can set up the output from the start as
FORCED_OFF, before enabling the output, rather than enabling the output
and then turning off the power of the output.

Signed-off-by: marius vlad <marius.vlad@collabora.com>
2023-04-04 08:13:58 +00:00
marius vlad 9b1b95ca76 libweston: Damage the output after the output has been added
Rather than damaging the output before the output has been added with
weston_compositor_add_output, do that afterwards as to avoid scheduling
a repaint for that output *before* actually adding the output.

This would avoid the awkward case where we attempt to set initial power
state to normal, but we can't apply it at that stage.

Signed-off-by: marius vlad <marius.vlad@collabora.com>
2023-04-04 08:13:58 +00:00
Daniel Stone 6f9c27ac07 input: Consistently use enums for modifier/axis/state
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-03 20:58:06 +03:00
Loïc Molinari 7c9c545b4e gl-renderer: Get rid of begin fence sync
Output repaint uses a pair of fence syncs to profile GPU execution by
retrieving their timestamps once signalled. While the end timestamp
can be rather inaccurate in some cases (drivers reusing sync objects
from previous command buffers), the begin timestamp is never correct
because fence syncs are signalled on command buffer completion.

Get rid of the begin fence sync and use the EXT_disjoint_timer_query
extension to measure the actual repaint duration and extrapolate the
begin timestamp from the end one.

Fixes #342

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-04-03 09:52:36 +02:00
Michael Olbrich 6d3d98851e libweston-desktop: implement tablet tool grab
This is needed for correct focus handling when xdg popups are opened.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich 9eab270de5 tablet: Add binding to activate surfaces using the tablet tool
Based on patches from:
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>
Bastian Farkas <bfarkas@de.adit-jv.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Lyude Paul 6a06669b58 clients: Add support for tablet cursor motion to window frames in libtoytoolkit
When it comes to a window frame, a tablet tool and cursor act almost
identical; they click things, drag things, etc. The tool type and extra
axes don't serve any use in the context of a window frame, so tablet
pointers share the frame_pointer structures used for the mouse pointer.

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich 818c1c275c libweston: handle tablet cursors in the compositor
The tablet is given a separate cursor. Most tablet interaction is an absolute
interaction and shouldn't need a cursor at all, but usually the cursor is used
to indicate the type of virtual tool currently assigned.

Based on patches from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>
Bastian Farkas <bfarkas@de.adit-jv.com>
Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich ce99b181a3 libinput: hook up tablet events
Based on a patches from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich 578922797b input: add weston grab interfaces for tablet tools
Based on a patch from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich d24af43233 input: add tablet focus handling
Closely modelled after the pointer focus handling

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>

Based on a patch from
Peter Hutterer <peter.hutterer@who-t.net>
Lyude Paul <thatslyude@gmail.com>

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Michael Olbrich 03596a9d06 libweston: Add initial tablet support to weston
Introduces three new structs, weston_tablet and weston_tablet_tool for the
respective devices, with the respective information as it's used on the protocol.
And weston_tablet_tool_id to track the tools of a tablet.

Note that tools are independent of tablets, many tools can be used across
multiple tablets.

The nesting on the protocol level requires a global tablet manager, a tablet
seat nested into weston_seat. The list of tablets and tools are also part of
the weston_seat.

Most functions are stubs except for the actual tablet and tablet tool
creation and removal.

This is based on patches from Peter Hutterer <peter.hutterer@who-t.net> and
Bastian Farkas <bfarkas@de.adit-jv.com>.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-31 12:10:26 +00:00
Leandro Ribeiro f95c2986dd drm: allow to skip composition if pending capture is writeback
We have an optimization to skip composition if there's no damage on the
primary plane and we already have a renderer buffer active. But we don't
allow this optimization if there's a pending capture task for the
output. For the renderer-based sources, that is really necessary, but
for the writeback source we should allow this optimization.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-31 10:36:31 +00:00
Jonas Ådahl 8f4b141299 desktop: Make popup grab follow keyboard focus semantics
A popup grab is specified to have the top most popup surface gain
keyboard focus. This means the keyboard focus should always follow the
most recent xdg_popup.grab() surface. Make sure this happens by keeping
track of the parent surface in the libweston-desktop popup grab,
updating the keyboard focus when surfaces are added and removed from the
popup chain, and restoring the keyboard focus to the toplevel when there
are no popups anymore.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Jonas Ådahl cc3d30c28b shell: Keep window 'activated' state if child has focus
Popups should have keyboard focus when active, but the toplevel window
should still appear "active". Make sure this is the case by changing the
"active" tracking to see whether any child surface has keyboard focus.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-03-30 17:14:29 +00:00
Daniel Stone 28b3529ca8 Revert "input: Consistently use enums for modifier/axis/state"
This reverts commit 9248340db0.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 18:00:05 +01:00
Andrew F. Davis 94afcbcdc3 backend-drm: Select plane based on current attached CRTC
When doing plane selection for an output CRTC check if the plane
already has a CRTC attached and if so prefer that plane only for
the corresponding CRTC.

This prevents changing a CRTC's primary plane when it is active
which is not allowed by the DRM framework.

Based-on-patch-by: Eric Ruei <e-ruei1@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2023-03-30 17:51:33 +01:00
Daniel Stone 9248340db0 input: Consistently use enums for modifier/axis/state
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-03-30 17:49:17 +01:00
Veeresh Kadasani c0f3cb87be backend-drm: Pass view alpha to plane state and commit
We map view alpha(0.0-1.0) to plane state's alpha
by using the max plane alpha value got from drm.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:57 +01:00
Veeresh Kadasani f35eccc6fa backend-drm: Add plane alpha DRM-property
This checks whether plane alpha is supported.
We get range of alpha value supported for plane
which is required for mapping view's alpha(0.0-1.0)
with drm plane alpha. No functional change.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:07 +01:00
Marius Vlad 1e867c189f libweston: Skip views without a parent
This prevents to trigger an assert within
weston_view_set_rel_position(), introduced with commit 'libweston: Split
weston_view_set_position() into rel and abs variants', which is hit when
a subsurface attempts to commit without having a parent surface set.

Fixes: #730

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Colin Kinloch <collin.kinloch@collabora.com>
2023-03-30 14:59:52 +00:00
Sergio Gómez 1ed88f60c0 libweston/input: Fix assert for valid confine region
We need only check that the region is not empty. If either the input region or
the constraint region have degenerate extents, the intersection from the
previous instruction will set confine_region->data to pixman_region_empty_data.

Fixes: b6423e59

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-03-29 08:31:00 -05:00
Leandro Ribeiro 6517accf7e backend-drm: cosmetic changes to dmabuf_feedback_maybe_update()
Cosmetic changes that makes dmabuf_feedback_maybe_update() easier to
read.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro c9b7c7085a backend-drm: add scanout tranche even for views eligible for direct scanout
We log the reasons why the fb of a certain view was not placed in an
overlay plane and use that for debug purposes. With these reasons we
also decide if the scanout tranche should be included on the dma-buf
feedback or not. For instance:

  1. If the reason is the incompatibility between the format/modifier
     pair of the fb and those supported by the KMS device, the scanout
     tranche is added and feedback is re-sent (so that the client can
     re-allocate with parameters that makes it eligible for direct
     scanout).

  2. If the reason is because we have no overlay planes available, the
     scanout tranche is useless. So the scanout tranche is removed and
     the feedback re-sent (so that clients can re-allocate with
     parameters optimal for the render device).

Also, when we detect that a view is eligible for direct scanout, we
don't even consider sending new feedback, as our interpretation of the
dma-buf feedback spec was that we should avoid bothering clients with
new feedback when they are already hitting direct scanout.

After some discussions and clarifications regarding the spec, we've
realized that Weston should start to also include the scanout tranche
even when the compositor is able to place client's content on overlay
planes. Basically, because this gives a chance for clients to
re-allocate with the proper parameters (not only format/modifier pair,
but also the target_device and the flags) from the scanout tranche. In
this patch we start doing this.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro 0251c05212 backend-drm: remove scanout tranche when there are no planes available
It makes no sense to keep the scanout tranche on the dma-buf feedback if
there are no overlay planes available. So start to remove it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Leandro Ribeiro 8fc9d68ffa backend-drm: change dmabuf_feedback_maybe_update() return type to void
As we are not using the returned value, so let's change to void.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-28 16:23:44 -03:00
Michael Olbrich d29c280867 backend-wayland: allow resizing with xdg-shell
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Michael Olbrich 6b23ffabcf backend-wayland: immediately unref the renderbuffer for use shm buffers
wayland_output_destroy_shm_buffers() is called immediately before
output_destroy() of the renderer is called. And for the pixman renderer all
renderbuffers must be destroyed before the output can be destroyed.
Also, weston_renderbuffer_unref() is not called when the buffer is released
because buffer->output is now NULL, so the renderbuffer would be leaked.

So just unref the renderbuffer immediately. Set it to NULL to avoid unreffing it
again should wayland_output_destroy_shm_buffers() be called again before the
buffer is released. This can happen during an xdg-shell resize.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00
Michael Olbrich 455f24be9c wayland-backend: split switch_mode to prepare for xdg-shell resizing
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 14:43:20 +00:00