1. 31 May, 2021 15 commits
    • Samu Nuutamo's avatar
      libinput-seat: update leds when a new device is added · 58a2faf7
      Samu Nuutamo authored
      
      
      Fix an issue where the keyboard leds will go out of sync when a new
      keyboard is connected.
      
      The issue can be easily reproduced by connecting two keyboards, enabling
      caps lock, and reconnecting one of the keyboards. Without the patch the
      leds on both keyboards will turn off while the actual caps lock state
      will stay enabled.
      Signed-off-by: Samu Nuutamo's avatarSamu Nuutamo <samu.nuutamo@gmail.com>
      58a2faf7
    • Pekka Paalanen's avatar
      clients/keyboard: free input_panel_surface · 497d03ed
      Pekka Paalanen authored
      Fixes ASan leak:
      
      Direct leak of 80 byte(s) in 1 object(s) allocated from:
          #0 0x7fe7791f4518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7fe779100892 in zalloc ../../git/wayland/src/wayland-private.h:232
          #2 0x7fe779100892 in proxy_create ../../git/wayland/src/wayland-client.c:422
          #3 0x7fe779100ede in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
          #4 0x7fe779100ede in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
          #5 0x7fe779101226 in wl_proxy_marshal_constructor ../../git/wayland/src/wayland-client.c:834
          #6 0x56428c9bc578 in zwp_input_panel_v1_get_input_panel_surface protocol/input-method-unstable-v1-client-protocol.h:678
          #7 0x56428c9c0bbb in set_toplevel ../../git/weston/clients/keyboard.c:965
          #8 0x56428c9c0c8d in display_output_handler ../../git/weston/clients/keyboard.c:980
          #9 0x56428c9ddead in display_handle_mode ../../git/weston/clients/window.c...
      497d03ed
    • Pekka Paalanen's avatar
      clients/window: clean up xkb compose data · 2af436bb
      Pekka Paalanen authored
      
      
      This fixes ASan report:
      	SUMMARY: AddressSanitizer: 151360 byte(s) leaked in 451 allocation(s).
      
      The leaks can be observed if you let weston-desktop-shell start fully
      before shutting down Weston. Many simple test suite tests are too fast
      to hit this, or do not even use desktop-shell.
      
      This clean-up code is copied from keyboard_handle_keymap().
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      2af436bb
    • Pekka Paalanen's avatar
      shared/cairo-util: fix leak from load_cairo_surface() · 091b1554
      Pekka Paalanen authored
      
      
      Fixes ASan reported leaks:
      
      Direct leak of 256 byte(s) in 1 object(s) allocated from:
          #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x7f8266c8589a  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x5089a)
          #2 0x7f8266c4ea77  (/lib/x86_64-linux-gnu/libpixman-1.so.0+0x19a77)
          #3 0x55fa7818f8e8 in load_png ../../git/weston/shared/image-loader.c:297
          #4 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
          #5 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
          #6 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
          #7 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
          #8 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
          #9 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
          #10 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
          #11 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
          #12 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
          #13 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)
      
      Indirect leak of 8024 byte(s) in 1 object(s) allocated from:
          #0 0x7f8266f2d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x55fa7818f5e7 in load_png ../../git/weston/shared/image-loader.c:275
          #2 0x55fa7819039e in load_image ../../git/weston/shared/image-loader.c:423
          #3 0x55fa78187b3e in load_cairo_surface ../../git/weston/shared/cairo-util.c:354
          #4 0x55fa7815ff8a in background_draw ../../git/weston/clients/desktop-shell.c:779
          #5 0x55fa7817b2c2 in widget_redraw ../../git/weston/clients/window.c:4520
          #6 0x55fa7817b831 in surface_redraw ../../git/weston/clients/window.c:4578
          #7 0x55fa7817b9a7 in idle_redraw ../../git/weston/clients/window.c:4607
          #8 0x55fa78184ea4 in display_run ../../git/weston/clients/window.c:6527
          #9 0x55fa781646fb in main ../../git/weston/clients/desktop-shell.c:1556
          #10 0x7f826659709a in __libc_start_main ../csu/libc-start.c:308
          #11 0x55fa7815c0a9 in _start (/home/pq/build/weston-meson/clients/weston-desktop-shell+0x120a9)
      
      from the command
      
      	ASAN_OPTIONS=fast_unwind_on_malloc=0,malloc_context_size=50 \
      	LSAN_OPTIONS=suppressions=/home/pq/git/weston/.gitlab-ci/leak-sanitizer.supp \
      	./tests/test-viewporter test_viewporter_bad_source_rect
      
      by recording the pixman image as user data so it can be freed when the
      surface is destroyed.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      091b1554
    • Lujin Wang's avatar
      clients: Free output->make/model in output_destroy · 928d3a00
      Lujin Wang authored
      
      
      == 8 bytes in 1 blocks are definitely lost in loss record 4 of 71
      ==    at 0x48450F8: malloc (vg_replace_malloc.c:309)
      ==    by 0x500213F: strdup (strdup.c:42)
      ==    by 0x40A57F: display_handle_geometry (in weston-desktop-shell)
      ==    by 0x4864D27: ffi_call_SYSV (in libffi.so.6.0.4)
      ==    by 0x4865697: ffi_call (in libffi.so.6.0.4)
      ==    by 0x4880E07: wl_closure_invoke (connection.c:935)
      ==    by 0x487DD73: dispatch_event.isra.5 (wayland-client.c:1310)
      ==    by 0x487EF87: dispatch_queue (wayland-client.c:1456)
      ==    by 0x487EF87: wl_display_dispatch_queue_pending (wayland-client.c:1698)
      ==    by 0x4104E3: handle_display_data (in weston-desktop-shell)
      ==    by 0x40FE8F: display_run (in weston-desktop-shell)
      ==    by 0x405AB3: main (in weston-desktop-shell)
      Signed-off-by: Lujin Wang's avatarLujin Wang <luwang@nvidia.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      928d3a00
    • Pekka Paalanen's avatar
      desktop-shell: clean up shell_output better · 719ca873
      Pekka Paalanen authored
      This fixes the following ASan detected leaks:
      
      Direct leak of 88 byte(s) in 1 object(s) allocated from:
          #0 0x7f8c3455f330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x7f8c33c60906 in wl_event_loop_add_timer ../../git/wayland/src/event-loop.c:571
          #2 0x7f8c2ff98f46 in shell_fade_init ../../git/weston/desktop-shell/shell.c:4211
          #3 0x7f8c2ff9e1da in wet_shell_init ../../git/weston/desktop-shell/shell.c:5266
          #4 0x7f8c3443ede5 in wet_load_shell ../../git/weston/compositor/main.c:956
          #5 0x7f8c3444fdb9 in wet_main ../../git/weston/compositor/main.c:3434
          #6 0x55878ad3bfc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
          #7 0x55878ad3f9fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
          #8 0x55878ad2fbd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
          #9 0x55878ad2fc58 in fixture_setup_run_ ../../git/weston/tests/viewpo...
      719ca873
    • Pekka Paalanen's avatar
      desktop-shell: rename output_listener to shell_output · 0d5e4ffb
      Pekka Paalanen authored
      
      
      Most other places call a variable like this 'shell_output', so let's do
      that here too. The old name was really confusing.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      0d5e4ffb
    • Pekka Paalanen's avatar
      desktop-shell: destroy weston_desktop · abd72929
      Pekka Paalanen authored
      
      
      Plugs ASan reported leaks:
      
      Direct leak of 88 byte(s) in 1 object(s) allocated from:
          #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7f338afe22f3 in zalloc ../../git/weston/include/libweston/zalloc.h:38
          #2 0x7f338afe3cc2 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
          #3 0x7f338afdbaef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
          #4 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
          #5 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
          #6 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
          #7 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
          #8 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
          #9 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
          #10 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
          #11 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
          #12 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
          #13 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)
      
      Indirect leak of 152 byte(s) in 1 object(s) allocated from:
          #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7f338afdb811 in zalloc ../../git/weston/include/libweston/zalloc.h:38
          #2 0x7f338afdb92d in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:65
          #3 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
          #4 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
          #5 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
          #6 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
          #7 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
          #8 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
          #9 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
          #10 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
          #11 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
          #12 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)
      
      Indirect leak of 72 byte(s) in 1 object(s) allocated from:
          #0 0x7f338f70a518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7f338afdc5ae in zalloc ../../git/weston/include/libweston/zalloc.h:38
          #2 0x7f338afdc89e in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108
          #3 0x7f338afe3d2a in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415
          #4 0x7f338afdbaef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
          #5 0x7f338b148d39 in wet_shell_init ../../git/weston/desktop-shell/shell.c:5224
          #6 0x7f338f5e9de5 in wet_load_shell ../../git/weston/compositor/main.c:956
          #7 0x7f338f5fadb9 in wet_main ../../git/weston/compositor/main.c:3434
          #8 0x5646d2392fc6 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
          #9 0x5646d23969fa in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
          #10 0x5646d2386bd6 in fixture_setup ../../git/weston/tests/viewporter-test.c:46
          #11 0x5646d2386c58 in fixture_setup_run_ ../../git/weston/tests/viewporter-test.c:48
          #12 0x5646d2396faf in main ../../git/weston/tests/weston-test-runner.c:661
          #13 0x7f338f25f09a in __libc_start_main ../csu/libc-start.c:308
          #14 0x5646d2386769 in _start (/home/pq/build/weston-meson/tests/test-viewporter+0xc769)
      
      Oops.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      abd72929
    • Pekka Paalanen's avatar
      tests: clean up after viewporter-test · ef4d5c40
      Pekka Paalanen authored
      
      
      Clean up after each test to avoid ASan reporting leaks.
      
      At few points client_roundtrip() is replaced with client_destroy()
      because the latter does a final roundtrip anyway.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      ef4d5c40
    • Pekka Paalanen's avatar
      tests: allow client_destroy() after expect_protocol_error() · ed6df8ed
      Pekka Paalanen authored
      
      
      expect_protocol_error() ensures that the connection has failed in the
      expected way. To satisfy ASan leak detection, we still need to tear down
      everything, including call client_destroy().
      
      client_destroy() needs to check that tear-down does not cause protocol
      errors, so it does one last roundtrip that checks that is succeeds. But
      if the connection is already down in an expected way, this roundtrip
      cannot succeed and must be skipped.
      
      Also moves the roundtrip under 'if (wl_display)', assuming the 'if' is
      there for a reason - but obviously that reason was never used as it
      would have crashed.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      ed6df8ed
    • Pekka Paalanen's avatar
      Add leak sanitizer suppressions · 6ae243f9
      Pekka Paalanen authored
      ASan will detect leaks also outside of the code we build, and sometimes
      that external code leaks and we cannot work around it. Then we need to
      suppress the leak reports to make our own ASan testing succeed. This
      commit only introduces the suppressions file, making use of it CI is for
      another time. This file is useful for manual targeted testing as below.
      
      Start by suppressing two functions what weston-keyboard client ends up
      calling, suppressing leak reports like these:
      
      Indirect leak of 96 byte(s) in 3 object(s) allocated from:
          #0 0x7fc109c3d518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7fc109083d18  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x20d18)
          #2 0x7fc1090849a7 in FcPatternDuplicate (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x219a7)
          #3 0x7fc109adf93e  (/lib/x86_64-linux-gnu/libcairo.so.2+0xbb93e)
          #4 0x7fc109adfc8d  (/lib/x86_64-linux-gnu/libcairo.so.2+0xbbc8d)
          #5 0x7fc109aa02e7 in cairo_toy_font_face_create (/lib/x86_64-linu...
      6ae243f9
    • Pekka Paalanen's avatar
      clients/window: destroy remaining globals · c8c53baf
      Pekka Paalanen authored
      
      
      Destroy the remaining globals on exit. Fixes a bunch of leaks reported
      by ASan.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      c8c53baf
    • Pekka Paalanen's avatar
      clients/window: move code into global_destroy() · 1e08a81c
      Pekka Paalanen authored
      
      
      Another patch will want to call global_destroy() too.
      
      Pure refactoring, no functional change.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      1e08a81c
    • Pekka Paalanen's avatar
      keyboard: free stuff on exit · d9b949d8
      Pekka Paalanen authored
      
      
      This fixes a bunch of leaks when trying to run a Weston test with
      desktop-shell, which spawns weston-keyboard.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      d9b949d8
    • Pekka Paalanen's avatar
      clients/window: fix leaks on start-up failure · 1f3e9045
      Pekka Paalanen authored
      
      
      Trying to run viewporter-test with ASan leak checking,
      weston-desktop-shell helper client reports many leaks, because the
      compositor quits before the client can start. Hence the
      wl_display_roundtrip() fails.
      
      Clean up by calling display_destroy() when wl_display_roundtrip() fails.
      It's late enough that all kinds of things may have been allocated, so a
      special local tear-down path is not feasible.
      
      To make that work, display_destroy() must handle many things that might
      be NULL which normally aren't. Also display_create() needs to initialize
      lists early enough so that cleaning them up works.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      1f3e9045
  2. 30 May, 2021 1 commit
    • Simon Ser's avatar
      clients/window: atomically update pointer cursor · 992ee045
      Simon Ser authored
      
      
      Currently, Weston clients update the pointer cursor by first issuing
      a wl_surface.commit request to update the buffer, then a
      wl_pointer.set_cursor request to update the hotspot. This causes an
      issue because buffer and hotspot aren't updated atomically: in-between
      the two requests, the buffer is new but the hotspot is old.
      
      To fix this issue, create a new surface each time the cursor is
      updated.
      Signed-off-by: Simon Ser's avatarSimon Ser <contact@emersion.fr>
      992ee045
  3. 28 May, 2021 12 commits
    • Pekka Paalanen's avatar
      tests: proper weston_test_surface_create() · 7514bf7e
      Pekka Paalanen authored
      
      
      struct weston_test_surface in the test harness' compositor plugin had no
      tear down code, which lead to ASan report on alpha-blending test:
      
      Direct leak of 64 byte(s) in 2 object(s) allocated from:
          #0 0x7f8931f10330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
          #1 0x7f892d934425 in move_surface ../../git/weston/tests/weston-test.c:181
          #2 0x7f893159d8ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)
      
      While at it, let's do this properly for once:
      - put the creation in a new function
      - hook up to the weston_surface destroy signal so this actually gets
        freed (fixes the leak)
      - check that we don't overwrite another surface role
      - check that committed_private actually is ours
      - set the surface label func so it gets properly listed in debugs and
        traces
      - use the proper surface role setup call, so no-one stomps on anyones
        toes if a test makes a mistake by using a wrong wl_surface
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      7514bf7e
    • Pekka Paalanen's avatar
      tests: destroy screenshooter · 33b29bbb
      Pekka Paalanen authored
      
      
      Fixes a leak found by ASan in alpha-blending-test.
      
      Direct leak of 160 byte(s) in 2 object(s) allocated from:
          #0 0x7f511fe11518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7f511fc76373 in zalloc ../../git/wayland/src/wayland-private.h:232
          #2 0x7f511fc76373 in proxy_create ../../git/wayland/src/wayland-client.c:422
          #3 0x7f511fc79dcc in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
          #4 0x7f511fc79dcc in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
          #5 0x7f511fc7b17b in wl_proxy_marshal_constructor_versioned ../../git/wayland/src/wayland-client.c:873
          #6 0x5583e5348f43 in wl_registry_bind /home/pq/local/include/wayland-client-protocol.h:1165
          #7 0x5583e534cfbe in handle_global ../../git/weston/tests/weston-test-client-helper.c:800
          #8 0x7f511f34b8ed in ffi_call_unix64 (/lib/x86_64-linux-gnu/libffi.so.6+0x68ed)
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      33b29bbb
    • Pekka Paalanen's avatar
      tests: destroy subcompositor in alpha-blending · 681db341
      Pekka Paalanen authored
      
      
      Fixed a leak found by ASan:
      
      Direct leak of 160 byte(s) in 2 object(s) allocated from:
          #0 0x7f511fe11518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7f511fc76373 in zalloc ../../git/wayland/src/wayland-private.h:232
          #2 0x7f511fc76373 in proxy_create ../../git/wayland/src/wayland-client.c:422
          #3 0x7f511fc79dcc in create_outgoing_proxy ../../git/wayland/src/wayland-client.c:651
          #4 0x7f511fc79dcc in wl_proxy_marshal_array_constructor_versioned ../../git/wayland/src/wayland-client.c:736
          #5 0x7f511fc7b17b in wl_proxy_marshal_constructor_versioned ../../git/wayland/src/wayland-client.c:873
          #6 0x5583e5348f43 in wl_registry_bind /home/pq/local/include/wayland-client-protocol.h:1165
          #7 0x5583e535140b in bind_to_singleton_global ../../git/weston/tests/weston-test-client-helper.c:1863
          #8 0x5583e5348752 in alpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:219
          #9 0x5583e5348571 in wrapalpha_blend_monotonic ../../git/weston/tests/alpha-blending-test.c:200
          #10 0x5583e53554cc in run_test ../../git/weston/tests/weston-test-runner.c:162
          #11 0x5583e5355b6d in run_case ../../git/weston/tests/weston-test-runner.c:277
          #12 0x5583e5355913 in for_each_test_case ../../git/weston/tests/weston-test-runner.c:235
          #13 0x5583e5355df5 in testsuite_run ../../git/weston/tests/weston-test-runner.c:311
          #14 0x7f511aaaf752 in client_thread_routine ../../git/weston/tests/weston-test.c:404
          #15 0x7f511f88cfa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      681db341
    • Lujin Wang's avatar
      libweston: Remove source repaint_timer in weston_compositor_shutdown · d4b46cdd
      Lujin Wang authored
      
      
      Fixes a definitely lost:
      == 56 bytes in 1 blocks are definitely lost in loss record 16 of 45
      ==    at 0x48450F8: malloc (vg_replace_malloc.c:309)
      ==    by 0x4B55E93: wl_event_loop_add_timer (event-loop.c:197)
      ==    by 0x4126CF: weston_compositor_create (in /usr/local/bin/weston)
      ==    by 0x409997: main (in /usr/local/bin/weston)
      Signed-off-by: Lujin Wang's avatarLujin Wang <luwang@nvidia.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      d4b46cdd
    • Pekka Paalanen's avatar
      libweston-desktop: add weston_desktop_xwayland_fini() · e2583ca0
      Pekka Paalanen authored
      This fixes the following leaks detected by ASan in
      ./tests/test-alpha-blending:
      
      Direct leak of 176 byte(s) in 2 object(s) allocated from:
          #0 0x7fb447880518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
          #1 0x7fb4432c12d7 in zalloc ../../git/weston/include/libweston/zalloc.h:38
          #2 0x7fb4432c2ca6 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
          #3 0x7fb4432baadf in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
          #4 0x7fb4432e1e1f in wet_shell_init ../../git/weston/tests/weston-test-desktop-shell.c:224
          #5 0x7fb44775fddd in wet_load_shell ../../git/weston/compositor/main.c:956
          #6 0x7fb447770db1 in wet_main ../../git/weston/compositor/main.c:3434
          #7 0x56172c599279 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
          #8 0x56172c59cce5 in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528...
      e2583ca0
    • Pekka Paalanen's avatar
      libweston-desktop: introduce weston_desktop_client_destroy() · f53c05d3
      Pekka Paalanen authored
      
      
      This new function is callable explicitly, unlike the old function that
      used to have the same name.
      
      This will be needed when tearing down what
      weston_desktop_xwayland_init() puts up.
      
      Since calling weston_desktop_client_destroy() for an external client
      (one that has a wl_resource for this) is a bug, add asserts to prevent
      it. This will only be needed for the internal client: XWM.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      f53c05d3
    • Pekka Paalanen's avatar
      libweston-desktop: rename weston_desktop_client_destroy() · 5a6604a7
      Pekka Paalanen authored
      
      
      This function here is a wl_resource destructor, but we will need another
      function for externally triggered destroy when wl_resource does not
      exist.
      
      Rename the existing function, because the old name fits better the new
      function to be written.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      5a6604a7
    • Pekka Paalanen's avatar
      tests: call weston_layer_fini() · 6a0a3a01
      Pekka Paalanen authored
      
      
      This ensures the layers are torn down properly.
      
      See commit: libweston: add weston_layer_fini()
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      6a0a3a01
    • Pekka Paalanen's avatar
      kiosk-shell: call weston_layer_fini() · 91147c6e
      Pekka Paalanen authored
      
      
      This ensures the layers are torn down properly.
      
      See commit: libweston: add weston_layer_fini()
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      91147c6e
    • Pekka Paalanen's avatar
      ivi-shell: call weston_layer_fini() · 9706a807
      Pekka Paalanen authored
      
      
      This ensures the layers are torn down properly.
      
      See commit: libweston: add weston_layer_fini()
      
      There would be a lot more to tear down here, but that is for another
      time.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      9706a807
    • Pekka Paalanen's avatar
      desktop-shell: call weston_layer_fini() · 4bb326bc
      Pekka Paalanen authored
      
      
      This ensures the layers are torn down properly.
      
      See commit: libweston: add weston_layer_fini()
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      4bb326bc
    • Pekka Paalanen's avatar
      libweston: add weston_layer_fini() · 8740037a
      Pekka Paalanen authored
      
      
      Layers did not have a fini sequence before, which means the compositor
      layer list might have stale pointers temporarily when shutting down. A
      bigger problem might be having views linger after the destruction of the
      layer.
      
      These problems were not observed yet, but if they exist, this patch
      should help to find them and then fix them.
      
      The check in weston_compositor_shutdown() is not an assert yet, because
      it will trigger until all components call weston_layer_fini() correctly.
      Some components do not even have a tear-down function to call it from at
      all, like fullscreen-shell.
      
      The same with the check in weston_layer_fini().
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      8740037a
  4. 26 May, 2021 1 commit
  5. 18 May, 2021 10 commits
    • Daniel Stone's avatar
      CI: Use FDO_CI_CONCURRENT · 58dba727
      Daniel Stone authored
      $FDO_CI_CONCURRENT is provided by in the CI environment by the fd.o
      GitLab runners to tell us how many parallel processes would be 'good' to
      use.
      
      Use this to override the default Ninja invocation which uses as many
      CPUs as available, and instead tell it to use as many parallel processes
      as the runner thinks we should during the build process.
      
      Tests are invoked using `meson test` inside a virtme/QEmu VM; whilst
      Meson's test backend will use as many processors as availble, virtme
      will by default create a single-CPU VM. So if we create a VM with as
      many CPUs as we should have parallel processes, we can let it use all of
      them. This also requires quadrupling the requested RAM so ASan doesn't
      force us straight into OOM.
      
      Suggested by @daenzer
      
      .
      Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
      58dba727
    • Pekka Paalanen's avatar
      libweston: comment places that cannot use paint node lists · 6551c09d
      Pekka Paalanen authored
      
      
      These are all the remaining places that still use the global view_list,
      and cannot avoid it. Add a comment to explain why in each.
      
      Now all places that use view_list have been audited for paint node
      lists.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      6551c09d
    • Pekka Paalanen's avatar
      drm-backend: iterate paint nodes · aa2e0b20
      Pekka Paalanen authored
      
      
      Iterate paint nodes instead of the global view list. Right now this does
      not change behavior.
      
      This is a step towards using per-output view lists that can then be
      optimized for the output in libweston core.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      aa2e0b20
    • Pekka Paalanen's avatar
      libweston: iterate paint nodes in accumulate damage · 20ab6f88
      Pekka Paalanen authored
      
      
      Iterate paint nodes instead of the global view list. Right now this does
      not change behavior.
      
      This is a step towards using per-output view lists that can then be
      optimized for the output in libweston core.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      20ab6f88
    • Pekka Paalanen's avatar
      libweston: iterate paint nodes on output repaint · 6d6b3673
      Pekka Paalanen authored
      
      
      Iterate paint nodes instead of the global view list. Right now this does
      not change behavior.
      
      This is a step towards using per-output view lists that can then be
      optimized for the output in libweston core.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      6d6b3673
    • Pekka Paalanen's avatar
      gl-renderer: iterate paint nodes · 29cdb340
      Pekka Paalanen authored
      
      
      Iterate paint nodes instead of the global view list. Right now this does
      not change behavior.
      
      This is a step towards using per-output view lists that can then be
      optimized for the output in libweston core.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      29cdb340
    • Pekka Paalanen's avatar
      pixman-renderer: iterate paint nodes · e02dbf65
      Pekka Paalanen authored
      
      
      Iterate paint nodes instead of the global view list. Right now this does
      not change behavior.
      
      This is a step towards using per-output view lists that can then be
      optimized for the output in libweston core.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      e02dbf65
    • Pekka Paalanen's avatar
      libweston: per-output z-ordered paint node list · 2fddc539
      Pekka Paalanen authored
      
      
      This patch creates a per-output paint node list in the same z-order as
      the global view_list in weston_compositor.
      
      The next step is to switch output repaints and backends to use the
      z-order list instead of view_list.
      
      Having a per-output paint node list for repaints allows including only
      those paint nodes that actually contribute to the output image, so that
      completely occluded and out-of-screen views can be ignored in libweston
      core already.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      2fddc539
    • Pekka Paalanen's avatar
      libweston: introduce weston_paint_node · 1a4f87de
      Pekka Paalanen authored
      This new object is created for every surface-view-output triplet. As
      there is always exactly one surface for a view and it does not change
      during a view's lifetime, this is really for a view-output pair or a
      surface-output pair.
      
      The object is created on-demand as a part of preparing for an output
      repaint, so it applies only to surfaces that are going through repaint.
      A prerequisite for that is that the surface is mapped, which means it
      has a mapped view.
      
      When any one of surface or view gets destroyed or output gets disabled,
      all related paint nodes are destroyed.
      
      In future, paint node will be useful for caching surface-output or
      view-output pair dependent data:
      - damage regions for overlapping outputs
      - color transformations
      - backend-specific bookkeeping (e.g. DRM KMS plane assigments)
      - per-output repaint lists
      - surface geometry transformed into output space
      
      Suggested by Daniel Stone in
      wayland/weston!582 (comment 899406)
      
      
      
      PS. The call in weston_view_destroy() to
      weston_compositor_build_view_list() might be so that if the view has
      sub-surfaces, rebuilding the view list removes those those too and
      automagically deletes their views.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.com>
      1a4f87de
    • Pekka Paalanen's avatar
      7ee4149c
  6. 17 May, 2021 1 commit